fix(discord): ignore system messages in on_message handler (#2618)
Cherry-picked from PR #2575 by ticketclosed-wontfix. Filters out Discord system messages (thread renames, pins, member joins, boosts) that were being treated as regular user messages. Follow-up fix: also allow MessageType.reply (value 19) — the original filter only allowed MessageType.default, which would silently drop all reply-based interactions. Added pytest.importorskip for discord dependency in tests.
This commit is contained in:
@@ -531,6 +531,11 @@ class DiscordAdapter(BasePlatformAdapter):
|
||||
if message.author == self._client.user:
|
||||
return
|
||||
|
||||
# Ignore Discord system messages (thread renames, pins, member joins, etc.)
|
||||
# Allow both default and reply types — replies have a distinct MessageType.
|
||||
if message.type not in (discord.MessageType.default, discord.MessageType.reply):
|
||||
return
|
||||
|
||||
# Bot message filtering (DISCORD_ALLOW_BOTS):
|
||||
# "none" — ignore all other bots (default)
|
||||
# "mentions" — accept bot messages only when they @mention us
|
||||
|
||||
Reference in New Issue
Block a user