From 80951013e391aab140800e4f386867e6c391553f Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Sat, 27 Jun 2020 22:52:54 -0700 Subject: add ts defs so not a lot of errors left - made .todo file for epic error tracking --- src/commands/moderation/clear.ts | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src/commands/moderation/clear.ts') diff --git a/src/commands/moderation/clear.ts b/src/commands/moderation/clear.ts index 5175556..c306231 100644 --- a/src/commands/moderation/clear.ts +++ b/src/commands/moderation/clear.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore no types import emoji from 'emoji-random'; module.exports = class ClearModeration extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'clear', aliases: ['delete', 'del', 'c'], @@ -32,26 +33,35 @@ module.exports = class ClearModeration extends Command { clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'] }); } - async run(msg: CommandoMessage, { deleteAmount }) { + //@ts-ignore this is not promise based + async run(msg: CommandoMessage, { deleteAmount }: any) { 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 => { + return msg.reply('You haven\'t specified an amount of messages which should be deleted. ' + emoji.random()).then(deleteNotificationMessage => { + //@ts-ignore this exists deleteNotificationMessage.delete({ timeout: 2000 }); + //@ts-ignore this exists msg.delete({ timeout: 2000 }) }); } else if (isNaN(deleteAmount)) { - msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => { + return msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => { + //@ts-ignore this exists deleteNotificationMessage.delete({ timeout: 2000 }); + //@ts-ignore this exists msg.delete({ timeout: 2000 }) }); } else if (deleteAmount > 100) { - msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => { + return msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => { + //@ts-ignore this exists deleteNotificationMessage.delete({ timeout: 2000 }); + //@ts-ignore this exists msg.delete({ timeout: 2000 }) }); } else if (deleteAmount < 1) { - msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => { + return msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => { + //@ts-ignore this exists deleteNotificationMessage.delete({ timeout: 2000 }); + //@ts-ignore this exists msg.delete({ timeout: 2000 }) }); } @@ -69,15 +79,18 @@ module.exports = class ClearModeration extends Command { }).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 + //@ts-ignore this exists msg.channel.bulkDelete(messages); }); - msg.reply('It\'s been deleted ~uwu ' + emoji.random()).then(deleteNotificationMessage => { + return msg.reply('It\'s been deleted ~uwu ' + emoji.random()).then(deleteNotificationMessage => { + //@ts-ignore this exists deleteNotificationMessage.delete({ timeout: 2000 }); + //@ts-ignore this exists msg.delete({ timeout: 2000 }) }); } } else { - msg.reply('Insufficent permsissions. ' + emoji.random()); + return msg.reply('Insufficent permsissions. ' + emoji.random()); } } }; \ No newline at end of file -- cgit v1.2.3