feat: clear command

This commit is contained in:
ethanf 2024-01-16 17:07:14 -06:00
parent 713f44835e
commit 9da39df8fc
2 changed files with 19 additions and 0 deletions

View File

@ -239,6 +239,21 @@ client.on("interactionCreate", async (interaction) => {
) )
); );
} }
if (command === "clear") {
await interaction.reply("clearing messages...");
let channel = client.channels.cache.get(COMMAND_CHANNEL_ID);
if (!channel) return console.error("Can't find command channel");
channel.messages
.fetch({ limit: 100 })
.then((messages) => {
messages.forEach((message) => {
if (message.author.id === client.user.id) {
message.delete();
}
});
})
.catch(console.error);
}
}); });
client.login(TOKEN); client.login(TOKEN);

View File

@ -26,6 +26,10 @@ const commands = [
name: "fk", name: "fk",
description: "Pulls addup channel members into fk channel and lists them", description: "Pulls addup channel members into fk channel and lists them",
}, },
{
name: "clear",
description: "Clears bot messages in command channel",
},
{ {
name: "scout", name: "scout",
description: "Lists picking channel members with scout role", description: "Lists picking channel members with scout role",