From 1cae9ac6285265ab128f62cb4eb18d9feb7d8911 Mon Sep 17 00:00:00 2001 From: Dolf Date: Thu, 2 Apr 2026 18:36:31 -0700 Subject: [PATCH] feat(telegram): add group_topics skill binding for supergroup forum topics Reads config.extra['group_topics'] to bind skills to specific thread_ids in supergroup/forum chats. Mirrors the dm_topics skill injection pattern but for group chat_type. Enables per-topic skill auto-loading in Falcon HQ. Config format: platforms.telegram.extra.group_topics: - chat_id: -1003853746818 topics: - name: FalconConnect thread_id: 5 skill: falconconnect-architecture --- gateway/platforms/telegram.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gateway/platforms/telegram.py b/gateway/platforms/telegram.py index ad7c8f3d6..12ef561b5 100644 --- a/gateway/platforms/telegram.py +++ b/gateway/platforms/telegram.py @@ -2101,6 +2101,19 @@ class TelegramAdapter(BasePlatformAdapter): if not chat_topic: chat_topic = created_name + elif chat_type == "group" and thread_id_str: + # Group/supergroup forum topic skill binding via config.extra['group_topics'] + group_topics_config: list = self.config.extra.get("group_topics", []) + for chat_entry in group_topics_config: + if str(chat_entry.get("chat_id", "")) == str(chat.id): + for topic in chat_entry.get("topics", []): + tid = topic.get("thread_id") + if tid is not None and str(tid) == thread_id_str: + chat_topic = topic.get("name") + topic_skill = topic.get("skill") + break + break + # Build source source = self.build_source( chat_id=str(chat.id),