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/utility/rustserverstatus.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/commands/utility/rustserverstatus.ts') 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 -- cgit v1.2.3