Skip to content

Commit

Permalink
Re-fix negative amounts of money on leaderboard
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMonDon committed Jul 22, 2024
1 parent 873a9d0 commit f066cfc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion commands/Economy/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class Leaderboard extends Command {
const sortedLeaderboard = leaderboard
.sort((a, b) => (b.money > a.money ? 1 : -1))
.map((c, index) => {
let moneyStr = `${c.money.toLocaleString()}`;
const bigMoney = BigInt(c.money);
const money = bigMoney < 0n ? -bigMoney : bigMoney;
let moneyStr = `${money.toLocaleString()}`;
if (moneyStr.length > 150) {
moneyStr = moneyStr.slice(0, 147) + '...';
}
Expand Down
4 changes: 3 additions & 1 deletion slash_commands/Economy/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ exports.run = async (interaction) => {
const sortedLeaderboard = leaderboard
.sort((a, b) => (b.money > a.money ? 1 : -1))
.map((c, index) => {
let moneyStr = `${Math.abs(Number(c.money)).toLocaleString()}`;
const bigMoney = BigInt(c.money);
const money = bigMoney < 0n ? -bigMoney : bigMoney;
let moneyStr = `${money.toLocaleString()}`;
if (moneyStr.length > 150) {
moneyStr = moneyStr.slice(0, 147) + '...';
}
Expand Down

0 comments on commit f066cfc

Please sign in to comment.