clarified not serialized attributes
This commit is contained in:
@@ -114,6 +114,7 @@ python3 src/main.py
|
||||
* remove old and unused logs at start and guild leaving
|
||||
* GDPR disclaimer before scanning
|
||||
* start and stop dates
|
||||
* bug fix and improvements
|
||||
* **v1.12**
|
||||
* more scans: `%words`
|
||||
* concurrent `fast` analysis
|
||||
|
||||
@@ -8,6 +8,8 @@ from utils import FakeMessage
|
||||
CHUNK_SIZE = 2000
|
||||
FORMAT = 3
|
||||
|
||||
NOT_SERIALIZED = ["channel", "guild", "start_date"]
|
||||
|
||||
|
||||
class ChannelLogs:
|
||||
def __init__(self, channel: Union[discord.TextChannel, dict], guild: Any):
|
||||
@@ -92,8 +94,7 @@ class ChannelLogs:
|
||||
|
||||
def dict(self) -> dict:
|
||||
channel = dict(self.__dict__)
|
||||
channel.pop("channel", None)
|
||||
channel.pop("guild", None)
|
||||
channel.pop("start_date", None)
|
||||
for key in NOT_SERIALIZED:
|
||||
channel.pop(key, None)
|
||||
channel["messages"] = [message.dict() for message in self.messages]
|
||||
return channel
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user