diff options
Diffstat (limited to 'src/commands/moderation/clear.ts')
| -rw-r--r-- | src/commands/moderation/clear.ts | 28 |
1 files changed, 17 insertions, 11 deletions
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 { |