diff --git a/zoizbot/commands/examples.js b/zoizbot/commands/examples.js index 03fe188..8f38e8a 100644 --- a/zoizbot/commands/examples.js +++ b/zoizbot/commands/examples.js @@ -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 });