From 65f3a596fd35f7319fc53aaf9f54e7bf63c3d179 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Sat, 1 Jun 2024 17:52:17 +0100 Subject: Use tz aware datetime objects when tracking system information --- arthur/exts/systems/system_information.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'arthur/exts/systems/system_information.py') 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)}") -- cgit v1.2.3