summaryrefslogtreecommitdiff
path: root/src/commands/utility/btcchange.js
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-13 05:32:35 -0700
committer8cy <[email protected]>2020-04-13 05:32:35 -0700
commit9dff52f7d047c905326bc2f476ede5463e00f2a0 (patch)
tree1fec8563b3b72fde9b2ab7ad9e56a97398798685 /src/commands/utility/btcchange.js
parenttypescript (diff)
downloads5nical-9dff52f7d047c905326bc2f476ede5463e00f2a0.tar.xz
s5nical-9dff52f7d047c905326bc2f476ede5463e00f2a0.zip
typescript final
Diffstat (limited to 'src/commands/utility/btcchange.js')
-rw-r--r--src/commands/utility/btcchange.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/commands/utility/btcchange.js b/src/commands/utility/btcchange.js
new file mode 100644
index 0000000..eb7a204
--- /dev/null
+++ b/src/commands/utility/btcchange.js
@@ -0,0 +1,45 @@
+const { Command } = require('discord.js-commando');
+const btc = require('btc-value');
+btc.setApiKey('a43419ce-fc59-4951-8af9-20c5e36ef73f');
+
+module.exports = class BTCChangeUtility extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'btcchange',
+ aliases: ['bitcoinchange', 'cryptochange', 'btcc'],
+ group: 'utility',
+ memberName: 'btcchange',
+ description: 'allows you to check the fluctuation in bitcoin prices in a specified amount of time',
+ args: [
+ {
+ key: 'timeAmount',
+ prompt: 'what time range do you want to check the fluction amount in? (day, hour, week)',
+ type: 'string'
+ }
+ ],
+ examples: [
+ 's5n!btcchange day',
+ 's5n!bitcoinchange hour',
+ 's5n!cryptochange week',
+ 's5n!btcc day'
+ ]
+ });
+ }
+ run(msg, { timeAmount }) {
+ if (timeAmount == 'day') {
+ btc.getPercentageChangeLastDay().then(percentage => {
+ 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());
+ });
+ } else if (timeAmount == 'week') {
+ btc.getPercentageChangeLastWeek().then(percentage => {
+ msg.reply('the fluction amount of *bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%** ' + emoji.random());
+ });
+ } else {
+ msg.reply('*' + timeAmount + '* is not a valid range lol ' + emoji.random());
+ }
+ }
+}; \ No newline at end of file