diff options
| author | 8cy <[email protected]> | 2020-04-27 08:00:29 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-27 08:00:29 -0700 |
| commit | 0d35c0116c38d1f8642e4c8d8f36509f7500bb05 (patch) | |
| tree | 24532f9d04bd1465b5b4d21bde18d86812646f45 /src/commands/moderation/clear.ts | |
| parent | add welcome command, v7.8.0 (diff) | |
| download | dep-core-0d35c0116c38d1f8642e4c8d8f36509f7500bb05.tar.xz dep-core-0d35c0116c38d1f8642e4c8d8f36509f7500bb05.zip | |
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)
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 { |