mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Prevent people from being able to redeem a daily dollar with a brand new gambler entity
This commit is contained in:
@@ -411,6 +411,13 @@ public class GetDailyDollarCommand : ICommand
|
||||
return;
|
||||
}
|
||||
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();
|
||||
var mostRecentTxn = await db.Transactions.OrderBy(x => x.Id).LastOrDefaultAsync(x =>
|
||||
x.Gambler == gambler && x.EventSource == TransactionSourceEventType.DailyDollar, cancellationToken: ctx);
|
||||
|
||||
Reference in New Issue
Block a user