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/starboundserverstatus.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/commands/utility/starboundserverstatus.ts') diff --git a/src/commands/utility/starboundserverstatus.ts b/src/commands/utility/starboundserverstatus.ts index eaddfc8..0d8e319 100644 --- a/src/commands/utility/starboundserverstatus.ts +++ b/src/commands/utility/starboundserverstatus.ts @@ -1,11 +1,13 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed, Message } from 'discord.js'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +//@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 StarboundServerStatusUtility extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'starboundserverstatus', aliases: [ @@ -43,7 +45,7 @@ module.exports = class StarboundServerStatusUtility extends Command { ] }); } - async run(msg: CommandoMessage, { host, port }) { + run(msg: CommandoMessage, { host, port }: any) { try { const options = { host, @@ -51,12 +53,14 @@ module.exports = class StarboundServerStatusUtility extends Command { } if (port) { + //@ts-ignore added auto options.port = port } - gamedig + return gamedig .query(options) - .then(data => { + // this is auto'd so might not be good + .then((data: { raw: { numplayers: any; }; maxplayers: any; name: any; query: { duration: any; address: any; port: any; }; password: any; }) => { const curr = data.raw.numplayers const max = data.maxplayers @@ -82,14 +86,14 @@ module.exports = class StarboundServerStatusUtility extends Command { .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