diff options
Diffstat (limited to 'bot/src/commands/rm.js')
| -rw-r--r-- | bot/src/commands/rm.js | 21 |
1 files changed, 21 insertions, 0 deletions
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.`)); + } +}; |
