From c610b8babbac75b414549402d6b414a633e3774e Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Tue, 26 Sep 2017 17:21:16 +0000 Subject: [PATCH] Update for bulkDelete change --- .gitignore | 3 +++ commands/moderation/prune.js | 11 ++++------- package.json | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b8c3d51e..0c65b2e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ +# Dependencies node_modules/ package-lock.json + +# Logs logs/ *.log diff --git a/commands/moderation/prune.js b/commands/moderation/prune.js index 040efaf9..105ba8b9 100644 --- a/commands/moderation/prune.js +++ b/commands/moderation/prune.js @@ -30,12 +30,9 @@ module.exports = class PruneCommand extends Command { } async run(msg, { count }) { - try { - const messages = await msg.channel.messages.fetch({ limit: count + 1 }); - await msg.channel.bulkDelete(messages, true); - return null; - } catch (err) { - return msg.say('There are no messages younger than two weeks that can be deleted.'); - } + const messages = await msg.channel.messages.fetch({ limit: count + 1 }); + const msgs = await msg.channel.bulkDelete(messages, true); + if (!msgs.size) return msg.say('There are no messages younger than two weeks that can be deleted.'); + return null; } }; diff --git a/package.json b/package.json index 2184c9f8..cff7c60a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "42.12.4", + "version": "42.12.5", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {