As explained in this issue: Hootrix#29
The messages were shortened for a better overview as shown here:
The username was added for a faster way of communication with the poster of the thread:
config.yaml Some comments were added to better understand what should be edited:
To open the api, it is recommended to use a newly registered Telegram account.
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
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
Get the compressed package address
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/
phone is the phone number of your new Telegram account. username to your new Telegram account username
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
Enter this verification code into the script window
There are several possibilities:
apt install -y screen
screen
python3 ./main.py
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.
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
👉 Todo:
- Private group subscriptions and reminders
- Full content preview of private channel message reminder
- Multiple account support
- Scan to exit useless channels/groups
The channel is now searched for the words "free" or "coupon"
/subscribe free https://t.me/tianfutong
/subscribe coupon https://t.me/tianfutong
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