From 2995c642fe8af4eaadba02eebe1ff3cfd50a8d96 Mon Sep 17 00:00:00 2001 From: duncte123 Date: Sun, 10 Mar 2024 10:56:57 +0100 Subject: [PATCH] Limit reload command to bot admins --- src/main/kotlin/me/duncte123/io/commands/ReloadCommand.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/kotlin/me/duncte123/io/commands/ReloadCommand.kt b/src/main/kotlin/me/duncte123/io/commands/ReloadCommand.kt index 1f05a05..5b31870 100644 --- a/src/main/kotlin/me/duncte123/io/commands/ReloadCommand.kt +++ b/src/main/kotlin/me/duncte123/io/commands/ReloadCommand.kt @@ -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)