Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DiscordBot/Services/Casino/CasinoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public bool IsChannelAllowed(ulong channelId)
{
var user = await GetOrCreateCasinoUser(userId);
var now = DateTime.UtcNow;
var nextRewardTime = user.LastDailyReward.AddSeconds(_settings.CasinoDailyRewardIntervalSeconds);
var nextRewardTime = user.LastDailyReward.Date.AddDays(_settings.CasinoDailyRewardIntervalDays);

if (now < nextRewardTime)
{
Expand All @@ -335,7 +335,7 @@ public bool IsChannelAllowed(ulong channelId)
await RecordTransaction(userId, (long)tokensAwarded, TransactionType.DailyReward);

await _loggingService.LogChannelAndFile($"{ServiceName}: User {userId} claimed daily reward of {tokensAwarded} tokens");
return (true, tokensAwarded, newBalance, now.AddSeconds(_settings.CasinoDailyRewardIntervalSeconds));
return (true, tokensAwarded, newBalance, now.Date.AddDays(_settings.CasinoDailyRewardIntervalDays));
}
catch (Exception ex)
{
Expand All @@ -348,7 +348,7 @@ public bool IsChannelAllowed(ulong channelId)
public async Task<DateTime> GetNextDailyRewardTime(string userId)
{
var user = await GetOrCreateCasinoUser(userId);
return user.LastDailyReward.AddSeconds(_settings.CasinoDailyRewardIntervalSeconds);
return user.LastDailyReward.Date.AddDays(_settings.CasinoDailyRewardIntervalDays);
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion DiscordBot/Settings/Deserialized/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public class BotSettings

// Daily Reward Settings
public ulong CasinoDailyRewardTokens { get; set; } = 100;
public int CasinoDailyRewardIntervalSeconds { get; set; } = 86400; // 24 hours = 86400 seconds
public int CasinoDailyRewardIntervalDays { get; set; } = 1; // Number of days between rewards

#endregion // Casino Settings

Expand Down