/keyword_alert_bot_EN

telegram keyword alert bot with English description

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Modifications compared to the original version:

As explained in this issue: Hootrix#29

The messages were shortened for a better overview as shown here: image

The username was added for a faster way of communication with the poster of the thread: image

config.yaml Some comments were added to better understand what should be edited:

image

image

Here is how you get started:

1. Create account

Create Telegram Account & API

https://my.telegram.org/apps

To open the api, it is recommended to use a newly registered Telegram account.

Get api_id, api_hash chrome_2022-08-08_11-04-17

Create BOT

Go to this adress in the telegram app or if you use web.telegram.com add in the search field: https://t.me/BotFather Then enter this in the chat to create a new bot: /start /newbot Enter bot name Enter bot username

I think one of these should end with _bot. There are many manuals how to create a bot if you do not get along.

Next copy token to access the HTTP API Telegram_2022-08-08_10-57-30

2. Operating environment

Preparing python related components

Based on Debian 11 environment. You can use any apt supported system, Ubuntu 22 will also work. Enter this to the SSH or bash console:

apt update
apt install -y pip 
pip install telethon peewee PySocks diskcache PyYAML asyncstdlib colorama text_box_wrapper

Pull program files from GitHub

Get the compressed package address

image

Then enter this:

cd 
wget -N https://github.com/crazypeace/keyword_alert_bot/archive/refs/heads/master.zip
unzip master.zip
cd keyword_alert_bot-master/

3. Edit config.yml

Modify the following fields Notepad3_2022-08-08_11-09-15-1

phone is the phone number of your new Telegram account. username to your new Telegram account username

4. Start bot

You need python3 installed. You can then start the main component:

python3 ./main.py

The script window prompts you to enter a verification code, and at the same time, your new Telegram account receives a verification code image

Enter this verification code into the script window

5. Autostart bot

Run in the background using screen

There are several possibilities:

apt install -y screen
screen
python3 ./main.py

Schedule tasks using crontab

crontab -e

When you run it for the first time, you will be prompted which editor to use. Just choose the one you like. Newbies recommend nano, which operates more like Win's notepad.

Enter the following line and save it

@reboot ( sleep 120 ; python3 /etc/keyword_alert_bot-master/main.py )

This means that after each reboot, wait 120 seconds before executing the following shell command.

🤖Telegram keyword alert bot ⏰

Used to remind channel/group keyword messages If you want to subscribe to group messages, make sure that ordinary TG accounts do not require verification to join the group. Principle: tg command line client to monitor messages, and use bot to send messages to subscribed users.

👉 Features:

  • Keyword message subscription: Send new message reminders based on set keywords and channels

  • Support regular expression matching syntax

  • Support multi-channel subscription & multi-keyword subscription

  • Support subscribing to group messages

  • Support message subscription of private channel ID/invitation link

    1. https://t.me/+B8yv7lgd9FI0Y2M1
    2. https://t.me/joinchat/B8yv7lgd9FI0Y2M1

👉 Todo:

  • Private group subscriptions and reminders
  • Full content preview of private channel message reminder
  • Multiple account support
  • Scan to exit useless channels/groups

DEMO

http://t.me/keyword_alert_bot

image

USAGE

Normal keyword matching

The channel is now searched for the words "free" or "coupon"

/subscribe   free     https://t.me/tianfutong
/subscribe   coupon   https://t.me/tianfutong

Regular expression matching

Use js regular grammar rules and wrap regular statements with /. Currently available matching modes: i, g

#Subscribe mobile phone model keyword: iphone x, exclude XR, XS and other models, and ignore case
/subscribe   /(iphone\s*x)(?:[^sr]|$)/ig  com9ji,xiaobaiup
/subscribe   /(iphone\s*x)(?:[^sr]|$)/ig  https://t.me/com9ji,https://t.me/xiaobaiup