用途:在 Telegram 中获取、搜索、下载、发送、编辑和发布消息,适合通过命令行整理聊天记录、检索内容、发送文件与发布频道草稿。
主要能力:列出聊天(list),获取最近消息(recent),按内容搜索(search),读取未读(unread),发送文本或文件(send),编辑自己的消息(edit),下载附件(download),抓取论坛主题消息(thread),以及将草稿发布到频道(publish)。支持 --json、--to-daily、--to-person、-o 输出到文件,减少上下文消耗;--with-media 可同时下载媒体。
使用方式:需先在 ~/.telegram_dl/ 配置认证,可用 python3 scripts/telegram_fetch.py setup 检查状态;未配置时按提示从 https://my.telegram.org/auth 获取 API 凭据并克隆 https://github.com/glebis/telegram_dl 完成交互式登录。常用命令如 python3 scripts/telegram_fetch.py recent --limit 20、python3 scripts/telegram_fetch.py search "meeting"、python3 scripts/telegram_fetch.py send --chat "@username" --text "Hello!"。发送含 Markdown 的内容需加 --markdown;publish 会自动处理 Markdown。依赖 Python 包 telethon、pyyaml,安装命令 pip install telethon pyyaml。
适用场景:整理聊天记录、检索项目信息、导出附件、回复消息、归档到 Obsidian 每日笔记或人物笔记,以及向 klodkot 频道发布草稿。
限制:只能编辑自己的消息;发帖频道字段必须为 klodkot;脚本内置 0.1 秒限速并自动处理 FloodWaitError;精确查找聊天若未命中可增大 --limit。其他费用、平台与效果信息暂未提供。