瀏覽代碼

Pattern age time math fix

master
Rocketsoup 8 月之前
父節點
當前提交
888d49e0cf
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      rocketbot/pattern.py

+ 2
- 2
rocketbot/pattern.py 查看文件

@@ -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…
取消
儲存