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/server/goodbye.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/commands/server/goodbye.ts') diff --git a/src/commands/server/goodbye.ts b/src/commands/server/goodbye.ts index 8a4669f..b924654 100644 --- a/src/commands/server/goodbye.ts +++ b/src/commands/server/goodbye.ts @@ -1,4 +1,5 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore no types import emoji from 'emoji-random'; import Goodbye from '../../models/goodbye.js'; import mongo from 'mongoose'; @@ -6,7 +7,7 @@ import config from '../../config.json'; mongo.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) module.exports = class GoodbyeServer extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'goodbye', group: 'server', @@ -34,7 +35,8 @@ module.exports = class GoodbyeServer extends Command { guildOnly: true }); } - async run(msg: CommandoMessage, { wType }) { + //@ts-ignore doesnt matter if not all code paths return a value + async run(msg: CommandoMessage, { wType }: any) { const goodbye = new Goodbye({ _id: mongo.Types.ObjectId(), username: msg.author.username, @@ -54,17 +56,24 @@ module.exports = class GoodbyeServer extends Command { } else if (guild && wType == 'remove') { await Goodbye.findOneAndDelete({ guildID: msg.guild.id }) msg.say('The current goodbye channel has been unset! ' + emoji.random()).then(mnotif => { + //@ts-ignore this exists mnotif.delete({ timeout: 2000 }) + //@ts-ignore this exists msg.delete({ timeout: 2000 }) }) } else if (!guild && wType == 'remove') { msg.reply('There is no current goodbye channel set for this guild! ' + emoji.random()).then(mnotif => { + //@ts-ignore this exists mnotif.delete({ timeout: 2000 }) + //@ts-ignore this exists msg.delete({ timeout: 2000 }) }) } else if (guild && wType == 'set') { + //@ts-ignore this exists msg.reply(`There already is a goodbye channel set! It's ${guild.channelname}! ` + emoji.random()).then(mnotif => { + //@ts-ignore this exists mnotif.delete({ timeout: 2000 }) + //@ts-ignore this exists msg.delete({ timeout: 2000 }) }) } else if (!guild && wType == 'set') { @@ -73,17 +82,20 @@ module.exports = class GoodbyeServer extends Command { .catch(err => console.log(err)) msg.reply(`The goodbye channel has been set to ${msg.channel}! ` + emoji.random()).then(mnotif => { + //@ts-ignore this exists mnotif.delete({ timeout: 2000 }) + //@ts-ignore this exists msg.delete({ timeout: 2000 }) }) } else if (!guild) { msg.reply('There is no current goodbye channel set for this guild! To set one, do `uwu!goodbye set` in the channel you want to set it in. ' + emoji.random()) } else if (guild) { + //@ts-ignore this exists msg.reply(`The current goodbye channel is ${guild.channelname}. ` + emoji.random()) } }) } else { - msg.reply('Insufficent permissions! ' + emoji.random()) + return msg.reply('Insufficent permissions! ' + emoji.random()) } } }; \ No newline at end of file -- cgit v1.2.3