From 998e1024946ecd2c5ced0027540af8a2df0a644f Mon Sep 17 00:00:00 2001 From: Szymon Uglis Date: Fri, 29 Nov 2024 12:08:10 +0100 Subject: [PATCH] Fix date time difference check --- lib/src/modules/join_logs.dart | 4 ++-- lib/src/modules/mentions.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/modules/join_logs.dart b/lib/src/modules/join_logs.dart index 4eb1815..c16923b 100644 --- a/lib/src/modules/join_logs.dart +++ b/lib/src/modules/join_logs.dart @@ -32,7 +32,7 @@ class JoinLogsModule implements RequiresInitialization { _logger.fine('Sending join message for member ${event.member.id} in channel ${channel.id}'); final descriptionBuffer = StringBuffer('**Member joined**'); - if (event.member.id.timestamp.difference(DateTime.now()).inDays < 30) { + if (DateTime.now().difference(event.member.id.timestamp).inDays < 30) { descriptionBuffer.write(" (New user)"); } @@ -55,7 +55,7 @@ class JoinLogsModule implements RequiresInitialization { return; } - if (event.removedMember != null && event.removedMember!.joinedAt.difference(DateTime.now()).inDays > 7) { + if (event.removedMember != null && DateTime.now().difference(event.removedMember!.joinedAt).inDays > 7) { return; } diff --git a/lib/src/modules/mentions.dart b/lib/src/modules/mentions.dart index fe9aed9..4ebc9a2 100644 --- a/lib/src/modules/mentions.dart +++ b/lib/src/modules/mentions.dart @@ -47,7 +47,7 @@ class MentionsMonitoringModule implements RequiresInitialization { _kickMemberForKey(key, value.count); } - if (value.lastUpdated.difference(DateTime.now()).inSeconds > 3) { + if (DateTime.now().difference(value.lastUpdated).inSeconds > 3) { toRemove.add(key); } }