Skip to content

Commit

Permalink
The real user apps update
Browse files Browse the repository at this point in the history
(as in the one which actually works)
  • Loading branch information
DRSchlaubi committed Sep 17, 2024
1 parent 9953b46 commit 33e0b6c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
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
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) {
Expand All @@ -22,6 +26,10 @@ class GDPRModule(context: PluginContext) : SubCommandModule(context) {

val interactiveDataPoints = dataPoints.filterIsInstance<PermanentlyStoredDataPoint>()

override fun SlashCommand<*, *, *>.commandSettings() {
executableEverywhere()
}

override suspend fun overrideSetup() {
infoCommand()
requestCommand()
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions runtime/plugins.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
:core:ktor
:music:player
:music:commands
:core:redeploy-hook
:core:gdpr

0 comments on commit 33e0b6c

Please sign in to comment.