mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
Use aware objects when storing and reading UTC timestamps (#4017)
* Use aware objects instead of naive ones * Use aware objects when storing and reading UTC timestamps * Remove unneeded parentheses * Fixed naive and aware objects unable to be compared here * Address feedback * Fix the newly added `modlog.create_case()` calls Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from datetime import timezone
|
||||
from typing import Optional, Union
|
||||
|
||||
import discord
|
||||
@@ -181,7 +182,7 @@ class ModLog(commands.Cog):
|
||||
to_modify = {"reason": reason}
|
||||
if case_obj.moderator != author:
|
||||
to_modify["amended_by"] = author
|
||||
to_modify["modified_at"] = ctx.message.created_at.timestamp()
|
||||
to_modify["modified_at"] = ctx.message.created_at.replace(tzinfo=timezone.utc).timestamp()
|
||||
await case_obj.edit(to_modify)
|
||||
await ctx.send(
|
||||
_("Reason for case #{num} has been updated.").format(num=case_obj.case_number)
|
||||
|
||||
Reference in New Issue
Block a user