feat: clear command
This commit is contained in:
parent
713f44835e
commit
9da39df8fc
15
index.js
15
index.js
@ -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);
|
||||
|
||||
@ -26,6 +26,10 @@ const commands = [
|
||||
name: "fk",
|
||||
description: "Pulls addup channel members into fk channel and lists them",
|
||||
},
|
||||
{
|
||||
name: "clear",
|
||||
description: "Clears bot messages in command channel",
|
||||
},
|
||||
{
|
||||
name: "scout",
|
||||
description: "Lists picking channel members with scout role",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user