Skip to content

Commit

Permalink
Clarify and fix bug in enforcing 'message_length_threshold' in 'anti_…
Browse files Browse the repository at this point in the history
…crosspost' extension
  • Loading branch information
Mega-JC committed Jul 26, 2024
1 parent 009ced2 commit a443a56
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pcbot/exts/anti_crosspost.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(
bot (BotT): The bot instance.
channel_ids (Collection[int]): Collection of channel IDs to monitor.
crosspost_timedelta_threshold (int): Minimum time difference between messages to not be considered crossposts.
message_length_threshold (int): Minimum length of a message to be considered.
message_length_threshold (int): Minimum length of a text-only message to be considered.
max_tracked_users (int): Maximum number of users to track.
max_tracked_message_groups_per_user (int): Maximum number of message
groups to track per user.
Expand Down Expand Up @@ -103,8 +103,9 @@ async def on_message(self, message: discord.Message):
or not self._is_valid_channel(message.channel) # type: ignore
or message.type != discord.MessageType.default
or (
len(message.content) < self.message_length_threshold
message.content
and not message.attachments
and len(message.content) < self.message_length_threshold
)
):
return
Expand Down Expand Up @@ -259,7 +260,7 @@ async def setup(
max_tracked_users (int): Maximum number of users to track.
max_tracked_message_groups_per_user (int): Maximum number of message groups to track per user.
crosspost_timedelta_threshold (int): Minimum time difference between messages to not be considered crossposts.
message_length_threshold (int): Minimum length of a message to be considered.
message_length_threshold (int): Minimum length of a text-only message to be considered.
theme_color (int | discord.Color): Theme color for the bot's responses.
"""
await bot.add_cog(
Expand Down

0 comments on commit a443a56

Please sign in to comment.