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/crypto/btcchange.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/commands/crypto/btcchange.ts') diff --git a/src/commands/crypto/btcchange.ts b/src/commands/crypto/btcchange.ts index f0b05b0..002a2cb 100644 --- a/src/commands/crypto/btcchange.ts +++ b/src/commands/crypto/btcchange.ts @@ -1,10 +1,11 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import btc from 'btc-value'; +//@ts-ignore no types import emoji from 'emoji-random'; btc.setApiKey('a43419ce-fc59-4951-8af9-20c5e36ef73f'); module.exports = class BTCChangeCrypto extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'btcchange', aliases: ['bitcoinchange', 'cryptochange', 'btcc'], @@ -33,21 +34,21 @@ module.exports = class BTCChangeCrypto extends Command { clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] }); } - run(msg: CommandoMessage, { timeAmount }) { + run(msg: CommandoMessage, { timeAmount }: any) { if (timeAmount == 'day') { - btc.getPercentageChangeLastDay().then(percentage => { - msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random()); + return btc.getPercentageChangeLastDay().then(percentage => { + return msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random()); }); } else if (timeAmount == 'hour') { - btc.getPercentageChangeLastHour().then(percentage => { - msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random()); + return btc.getPercentageChangeLastHour().then(percentage => { + return msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random()); }); } else if (timeAmount == 'week') { - btc.getPercentageChangeLastWeek().then(percentage => { - msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random()); + return btc.getPercentageChangeLastWeek().then(percentage => { + return msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random()); }); } else { - msg.reply('*' + timeAmount + '* is not a valid range. ' + emoji.random()); + return msg.reply('*' + timeAmount + '* is not a valid range. ' + emoji.random()); } } }; \ No newline at end of file -- cgit v1.2.3