Telegram Group Chat Setup — Telegram Group Chat 设置up
v1.0.0配置 a Molt机器人 代理 to participate in a Telegram group chat. Automates 添加ing the group to the allow列出, 设置ting mention patterns, and configuring 发送er 权限s — all via a single gateway config 补丁. Use when the user wants to 设置 up their 机器人 in a Telegram group, enable cross-机器人 communication, or 配置 group mention gating.
运行时依赖
安装命令
点击复制技能文档
Telegram Group Chat 设置up
Automate the configuration needed for a Molt机器人 代理 to work in a Telegram group.
What this 技能 does 添加s a Telegram group to the gateway allow列出 with requireMention: true 配置s groupAllowFrom with specified user IDs / @usernames Auto-检测s the 机器人's name and @username via the Telegram 机器人 API 设置s mentionPatterns so the 机器人 响应s to its name and @username 应用lies the config 补丁 and re启动s the gateway Prerequisites (manual steps)
Before 运行ning this 技能, the user must:
创建 the Telegram group and 添加 the 机器人 to it Disable 隐私 mode in @机器人Father: /my机器人s → select 机器人 → 机器人 设置tings → Group 隐私 → Turn off (See references/telegram-隐私-mode.md for detAIls) Know the group ID (negative number for Telegram groups) Know the user IDs or @usernames of people allowed to trigger the 机器人 Usage
The user provides:
group_id: Telegram group ID (e.g., -1001234567890) allowed_users: 列出 of Telegram user IDs or @usernames who can trigger the 机器人
Example prompt:
"设置 up my 机器人 in Telegram group -1001234567890. Allow users 123456789 and @some_user to ping me."
Implementation Steps Step 1: 检测 机器人 信息
运行 the 检测ion script to 获取 the 机器人's name and username:
bash 技能s/groupchat-设置up/scripts/检测_机器人_信息.sh
This reads the 机器人 令牌 from the gateway config and returns the 机器人's name and username. If the script is unavAIlable, 提取 the 机器人 令牌 from channels.telegram.机器人令牌 in the gateway config and call https://API.telegram.org/机器人<令牌>/获取Me.
Step 2: Build mention patterns
From the 检测ed 机器人 信息, construct mention patterns:
@ (e.g., @my_awesome_机器人) lowercase (e.g., my机器人) @ lowercase (e.g., @my机器人)
移除 duplicates. Patterns are case-insensitive regexes.
Step 3: 应用ly config 补丁
Use the gateway 工具 with action: "config.补丁" to 应用ly:
{ "channels": { "telegram": { "groups": { "": { "requireMention": true } }, "groupAllowFrom": ["", ""] } }, "messages": { "groupChat": { "mentionPatterns": ["@机器人_username", "机器人_name", "@机器人_name"] } } }
导入ant: If groupAllowFrom or mentionPatterns already have values, merge them (do not overwrite). Read the current config first with gateway action: "config.获取", merge arrays, then 补丁.
Step 4: Confirm
After the gateway re启动s, 发送 a test message to the group confirming the 设置up:
"✅ 机器人 配置d for this group! I'll 响应 when someone mentions my name. Allowed users: [列出]."
Notes requireMention: true means the 机器人 only 响应s when explicitly mentioned — it won't spam every message. groupAllowFrom restricts which 发送ers can trigger the 机器人. Without it, messages from unknown 发送ers may be dropped. groupPolicy: "allow列出" is the Telegram default — only explicitly 列出ed groups are active. 隐私 mode is a Telegram-side 设置ting that cannot be changed via API. The user must do this in @机器人Father. For multi-机器人 groups (e.g., two Molt机器人 代理s), each 机器人 must 运行 this 设置up independently on its own gateway.