Use gambler ID in Redis key to avoid the possibility of concurrent games messing with the state

This commit is contained in:
barelyprofessional
2026-02-07 11:27:03 -06:00
parent 54d989f64f
commit 8246b75868
2 changed files with 16 additions and 17 deletions

View File

@@ -59,12 +59,11 @@ public class MinesCommand : ICommand
true, autoDeleteAfter: gameDisabledCleanupDelay);
return;
}
KasinoMines = new KasinoMines(botInstance);
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
if (gambler == null)
throw new InvalidOperationException($"Caught a null when retrieving gambler for {user.KfUsername}");
KasinoMines = new KasinoMines(botInstance, gambler.Id);
bool cashout = false;
if (message.Message.Contains("cashout")) cashout = true;
//check if user has an existing game already