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/rustserverstatus.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/rustserverstatus.ts')
| -rw-r--r-- | src/commands/utility/rustserverstatus.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/commands/utility/rustserverstatus.ts b/src/commands/utility/rustserverstatus.ts index f7f58bc..dd91487 100644 --- a/src/commands/utility/rustserverstatus.ts +++ b/src/commands/utility/rustserverstatus.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 RustServerStatusUtility extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'rustserverstatus', aliases: [ @@ -43,7 +44,7 @@ module.exports = class RustServerStatusUtility extends Command { ] }); } - async run(msg: CommandoMessage, { host, port }) { + run(msg: CommandoMessage, { host, port }: any) { try { const options = { host, @@ -51,26 +52,27 @@ module.exports = class RustServerStatusUtility extends Command { } if (port) { + //@ts-ignore gets added options.port = port } - gamedig + return gamedig .query(options) - .then(data => { + .then((data: any) => { msg.replyEmbed( gameDigHelper(data) .setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/252490/header.jpg') .setColor(0xFFCC4D) ) }) - .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 |