From 453b79a6a0da8d2355c1b537e9d9d1e8b78f6ddd Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Wed, 31 Mar 2021 20:26:55 -0500 Subject: [PATCH] Fix fetch messages command --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 74635be..a8d46ae 100644 --- a/index.js +++ b/index.js @@ -19,6 +19,10 @@ client.on("message", message => { }); async function bulkDelete(message) { + if (!message.author.permissions.toArray().has('ADMINISTRATOR')) { + message.reply("you do not have permissions!"); + return; + } const amount = parseInt(message.content.substring(12)); if (!amount) { @@ -36,7 +40,7 @@ async function bulkDelete(message) { return; } - await message.channel.fetch( { limit: amount } ).then(messages => { + await message.channel.messages.fetch( { limit: amount } ).then(messages => { message.channel.bulkDelete(messages).catch(console.error); }).catch(console.error); }