Exception logging for VIP levels as they're not working

This commit is contained in:
barelyprofessional
2026-01-05 19:21:22 -06:00
parent 78d5ba9f40
commit 78207b291b

View File

@@ -156,20 +156,27 @@ internal class BotCommands
return; return;
} }
if (!(await SettingsProvider.GetValueAsync(BuiltIn.Keys.MoneyEnabled)).ToBoolean()) return; try
var wagerCommand = HasAttribute<WagerCommand>(command); {
if (!wagerCommand) return; if (!(await SettingsProvider.GetValueAsync(BuiltIn.Keys.MoneyEnabled)).ToBoolean()) return;
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: _cancellationToken); var wagerCommand = HasAttribute<WagerCommand>(command);
if (gambler == null) return; if (!wagerCommand) return;
if (gambler.TotalWagered < gambler.NextVipLevelWagerRequirement) return; var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: _cancellationToken);
// The reason for doing this instead of passing in TotalWagered is that otherwise VIP levels might if (gambler == null) return;
// get skipped if the user is a low VIP level but wagering very large amounts if (gambler.TotalWagered < gambler.NextVipLevelWagerRequirement) return;
var newLevel = Money.GetNextVipLevel(gambler.NextVipLevelWagerRequirement); // The reason for doing this instead of passing in TotalWagered is that otherwise VIP levels might
if (newLevel == null) return; // get skipped if the user is a low VIP level but wagering very large amounts
var payout = await Money.UpgradeVipLevelAsync(gambler.Id, newLevel, _cancellationToken); var newLevel = Money.GetNextVipLevel(gambler.NextVipLevelWagerRequirement);
await _bot.SendChatMessageAsync( if (newLevel == null) return;
$"🤑🤑 {user.FormatUsername()} has leveled up to to {newLevel.VipLevel.Icon} {newLevel.VipLevel.Name} Tier {newLevel.Tier} " + var payout = await Money.UpgradeVipLevelAsync(gambler.Id, newLevel, _cancellationToken);
$"and received a bonus of {await payout.FormatKasinoCurrencyAsync()}", true); 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);
}
catch (Exception e)
{
_logger.Error(e);
}
} }
private async Task SendCooldownResponse(UserDbModel user, RateLimitOptionsModel options, DateTimeOffset oldestEntryExpires, string commandName) private async Task SendCooldownResponse(UserDbModel user, RateLimitOptionsModel options, DateTimeOffset oldestEntryExpires, string commandName)