clarified not serialized attributes

This commit is contained in:
Klemek
2021-04-09 18:29:27 +02:00
parent 5c570ee09b
commit 09161850c5
3 changed files with 10 additions and 4 deletions
+5 -1
View File
@@ -8,6 +8,9 @@ IMAGE_FORMAT = [".gif", ".gifv", ".png", ".jpg", ".jpeg", ".bmp"]
EMBED_IMAGES = ["image", "gifv"]
NOT_SERIALIZED = ["channel"]
class MessageLog:
def __init__(self, message: Union[discord.Message, dict], channel: Any):
self.channel = channel
@@ -79,7 +82,8 @@ class MessageLog:
def dict(self) -> dict:
message = dict(self.__dict__)
message.pop("channel", None)
for key in NOT_SERIALIZED:
message.pop(key, None)
message["created_at"] = self.created_at.isoformat()
message["edited_at"] = (
self.edited_at.isoformat() if self.edited_at is not None else None