From 0d35c0116c38d1f8642e4c8d8f36509f7500bb05 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Mon, 27 Apr 2020 08:00:29 -0700 Subject: A New World, v8.0.0 - change some formatting - add throttling to all commands - change timout in welcome and clear - add another edge case to welcome and darling - use new mongo.connect params for stability - move some commands around - remove some tsingnores for idk in total, epic update 8) --- src/commands/moderation/clear.ts | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/commands/moderation/clear.ts') diff --git a/src/commands/moderation/clear.ts b/src/commands/moderation/clear.ts index e83d023..c2f44ab 100644 --- a/src/commands/moderation/clear.ts +++ b/src/commands/moderation/clear.ts @@ -5,7 +5,7 @@ module.exports = class ClearBot extends Command { constructor(client) { super(client, { name: 'clear', - aliases: ['delete', 'del', 'c', 'd'], + aliases: ['delete', 'del', 'c'], group: 'bot', memberName: 'clear', description: 'Clears a specified amount of messages.', @@ -24,6 +24,10 @@ module.exports = class ClearBot extends Command { 'uwu!c 45', 'uwu!d 84' ], + throttling: { + usages: 5, + duration: 30 + }, userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'] }); @@ -32,23 +36,23 @@ module.exports = class ClearBot extends Command { if (msg.member.hasPermission('MANAGE_MESSAGES')) { if (!deleteAmount) { msg.reply('You haven\'t specified an amount of messages which should be deleted. ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); + deleteNotificationMessage.delete({ timeout: 2000 }); + msg.delete({ timeout: 2000 }) }); } else if (isNaN(deleteAmount)) { msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); + deleteNotificationMessage.delete({ timeout: 2000 }); + msg.delete({ timeout: 2000 }) }); } else if (deleteAmount > 100) { msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); + deleteNotificationMessage.delete({ timeout: 2000 }); + msg.delete({ timeout: 2000 }) }); } else if (deleteAmount < 1) { msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); + deleteNotificationMessage.delete({ timeout: 2000 }); + msg.delete({ timeout: 2000 }) }); } /*else if (msg.createdTimestamp > 1209600) { @@ -63,11 +67,13 @@ module.exports = class ClearBot extends Command { await msg.channel.messages.fetch({ limit: clearAmount }).then(messages => { // I am on v11 discord.js + // why the hell did i put this msg here lol, its 07:56 on 2020/04/27 and i woke up at 6am and i dont really know + // why i put this msg here lol, i am on v12 so that msg mustve been a while ago lol msg.channel.bulkDelete(messages); }); msg.reply('It\'s been deleted ~uwu ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); + deleteNotificationMessage.delete({ timeout: 2000 }); + msg.delete({ timeout: 2000 }) }); } } else { -- cgit v1.2.3