Skip to content

Commit

Permalink
Limit reload command to bot admins
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Mar 10, 2024
1 parent 7982000 commit 2995c64
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/kotlin/me/duncte123/io/commands/ReloadCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEve
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions
import net.dv8tion.jda.api.interactions.commands.build.CommandData

const val DUNSTE_ID = 311769499995209728L

class ReloadCommand : ICommand {
override val name = "reload"
override val description = "Reloads all user commands"

override fun execute(event: SlashCommandInteractionEvent) {
if (event.user.idLong != DUNSTE_ID) {
event.reply("This action is restricted to bot admins only").queue()
return
}

commandManager.resetCommands()
commandManager.registerUserCommands()
commandManager.registerCommandsOnJda(event.jda)
Expand Down

0 comments on commit 2995c64

Please sign in to comment.