diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 0000000..fea3e03 --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/src/main/kotlin/dev/jansel/feixiao/App.kt b/src/main/kotlin/dev/jansel/feixiao/App.kt index afdfc21..eabdacc 100644 --- a/src/main/kotlin/dev/jansel/feixiao/App.kt +++ b/src/main/kotlin/dev/jansel/feixiao/App.kt @@ -1,6 +1,3 @@ -/* - * This Kotlin source file was generated by the Gradle 'init' task. - */ package dev.jansel.feixiao import com.github.twitch4j.TwitchClient @@ -8,14 +5,14 @@ import dev.jansel.feixiao.extensions.EventHooks import dev.jansel.feixiao.extensions.StreamerCommand import dev.jansel.feixiao.utils.database import dev.jansel.feixiao.utils.token +import dev.jansel.feixiao.utils.twitch import dev.kordex.core.ExtensibleBot import dev.kordex.core.i18n.SupportedLocales import io.github.oshai.kotlinlogging.KotlinLogging -import dev.jansel.feixiao.utils.twitch var twitchClient: TwitchClient? = null -val logger = KotlinLogging.logger { } -var botRef : ExtensibleBot? = null +val logger = KotlinLogging.logger { } +var botRef: ExtensibleBot? = null suspend fun main() { botRef = ExtensibleBot(token) { diff --git a/src/main/kotlin/dev/jansel/feixiao/database/collections/StreamerCollection.kt b/src/main/kotlin/dev/jansel/feixiao/database/collections/StreamerCollection.kt index 3928d93..1954f78 100644 --- a/src/main/kotlin/dev/jansel/feixiao/database/collections/StreamerCollection.kt +++ b/src/main/kotlin/dev/jansel/feixiao/database/collections/StreamerCollection.kt @@ -6,7 +6,6 @@ import dev.jansel.feixiao.database.entities.StreamerData import dev.kord.common.entity.Snowflake import dev.kordex.core.koin.KordExKoinComponent import org.koin.core.component.inject -import org.litote.kmongo.elemMatch import org.litote.kmongo.eq import org.litote.kmongo.setValue @@ -54,7 +53,7 @@ class StreamerCollection : KordExKoinComponent { streamerName: String, roleId: Snowflake, guildId: Snowflake, - noOverload : Boolean = false // this is needed to avoid a conflict with the other updateData function + noOverload: Boolean = false // this is needed to avoid a conflict with the other updateData function ): Int { val coll = collection.findOne(StreamerData::name eq streamerName) if (coll != null) { @@ -62,7 +61,10 @@ class StreamerCollection : KordExKoinComponent { if (temp == null) return 1 collection.updateMany( 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 } @@ -87,7 +89,10 @@ class StreamerCollection : KordExKoinComponent { if (temp == null) return 1 collection.updateMany( 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 } @@ -112,7 +117,10 @@ class StreamerCollection : KordExKoinComponent { if (temp == null) return 1 collection.updateMany( 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 } diff --git a/src/main/kotlin/dev/jansel/feixiao/extensions/StreamerCommand.kt b/src/main/kotlin/dev/jansel/feixiao/extensions/StreamerCommand.kt index ddef6a6..0e1818c 100644 --- a/src/main/kotlin/dev/jansel/feixiao/extensions/StreamerCommand.kt +++ b/src/main/kotlin/dev/jansel/feixiao/extensions/StreamerCommand.kt @@ -2,7 +2,6 @@ package dev.jansel.feixiao.extensions import dev.jansel.feixiao.database.collections.StreamerCollection import dev.jansel.feixiao.database.entities.StreamerData -import dev.jansel.feixiao.extensions.StreamerCommand.UpdateStreamerArgs import dev.jansel.feixiao.i18n.Translations import dev.jansel.feixiao.twitchClient 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.commands.Arguments import dev.kordex.core.commands.application.slash.publicSubCommand -import dev.kordex.core.commands.converters.impl.channel -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.commands.converters.impl.* import dev.kordex.core.extensions.Extension import dev.kordex.core.extensions.publicSlashCommand import org.litote.kmongo.eq diff --git a/src/main/kotlin/dev/jansel/feixiao/utils/Twitch.kt b/src/main/kotlin/dev/jansel/feixiao/utils/Twitch.kt index 1f45103..0aa7ca8 100644 --- a/src/main/kotlin/dev/jansel/feixiao/utils/Twitch.kt +++ b/src/main/kotlin/dev/jansel/feixiao/utils/Twitch.kt @@ -63,5 +63,4 @@ class Twitch : KordExKoinComponent { } - } diff --git a/src/main/kotlin/dev/jansel/feixiao/utils/_Utils.kt b/src/main/kotlin/dev/jansel/feixiao/utils/_Utils.kt index a7c9ec5..c1b55da 100644 --- a/src/main/kotlin/dev/jansel/feixiao/utils/_Utils.kt +++ b/src/main/kotlin/dev/jansel/feixiao/utils/_Utils.kt @@ -1,17 +1,12 @@ 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.collections.MetaCollection import dev.jansel.feixiao.database.collections.StreamerCollection -import dev.jansel.feixiao.twitchClient import dev.kord.common.entity.Snowflake -import dev.kord.core.entity.channel.GuildMessageChannel import dev.kordex.core.builders.ExtensibleBotBuilder import dev.kordex.core.utils.env import dev.kordex.core.utils.loadModule -import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import org.koin.dsl.bind