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": {