From b187b9a97147a4d1189c6b7cc888201b5646aa44 Mon Sep 17 00:00:00 2001 From: Mercy <19710443+MercurialPony@users.noreply.github.com> Date: Mon, 4 Dec 2023 01:32:16 +0300 Subject: [PATCH] Change DateTimeOffset.Now to Message.CreatedAt --- Izzy-Moonbot/Service/MonitoringService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Izzy-Moonbot/Service/MonitoringService.cs b/Izzy-Moonbot/Service/MonitoringService.cs index 329e3f98..af97982f 100644 --- a/Izzy-Moonbot/Service/MonitoringService.cs +++ b/Izzy-Moonbot/Service/MonitoringService.cs @@ -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