返回顶部
t

telegram-opsTelegram运维

Telegram Bot API operations for forum management. Use for creating/editing/archiving forum topics, setting topic icons, managing Telegram groups via Bot API. Use when archiving channels/topics. Requires bot token from OpenClaw config.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
1,667
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

telegram-ops

Telegram 运维

管理 Telegram 论坛主题和 Bot API 操作。

前置条件

  • - 机器人必须是群组管理员,并拥有 canmanagetopics 权限
  • 从 OpenClaw 配置中获取机器人令牌:
bash gateway action=config.get | jq -r .result.parsed.channels.telegram.botToken

创建主题

创建主题时,请遵循以下所有步骤:

  1. 1. 通过 Telegram Bot API 创建主题(返回 messagethreadid)
  2. 设置图标 -- 选择一个与主题用途匹配的图标(参见图标参考
  3. 选择相关技能 -- 运行 openclaw skills list,仅选择与主题用途匹配的 ready 技能
  4. 编写系统提示 -- 为代理提供该主题的上下文说明
  5. 修补 OpenClaw 配置 -- 将主题及其技能和系统提示注册到配置中

步骤 1:通过 Bot API 创建

bash
curl -X POST https://api.telegram.org/bot/createForumTopic \
-H Content-Type: application/json \
-d {
chatid: ID>,
name: 主题名称
}

返回 messagethreadid(主题 ID)-- 后续所有步骤都需要此 ID。

步骤 2:设置图标

bash
curl -X POST https://api.telegram.org/bot/editForumTopic \
-H Content-Type: application/json \
-d {
chatid: ID>,
messagethreadid: ,
name: 主题名称,
iconcustomemojiid: ID>
}

步骤 3-5:配置 OpenClaw

修补配置以注册主题及其系统提示:

bash
gateway action=config.patch raw={channels:{telegram:{groups:{ID>:{topics:{ID>:{systemPrompt:主题特定指令}}}}}}}

主题配置继承自父级群组 -- 仅指定需要覆盖的项。

不要添加 skills 键 -- 省略该键表示所有技能均可用。仅在你有特定理由限制主题能力时才限制技能。

会话密钥

每个主题拥有独立的 OpenClaw 会话:

agent:main:telegram:group:ID>:topic:ID>

每个会话具有独立的对话历史、上下文窗口和压缩机制。

主题图标

表情符号ID用途
5312016608254762256运维、速度、告警
💡
5312536423851630001 | 创意、建议 | | 📰 | 5434144690511290129 | 新闻、公告 | | 🔥 | 5312241539987020022 | 热门话题、紧急事项 | | ❤️ | 5312138559556164615 | 社区、关爱 | | 📝 | 5373251851074415873 | 笔记、文档 | | 🤖 | 5309832892262654231 | 机器人、自动化 | | 💬 | 5417915203100613993 | 聊天、讨论 | | 📊 | 5350305691942788490 | 统计、分析 | | 🎯 | 5418085807791545980 | 目标、指标 |

完整列表请参见 references/emoji-ids.md。

获取所有有效图标贴纸 ID:
bash
curl -X POST https://api.telegram.org/bot/getForumTopicIconStickers

归档主题

归档流程:以 [ARCHIVED] 前缀重命名、设置文件夹图标、关闭主题,然后处理 OpenClaw 会话。

步骤 1:在 Telegram 中归档

使用归档脚本:
bash
scripts/archivetopic.sh ID> 当前主题名称

该脚本将:

  • - 重命名为 [ARCHIVED] 当前主题名称
  • 设置 📁 文件夹图标(5357315181649076022)
  • 关闭主题(锁定新消息)

步骤 2:导出并删除 OpenClaw 会话

bash

将会话历史导出到会话归档文件夹


openclaw sessions history agent:main:telegram:group:ID>:topic:ID> > ~/.openclaw/agents/main/sessions/archive/<主题名称>-<日期>.md

删除会话(手动操作 - 从 sessions.json 中移除并删除记录文件)

会话密钥:agent:main:telegram:group:ID>:topic:ID>

步骤 3:清理配置(可选)

如果主题有自定义设置,从 OpenClaw 配置中移除该主题:
bash
gateway action=config.patch raw={channels:{telegram:{groups:{ID>:{topics:{ID>:null}}}}}}

限制

不存在 getForumTopicInfo 方法。 无法通过线程 ID 查询主题名称。

解决方案:

  1. 1. 从 forumtopiccreated 事件中缓存名称
  2. 在本地配置中存储映射关系
  3. 监控主题创建服务消息

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 telegram-ops-1776367462 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 telegram-ops-1776367462 技能

通过命令行安装

skillhub install telegram-ops-1776367462

下载

⬇ 下载 telegram-ops v1.0.0(免费)

文件大小: 7.57 KB | 发布时间: 2026-4-17 14:23

v1.0.0 最新 2026-4-17 14:23
Initial release of telegram-ops: Telegram Bot API operations for forum management.

- Provides detailed instructions for creating, editing, and archiving Telegram forum topics using the Bot API.
- Lists prerequisites and permissions required for proper bot operation.
- Documents step-by-step workflows for creating/setting up topics and integrating with OpenClaw configuration.
- Includes emoji icon reference and methods to fetch valid sticker IDs for topic icons.
- Describes session isolation per topic and how to archive/clean up OpenClaw sessions and config.
- Notes Telegram API limitations and recommended workarounds for missing topic info methods.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large