Skip to content

Commit

Permalink
Always detect crosspost messages in threads/posts in 'anti_crosspost'…
Browse files Browse the repository at this point in the history
… extension
  • Loading branch information
Mega-JC committed Jul 21, 2024
1 parent 25e1c55 commit a8ef0d2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions pcbot/exts/anti_crosspost.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,18 @@ async def on_message(self, message: discord.Message):
if message.author.bot or not (
(
message.channel.id in self.channel_ids
or isinstance(message.channel, (discord.abc.GuildChannel))
and message.channel.category_id in self.channel_ids
or isinstance(message.channel, discord.Thread)
and message.channel.parent_id in self.channel_ids
or (
isinstance(message.channel, (discord.abc.GuildChannel))
and message.channel.category_id in self.channel_ids
)
or (
isinstance(message.channel, discord.Thread)
and (
message.channel.parent_id in self.channel_ids
or message.channel.parent
and message.channel.parent.category_id in self.channel_ids
)
)
)
and message.type == discord.MessageType.default
):
Expand All @@ -80,11 +88,10 @@ async def on_message(self, message: discord.Message):
if (
len(self.crossposting_cache[message.author.id]["message_groups"])
> self.max_tracked_message_groups_per_user
and len(self.crossposting_cache[message.author.id]["message_groups"][0]) < 2
):
self.crossposting_cache[message.author.id]["message_groups"].pop(0)

# To fix the code below from sending an

for i, messages in enumerate(
self.crossposting_cache[message.author.id]["message_groups"]
):
Expand Down

0 comments on commit a8ef0d2

Please sign in to comment.