Initial Commit
This commit is contained in:
commit
6d2e379a0c
41 changed files with 5064 additions and 0 deletions
31
src/commands/utility/deletemsgs.js
Normal file
31
src/commands/utility/deletemsgs.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { SlashCommandBuilder } from "discord.js";
|
||||
|
||||
const command = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("deletemsgs")
|
||||
.setDescription("Supprime tous les messages, sauf ceux épinglés"),
|
||||
async execute(interaction) {
|
||||
let textChannel = interaction.client.channels.cache.get(
|
||||
interaction.channelId
|
||||
);
|
||||
|
||||
textChannel.messages
|
||||
.fetch({ limit: 100 })
|
||||
.then((fetched) => {
|
||||
const notPinned = fetched.filter((fetchedMsg) => !fetchedMsg.pinned);
|
||||
textChannel.bulkDelete(notPinned, true);
|
||||
console.log(
|
||||
`[${new Date().toLocaleString()}] Command : Delete Messages used`
|
||||
);
|
||||
})
|
||||
.catch(console.error);
|
||||
|
||||
interaction.reply("Et voila, c'est tout propre ! 🐱").then(() => {
|
||||
setTimeout(() => {
|
||||
interaction.deleteReply();
|
||||
}, 7000);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export { command };
|
||||
Loading…
Add table
Add a link
Reference in a new issue