From 73a2a7955dbe5bfdca25ed70992f0dd865f54a80 Mon Sep 17 00:00:00 2001 From: Snazzah Date: Tue, 11 Aug 2020 22:24:01 -0500 Subject: [PATCH] Add admin balance command --- src/commands/admin/adminbalance.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/commands/admin/adminbalance.js diff --git a/src/commands/admin/adminbalance.js b/src/commands/admin/adminbalance.js new file mode 100644 index 0000000..4ef0455 --- /dev/null +++ b/src/commands/admin/adminbalance.js @@ -0,0 +1,29 @@ +const Command = require('../../structures/Command'); + +module.exports = class AdminBalance extends Command { + get name() { return 'adminbalance'; } + + get _options() { return { + aliases: ['abal', 'adminbal'], + permissions: ['admin'] + }; } + + async exec(message) { + const response = await this.client.lbry.walletBalance(); + if (response.status !== 200) { + console.error('SDK error in adminbalance', response, await response.text()); + return message.channel.createMessage(`LBRY-SDK returned ${response.status}, check console.`); + } + const wallet = await response.json(); + return message.channel.createMessage({ embed: { + description: `**Available:** ${wallet.result.available} LBC\n\n` + + `Reserved in Supports: ${wallet.result.reserved_subtotals.supports} LBC\n` + + `Total: ${wallet.result.total} LBC` + } }); + } + + get metadata() { return { + category: 'Admin', + description: 'Shows the master wallet balance.' + }; } +};