optimize code and imports
This commit is contained in:
parent
5728ac716c
commit
76f775d292
10
.idea/material_theme_project_new.xml
generated
Normal file
10
.idea/material_theme_project_new.xml
generated
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MaterialThemeProjectNewConfig">
|
||||||
|
<option name="metadata">
|
||||||
|
<MTProjectMetadataState>
|
||||||
|
<option name="userId" value="-7d6c680f:19397de9638:-7fff" />
|
||||||
|
</MTProjectMetadataState>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1,6 +1,3 @@
|
|||||||
/*
|
|
||||||
* This Kotlin source file was generated by the Gradle 'init' task.
|
|
||||||
*/
|
|
||||||
package dev.jansel.feixiao
|
package dev.jansel.feixiao
|
||||||
|
|
||||||
import com.github.twitch4j.TwitchClient
|
import com.github.twitch4j.TwitchClient
|
||||||
@ -8,10 +5,10 @@ import dev.jansel.feixiao.extensions.EventHooks
|
|||||||
import dev.jansel.feixiao.extensions.StreamerCommand
|
import dev.jansel.feixiao.extensions.StreamerCommand
|
||||||
import dev.jansel.feixiao.utils.database
|
import dev.jansel.feixiao.utils.database
|
||||||
import dev.jansel.feixiao.utils.token
|
import dev.jansel.feixiao.utils.token
|
||||||
|
import dev.jansel.feixiao.utils.twitch
|
||||||
import dev.kordex.core.ExtensibleBot
|
import dev.kordex.core.ExtensibleBot
|
||||||
import dev.kordex.core.i18n.SupportedLocales
|
import dev.kordex.core.i18n.SupportedLocales
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||||
import dev.jansel.feixiao.utils.twitch
|
|
||||||
|
|
||||||
var twitchClient: TwitchClient? = null
|
var twitchClient: TwitchClient? = null
|
||||||
val logger = KotlinLogging.logger { }
|
val logger = KotlinLogging.logger { }
|
||||||
|
@ -6,7 +6,6 @@ import dev.jansel.feixiao.database.entities.StreamerData
|
|||||||
import dev.kord.common.entity.Snowflake
|
import dev.kord.common.entity.Snowflake
|
||||||
import dev.kordex.core.koin.KordExKoinComponent
|
import dev.kordex.core.koin.KordExKoinComponent
|
||||||
import org.koin.core.component.inject
|
import org.koin.core.component.inject
|
||||||
import org.litote.kmongo.elemMatch
|
|
||||||
import org.litote.kmongo.eq
|
import org.litote.kmongo.eq
|
||||||
import org.litote.kmongo.setValue
|
import org.litote.kmongo.setValue
|
||||||
|
|
||||||
@ -62,7 +61,10 @@ class StreamerCollection : KordExKoinComponent {
|
|||||||
if (temp == null) return 1
|
if (temp == null) return 1
|
||||||
collection.updateMany(
|
collection.updateMany(
|
||||||
StreamerData::name eq streamerName,
|
StreamerData::name eq streamerName,
|
||||||
setValue(StreamerData::servers, coll.servers - temp + Server(guildId, temp.channelId, roleId, temp.liveMessage))
|
setValue(
|
||||||
|
StreamerData::servers,
|
||||||
|
coll.servers - temp + Server(guildId, temp.channelId, roleId, temp.liveMessage)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -87,7 +89,10 @@ class StreamerCollection : KordExKoinComponent {
|
|||||||
if (temp == null) return 1
|
if (temp == null) return 1
|
||||||
collection.updateMany(
|
collection.updateMany(
|
||||||
StreamerData::name eq streamerName,
|
StreamerData::name eq streamerName,
|
||||||
setValue(StreamerData::servers, coll.servers - temp + Server(guildId, temp.channelId, temp.roleId, liveMessage))
|
setValue(
|
||||||
|
StreamerData::servers,
|
||||||
|
coll.servers - temp + Server(guildId, temp.channelId, temp.roleId, liveMessage)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -112,7 +117,10 @@ class StreamerCollection : KordExKoinComponent {
|
|||||||
if (temp == null) return 1
|
if (temp == null) return 1
|
||||||
collection.updateMany(
|
collection.updateMany(
|
||||||
StreamerData::name eq streamerName,
|
StreamerData::name eq streamerName,
|
||||||
setValue(StreamerData::servers, coll.servers - temp + Server(guildId, channelId, temp.roleId, temp.liveMessage))
|
setValue(
|
||||||
|
StreamerData::servers,
|
||||||
|
coll.servers - temp + Server(guildId, channelId, temp.roleId, temp.liveMessage)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package dev.jansel.feixiao.extensions
|
|||||||
|
|
||||||
import dev.jansel.feixiao.database.collections.StreamerCollection
|
import dev.jansel.feixiao.database.collections.StreamerCollection
|
||||||
import dev.jansel.feixiao.database.entities.StreamerData
|
import dev.jansel.feixiao.database.entities.StreamerData
|
||||||
import dev.jansel.feixiao.extensions.StreamerCommand.UpdateStreamerArgs
|
|
||||||
import dev.jansel.feixiao.i18n.Translations
|
import dev.jansel.feixiao.i18n.Translations
|
||||||
import dev.jansel.feixiao.twitchClient
|
import dev.jansel.feixiao.twitchClient
|
||||||
import dev.kord.common.entity.Permission
|
import dev.kord.common.entity.Permission
|
||||||
@ -10,11 +9,7 @@ import dev.kordex.core.checks.anyGuild
|
|||||||
import dev.kordex.core.checks.hasPermission
|
import dev.kordex.core.checks.hasPermission
|
||||||
import dev.kordex.core.commands.Arguments
|
import dev.kordex.core.commands.Arguments
|
||||||
import dev.kordex.core.commands.application.slash.publicSubCommand
|
import dev.kordex.core.commands.application.slash.publicSubCommand
|
||||||
import dev.kordex.core.commands.converters.impl.channel
|
import dev.kordex.core.commands.converters.impl.*
|
||||||
import dev.kordex.core.commands.converters.impl.optionalChannel
|
|
||||||
import dev.kordex.core.commands.converters.impl.optionalRole
|
|
||||||
import dev.kordex.core.commands.converters.impl.optionalString
|
|
||||||
import dev.kordex.core.commands.converters.impl.string
|
|
||||||
import dev.kordex.core.extensions.Extension
|
import dev.kordex.core.extensions.Extension
|
||||||
import dev.kordex.core.extensions.publicSlashCommand
|
import dev.kordex.core.extensions.publicSlashCommand
|
||||||
import org.litote.kmongo.eq
|
import org.litote.kmongo.eq
|
||||||
|
@ -63,5 +63,4 @@ class Twitch : KordExKoinComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
package dev.jansel.feixiao.utils
|
package dev.jansel.feixiao.utils
|
||||||
|
|
||||||
import com.github.twitch4j.TwitchClientBuilder
|
|
||||||
import com.github.twitch4j.events.ChannelGoLiveEvent
|
|
||||||
import dev.jansel.feixiao.database.Database
|
import dev.jansel.feixiao.database.Database
|
||||||
import dev.jansel.feixiao.database.collections.MetaCollection
|
import dev.jansel.feixiao.database.collections.MetaCollection
|
||||||
import dev.jansel.feixiao.database.collections.StreamerCollection
|
import dev.jansel.feixiao.database.collections.StreamerCollection
|
||||||
import dev.jansel.feixiao.twitchClient
|
|
||||||
import dev.kord.common.entity.Snowflake
|
import dev.kord.common.entity.Snowflake
|
||||||
import dev.kord.core.entity.channel.GuildMessageChannel
|
|
||||||
import dev.kordex.core.builders.ExtensibleBotBuilder
|
import dev.kordex.core.builders.ExtensibleBotBuilder
|
||||||
import dev.kordex.core.utils.env
|
import dev.kordex.core.utils.env
|
||||||
import dev.kordex.core.utils.loadModule
|
import dev.kordex.core.utils.loadModule
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.koin.dsl.bind
|
import org.koin.dsl.bind
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user