Skip to content

Commit

Permalink
Fix date time difference check
Browse files Browse the repository at this point in the history
  • Loading branch information
l7ssha committed Nov 29, 2024
1 parent ad8c490 commit 998e102
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/src/modules/join_logs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
}

Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/modules/mentions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 998e102

Please sign in to comment.