Git Product home page Git Product logo

keyword_alert_bot's Introduction

🤖Telegram keyword alert bot ⏰

用于提醒 频道/群组 关键字消息

如果想订阅群组消息,确保普通TG账户加入该群组不需要验证。

原理:tg命令行客户端来监听消息,使用bot来发送消息给订阅用户。

👉 Features:

  • 关键字消息订阅:根据设定的关键字和频道来发送新消息提醒
  • 支持正则表达式匹配语法
  • 支持多频道订阅 & 多关键字订阅
  • 支持订阅群组消息

👉 Todo:

  • 支持私有频道的消息订阅
  • Bot 加入频道 / 群组推送消息 [目前没研究,感觉很少有人需要]

DEMO

http://t.me/keyword_alert_bot

image

USAGE

普通关键字匹配

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

正则表达式匹配

使用js正则语法规则,用/包裹正则语句,目前可以使用的匹配模式: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+

首次运行需要用tg账户接收数字验证码,且输入密码(telegram API触发)

$ pipenv install

$ pipenv shell

$ python3 ./main.py

3. crontab (optional)

  • update telethon

依赖库telethon可能会有旧版本不可用的情况或者其他BUG,请最好是通过定时任务去执行依赖更新。

e.g.

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

BUG Q&A

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

请尝试更新telethon解决问题🤔,我也很无助。

  • 订阅群组消息,机器人没任何反应 Hootrix#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

Multi-keyword and multi-channel subscription support, using comma `,` interval.

Use space between keywords and channels

Main command:

/subscribe - Subscription 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 - cancel all subscriptions

/list - displays a list of all subscriptions

keyword_alert_bot's People

Contributors

crazypeace avatar dependabot[bot] avatar hootrix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.