Restructure

This commit is contained in:
2024-02-05 19:18:42 -05:00
parent e851b7d169
commit bbf98e0a2a
5 changed files with 77 additions and 27 deletions

19
commands/delete.js Normal file
View File

@@ -0,0 +1,19 @@
module.exports = {
name: 'delete',
description: 'Delete a specified number of your messages.',
async execute(message, args, deleteTimeout) {
const deleteCount = parseInt(args[0], 10);
if (isNaN(deleteCount)) {
const errorMsg = await message.channel.send('Please provide the number of messages to delete.');
setTimeout(() => errorMsg.delete().catch(console.error), deleteTimeout);
return;
}
const messages = await message.channel.messages.fetch({ limit: deleteCount + 1 });
const filtered = messages.filter(msg => msg.author.id === message.author.id);
filtered.forEach(msg => {
msg.delete().catch(console.error);
});
},
};

14
commands/help.js Normal file
View File

@@ -0,0 +1,14 @@
module.exports = {
name: 'help',
description: 'List all of my commands or info about a specific command.',
execute(message, args, deleteTimeout) {
let reply = 'Here are my supported commands:\n\n';
const commands = Array.from(message.client.commands.values());
reply += commands.map(command => `.${command.name} - ${command.description}`).join('\n');
message.channel.send(reply).then(sentMessage => {
setTimeout(() => sentMessage.delete().catch(console.error), deleteTimeout);
});
},
};