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/btc.ts | 11 ++++++----- src/commands/crypto/btcchange.ts | 21 +++++++++++---------- src/commands/crypto/securitykey.ts | 7 ++++--- 3 files changed, 21 insertions(+), 18 deletions(-) (limited to 'src/commands/crypto') diff --git a/src/commands/crypto/btc.ts b/src/commands/crypto/btc.ts index 596b9e4..88cbf5a 100644 --- a/src/commands/crypto/btc.ts +++ b/src/commands/crypto/btc.ts @@ -1,10 +1,11 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; import btc from 'btc-value'; btc.setApiKey('a43419ce-fc59-4951-8af9-20c5e36ef73f'); module.exports = class BTCCrypto extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'btc', aliases: ['bitcoin', 'crypto'], @@ -32,10 +33,10 @@ module.exports = class BTCCrypto extends Command { clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] }); } - run(msg: CommandoMessage, { currencyName }) { + run(msg: CommandoMessage, { currencyName }: any) { currencyName = currencyName.toUpperCase(); - btc({ isDecimal: true, currencyCode: currencyName }).then(value => { - msg.reply(`The current price of *Bitcoin* is **${value} ${currencyName}**. ${emoji.random()}`); + return btc({ isDecimal: true, currencyCode: currencyName }).then(value => { + return msg.reply(`The current price of *Bitcoin* is **${value} ${currencyName}**. ${emoji.random()}`); }); } }; \ No newline at end of file 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 diff --git a/src/commands/crypto/securitykey.ts b/src/commands/crypto/securitykey.ts index 649320a..a1852e7 100644 --- a/src/commands/crypto/securitykey.ts +++ b/src/commands/crypto/securitykey.ts @@ -1,9 +1,10 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore no types import emoji from 'emoji-random' import crypto from 'crypto' module.exports = class RateCrypto extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'securitykey', aliases: ['security-key'], @@ -21,6 +22,6 @@ module.exports = class RateCrypto extends Command { } run(msg: CommandoMessage) { msg.reply(`Check your DMs! ${emoji.random()}`) - msg.author.send(crypto.randomBytes(15).toString('hex') + ' ' + emoji.random()) + return msg.author.send(crypto.randomBytes(15).toString('hex') + ' ' + emoji.random()) } }; \ No newline at end of file -- cgit v1.2.3