Skip to content

Commit

Permalink
Change DateTimeOffset.Now to Message.CreatedAt
Browse files Browse the repository at this point in the history
  • Loading branch information
MercurialPony committed Dec 3, 2023
1 parent 40de960 commit b187b9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Izzy-Moonbot/Service/MonitoringService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ private async Task ProcessLimitTrip(IIzzyContext context)

TimeSpan monitoringPeriod = TimeSpan.FromSeconds(_config.MonitoringMessageInterval);

if(DateTimeOffset.Now - user.LastMessageTimeInMonitoredChannel > monitoringPeriod)
if(context.Message.CreatedAt - user.LastMessageTimeInMonitoredChannel > monitoringPeriod)
{
// user has waited long enough, allow
user.LastMessageTimeInMonitoredChannel = DateTimeOffset.Now;
user.LastMessageTimeInMonitoredChannel = context.Message.CreatedAt;
await FileHelper.SaveUsersAsync(_users);
}
else
Expand Down

0 comments on commit b187b9a

Please sign in to comment.