Skip to content

Commit

Permalink
optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkyAI committed May 27, 2024
1 parent ec51273 commit be9d011
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/moe/nikky/ConfigurationExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import moe.nikky.checks.anyCheck
import moe.nikky.checks.hasRoleNullable
import net.peanuuutz.tomlkt.TomlComment
import org.koin.dsl.module
import java.util.*
import java.util.Locale

class ConfigurationExtension : Extension(), Klogging {
override val name: String = "configuration-extension"
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/moe/nikky/DiceExtension.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package moe.nikky

import br.com.colman.dicehelper.*
import br.com.colman.dicehelper.Dice
import br.com.colman.dicehelper.DiceNotation
import br.com.colman.dicehelper.FixedDice
import br.com.colman.dicehelper.RandomDice
import br.com.colman.dicehelper.diceNotation
import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.converters.impl.string
import com.kotlindiscord.kord.extensions.extensions.Extension
Expand Down
1 change: 0 additions & 1 deletion src/main/kotlin/moe/nikky/Json5DataAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.kotlindiscord.kord.extensions.storage.DataAdapter
import com.kotlindiscord.kord.extensions.storage.StorageUnit
import com.kotlindiscord.kord.extensions.storage.storageFileRoot
import io.github.xn32.json5k.Json5
import kotlinx.serialization.json.Json
import java.io.File
import java.nio.file.Path
import kotlin.io.path.div
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/moe/nikky/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.koin.dsl.module
import java.io.File
import java.security.Security
import java.text.SimpleDateFormat
import java.util.*
import java.util.Date

private val logger = logger("moe.nikky.Main")
val TEST_GUILD_ID = envOrNull("TEST_GUILD")?.let { Snowflake(it) }
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/moe/nikky/RoleChooserConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import dev.kord.core.entity.Message
import dev.kord.core.entity.ReactionEmoji
import dev.kord.core.entity.Role
import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.entity.channel.TopGuildMessageChannel
import dev.kord.rest.request.KtorRequestException
import io.github.xn32.json5k.SerialComment
import io.klogging.context.logContext
import io.klogging.logger
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.withContext
import kotlinx.serialization.Serializable
Expand Down
16 changes: 1 addition & 15 deletions src/main/kotlin/moe/nikky/RoleManagementExtension.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package moe.nikky

import com.kotlindiscord.kord.extensions.DiscordRelayedException
import com.kotlindiscord.kord.extensions.checks.anyGuild
import com.kotlindiscord.kord.extensions.checks.guildFor
import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.CommandContext
import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand
import com.kotlindiscord.kord.extensions.commands.converters.impl.ColorConverter
import com.kotlindiscord.kord.extensions.commands.converters.impl.boolean
import com.kotlindiscord.kord.extensions.commands.converters.impl.color
import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingBoolean
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalChannel
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalColor
Expand Down Expand Up @@ -38,17 +33,12 @@ import dev.kord.core.behavior.MessageBehavior
import dev.kord.core.behavior.channel.ChannelBehavior
import dev.kord.core.behavior.channel.asChannelOf
import dev.kord.core.behavior.channel.createMessage
import dev.kord.core.behavior.channel.editMemberPermission
import dev.kord.core.behavior.channel.editRolePermission
import dev.kord.core.behavior.createRole
import dev.kord.core.behavior.edit
import dev.kord.core.behavior.getChannelOfOrNull
import dev.kord.core.entity.Guild
import dev.kord.core.entity.Message
import dev.kord.core.entity.ReactionEmoji
import dev.kord.core.entity.Role
import dev.kord.core.entity.channel.GuildChannel
import dev.kord.core.entity.channel.NewsChannel
import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.event.guild.GuildCreateEvent
import dev.kord.core.live.live
Expand All @@ -57,14 +47,11 @@ import dev.kord.core.live.onReactionRemove
import dev.kord.rest.request.KtorRequestException
import io.github.xn32.json5k.Json5
import io.klogging.Klogging
import io.klogging.context.logContext
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.toList
import kotlinx.serialization.Serializable
Expand All @@ -73,8 +60,7 @@ import kotlinx.serialization.builtins.serializer
import moe.nikky.converter.reactionEmoji
import org.koin.core.component.inject
import org.koin.dsl.module
import java.lang.Exception
import java.util.*
import java.util.Locale

class RoleManagementExtension : Extension(), Klogging {
override val name: String = "role-management"
Expand Down
11 changes: 9 additions & 2 deletions src/main/kotlin/moe/nikky/TestExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.optionalEnumChoice
import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand
import com.kotlindiscord.kord.extensions.commands.converters.impl.*
import com.kotlindiscord.kord.extensions.extensions.*
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalDuration
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalString
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalUser
import com.kotlindiscord.kord.extensions.commands.converters.impl.string
import com.kotlindiscord.kord.extensions.commands.converters.impl.user
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.extensions.event
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
import com.kotlindiscord.kord.extensions.utils.respond
import dev.kord.common.entity.GuildScheduledEventEntityMetadata
import dev.kord.common.entity.GuildScheduledEventPrivacyLevel
Expand Down
9 changes: 8 additions & 1 deletion src/main/kotlin/moe/nikky/json/VersiondSerializer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ package moe.nikky.json
import io.klogging.Klogging
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.KSerializer
import kotlinx.serialization.json.*
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.JsonTransformingSerializer
import kotlinx.serialization.json.intOrNull
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import moe.nikky.debugF

data class VersionMigrator<T : Any, R : Any>(
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/moe/nikky/toDuration.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package moe.nikky

import kotlinx.datetime.*
import kotlinx.datetime.Clock
import kotlinx.datetime.DateTimePeriod
import kotlinx.datetime.Instant
import kotlinx.datetime.TimeZone
import kotlinx.datetime.plus
import kotlin.time.Duration

/**
Expand Down
16 changes: 13 additions & 3 deletions src/main/kotlin/moe/nikky/twitch/TwitchApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.plugins.*
import io.ktor.client.request.*
import io.sentry.JsonSerializable
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.flow.flatMapConcat
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.map
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import kotlinx.serialization.KSerializer
Expand All @@ -18,7 +23,12 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.Transient
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.json.*
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonNull
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonPrimitive
import moe.nikky.debugF
import moe.nikky.errorF
import moe.nikky.infoF
Expand Down
1 change: 0 additions & 1 deletion src/main/kotlin/moe/nikky/twitch/TwitchEntryConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package moe.nikky.twitch
import com.kotlindiscord.kord.extensions.storage.Data
import dev.kord.common.entity.Snowflake
import kotlinx.serialization.Serializable
import net.peanuuutz.tomlkt.TomlBlockArray
import net.peanuuutz.tomlkt.TomlComment

@Serializable
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/moe/nikky/twitch/TwitchExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.entity.channel.TopGuildMessageChannel
import dev.kord.rest.Image
import dev.kord.rest.builder.message.EmbedBuilder
import dev.kord.rest.builder.message.create.embed
import dev.kord.rest.builder.message.embed
import dev.kord.rest.builder.message.modify.embed
import dev.kord.rest.request.KtorRequestException
import dev.kord.rest.request.RestRequestException
import io.klogging.Klogging
Expand Down

0 comments on commit be9d011

Please sign in to comment.