summaryrefslogtreecommitdiff
path: root/src/commands/utility/starboundserverstatus.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-06-27 22:52:54 -0700
committer8cy <[email protected]>2020-06-27 22:52:54 -0700
commit80951013e391aab140800e4f386867e6c391553f (patch)
tree3d7101237ef1cd8d6fe2a2fab751a2dc55ae7d84 /src/commands/utility/starboundserverstatus.ts
parentmore config shit (diff)
downloaddep-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/starboundserverstatus.ts')
-rw-r--r--src/commands/utility/starboundserverstatus.ts22
1 files changed, 13 insertions, 9 deletions
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