Prevent people from being able to redeem a daily dollar with a brand new gambler entity

This commit is contained in:
barelyprofessional
2026-01-05 00:47:34 -06:00
parent 1c8a2658ca
commit a288f3f4eb

View File

@@ -411,6 +411,13 @@ public class GetDailyDollarCommand : ICommand
return; return;
} }
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx); var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
if (gambler!.Created.Date == DateTime.UtcNow.Date)
{
await botInstance.SendChatMessageAsync(
$"{user.FormatUsername()}, new accounts cannot redeem a daily dollar", true,
autoDeleteAfter: TimeSpan.FromSeconds(15));
return;
}
await using var db = new ApplicationDbContext(); await using var db = new ApplicationDbContext();
var mostRecentTxn = await db.Transactions.OrderBy(x => x.Id).LastOrDefaultAsync(x => var mostRecentTxn = await db.Transactions.OrderBy(x => x.Id).LastOrDefaultAsync(x =>
x.Gambler == gambler && x.EventSource == TransactionSourceEventType.DailyDollar, cancellationToken: ctx); x.Gambler == gambler && x.EventSource == TransactionSourceEventType.DailyDollar, cancellationToken: ctx);