mirror of
https://github.com/SEPPDROID/zoizbot.git
synced 2025-10-22 07:54:28 +00:00
added an purge example - Update examples.js
This commit is contained in:
@@ -57,6 +57,19 @@ zoizbot.on("message", async message => {
|
||||
return message.reply(`${member.user.tag} has been banned by ${message.author.tag} because: ${banReason}`)
|
||||
}
|
||||
|
||||
//simple purge example command
|
||||
|
||||
if (command === "purge") {
|
||||
const deleteCount = parseInt(args[0], 10);
|
||||
|
||||
if (!deleteCount || deleteCount < 2 || deleteCount > 100)
|
||||
return message.reply("Please provide a number between 2 and 100 for the number of messages to delete");
|
||||
|
||||
const fetched = await message.channel.messages.fetch({ limit: deleteCount });
|
||||
message.channel.bulkDelete(fetched)
|
||||
.catch(error => message.reply(`Couldn't delete messages because of: ${error}`));
|
||||
}
|
||||
|
||||
else return
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user