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/minecraft/getbody.ts | 8 ++++---- src/commands/minecraft/getface.ts | 8 ++++---- src/commands/minecraft/gethead.ts | 8 ++++---- src/commands/minecraft/getminime.ts | 10 +++++----- src/commands/minecraft/getskin.ts | 8 ++++---- src/commands/minecraft/minecraftserverstatus.ts | 8 +++++--- 6 files changed, 26 insertions(+), 24 deletions(-) (limited to 'src/commands/minecraft') diff --git a/src/commands/minecraft/getbody.ts b/src/commands/minecraft/getbody.ts index d33192b..072a9d2 100644 --- a/src/commands/minecraft/getbody.ts +++ b/src/commands/minecraft/getbody.ts @@ -1,8 +1,8 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; module.exports = class GetBodyMinecraft extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'getbody', aliases: [ @@ -33,13 +33,13 @@ module.exports = class GetBodyMinecraft extends Command { ] }); } - async run(msg: CommandoMessage, { uUsername }) { + async run(msg: CommandoMessage, { uUsername }: any) { let emb = new MessageEmbed() .setColor(0xFFCC4D) .setAuthor(uUsername, `https://minotar.net/body/${encodeURIComponent(uUsername)}`) .setImage(`https://minotar.net/body/${encodeURIComponent(uUsername)}`) console.debug(`URL for ${uUsername}:`, emb.image?.url) - msg.reply(emb) + return msg.reply(emb) } }; \ No newline at end of file diff --git a/src/commands/minecraft/getface.ts b/src/commands/minecraft/getface.ts index b53e6fb..7565d68 100644 --- a/src/commands/minecraft/getface.ts +++ b/src/commands/minecraft/getface.ts @@ -1,8 +1,8 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; module.exports = class GetFaceMinecraft extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'getface', aliases: [ @@ -33,11 +33,11 @@ module.exports = class GetFaceMinecraft extends Command { ] }); } - async run(msg: CommandoMessage, { uUsername }) { + async run(msg: CommandoMessage, { uUsername }: any) { let emb = new MessageEmbed() .setColor(0xFFCC4D) .setAuthor(uUsername, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) .setImage(`https://minotar.net/helm/${encodeURIComponent(uUsername)}`) - msg.reply(emb) + return msg.reply(emb) } }; \ No newline at end of file diff --git a/src/commands/minecraft/gethead.ts b/src/commands/minecraft/gethead.ts index 665d01e..4ae61e2 100644 --- a/src/commands/minecraft/gethead.ts +++ b/src/commands/minecraft/gethead.ts @@ -1,8 +1,8 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; module.exports = class GetHeadMinecraft extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'gethead', aliases: [ @@ -33,11 +33,11 @@ module.exports = class GetHeadMinecraft extends Command { ] }); } - async run(msg: CommandoMessage, { uUsername }) { + async run(msg: CommandoMessage, { uUsername }: any) { let emb = new MessageEmbed() .setColor(0xFFCC4D) .setAuthor(uUsername, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) .setImage(`https://minotar.net/cube/${encodeURIComponent(uUsername)}/100.png`) - msg.reply(emb) + return msg.reply(emb) } }; \ No newline at end of file diff --git a/src/commands/minecraft/getminime.ts b/src/commands/minecraft/getminime.ts index 13352f0..c06c7aa 100644 --- a/src/commands/minecraft/getminime.ts +++ b/src/commands/minecraft/getminime.ts @@ -1,8 +1,8 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; module.exports = class GetMiniMeMinecraft extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'getminime', aliases: [ @@ -39,7 +39,7 @@ module.exports = class GetMiniMeMinecraft extends Command { ] }); } - async run(msg: CommandoMessage, { uUsername, uTrans }) { + async run(msg: CommandoMessage, { uUsername, uTrans }: any) { console.debug('Transparency value:', uTrans) let emb = new MessageEmbed() @@ -50,10 +50,10 @@ module.exports = class GetMiniMeMinecraft extends Command { if (uTrans) { emb.setImage(`http://avatar.yourminecraftservers.com/avatar/trnsp/steve/tall/128/${encodeURIComponent(uUsername)}.png`) } else { - emb.setImage(`http://avatar.yourminecraftservers.com/avatar/rad/steve/tall/128/${encodeURIComponent(username)}.png`) + emb.setImage(`http://avatar.yourminecraftservers.com/avatar/rad/steve/tall/128/${encodeURIComponent(uUsername)}.png`) } console.debug(`Image URL for ${uUsername}: ${emb.image?.url}`) - msg.reply(emb) + return msg.reply(emb) } }; \ No newline at end of file diff --git a/src/commands/minecraft/getskin.ts b/src/commands/minecraft/getskin.ts index ff2deb2..137e9b0 100644 --- a/src/commands/minecraft/getskin.ts +++ b/src/commands/minecraft/getskin.ts @@ -1,8 +1,8 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; module.exports = class GetSkinMinecraft extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'getskin', aliases: [ @@ -33,11 +33,11 @@ module.exports = class GetSkinMinecraft extends Command { ] }); } - async run(msg: CommandoMessage, { uUsername }) { + async run(msg: CommandoMessage, { uUsername }: any) { let emb = new MessageEmbed() .setColor(0xFFCC4D) .setAuthor(uUsername, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) .setImage(`https://minotar.net/skin/${encodeURIComponent(uUsername)}`) - msg.reply(emb) + return msg.reply(emb) } }; \ No newline at end of file diff --git a/src/commands/minecraft/minecraftserverstatus.ts b/src/commands/minecraft/minecraftserverstatus.ts index 156a04f..706b43f 100644 --- a/src/commands/minecraft/minecraftserverstatus.ts +++ b/src/commands/minecraft/minecraftserverstatus.ts @@ -1,10 +1,11 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; import axios from 'axios' +//@ts-ignore no types import emoji from 'emoji-random' module.exports = class MinecraftServerMinecraft extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'minecraftserverstatus', aliases: [ @@ -42,12 +43,13 @@ module.exports = class MinecraftServerMinecraft extends Command { ] }); } - async run(msg: CommandoMessage, { ip, port }) { + async run(msg: CommandoMessage, { ip, port }: any) { const res = ( await axios(`https://mcapi.us/server/status?ip=${ip}&port=${port}`).catch(err => { console.error(err) return msg.reply('Woops, an error has occured. ' + emoji.random()) }) + //@ts-ignore yes this exists... ).data if (res.status !== 'success') { -- cgit v1.2.3