From fc76d7c73ae9ffec6be86fc7d9d9e8c9a14605ab Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 22 May 2020 20:36:26 -0400 Subject: Added more ALP exclusive logs & cleaning up code --- commands/balance.js | 59 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'commands/balance.js') diff --git a/commands/balance.js b/commands/balance.js index ae575cc..7b340b2 100644 --- a/commands/balance.js +++ b/commands/balance.js @@ -1,5 +1,5 @@ -/**************************************** - * +/** ************************************** + * * Balance: Command for AleeBot * Copyright (C) 2017-2020 Alee Productions * @@ -15,37 +15,36 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * *************************************/ module.exports.run = async (client, message) => { - const db = require('quick.db'); - const { RichEmbed } = require('discord.js'); + const db = require('quick.db'); + const {RichEmbed} = require('discord.js'); + + const user = message.mentions.users.first() || message.author; - let user = message.mentions.users.first() || message.author; + let balance = await db.fetch(`userBalance_${user.id}`); - let balance = await db.fetch(`userBalance_${user.id}`); + if (balance === null) { + db.set(`userBalance_${message.author.id}`, 0); + balance = 0; + } + const embed = new RichEmbed() + .setDescription(`**AleeCorp Bank**`) + .addField('Account Holder: ', user.username, true) + .addField('Account Balance: ', balance, true) + .setColor('#1fd619'); - if (balance === null) { - db.set(`userBalance_${message.author.id}`, 0); - balance = 0; - } - const embed = new RichEmbed() - .setDescription(`**AleeCorp Bank**`) - .addField('Account Holder: ', user.username, true) - .addField('Account Balance: ', balance, true) - .setColor('#1fd619') + message.channel.send({embed}); +}; - message.channel.send({embed}) - }; - - exports.conf = { - aliases: ['bal', 'money'], - guildOnly: false, - }; - exports.help = { - name: 'balance', - description: 'Checks the balance of AleeBot', - usage: 'balance [@someone (optional)]', - category: '- Economy Commands', - }; - \ No newline at end of file +exports.conf = { + aliases: ['bal', 'money'], + guildOnly: false, +}; +exports.help = { + name: 'balance', + description: 'Checks the balance of AleeBot', + usage: 'balance [@someone (optional)]', + category: '- Economy Commands', +}; -- cgit v1.2.3