From fd7f8eba960981482fabf350995bf753feebb176 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 3 Mar 2025 11:42:27 -0500 Subject: More commands ported; Almost all 2.x features have been added --- bot/src/commands/rm.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 bot/src/commands/rm.js (limited to 'bot/src/commands/rm.js') diff --git a/bot/src/commands/rm.js b/bot/src/commands/rm.js new file mode 100644 index 0000000..ec6f647 --- /dev/null +++ b/bot/src/commands/rm.js @@ -0,0 +1,21 @@ +import { SlashCommandBuilder, PermissionFlagsBits } from 'discord.js'; + +export default { + data: new SlashCommandBuilder() + .setName('rm') + .setDescription('Purges messages.') + .addNumberOption(option => + option + .setName('amount') + .setDescription('Enter the amount of messages you want to delete.') + .setRequired(true)) + .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages), + async execute(interaction) { + const amount = interaction.options.getNumber('amount'); + + if (amount > 100) return interaction.reply('Put a number less than 100.'); + + return await interaction.channel.bulkDelete(amount) + .then( (messages) => interaction.reply(`Deleted ${messages.size} messages.`)); + } +}; -- cgit v1.2.3