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/utility/csgoserverstatus.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/utility/csgoserverstatus.ts')
| -rw-r--r-- | src/commands/utility/csgoserverstatus.ts | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/commands/utility/csgoserverstatus.ts b/src/commands/utility/csgoserverstatus.ts index eba0aad..5f0cfe7 100644 --- a/src/commands/utility/csgoserverstatus.ts +++ b/src/commands/utility/csgoserverstatus.ts @@ -1,11 +1,12 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore no types import emoji from 'emoji-random' +//@ts-ignore no @types import gamedig from 'gamedig' -import gameDigHelper from '../../utils/gameDigHelper.js' +const gameDigHelper = require('../../utils/gameDigHelper.js') module.exports = class CSGOServerStatusUtility extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'csgoserverstatus', aliases: [ @@ -45,33 +46,34 @@ module.exports = class CSGOServerStatusUtility extends Command { ] }); } - async run(msg: CommandoMessage, { host, port }) { + async run(msg: CommandoMessage, { host, port }: any) { try { const options = { host, - type: 'csgo' + type: 'csgo', } if (port) { + //@ts-ignore this get auto appended options.port = port } - gamedig + return gamedig .query(options) - .then(data => { + .then((data: any) => { let emb = gameDigHelper(data) emb.setColor(0xFFCC4D) emb.setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/730/header.jpg') return msg.replyEmbed(emb) }) - .catch(err => { + .catch((err: string) => { if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) console.error(err) return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) }) } finally { - msg.channel.stopTyping() + return msg.channel.stopTyping() } } };
\ No newline at end of file |