简介
基于第三方 Telegram CLI 的纯文档型技能,支持命令行读取、搜索、发送消息及群组管理,适合开发者自动化 Telegram 工作流。
原始描述
Telegram CLI for reading, searching, and sending messages. Use when the user asks about Telegram messages, wants to check inbox, search chats, send messages, or look up contacts and groups.
中文使用说明 来自收录源
核心用法
该 Skill 是 Telegram CLI 工具 @cyberdrk/tg 的使用说明文档,为 AI Agent 提供与 Telegram 交互的标准化指令集。用户需先通过 npm 全局安装 CLI 工具并完成 Telegram API 认证,即可通过命令行实现:消息收发(tg send、、tg read)、收件箱管理(tg inbox)、聊天记录搜索(tg search)、联系人及群组信息查询(tg contact、、tg members、、tg admins)等操作。所有命令均支持 --json` 输出格式,便于程序化处理。
显著优点
- 纯文档零风险:Skill 本身不含任何可执行代码,仅为 Markdown 使用指南,安全透明可审计
- 功能覆盖全面:涵盖消息读写、搜索、联系人管理、群组权限查询等核心 Telegram 操作
- 结构化输出友好:内置 JSON 输出支持,方便 AI Agent 解析和后续自动化处理
- 参数设计灵活:支持时间范围过滤(
--since)、消息数量限制(-n)、模糊匹配聊天名称等实用特性 - 轻量无依赖:Skill 不捆绑任何运行时,CLI 工具由用户按需自主安装
潜在缺点与局限性
- 来源可信度有限:底层 CLI 工具来自个人开发者账号(T3 来源),非 Telegram 官方出品,长期维护存在不确定性
- 功能边界受限:不支持媒体文件上传下载、语音通话、复杂群组管理等高级功能
- 认证门槛较高:首次使用需手动从 my.telegram.org 申请 API ID 和 Hash,对普通用户不够友好
- 无图形界面:纯命令行交互,不适合需要可视化操作的场景
- 依赖外部工具:Skill 仅为文档,实际功能完全依赖用户自行安装的第三方 npm 包,版本兼容性需自行保障
适合的目标群体
- 开发者及技术型用户,需要通过脚本自动化 Telegram 消息处理
- AI Agent 构建者,希望为 Agent 赋予 Telegram 读写能力
- 需要批量查询聊天记录、监控群组动态的运营人员
- 偏好命令行效率、追求工作流集成的极客用户
使用风险
- API 凭证泄露风险:Telegram API ID 和 Hash 具有长期有效性,若保管不当可能导致账号被盗用
- 会话数据本地存储:CLI 工具将加密会话保存在
~/.config/tg/,多用户环境需注意目录权限隔离 - 第三方工具信任问题:
@cyberdrk/tg非官方工具,其代码安全性、隐私政策需用户自行评估 - 误操作风险:命令行发送消息无二次确认,批量操作可能导致消息误发
- Rate Limit 限制:高频调用 Telegram API 可能触发平台限流,影响正常使用
技能正文
name: tg description: Telegram CLI for reading, searching, and sending messages. Use when the user asks about Telegram messages, wants to check inbox, search chats, send messages, or look up contacts and groups.
Telegram CLI
Fast Telegram CLI for reading, searching, and sending messages.
When to Use
Use this skill when the user:
- Asks to check Telegram messages or inbox
- Wants to search Telegram for a topic/keyword
- Wants to send a Telegram message to someone
- Asks about a Telegram group, contact, or chat
- Wants to see unread messages
- Needs to look up group members or admins
Install
npm install -g @cyberdrk/tg
Or from source:
cd ~/Code/cyberdrk305/telegram && npm install && npm run build && npm link
Authentication
First-time setup requires API credentials from https://my.telegram.org/apps
tg auth
Commands
Reading
tg inbox # Unread messages summary
tg chats # List all chats
tg read "ChatName" -n 50 # Read last 50 messages
tg read "ChatName" --since "1h" # Messages from last hour
tg read @username -n 20 # Read DM with user
tg search "query" --chat "ChatName" # Search within chat
tg search "query" --all # Search all chats
Writing
tg send @username "message" # Send DM
tg send "GroupName" "message" # Send to group
tg reply "ChatName" 12345 "response" # Reply to message ID
Contacts & Groups
tg contact @username # Get contact info
tg members "GroupName" # List group members
tg admins "GroupName" # List admins only
tg groups --admin # Groups where you're admin
Status
tg whoami # Show logged-in account
tg check # Verify session
Output Formats
All commands support --json for structured output suitable for processing:
tg inbox --json # JSON format
tg read "Chat" --json # JSON with messages array
tg chats --json # JSON with chat list
Examples
Check inbox:
tg inbox
Read recent messages from a chat:
tg read "MetaDAO Community" -n 20
Search for a topic:
tg search "futarchy" --chat "MetaDAO"
Send a message:
tg send @username "Hello, checking in!"
Notes
- Chat names can be partial matches (e.g., "MetaDAO" matches "MetaDAO Community")
- Usernames must start with @ (e.g., @username)
- Messages are returned in reverse chronological order (newest first)
- The
--sinceflag accepts formats like "1h", "30m", "7d"
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。