From 4a1e6a5b8af950497bfc9ea6cf17af2394fca0b2 Mon Sep 17 00:00:00 2001 From: Taken Date: Wed, 26 Apr 2023 21:19:32 +0200 Subject: [PATCH] Adding purgereaction command --- commands/devel.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/commands/devel.js b/commands/devel.js index 4eb26e6..3085cb1 100644 --- a/commands/devel.js +++ b/commands/devel.js @@ -25,6 +25,14 @@ module.exports = { subcommand .setName('listallverified') .setDescription('List all verified users.')) + .addSubcommand(subcommand => + subcommand + .setName('purgereactions') + .setDescription('Purge all reactions from a messages.') + .addIntegerOption(option => + option + .setName('count') + .setDescription('Count of messages to purge reactions from.'))) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -98,8 +106,26 @@ module.exports = { await interaction.reply({ embeds: [embed] }) - } + if (subcommand === 'purgereactions') { + + const count = interaction.options.getInteger('count'); + await interaction.deferReply({}) + + if (user.id !== dev) { + interaction.editReply({ content: 'Due to you not screwing something up this command is restricted to only ' + userMentioned, ephemeral: true }) + return + } + + const messages = await interaction.channel.messages.fetch({ limit: count }); + + messages.forEach(async (message) => { + await message.reactions.removeAll(); + }) + + await interaction.editReply(`Purged reactions from ${count} message(s).`) + + } } }; \ No newline at end of file