名称: telegram-auto-topic
描述: >
在 Telegram 论坛群组中,在任何消息的开头添加 /topic,即可自动基于该消息创建一个新话题。话题标题会根据消息内容自动生成。
Github: https://github.com/itstauq/telegram-auto-topic
元数据:
openclaw:
requires:
config:
- ~/.openclaw/openclaw.json
env:
- OPENCLAW_CONFIG
bins:
- curl
- jq
在 Telegram 论坛群组的任何消息开头添加 /topic → 即可基于该消息创建一个新话题。标题会自动从你的消息中提取,无需自行构思。
1. 你发送一条以 /topic 开头的消息:
/topic @你的机器人 我需要在三月前研究一下更新护照的事
2. 一个名为 "三月前更新护照" 的新论坛话题被创建,你的消息被引用在其中。你会收到一个直接链接到新话题的回复。
channels.telegram.groups.<聊天ID>) —— 这是 OpenClaw 知道处理该群组消息的方式。当消息以 /topic 开头时:
scripts/telegram-auto-topic.sh <chat_id> <message_id> "<sender name>" "<title>" "<text after /topic>"topic_id、title 和 link 的 JSON。话题已创建 → [<标题>](<链接>)topic_id 作为 threadId)。像回复任何普通消息一样自然地回应。/topic 开头的消息。也适用于媒体消息 —— 在照片、视频或文档的说明文字中包含 /topic,这些媒体会被转发到新话题中。
scripts/telegram-auto-topic.sh <chat_id> <message_id> <sender> [title] [text]
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
chat_id |
参数 | 是 | 超级群组的聊天 ID(负数) |
message_id |
参数 | 是 | 要引用的原始消息 ID |
sender |
参数 | 是 | 原始发送者的显示名称 |
title |
参数 | 否 | 话题标题。如果省略,则回退到文本的前 ~50 个字符 |
text |
参数 | 否 | /topic 之后的消息正文。如果为空,则作为媒体转发 |
返回 JSON:{"topic_id": 123, "title": "使用的标题", "link": "https://t.me/c/..."}
跳过 @机器人 提及 —— 默认情况下,机器人仅在提及时才响应。要使用 /topic 而不提及机器人:
"channels.telegram.groups.<聊天ID>": {
"requireMention": false
}
Telegram 自动补全 —— 要在 Telegram 的命令菜单中显示 /topic,请在 channels.telegram 下添加:
{
"customCommands": [
{
"command": "topic",
"description": "从消息创建新的论坛话题"
}
]
}