Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
feat: add channel-based filtering for Discord
Bongjin Lee48d430bf5e9d
diff --git a/nanobot/channels/discord.py b/nanobot/channels/discord.pyindex 9a75da1e9..60ca06982 100644--- a/nanobot/channels/discord.py+++ b/nanobot/channels/discord.py@@ -53,6 +53,7 @@ class DiscordConfig(Base):enabled: bool = Falsetoken: str = ""allow_from: list[str] = Field(default_factory=list)+ allow_channels: list[str] = Field(default_factory=list) # Allowed channel IDs (empty = all)intents: int = 37377group_policy: Literal["mention", "open"] = "mention"read_receipt_emoji: str = "👀"@@ -533,6 +534,12 @@ class DiscordChannel(BaseChannel):"""Check if inbound Discord message should be processed."""if not self.is_allowed(sender_id):return False+ # Channel-based filtering: only respond in allowed channels+ allow_channels = self.config.allow_channels+ if allow_channels:+ channel_id = self._channel_key(message.channel)+ if channel_id not in allow_channels:+ return Falseif message.guild is not None and not self._should_respond_in_group(message, content):return Falsereturn True