From fc241c6cc0c61b2860f1afeb3028585f62250e53 Mon Sep 17 00:00:00 2001 From: TheMonDon <11539895+TheMonDon@users.noreply.github.com> Date: Sun, 21 Jul 2024 05:43:15 -0500 Subject: [PATCH] Fix add-money --- commands/Economy/add-money.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/commands/Economy/add-money.js b/commands/Economy/add-money.js index ac24c6ac..55df2f19 100755 --- a/commands/Economy/add-money.js +++ b/commands/Economy/add-money.js @@ -31,23 +31,26 @@ class AddMoney extends Command { if (args.length === 2) { mem = await this.client.util.getMember(msg, args[0]); - amount = args[1].replace(/[^0-9\\.]/g, ''); + amount = parseInt(args[1].replace(/[^0-9\\.]/g, '')); } else { mem = await this.client.util.getMember(msg, args[1]); - amount = args[2].replace(/[^0-9\\.]/g, ''); + amount = parseInt(args[2].replace(/[^0-9\\.]/g, '')); } if (['cash', 'bank'].includes(args[0].toLowerCase())) { type = args[0].toLowerCase(); } - if (isNaN(amount)) return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Amount'); - if (amount > 1000000000000) + if (isNaN(amount)) { + return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Amount'); + } + if (amount > 1000000000000) { return this.client.util.errorEmbed(msg, `You can't add more than 1 Trillion to a member`, 'Invalid Amount'); + } if (!mem) return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Member'); if (mem.user.bot) return this.client.util.errorEmbed(msg, "You can't add money to a bot."); - amount = BigInt(parseInt(amount)); + amount = BigInt(amount); if (type === 'bank') { const bank = BigInt((await db.get(`servers.${msg.guild.id}.users.${mem.id}.economy.bank`)) || 0); const newAmount = bank + amount;