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:
DevilXD
2020-08-12 10:46:32 +02:00
committed by GitHub
parent 73a34eacd6
commit 6e63ed4e60
10 changed files with 63 additions and 59 deletions

View File

@@ -1,4 +1,5 @@
import asyncio
from datetime import timezone
from typing import cast, Optional
import discord
@@ -107,7 +108,7 @@ class MuteMixin(MixinMeta):
await modlog.create_case(
self.bot,
guild,
ctx.message.created_at,
ctx.message.created_at.replace(tzinfo=timezone.utc),
"voiceunban",
user,
author,
@@ -148,7 +149,7 @@ class MuteMixin(MixinMeta):
await modlog.create_case(
self.bot,
guild,
ctx.message.created_at,
ctx.message.created_at.replace(tzinfo=timezone.utc),
"voiceban",
user,
author,
@@ -188,7 +189,7 @@ class MuteMixin(MixinMeta):
await modlog.create_case(
self.bot,
guild,
ctx.message.created_at,
ctx.message.created_at.replace(tzinfo=timezone.utc),
"vmute",
user,
author,
@@ -232,7 +233,7 @@ class MuteMixin(MixinMeta):
await modlog.create_case(
self.bot,
guild,
ctx.message.created_at,
ctx.message.created_at.replace(tzinfo=timezone.utc),
"cmute",
user,
author,
@@ -262,7 +263,7 @@ class MuteMixin(MixinMeta):
await modlog.create_case(
self.bot,
guild,
ctx.message.created_at,
ctx.message.created_at.replace(tzinfo=timezone.utc),
"smute",
user,
author,
@@ -305,7 +306,7 @@ class MuteMixin(MixinMeta):
await modlog.create_case(
self.bot,
guild,
ctx.message.created_at,
ctx.message.created_at.replace(tzinfo=timezone.utc),
"vunmute",
user,
author,
@@ -349,7 +350,7 @@ class MuteMixin(MixinMeta):
await modlog.create_case(
self.bot,
guild,
ctx.message.created_at,
ctx.message.created_at.replace(tzinfo=timezone.utc),
"cunmute",
user,
author,
@@ -383,7 +384,7 @@ class MuteMixin(MixinMeta):
await modlog.create_case(
self.bot,
guild,
ctx.message.created_at,
ctx.message.created_at.replace(tzinfo=timezone.utc),
"sunmute",
user,
author,