fix(discord): skip obfuscated channels in directory and backfill enumeration
Discord's Channel Obfuscation change (announced Aug 12 2026, HTTP enforcement Nov 16 2026) dispatches channels the bot lacks VIEW_CHANNEL on with name "___hidden___", flag 1 << 17 (CHANNEL_OBFUSCATED), and nulled fields. Without filtering, the channel directory lists phantom "___hidden___" entries the agent can never post to, and wildcard missed-message backfill wastes history reads on channels that always 403. Adds is_discord_channel_obfuscated() to gateway/platforms/helpers.py (checks the flag bit plus the sentinel name for discord.py builds that don't expose the new flag) and applies it at both enumeration sites.
This commit is contained in:
@@ -2280,8 +2280,18 @@ class DiscordAdapter(DiscordMediaMixin, BasePlatformAdapter):
|
||||
seen: set[str] = set()
|
||||
candidate_channels = []
|
||||
if "*" in channel_ids:
|
||||
from gateway.platforms.helpers import is_discord_channel_obfuscated
|
||||
|
||||
for guild in getattr(self._client, "guilds", []) or []:
|
||||
candidate_channels.extend(getattr(guild, "text_channels", []) or [])
|
||||
# Skip obfuscated placeholders (bot lacks VIEW_CHANNEL;
|
||||
# Discord dispatches them with name "___hidden___" +
|
||||
# CHANNEL_OBFUSCATED flag as of the Aug 2026 privacy
|
||||
# change). History reads on them always fail.
|
||||
candidate_channels.extend(
|
||||
ch
|
||||
for ch in (getattr(guild, "text_channels", []) or [])
|
||||
if not is_discord_channel_obfuscated(ch)
|
||||
)
|
||||
else:
|
||||
for channel_id in sorted(channel_ids):
|
||||
channel = None
|
||||
|
||||
Reference in New Issue
Block a user