diff options
| author | 8cy <[email protected]> | 2020-06-27 22:52:54 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-06-27 22:52:54 -0700 |
| commit | 80951013e391aab140800e4f386867e6c391553f (patch) | |
| tree | 3d7101237ef1cd8d6fe2a2fab751a2dc55ae7d84 /src/commands/server/goodbye.ts | |
| parent | more config shit (diff) | |
| download | dep-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/server/goodbye.ts')
| -rw-r--r-- | src/commands/server/goodbye.ts | 20 |
1 files changed, 16 insertions, 4 deletions
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 |