telegram-hottest-message
v1.0.9
Published
Get the hottest messages from a specified Telegram channel and forward them to a target chat.
Readme
Telegram Hottest Message
获取 Telegram 指定频道中最热门的消息(表情回复最多的),并可以转发到指定聊天。(比如:想获取某些福利群组里,点赞最多最火的消息)
请放心,THM没收集你的任何信息,用的npm包都是官方的,请踏实儿使用~enjoy~

功能特性
- 🔥 根据消息反应(表情回复)数量排序,找出最热门的消息
- 📨 支持将热门消息转发到指定聊天
- 🌐 支持 SOCKS5/HTTP 代理
- 🎯 可自定义获取消息数量和转发数量
- 📅 支持按时间范围筛选消息(如最近 7 天、指定日期等)
- 📱 交互式选择频道对话
- 💾 支持会话持久化
安装
从 npm 安装(推荐)
npm install -g telegram-hottest-message从源码构建
git clone https://github.com/jianqiao0313/Telegram-Hottest-Message.git
cd Telegram-Hottest-Message
npm install
npm run build
npm link使用方法
基本用法
thm完整参数
thm -I your_api_id -H your_api_hash -S your_session_string -M 50000 -T 20 -P socks5://[user:pass@]127.0.0.1:7890 -F me参数说明
| 参数 | 长参数 | 说明 | 默认值 |
|------|--------|------|--------|
| -I | --apiId | Telegram API ID | 2040 |
| -H | --apiHash | Telegram API Hash | b18441a1ff607e10a989891a5462e627 |
| -S | --session | 会话字符串 | 无 |
| -M | --maxMessages | 最大获取消息数 | 100000 |
| -T | --top | 转发的热门消息数量 | 100 |
| -O | --offsetId | 消息偏移ID | 无 |
| -P | --proxy | 代理地址 | 无 |
| -F | --forward | 转发目标聊天 | me |
| --since | | 仅获取此日期之后的消息(如 7d/2024-01-01) | 无 |
| --until | | 仅获取此日期之前的消息(如 2024-12-31) | 无 |
获取 API 凭证
- 访问 my.telegram.org
- 登录您的 Telegram 账户
- 点击 "API development tools"
- 创建新应用程序获取
api_id和api_hash
配置文件
在主目录下创建 ~/.thmrc 文件,以 JSON 格式持久化默认配置:
{
"apiId": 123456,
"apiHash": "your_api_hash",
"session": "your_session_string",
"proxy": "socks5://127.0.0.1:1080",
"forward": "me",
"since": "7d",
"until": "2024-12-31"
}| 字段 | 说明 |
|------|------|
| apiId | Telegram API ID |
| apiHash | Telegram API Hash |
| session | 会话字符串 |
| proxy | 代理地址(socks5:// 或 http://) |
| forward | 默认转发目标聊天 |
| since | 默认时间下限(如 7d) |
| until | 默认时间上限(如 2024-12-31) |
命令行参数优先于配置文件,未指定的参数会回退到 ~/.thmrc(如果存在),再回退到内置默认值。
会话字符串
首次运行时,程序会提示您输入手机号和验证码进行登录,登录成功后会显示会话字符串。请保存此字符串用于后续使用。
使用示例
示例 1:使用手机验证码或Telegram验证码登录
thm示例 2:使用默认 API 凭证
thm -S "your_session_string_here"示例 3:获取前 50 条热门消息
thm -S "your_session_string_here" -T 50示例 4:使用自定义代理
thm -S "your_session_string_here" -P "socks5://user:[email protected]:1080"示例 5:转发到特定聊天
thm -S "your_session_string_here" -F "your_channel_username"示例 6:按时间范围筛选
# 获取最近 7 天最火的 20 条
thm -S "your_session_string_here" --since 7d -T 20
# 获取 2024 年全年最火的
thm -S "your_session_string_here" --since 2024-01-01 --until 2025-01-01
# 获取最近 24 小时最火的
thm -S "your_session_string_here" --since 24h工作流程
- 🔐 使用提供的凭证登录 Telegram
- 📋 获取并显示可用的对话列表
- 🎯 选择要分析的频道
- 📥 获取频道中的消息
- 🔥 根据反应数量排序消息
- 📤 将热门消息转发到指定聊天
代理配置
支持以下代理格式:
socks5://127.0.0.1:1080socks5://user:[email protected]:1080http://127.0.0.1:8080http://user:[email protected]:8080
系统要求
- Node.js >= 22.0.0
- npm >= 8.0.0
开发
开发环境运行
npm run dev构建
npm run build代码检查
npm run lint许可证
MIT
贡献
欢迎提交 Issue 和 Pull Request!
⭐ Star
免责声明
请遵守 Telegram 的使用条款和相关法律法规。本工具仅供学习和个人使用。
