aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-06-01 17:52:17 +0100
committerGravatar Chris Lovering <[email protected]>2024-06-01 17:52:17 +0100
commit65f3a596fd35f7319fc53aaf9f54e7bf63c3d179 (patch)
treed722cfa28e28a33bb5891e42aade76a1d481b5c3
parentAllow users to prepare prior to sending positive feedback (diff)
Use tz aware datetime objects when tracking system information
-rw-r--r--arthur/exts/systems/system_information.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/arthur/exts/systems/system_information.py b/arthur/exts/systems/system_information.py
index a5c460d..67caeaf 100644
--- a/arthur/exts/systems/system_information.py
+++ b/arthur/exts/systems/system_information.py
@@ -2,7 +2,7 @@
import asyncio
import random
-from datetime import datetime
+from datetime import UTC, datetime
import aiohttp
from discord import Member, Message
@@ -68,7 +68,7 @@ class SystemInformation(Cog):
return
if self.last_sent:
- if (datetime.utcnow() - self.last_sent).seconds // 60 < MIN_MINUTES:
+ if (datetime.now(tz=UTC) - self.last_sent).seconds // 60 < MIN_MINUTES:
logger.trace("Ignoring message as within cooldown")
return
@@ -88,7 +88,7 @@ class SystemInformation(Cog):
comment = lib9front.generate_blog_comment(blogcom).strip()
- self.last_sent = datetime.utcnow()
+ self.last_sent = datetime.now(tz=UTC)
async with msg.channel.typing():
await asyncio.sleep(3)
await msg.reply(f"{comment} {random.choice(CORPORATE_FRIENDLY_SMILEYS)}")