feat: middle save

This commit is contained in:
Project_IO 2024-09-08 19:29:27 +09:00
parent 996a728203
commit e4afe685f7
2 changed files with 31 additions and 1 deletions

View file

@ -1,5 +1,17 @@
package net.wh64.p.x32
class GlobalCommandHandler {
import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
import net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent
import net.dv8tion.jda.api.hooks.ListenerAdapter
class GlobalCommandHandler : ListenerAdapter() {
override fun onSlashCommandInteraction(event: SlashCommandInteractionEvent) {
}
override fun onUserContextInteraction(event: UserContextInteractionEvent) {
}
override fun onMessageContextInteraction(event: MessageContextInteractionEvent) {
}
}

View file

@ -19,3 +19,21 @@ interface MessageContextExecutor {
val data: CommandData
fun execute(ev: MessageContextInteractionEvent)
}
abstract class CommandAdapter : SlashCommandExecutor, UserContextExecutor, MessageContextExecutor {
abstract override val data: CommandData
override fun execute(ev: SlashCommandInteractionEvent) {
executor(ev)
}
override fun execute(ev: UserContextInteractionEvent) {
executor(ev)
}
override fun execute(ev: MessageContextInteractionEvent) {
executor(ev)
}
abstract fun executor(ev: Any)
}