diff --git a/api/src/main/kotlin/dev/schlaubi/mikbot/plugin/api/util/UserCommands.kt b/api/src/main/kotlin/dev/schlaubi/mikbot/plugin/api/util/UserCommands.kt new file mode 100644 index 000000000..390a244a8 --- /dev/null +++ b/api/src/main/kotlin/dev/schlaubi/mikbot/plugin/api/util/UserCommands.kt @@ -0,0 +1,10 @@ +package dev.schlaubi.mikbot.plugin.api.util + +import com.kotlindiscord.kord.extensions.commands.application.ApplicationCommand +import dev.kord.common.entity.ApplicationIntegrationType +import dev.kord.common.entity.InteractionContextType + +public fun ApplicationCommand<*>.executableEverywhere() { + allowedInstallTypes.addAll(ApplicationIntegrationType.entries) + allowedContexts.addAll(InteractionContextType.entries) +} diff --git a/core/database-i18n/src/main/kotlin/dev/schlaubi/mikbot/core/i18n/database/settings/LanguageCommand.kt b/core/database-i18n/src/main/kotlin/dev/schlaubi/mikbot/core/i18n/database/settings/LanguageCommand.kt index 933a22fe4..d5113280e 100644 --- a/core/database-i18n/src/main/kotlin/dev/schlaubi/mikbot/core/i18n/database/settings/LanguageCommand.kt +++ b/core/database-i18n/src/main/kotlin/dev/schlaubi/mikbot/core/i18n/database/settings/LanguageCommand.kt @@ -7,6 +7,7 @@ import com.kotlindiscord.kord.extensions.i18n.SupportedLocales import dev.schlaubi.mikbot.core.i18n.database.LangaugeUser import dev.schlaubi.mikbot.core.i18n.database.LanguageDatabase import dev.schlaubi.mikbot.plugin.api.settings.SettingsModule +import dev.schlaubi.mikbot.plugin.api.util.executableEverywhere import java.util.* private class LanguageArguments : Arguments() { @@ -24,6 +25,7 @@ suspend fun SettingsModule.languageCommand() { ephemeralSlashCommand(::LanguageArguments) { name = "language" description = "Changed the language of the bot" + executableEverywhere() action { val locale = Locale.forLanguageTag(arguments.language) diff --git a/core/gdpr/src/main/kotlin/dev/schlaubi/mikbot/core/gdpr/GDPRModule.kt b/core/gdpr/src/main/kotlin/dev/schlaubi/mikbot/core/gdpr/GDPRModule.kt index 1bc162e5c..5a2477cf9 100644 --- a/core/gdpr/src/main/kotlin/dev/schlaubi/mikbot/core/gdpr/GDPRModule.kt +++ b/core/gdpr/src/main/kotlin/dev/schlaubi/mikbot/core/gdpr/GDPRModule.kt @@ -1,5 +1,8 @@ package dev.schlaubi.mikbot.core.gdpr +import com.kotlindiscord.kord.extensions.commands.application.slash.SlashCommand +import dev.kord.common.entity.ApplicationIntegrationType +import dev.kord.common.entity.InteractionContextType import dev.kord.rest.builder.component.ActionRowBuilder import dev.schlaubi.mikbot.core.gdpr.api.DataPoint import dev.schlaubi.mikbot.core.gdpr.api.GDPRExtensionPoint @@ -7,6 +10,7 @@ import dev.schlaubi.mikbot.core.gdpr.api.PermanentlyStoredDataPoint import dev.schlaubi.mikbot.plugin.api.PluginContext import dev.schlaubi.mikbot.plugin.api.getExtensions import dev.schlaubi.mikbot.plugin.api.module.SubCommandModule +import dev.schlaubi.mikbot.plugin.api.util.executableEverywhere import kotlinx.coroutines.flow.first class GDPRModule(context: PluginContext) : SubCommandModule(context) { @@ -22,6 +26,10 @@ class GDPRModule(context: PluginContext) : SubCommandModule(context) { val interactiveDataPoints = dataPoints.filterIsInstance() + override fun SlashCommand<*, *, *>.commandSettings() { + executableEverywhere() + } + override suspend fun overrideSetup() { infoCommand() requestCommand() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fa57b58af..3714bdc91 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,12 @@ [versions] kotlin = "2.0.0" -kordex = "1.9.2-mikbot-SNAPSHOT" +kordex = "1.9.4-mikbot-SNAPSHOT" kmongo = "5.1.0" coroutines = "1.8.1" serialization = "1.7.1" ktor = "2.3.11" kord = "feature-user-apps-20240917.114617-5" -api = "3.36.7" +api = "3.37.0" ksp = "2.0.0-1.0.22" lavakord = "7.1.0" diff --git a/music/commands/src/main/kotlin/dev/schlaubi/mikmusic/core/settings/commands/FixMusicChannel.kt b/music/commands/src/main/kotlin/dev/schlaubi/mikmusic/core/settings/commands/FixMusicChannel.kt index 152599da1..02fd7d675 100644 --- a/music/commands/src/main/kotlin/dev/schlaubi/mikmusic/core/settings/commands/FixMusicChannel.kt +++ b/music/commands/src/main/kotlin/dev/schlaubi/mikmusic/core/settings/commands/FixMusicChannel.kt @@ -4,13 +4,14 @@ import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand import dev.kord.common.entity.InteractionContextType import dev.schlaubi.mikbot.plugin.api.settings.SettingsModule import dev.schlaubi.mikbot.plugin.api.util.safeGuild +import dev.schlaubi.mikmusic.core.musicControlContexts import dev.schlaubi.mikmusic.core.settings.MusicSettingsDatabase import dev.schlaubi.mikmusic.util.musicModule suspend fun SettingsModule.fixMusicChannel() = ephemeralSlashCommand { name = "fix-music-channel" description = "Force-updates the music channel status" - allowedContexts.add(InteractionContextType.Guild) + musicControlContexts() action { val guildSettings = MusicSettingsDatabase.findGuild(safeGuild) diff --git a/runtime/build.gradle.kts b/runtime/build.gradle.kts index 219049cfd..622aef284 100644 --- a/runtime/build.gradle.kts +++ b/runtime/build.gradle.kts @@ -32,7 +32,7 @@ dependencies { isTransitive = false } implementation("dev.kord:kord-common-jvm:feature-user-apps-20240917.114617-5") - implementation("dev.kord:kord-rest-jvm:eature-user-apps-20240917.114617-5") + implementation("dev.kord:kord-rest-jvm:feature-user-apps-20240917.114617-5") // Util implementation(libs.kotlinx.serialization.json) diff --git a/runtime/plugins.txt b/runtime/plugins.txt index 0c349840c..385727eed 100644 --- a/runtime/plugins.txt +++ b/runtime/plugins.txt @@ -1,4 +1 @@ -:core:ktor -:music:player -:music:commands -:core:redeploy-hook +:core:gdpr