Closed jaredlyon closed 5 years ago
Upon initialization, the module now immediately subtracts the bet amount from the player's account prior to the end the hand and 'holds' it. The bot now keeps the money on player loss or returns twice the original bet if the player wins.
New bet init:
//initial bet
if (msg.args[0] && isNaN(msg.args[0])) {
bet = 10;
if (bot.bank[msg.author.id].balance.toFixed(2) < bet) {
msg.channel.send("You frickin' foolian juulian, you don't have enough money to cover your bet!")
return;
} else {
bot.bank[msg.author.id].balance -= bet
}
}
else if (msg.args[0] && !isNaN(msg.args[0]) && Number(msg.args[0]) > 0) {
bet = Number(msg.args[0]);
if (bot.bank[msg.author.id].balance.toFixed(2) < bet) {
msg.channel.send("You frickin' foolian juulian, you don't have enough money to cover your bet!")
return;
} else {
bot.bank[msg.author.id].balance -= bet
}
}
else {
bet = 10;
if (bot.bank[msg.author.id].balance.toFixed(2) < bet) {
msg.channel.send("You frickin' foolian juulian, you don't have enough money to cover your bet!")
return;
} else {
bot.bank[msg.author.id].balance -= bet
}
}
On player win:
//give money
bot.bank[msg.author.id].balance += bet*2;
On player loss, the bot does not make any further additions or subtractions to the player's account.
Bot should subtract the bet immediately in order to 'withhold' the money such that other currency commands do not interfere with the win-loss transactions.