From bfb4aae2aaaa49d7d420abe0bdc87983d01aa165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Sun, 20 Nov 2022 03:42:59 +0100 Subject: [PATCH] Register clear command --- .../wtf/beatrice/hidekobot/utils/SlashCommandsUtil.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/wtf/beatrice/hidekobot/utils/SlashCommandsUtil.java b/src/main/java/wtf/beatrice/hidekobot/utils/SlashCommandsUtil.java index e0576ac..3783cb5 100644 --- a/src/main/java/wtf/beatrice/hidekobot/utils/SlashCommandsUtil.java +++ b/src/main/java/wtf/beatrice/hidekobot/utils/SlashCommandsUtil.java @@ -1,7 +1,10 @@ package wtf.beatrice.hidekobot.utils; import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.interactions.commands.Command; +import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions; +import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.commands.build.Commands; import wtf.beatrice.hidekobot.HidekoBot; @@ -19,6 +22,9 @@ public class SlashCommandsUtil {{ add(Commands.slash("ping", "Test if the bot is responsive.")); add(Commands.slash("coinflip", "Flip a coin and get head or tails.")); + add(Commands.slash("clear", "Clear the current channel's chat.") + .addOption(OptionType.INTEGER, "amount", "The amount of messages to delete.") + .setDefaultPermissions(DefaultMemberPermissions.enabledFor(Permission.MESSAGE_MANAGE))); }}; public static void updateSlashCommands()