Skip to content

Commit

Permalink
Remove parseInt from commands
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMonDon committed Jul 21, 2024
1 parent fc241c6 commit 1bef072
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
15 changes: 6 additions & 9 deletions commands/Economy/balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ class Balance extends Command {
if (!mem) return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Member');

const cash = BigInt(
parseInt(
(await db.get(`servers.${msg.guild.id}.users.${mem.id}.economy.cash`)) ||
(await db.get(`servers.${msg.guild.id}.economy.startBalance`)) ||
0,
10,
),
(await db.get(`servers.${msg.guild.id}.users.${mem.id}.economy.cash`)) ||
(await db.get(`servers.${msg.guild.id}.economy.startBalance`)) ||
0,
);
const bank = BigInt(parseInt((await db.get(`servers.${msg.guild.id}.users.${mem.id}.economy.bank`)) || 0, 10));
const bank = BigInt((await db.get(`servers.${msg.guild.id}.users.${mem.id}.economy.bank`)) || 0);
const netWorth = cash + bank;

const currencySymbol = (await db.get(`servers.${msg.guild.id}.economy.symbol`)) || '$';
Expand Down Expand Up @@ -80,8 +77,8 @@ class Balance extends Command {
try {
const user = await this.client.users.cache.get(userId);
if (user) {
const userCash = BigInt(parseInt(usersData[userId]?.economy?.cash || 0, 10));
const userBank = BigInt(parseInt(usersData[userId]?.economy?.bank || 0, 10));
const userCash = BigInt(usersData[userId]?.economy?.cash || 0);
const userBank = BigInt(usersData[userId]?.economy?.bank || 0);
const userMoney = userCash + userBank;
leaderboard.push({ user: user.tag, userId: user.id, money: userMoney });
}
Expand Down
6 changes: 3 additions & 3 deletions commands/Economy/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class Leaderboard extends Command {
try {
const user = await this.client.users.cache.get(userId);
if (user) {
const cash = parseInt(usersData[userId]?.economy?.cash || 0, 10);
const bank = parseInt(usersData[userId]?.economy?.bank || 0, 10);
const money = BigInt(cash) + BigInt(bank);
const cash = BigInt(usersData[userId]?.economy?.cash || 0);
const bank = BigInt(usersData[userId]?.economy?.bank || 0);
const money = cash + bank;
leaderboard.push({ user: user.tag, userId: user.id, money });
}
} catch (err) {
Expand Down

0 comments on commit 1bef072

Please sign in to comment.