Sfoglia il codice sorgente

Pattern age time math fix

master
Rocketsoup 8 mesi fa
parent
commit
888d49e0cf
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2
    2
      rocketbot/pattern.py

+ 2
- 2
rocketbot/pattern.py Vedi File

@@ -4,7 +4,7 @@ to take on them.
4 4
 """
5 5
 import re
6 6
 from abc import ABCMeta, abstractmethod
7
-from datetime import datetime
7
+from datetime, timezone import datetime
8 8
 from typing import Any
9 9
 
10 10
 from discord import Message, utils as discordutils
@@ -75,7 +75,7 @@ class PatternSimpleExpression(PatternExpression):
75 75
 		if self.field == 'author.name':
76 76
 			return message.author.name
77 77
 		if self.field == 'lastmatched':
78
-			long_ago = datetime(year=1900, month=1, day=1, hour=0, minute=0, second=0)
78
+			long_ago = datetime(year=1900, month=1, day=1, hour=0, minute=0, second=0, tzinfo=timezone.utc)
79 79
 			last_matched = other_fields.get('last_matched') or long_ago
80 80
 			return message.created_at - last_matched
81 81
 		raise ValueError(f'Bad field name {self.field}')

Loading…
Annulla
Salva