mirror of
https://github.com/devproje/px32-bot.git
synced 2024-12-01 21:03:05 +00:00
feat: middle save
This commit is contained in:
parent
996a728203
commit
e4afe685f7
2 changed files with 31 additions and 1 deletions
|
@ -1,5 +1,17 @@
|
||||||
package net.wh64.p.x32
|
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) {
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -19,3 +19,21 @@ interface MessageContextExecutor {
|
||||||
val data: CommandData
|
val data: CommandData
|
||||||
fun execute(ev: MessageContextInteractionEvent)
|
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)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue