nsfw filters

This commit is contained in:
Klemek
2021-05-18 18:13:37 +02:00
parent a01414dce7
commit b2858cca95
4 changed files with 42 additions and 4 deletions
+11 -3
View File
@@ -47,11 +47,17 @@ class ChannelLogs:
def is_format(self):
return self.format == FORMAT
def preload(self, channel: discord.TextChannel):
self.name = channel.name
self.channel = channel
@property
def nsfw(self):
self.channel.nsfw
async def load(
self, channel: discord.TextChannel, start_date: datetime, stop_date: datetime
) -> Tuple[int, int]:
self.name = channel.name
self.channel = channel
is_empty = self.last_message_id is None
try:
if is_empty:
@@ -125,6 +131,8 @@ class ChannelLogs:
yield len(self.messages), True
def dict(self) -> dict:
channel = serialize(self, not_serialized=["channel", "guild", "start_date"])
channel = serialize(
self, not_serialized=["channel", "guild", "start_date"]
)
channel["messages"] = [message.dict() for message in self.messages]
return channel
+1
View File
@@ -231,6 +231,7 @@ class GuildLogs:
if channel.id not in self.channels or fresh:
loading_new += 1
self.channels[channel.id] = ChannelLogs(channel, self)
self.channels[channel.id].preload(channel)
workers += [
Worker(self.channels[channel.id], channel, start_date, stop_date)
]