From ffcca382189c03f705fe3f5df02a55a54311c322 Mon Sep 17 00:00:00 2001 From: Snazzah Date: Wed, 12 Aug 2020 21:37:26 -0500 Subject: [PATCH] Add balance command --- src/commands/curator/balance.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/commands/curator/balance.js diff --git a/src/commands/curator/balance.js b/src/commands/curator/balance.js new file mode 100644 index 0000000..391ebe8 --- /dev/null +++ b/src/commands/curator/balance.js @@ -0,0 +1,28 @@ +const Command = require('../../structures/Command'); +const Util = require('../../util'); + +module.exports = class Balance extends Command { + get name() { return 'balance'; } + + get _options() { return { + aliases: ['bal'], + permissions: ['curatorOrAdmin'] + }; } + + async exec(message) { + const account = await Util.LBRY.findOrCreateAccount(this.client, message.author.id); + const response = await this.client.lbry.accountBalance(account.accountID); + const wallet = await response.json(); + if (await this.handleResponse(message, response, wallet)) return; + return message.channel.createMessage({ embed: { + description: `You have **${wallet.result.available}** LBC available.\n\n` + + `Reserved in Supports: ${wallet.result.reserved_subtotals.supports} LBC\n` + + `Total: ${wallet.result.total} LBC` + } }); + } + + get metadata() { return { + category: 'Curator', + description: 'Shows the user\'s account balance.' + }; } +};