fix(discord): route unauthorized DMs to pairing

This commit is contained in:
chengyongru
2026-07-13 12:05:04 +08:00
committed by Xubin Ren
parent 053722a2a2
commit 6d406d93c9
2 changed files with 23 additions and 1 deletions
+3 -1
View File
@@ -664,7 +664,9 @@ class DiscordChannel(BaseChannel):
content: str,
) -> bool:
"""Check if inbound Discord message should be processed."""
if not self.is_allowed(sender_id):
# Reject unauthorized guild messages before any side effects, but let DMs
# reach BaseChannel._handle_message so it can issue a pairing code.
if message.guild is not None and not self.is_allowed(sender_id):
return False
# Channel-based filtering: only respond in allowed channels
allow_channels = self.config.allow_channels