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
|
* remove old and unused logs at start and guild leaving
|
||||||
* GDPR disclaimer before scanning
|
* GDPR disclaimer before scanning
|
||||||
* start and stop dates
|
* start and stop dates
|
||||||
|
* bug fix and improvements
|
||||||
* **v1.12**
|
* **v1.12**
|
||||||
* more scans: `%words`
|
* more scans: `%words`
|
||||||
* concurrent `fast` analysis
|
* concurrent `fast` analysis
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ from utils import FakeMessage
|
|||||||
CHUNK_SIZE = 2000
|
CHUNK_SIZE = 2000
|
||||||
FORMAT = 3
|
FORMAT = 3
|
||||||
|
|
||||||
|
NOT_SERIALIZED = ["channel", "guild", "start_date"]
|
||||||
|
|
||||||
|
|
||||||
class ChannelLogs:
|
class ChannelLogs:
|
||||||
def __init__(self, channel: Union[discord.TextChannel, dict], guild: Any):
|
def __init__(self, channel: Union[discord.TextChannel, dict], guild: Any):
|
||||||
@@ -92,8 +94,7 @@ class ChannelLogs:
|
|||||||
|
|
||||||
def dict(self) -> dict:
|
def dict(self) -> dict:
|
||||||
channel = dict(self.__dict__)
|
channel = dict(self.__dict__)
|
||||||
channel.pop("channel", None)
|
for key in NOT_SERIALIZED:
|
||||||
channel.pop("guild", None)
|
channel.pop(key, None)
|
||||||
channel.pop("start_date", None)
|
|
||||||
channel["messages"] = [message.dict() for message in self.messages]
|
channel["messages"] = [message.dict() for message in self.messages]
|
||||||
return channel
|
return channel
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ IMAGE_FORMAT = [".gif", ".gifv", ".png", ".jpg", ".jpeg", ".bmp"]
|
|||||||
EMBED_IMAGES = ["image", "gifv"]
|
EMBED_IMAGES = ["image", "gifv"]
|
||||||
|
|
||||||
|
|
||||||
|
NOT_SERIALIZED = ["channel"]
|
||||||
|
|
||||||
|
|
||||||
class MessageLog:
|
class MessageLog:
|
||||||
def __init__(self, message: Union[discord.Message, dict], channel: Any):
|
def __init__(self, message: Union[discord.Message, dict], channel: Any):
|
||||||
self.channel = channel
|
self.channel = channel
|
||||||
@@ -79,7 +82,8 @@ class MessageLog:
|
|||||||
|
|
||||||
def dict(self) -> dict:
|
def dict(self) -> dict:
|
||||||
message = 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["created_at"] = self.created_at.isoformat()
|
||||||
message["edited_at"] = (
|
message["edited_at"] = (
|
||||||
self.edited_at.isoformat() if self.edited_at is not None else None
|
self.edited_at.isoformat() if self.edited_at is not None else None
|
||||||
|
|||||||
Reference in New Issue
Block a user