Skip to content

Commit

Permalink
Add check for Infinity in blackjack
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMonDon committed Aug 4, 2024
1 parent f2eed23 commit ee8ed7d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions commands/Economy/blackjack.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,19 @@ class BlackJack extends Command {
bet = parseInt(cash);
} else {
bet = parseInt(Arguments.replace(/[^0-9]/g, ''));
if (bet === Infinity) {
return this.client.util.errorEmbed(msg, "You can't bet infinity.", 'Invalid bet');
}
if (isNaN(bet)) return this.client.util.errorEmbed(msg, 'Bet amount must be a number', 'Invalid Bet');
if (bet < 1) return this.client.util.errorEmbed(msg, `You can't bet less than ${currencySymbol}1`, 'Invalid Bet');
if (BigInt(bet) > cash)
return this.client.util.errorEmbed(msg, "You can't bet more cash than you have", 'Invalid Bet');
}

if (bet === Infinity) {
return this.client.util.errorEmbed(msg, "You can't bet infinity.", 'Invalid bet');
}

const bj = new Blackjack(bet, 1);
// this function is called every time something happens

Expand Down

0 comments on commit ee8ed7d

Please sign in to comment.