Skip to content

Commit

Permalink
Upgrade kordex gradle plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Nov 4, 2024
1 parent 3742679 commit 5f7b70f
Show file tree
Hide file tree
Showing 40 changed files with 125 additions and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ fun GDPRModule.infoCommand() = ephemeralSubCommand {
title = translate(GdprTranslations.Commands.Gdpr.Info.title)

dataPoint(
translate(GdprTranslations.Commands.Gdpr.Info.stored_data),
translate(GdprTranslations.Commands.Gdpr.Info.storedData),
storedData,
translate(GdprTranslations.Gdpr.General.Persistent_data.explainer)
translate(GdprTranslations.Gdpr.General.PersistentData.explainer)
)
dataPoint(translate(GdprTranslations.Commands.Gdpr.Info.anonymized_data), anonymizedData)
dataPoint(translate(GdprTranslations.Commands.Gdpr.Info.anonymizedData), anonymizedData)
dataPoint(
translate(GdprTranslations.Commands.Gdpr.Info.data_processing),
translate(GdprTranslations.Commands.Gdpr.Info.dataProcessing),
processedData,
translate(GdprTranslations.Gdpr.General.Persistent_data.explainer)
translate(GdprTranslations.Gdpr.General.PersistentData.explainer)
)
}
}
Expand Down Expand Up @@ -64,7 +64,7 @@ private suspend fun List<DataPoint>.toDescription(commandContext: CommandContext
append(commandContext.translate(descriptionKey))
if (sharingDescriptionKey != null) {
appendLine()
append(commandContext.translate(GdprTranslations.Gdpr.General.data_sharing))
append(commandContext.translate(GdprTranslations.Gdpr.General.dataSharing))
append(' ')
append(
commandContext.translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ private var lastRebalanceCheck = TimeSource.Monotonic.markNow()

private class RebalanceArguments() : Arguments() {
val forceTo by optionalInt {
name = KubernetesTranslations.Commands.Rebalance.Arguments.Force_to.name
description = KubernetesTranslations.Commands.Rebalance.Arguments.Force_to.description
name = KubernetesTranslations.Commands.Rebalance.Arguments.ForceTo.name
description = KubernetesTranslations.Commands.Rebalance.Arguments.ForceTo.description
}
}

Expand Down Expand Up @@ -94,7 +94,7 @@ class RebalancerExtension(context: PluginContext) : MikBotModule(context) {
} else if (arguments.forceTo != null) {
reBalance(arguments.forceTo!!)
} else {
discordError(KubernetesTranslations.Commands.Rebalance.already_balanced)
discordError(KubernetesTranslations.Commands.Rebalance.alreadyBalanced)
}

respond {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ suspend fun OwnerModule.redeployCommand() = ephemeralSlashCommand {

private suspend fun EphemeralSlashCommandContext<*, *>.notAvailable() {
respond {
content = translate(RedeployHookTranslations.Commands.Redeploy.not_satisfied)
content = translate(RedeployHookTranslations.Commands.Redeploy.notSatisfied)
}
}
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ coroutines = "1.9.0"
serialization = "1.7.3"
ktor = "3.0.1"
kord = "feature-user-apps-20241102.180018-12"
api = "4.0.5"
api = "4.1.0"
ksp = "2.0.21-1.0.26"
lavakord = "8.0.1"
kordex-plugin = "1.5.5"
kordex-plugin = "1.5.6"

[libraries]
kord-common = { group = "dev.kord", name = "kord-common", version.ref = "kord" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ suspend fun MusicModule.fixCommand() = ephemeralControlSlashCommand {
val current: RecoveryStep = nextStep

edit {
content = translate(MusicTranslations.Commands.Fix.running_step, translate(current.nameKey))
content = translate(MusicTranslations.Commands.Fix.runningStep, translate(current.nameKey))
components = mutableListOf()
}

Expand All @@ -52,7 +52,7 @@ suspend fun MusicModule.fixCommand() = ephemeralControlSlashCommand {
}

edit {
content = translate(MusicTranslations.Commands.Fix.ran_step, translate(current.nameKey))
content = translate(MusicTranslations.Commands.Fix.ranStep, translate(current.nameKey))

if (applicableRecoverySteps.hasNext()) {
nextStep = applicableRecoverySteps.next()
Expand All @@ -68,7 +68,7 @@ suspend fun MusicModule.fixCommand() = ephemeralControlSlashCommand {
}
} else {
edit {
content = translate(MusicTranslations.Command.Fix.troubleshooting_done)
content = translate(MusicTranslations.Command.Fix.troubleshootingDone)
}
nextStep = null
}
Expand Down Expand Up @@ -109,7 +109,7 @@ private interface RecoveryStep {
}

private object ReJoinVoiceChannel : RecoveryStep {
override val nameKey: Key = MusicTranslations.Commands.Fix.Step.re_join_channel
override val nameKey: Key = MusicTranslations.Commands.Fix.Step.reJoinChannel
override val MusicPlayer.applicable: Boolean
get() = link.lastChannelId == null || link.state == Link.State.NOT_CONNECTED

Expand All @@ -119,7 +119,7 @@ private object ReJoinVoiceChannel : RecoveryStep {
}

private object UnPausePlayback : RecoveryStep {
override val nameKey: Key = MusicTranslations.Commands.Fix.Step.unpause_plackback
override val nameKey: Key = MusicTranslations.Commands.Fix.Step.unpausePlackback
override val MusicPlayer.applicable: Boolean
get() = link.player.paused

Expand All @@ -130,7 +130,7 @@ private object UnPausePlayback : RecoveryStep {

private object RestartPlayback : RecoveryStep {

override val nameKey: Key = MusicTranslations.Commands.Fix.Step.restart_playback
override val nameKey: Key = MusicTranslations.Commands.Fix.Step.restartPlayback

override suspend fun EphemeralSlashCommandContext<*, *>.apply(musicPlayer: MusicPlayer) {
musicPlayer.player.pause(true)
Expand All @@ -141,7 +141,7 @@ private object RestartPlayback : RecoveryStep {

private object ReEstablishVoiceConnection : RecoveryStep {

override val nameKey: Key = MusicTranslations.Commands.Fix.Step.re_establish_voice_connection
override val nameKey: Key = MusicTranslations.Commands.Fix.Step.reEstablishVoiceConnection

override suspend fun EphemeralSlashCommandContext<*, *>.apply(musicPlayer: MusicPlayer) {
val state = musicPlayer.toState()
Expand All @@ -155,7 +155,7 @@ private object ReEstablishVoiceConnection : RecoveryStep {
}

private object SwitchVoiceServers : RecoveryStep {
override val nameKey: Key = MusicTranslations.Commands.Fix.Step.switch_voice_server
override val nameKey: Key = MusicTranslations.Commands.Fix.Step.switchVoiceServer

override suspend fun EphemeralSlashCommandContext<*, *>.apply(musicPlayer: MusicPlayer) {
val channel = musicPlayer.getChannel()!!
Expand All @@ -178,7 +178,7 @@ object SkipTrack : RecoveryStep {
override val MusicPlayer.applicable: Boolean
get() = queuedTracks.isNotEmpty()

override val nameKey: Key = MusicTranslations.Commands.Fix.Step.skip_track
override val nameKey: Key = MusicTranslations.Commands.Fix.Step.skipTrack

override suspend fun EphemeralSlashCommandContext<*, *>.apply(musicPlayer: MusicPlayer) {
musicPlayer.skip()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package dev.schlaubi.mikmusic.commands

import dev.arbjerg.lavalink.protocol.v4.Track
import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.application.slash.EphemeralSlashCommand
import dev.kordex.core.commands.application.slash.EphemeralSlashCommandContext
import dev.kordex.core.commands.application.slash.ephemeralSubCommand
import dev.kordex.core.commands.converters.impl.int
import dev.arbjerg.lavalink.protocol.v4.Track
import dev.kordex.core.i18n.EMPTY_KEY
import dev.kordex.core.i18n.toKey
import dev.schlaubi.mikbot.plugin.api.util.translate
import dev.schlaubi.mikbot.translations.MusicTranslations
Expand Down Expand Up @@ -43,7 +42,7 @@ suspend fun MusicModule.moveCommand() {
val toValue = safeArguments.to().coerceAtLeast(1)
if (toValue > musicPlayer.queuedTracks.size) {
respond {
content = translate(MusicTranslations.Commands.Move.Invalid_index.to)
content = translate(MusicTranslations.Commands.Move.InvalidIndex.to)
}
return@action
}
Expand All @@ -60,7 +59,7 @@ suspend fun MusicModule.moveCommand() {
}
} else {
respond {
content = translate(MusicTranslations.Commands.Move.Invalid_index.from)
content = translate(MusicTranslations.Commands.Move.InvalidIndex.from)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ suspend fun MusicModule.nextCommand() = ephemeralControlSlashCommand {
respond { content = translate(MusicTranslations.Commands.Skip.skipped) }
} else {
musicPlayer.skipChapter()
respond { content = translate(MusicTranslations.Commands.Next.skipped_chapter) }
respond { content = translate(MusicTranslations.Commands.Next.skippedChapter) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ import kotlin.time.toDuration

class NowPlayingArguments : Arguments() {
val index by optionalInt {
name = MusicTranslations.Commands.Now_playing.Arguments.Position.name
description = MusicTranslations.Commands.Now_playing.Arguments.Position.description
name = MusicTranslations.Commands.NowPlaying.Arguments.Position.name
description = MusicTranslations.Commands.NowPlaying.Arguments.Position.description
}
}

private val regex = """\.[0-9]*""".toRegex()

suspend fun MusicModule.nowPlayingCommand() = publicSlashCommand(::NowPlayingArguments) {
name = MusicTranslations.Commands.Now_playing.name
description = MusicTranslations.Commands.Now_playing.description
name = MusicTranslations.Commands.NowPlaying.name
description = MusicTranslations.Commands.NowPlaying.description
musicControlContexts()

check {
Expand All @@ -37,7 +37,7 @@ suspend fun MusicModule.nowPlayingCommand() = publicSlashCommand(::NowPlayingArg
val index = arguments.index
val (playingTrack) = if (index != null) {
musicPlayer.queuedTracks.getOrNull(index) ?: run {
respond { translate(MusicTranslations.Commands.Now_playing.invalid_index) }
respond { translate(MusicTranslations.Commands.NowPlaying.invalidIndex) }
return@action
}
} else musicPlayer.playingTrack ?: return@action
Expand All @@ -47,17 +47,17 @@ suspend fun MusicModule.nowPlayingCommand() = publicSlashCommand(::NowPlayingArg
addSong(this@action, playingTrack)

field {
name = translate(MusicTranslations.Commands.Now_playing.Serving_node.discord)
name = translate(MusicTranslations.Commands.NowPlaying.ServingNode.discord)
value = "`${java.net.InetAddress.getLocalHost().hostName}`"
}

field {
name = translate(MusicTranslations.Commands.Now_playing.Serving_node.music)
name = translate(MusicTranslations.Commands.NowPlaying.ServingNode.music)
value = "`${link.node.host}`"
}

field {
name = translate(MusicTranslations.Commands.Now_playing.progress)
name = translate(MusicTranslations.Commands.NowPlaying.progress)
value =
"${player.positionDuration.toString().replace(regex, "")}/${
playingTrack.info.length.toDuration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ suspend fun MusicModule.queueCommand() = ephemeralSlashCommand {
respond {
embed {
musicPlayer.addAutoPlaySongs(this@action)
description = translate(MusicTranslations.Commands.Queue.now_playing, track.format())
description = translate(MusicTranslations.Commands.Queue.nowPlaying, track.format())
}
}
} else {
respond {
content = translate(MusicTranslations.Commands.Queue.no_songs)
content = translate(MusicTranslations.Commands.Queue.noSongs)
}
}
return@action
Expand All @@ -49,7 +49,7 @@ suspend fun MusicModule.queueCommand() = ephemeralSlashCommand {
val playingTrack = musicPlayer.playingTrack
if (playingTrack != null) {
field {
name = translate(MusicTranslations.Music.Queue.now_playing)
name = translate(MusicTranslations.Music.Queue.nowPlaying)
value = playingTrack.format(musicPlayer.repeat)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ suspend fun MusicModule.radioCommand() {

action {
if (musicPlayer.hasAutoPlay) {
discordError(MusicTranslations.Commands.Radio.already_enabled)
discordError(MusicTranslations.Commands.Radio.alreadyEnabled)
}
val seedItem = (musicPlayer.loadItem(arguments.query))

Expand All @@ -56,7 +56,7 @@ suspend fun MusicModule.radioCommand() {

val realItems = item.filterNotNull()
if (realItems.isEmpty()) {
discordError(MusicTranslations.Commands.Radio.no_matching_songs)
discordError(MusicTranslations.Commands.Radio.noMatchingSongs)
}

if (isTrack) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ suspend fun MusicModule.removeCommand() = ephemeralControlSlashCommand {
}
} else {
respond {
content = translate(MusicTranslations.Commands.Remove.Invalid_index.multiple)
content = translate(MusicTranslations.Commands.Remove.InvalidIndex.multiple)
}
}
}
Expand All @@ -70,7 +70,7 @@ suspend fun MusicModule.removeCommand() = ephemeralControlSlashCommand {
}
} else {
respond {
content = translate(MusicTranslations.Commands.Remove.Invalid_index.single)
content = translate(MusicTranslations.Commands.Remove.InvalidIndex.single)
}
}
}
Expand All @@ -83,7 +83,7 @@ suspend fun MusicModule.removeCommand() = ephemeralControlSlashCommand {
doRemove {
val to = arguments.to ?: arguments.from
if (to < arguments.from) {
discordError(MusicTranslations.Commands.Remove.Range.invalid_range_end)
discordError(MusicTranslations.Commands.Remove.Range.invalidRangeEnd)
}
val range = arguments.from..to

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ suspend fun MusicModule.schedulerCommands() {
}

ephemeralControlSlashCommand {
name = MusicTranslations.Commands.Loop_queue.name
description = MusicTranslations.Commands.Loop_queue.description
name = MusicTranslations.Commands.LoopQueue.name
description = MusicTranslations.Commands.LoopQueue.description
musicControlContexts()

action {
schedulerOption(
MusicPlayer::loopQueue,
MusicPlayer::shuffle, MusicPlayer::repeat,
enabled = MusicTranslations.Commands.Loop_queue.enabled,
disabled = MusicTranslations.Commands.Loop_queue.disabled,
enabled = MusicTranslations.Commands.LoopQueue.enabled,
disabled = MusicTranslations.Commands.LoopQueue.disabled,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SeekArguments : Arguments() {

validate {
if (!value.matches(seekRegex)) {
discordError(MusicTranslations.Command.Seek.invalid_format)
discordError(MusicTranslations.Command.Seek.invalidFormat)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ suspend fun MusicModule.skipCommand() = ephemeralControlSlashCommand(::SkipArgum
return@action
}
if (arguments.to < 1 && musicPlayer.hasAutoPlay) {
discordError(MusicTranslations.Commands.skips_exceed_autoplay_range)
discordError(MusicTranslations.Commands.skipsExceedAutoplayRange)
}
if (arguments.to > (musicPlayer.queuedTracks.size + musicPlayer.autoPlayTrackCount)) {
respond {
content = translate(MusicTranslations.Commands.Skip.exceeds_range)
content = translate(MusicTranslations.Commands.Skip.exceedsRange)
}
return@action
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import dev.schlaubi.mikmusic.player.queue.queueTracks


suspend fun MusicModule.playMessageAction() = ephemeralMessageCommand {
name = MusicTranslations.Context.Message.play_as_track
name = MusicTranslations.Context.Message.playAsTrack

musicControlContexts()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import dev.schlaubi.mikmusic.core.settings.MusicSettingsDatabase

private class DjModeArguments : Arguments() {
val djRole by optionalRole {
name = MusicTranslations.Commands.Dj_mode.Arguments.Role.name
description = MusicTranslations.Commands.Dj_mode.Arguments.Role.description
name = MusicTranslations.Commands.DjMode.Arguments.Role.name
description = MusicTranslations.Commands.DjMode.Arguments.Role.description
}
}

suspend fun SettingsModule.djModeCommand() {
ephemeralSlashCommand(::DjModeArguments) {
name = MusicTranslations.Commands.Dj_mode.name
description = MusicTranslations.Commands.Dj_mode.description
name = MusicTranslations.Commands.DjMode.name
description = MusicTranslations.Commands.DjMode.description

guildAdminOnly()

Expand Down
Loading

0 comments on commit 5f7b70f

Please sign in to comment.