summaryrefslogtreecommitdiff
path: root/src/commands/moderation/clear.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-06-27 22:52:54 -0700
committer8cy <[email protected]>2020-06-27 22:52:54 -0700
commit80951013e391aab140800e4f386867e6c391553f (patch)
tree3d7101237ef1cd8d6fe2a2fab751a2dc55ae7d84 /src/commands/moderation/clear.ts
parentmore config shit (diff)
downloaddep-core-80951013e391aab140800e4f386867e6c391553f.tar.xz
dep-core-80951013e391aab140800e4f386867e6c391553f.zip
add ts defs so not a lot of errors left
- made .todo file for epic error tracking
Diffstat (limited to 'src/commands/moderation/clear.ts')
-rw-r--r--src/commands/moderation/clear.ts31
1 files changed, 22 insertions, 9 deletions
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