Hootrix / keyword_alert_bot

telegram keyword alert bot ⏰

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🤖Telegram keyword alert bot ⏰

Telegram关键字提醒机器人,用于实时监测频道/群组中的关键字消息。

确保普通Telegram账户能够在不需要验证的情况下加入指定群组。

原理:通过Telegram命令行客户端监听消息,使用机器人向订阅用户发送消息提醒。

👉 Features:

👉 Todo:

  • 私有群组订阅和提醒
  • 私有频道消息提醒完整内容预览
  • 多账号支持
  • 扫描退出无用频道/群组

DEMO

http://t.me/keyword_alert_bot

demo

USAGE

普通关键字匹配

/subscribe   免费     https://t.me/tianfutong
/subscribe   优惠券   https://t.me/tianfutong

正则表达式匹配

使用类似JavaScript正则语法规则,用/包裹正则语句,目前可以使用的匹配模式:i,g

# 订阅手机型号关键字:iphone x,排除XR,XS等型号,且忽略大小写
/subscribe   /(iphone\s*x)(?:[^sr]|$)/ig  com9ji,xiaobaiup
/subscribe   /(iphone\s*x)(?:[^sr]|$)/ig  https://t.me/com9ji,https://t.me/xiaobaiup

# xx券
/subscribe  /([\S]{2}券)/g  https://t.me/tianfutong

BUILD

1. config.yml.default --> config.yml

Create Telelgram Account & API

开通api 建议使用新注册的Telegram账户

Create BOT

访问https://t.me/BotFather 创建机器人

2. RUN

运行环境 python3.7+

首次运行需要使用Telegram账户接收数字验证码,并输入密码(Telegram API触发)。

$ pipenv install

$ pipenv shell

$ python3 ./main.py

3. crontab (optional)

  • update telethon

依赖库telethon可能存在旧版本不可用的情况或其他BUG,建议通过定时任务执行依赖更新。

e.g.

0 0 * * * cd /home/keyword_alert_bot && pipenv  telethon > /dev/null 2>&1

docker

当前目录下配置config.yml文件后,使用docker一键启动

docker run -it --name keyword_alert_bot -v $(pwd)/config.yml:/app/config.yml   yha8897/keyword_alert_bot

BUG Q&A

  • You have joined too many channels/supergroups (caused by JoinChannelRequest)

BOT中所有订阅频道的总数超过 500。原因是BOT使用的Telegram演示账户限制导致。建议你自行部署

  • 查看日志发现个别群组无法接收消息,而软件客户端正常接收

🤔尝试更新telethon到最新版本或者稳定的1.24.0版本

  • 订阅群组消息,机器人没任何反应 #20

  • ModuleNotFoundError: No module named 'asyncstdlib', No module named '...'

$ pipenv  install

BOT HELP


目的:根据关键字订阅频道消息

支持多关键字和多频道订阅,使用英文逗号`,`间隔

关键字和频道之间使用空格间隔

主要命令:

/subscribe - 订阅操作: `关键字1,关键字2 https://t.me/tianfutong,https://t.me/xiaobaiup`

/unsubscribe - 取消订阅: `关键字1,关键字2 https://t.me/tianfutong,https://t.me/xiaobaiup`

/unsubscribe_all - 取消所有订阅

/list - 显示所有订阅列表

---

Purpose: Subscribe to channel messages based on keywords

Supports multiple keyword and channel subscriptions, separated by commas.

Separate keywords and channels with a space.

Main commands:

/subscribe - subscribe operation: `keyword1, keyword2 https://t.me/tianfutong,https://t.me/xiaobaiup`

/unsubscribe - unsubscribe: `keyword1, keyword2 https://t.me/tianfutong,https://t.me/xiaobaiup`

/unsubscribe_all - unsubscribe from all subscriptions

/list - display all subscription lists.

License

LICENSE

Buy me a coffee

[USDT-TRC20]:TDELNhqYjMJvrChjcTBiBBieWYiDGiGm2r

wechat pay alipay paypal

About

telegram keyword alert bot ⏰

License:GNU General Public License v3.0


Languages

Language:Python 98.8%Language:Dockerfile 1.2%