Initial commit

This commit is contained in:
2025-02-02 14:10:51 -05:00
commit 9c74e724a8
28 changed files with 10554 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
// prune.js - Discord bot message pruning command
// Copyright (C) 2025 Luis Bauza
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('prune')
.setDescription('Prune up to 99 messages.')
.addIntegerOption(option =>
option
.setName('amount')
.setDescription('Number of messages to prune')
.setMinValue(1)
.setMaxValue(99)
.setRequired(true),
)
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
async execute(interaction) {
const amount = interaction.options.getInteger('amount');
try {
const deleted = await interaction.channel.bulkDelete(amount, true);
await interaction.reply({
content: `Successfully deleted ${deleted.size} message(s).`,
ephemeral: true,
});
} catch (error) {
console.error(error);
await interaction.reply({
content: 'There was an error trying to prune messages in this channel!',
ephemeral: true,
});
}
},
};