Still no idea why VIP levels aren't working, adding shitloads of logging

This commit is contained in:
barelyprofessional
2026-01-05 19:43:19 -06:00
parent 004a3d42b2
commit f0fe22ab12

View File

@@ -159,19 +159,26 @@ internal class BotCommands
try
{
if (!(await SettingsProvider.GetValueAsync(BuiltIn.Keys.MoneyEnabled)).ToBoolean()) return;
_logger.Info("Money is enabled. Calculating VIP maybe?");
var wagerCommand = HasAttribute<WagerCommand>(command);
if (!wagerCommand) return;
_logger.Info("It's a wager command");
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: _cancellationToken);
if (gambler == null) return;
_logger.Info($"Gambler ID is {gambler.Id}");
if (gambler.TotalWagered < gambler.NextVipLevelWagerRequirement) return;
_logger.Info("They've met the wager requirement");
// The reason for doing this instead of passing in TotalWagered is that otherwise VIP levels might
// get skipped if the user is a low VIP level but wagering very large amounts
var newLevel = Money.GetNextVipLevel(gambler.NextVipLevelWagerRequirement);
if (newLevel == null) return;
_logger.Info($"New level is {newLevel.VipLevel.Name} {newLevel.Tier}");
var payout = await Money.UpgradeVipLevelAsync(gambler.Id, newLevel, _cancellationToken);
_logger.Info($"Payout is {payout:N2}");
await _bot.SendChatMessageAsync(
$"🤑🤑 {user.FormatUsername()} has leveled up to to {newLevel.VipLevel.Icon} {newLevel.VipLevel.Name} Tier {newLevel.Tier} " +
$"and received a bonus of {await payout.FormatKasinoCurrencyAsync()}", true);
_logger.Info("Sent notification");
}
catch (Exception e)
{