handle splitpot

This commit is contained in:
Flummi 2023-07-12 08:23:45 +02:00
parent a9710113d4
commit 82230c7dbf
Signed by: Flummi
GPG Key ID: AA2AEF822A6F4817

View File

@ -174,11 +174,13 @@ bot.on("message", async e => {
// end of game // end of game
if(e.message.includes('wins the pot') || e.message.includes('Split pot')) { if(e.message.includes('wins the pot') || e.message.includes('Split pot')) {
if(e.message.includes(e.self.me.nickname)) { if(e.message.includes(e.self.me.nickname)) {
const amount = +e.message.match(/size (\d+) /)[1]; if(e.message.includes('Split pot')) {
if(e.message.includes('Split pot')) const tmp = e.message.match(/size (\d+) .*: (.*) \(/);
env.bank += ~~(amount / 2); env.bank += ~~(tmp[1] / tmp[2].split(', ').length);
else }
env.bank += amount; else {
env.bank += +e.message.match(/pot(: | of size )(\d+)/)[2];
}
} }
env.gamestate = 'preflop'; env.gamestate = 'preflop';