25 lines
676 B
JavaScript
25 lines
676 B
JavaScript
import { SlashCommandBuilder } from "discord.js";
|
|
import { client } from "..";
|
|
import { ROLE_ID_RUNNER } from "../config.json";
|
|
|
|
const data = new SlashCommandBuilder()
|
|
.setName("clear")
|
|
.setDescription("Clears bot messages in this channel");
|
|
|
|
const permissions = [ROLE_ID_RUNNER];
|
|
|
|
const execute = async (interaction) => {
|
|
await interaction.reply("Clearing messages...");
|
|
interaction.channel.messages
|
|
.fetch({ limit: 250 })
|
|
.then((messages) => {
|
|
messages.forEach((message) => {
|
|
if (message.author.id === client.user.id) {
|
|
message.delete();
|
|
}
|
|
});
|
|
})
|
|
.catch(console.error);
|
|
};
|
|
|
|
export { data, permissions, execute }; |