This bot monitors websites and notifies you via Telegram, when they visually change.
The bot supports the following commands: /help Lists all commands and their descriptions /start Lists all commands and their descriptions /list Lists all entries including their areas /listurls Lists all entries including their websites /info <name> Shows more information about a specific entry /myid Returns your User ID /add <name> <URL> [x y width height] Adds a new website with an optional screenshot area to the list /remove <name> Removes an entry from the list /update <name> <x> <y> <width> <height> Updates the screenshot area of an entry /setdelay <name> <delay> Specifies a delay in seconds to wait after the website has been loaded /setcaptureelement <name> [html element] Specifies which HTML element to capture /setclickelement <name> [html element] Specifies which HTML element to click before taking the screenshot /setwaitelement <name> [html element] Specifies which HTML element to wait for before taking the screenshot /fetch <name> Takes a screenshot with the stored settings and sends it into this chat /fetchurl <URL> [x y width height] Takes a screenshot of the given website and settings and sends it into this chat /diff <name> Shows a picture highlighting the differences of the last website change, including extended information about the normalized cross correlation /mute <name> <hours> Prevents change notifications for the given entry and duration /unmute <name> Resumes notifications for the given entry /listall Lists all entries from all chats /check Performs a manual check if any monitored website changed /getpermissions [id] Returns the permission level of the author of the message, replied to or the user id provided /setpermissions <level> [id] Sets the permission level of the author of the message, replied to or the user id provided
Installation (Linux)
Prerequisites
For the bot to work, you first need the following things:
ImageMagick (for cropping the screenshot using the convert tool and comparing the screenshots using compare)
For the urlwatch script to be periodically executed, you have to create a cronjob for it.
Edit the crontab file: crontab -e
Add the following line at the end: */30 * * * * /path/to/your/install/directory/urlwatcher/urlwatcher This executes the script every 30 minutes. To execute it e.g. every hour, use 0 * * * * (every time the minute is zero).
Save the file
Setup
Create the BOT_TOKEN file
For the scripts and the bot to work, you have to put your bot token in a file called BOT_TOKEN in your installation directory.
cd to your installation directory
Create the file: echo YOUR_BOT_TOKEN > BOT_TOKEN
Give yourself admin permissions
Start the bot
Run the command /myid to retrieve your ID
Stop the bot
Add your ID to the permissions file: echo "YOUR_ID: admin" > /path/to/your/install/directory/NotifierBot/permissions.txt
Start the bot again and make sure, it worked by checking your permissions with the bot: /getpermissions YOUR_ID
If the bot returned your permission level as admin, everything worked and you now have admin permissions
Note: Modifying the permissions file requires a restart of the bot, but using /setpermissions <level> <userid> does not.
(Optional) Create a systemd service for the bot
Create the unit file: sudo nano /etc/systemd/system/notifier.service
Paste the following content (replace YOUR_USER_ACCOUNT with your linux user account name):
```
[Unit]
Description=Telegram Notifier Bot
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=YOUR_USER_ACCOUNT
WorkingDirectory=/path/to/your/install/directory/NotifierBot
ExecStart=/path/to/your/install/directory/NotifierBot/Notifier
[Install]
WantedBy=multi-user.target
3. Start the service: `sudo service notifier start`
4. Optional: Enable automatic start on boot: `sudo service notifier enable`
Notifier Telegram Bot
This bot monitors websites and notifies you via Telegram, when they visually change.
The bot supports the following commands:
/helpLists all commands and their descriptions
/startLists all commands and their descriptions
/listLists all entries including their areas
/listurlsLists all entries including their websites
/info <name>Shows more information about a specific entry
/myidReturns your User ID
/add <name> <URL> [x y width height]Adds a new website with an optional screenshot area to the list
/remove <name>Removes an entry from the list
/update <name> <x> <y> <width> <height>Updates the screenshot area of an entry
/setdelay <name> <delay>Specifies a delay in seconds to wait after the website has been loaded
/setcaptureelement <name> [html element]Specifies which HTML element to capture
/setclickelement <name> [html element]Specifies which HTML element to click before taking the screenshot
/setwaitelement <name> [html element]Specifies which HTML element to wait for before taking the screenshot
/fetch <name>Takes a screenshot with the stored settings and sends it into this chat
/fetchurl <URL> [x y width height]Takes a screenshot of the given website and settings and sends it into this chat
/diff <name>Shows a picture highlighting the differences of the last website change, including extended information about the normalized cross correlation
/mute <name> <hours>Prevents change notifications for the given entry and duration
/unmute <name>Resumes notifications for the given entry
/listallLists all entries from all chats
/checkPerforms a manual check if any monitored website changed
/getpermissions [id]Returns the permission level of the author of the message, replied to or the user id provided
/setpermissions <level> [id]Sets the permission level of the author of the message, replied to or the user id provided
Installation (Linux)
Prerequisites
For the bot to work, you first need the following things:
converttool and comparing the screenshots usingcompare)capture-website-clito take the screenshotsgit clone https://github.com/iComputerfreak/NotifierBotcd NotifierBot/NotifierBotswift build -c releasecp .build/release/Notifier ..cd ..wget -O tools/telegram.sh https://raw.githubusercontent.com/fabianonline/telegram.sh/master/telegramchmod +x tools/telegram.shIf you completed all the steps above, your install directory should look like this:
Adding the urlwatch script to crontab
For the urlwatch script to be periodically executed, you have to create a cronjob for it.
crontab -e*/30 * * * * /path/to/your/install/directory/urlwatcher/urlwatcherThis executes the script every 30 minutes. To execute it e.g. every hour, use
0 * * * *(every time the minute is zero).Setup
Create the BOT_TOKEN file
For the scripts and the bot to work, you have to put your bot token in a file called BOT_TOKEN in your installation directory.
cdto your installation directoryecho YOUR_BOT_TOKEN > BOT_TOKENGive yourself admin permissions
/myidto retrieve your IDecho "YOUR_ID: admin" > /path/to/your/install/directory/NotifierBot/permissions.txt/getpermissions YOUR_IDNote: Modifying the permissions file requires a restart of the bot, but using
/setpermissions <level> <userid>does not.(Optional) Create a systemd service for the bot
sudo nano /etc/systemd/system/notifier.serviceYOUR_USER_ACCOUNTwith your linux user account name): ``` [Unit] Description=Telegram Notifier Bot After=network.target StartLimitIntervalSec=0 [Service] Type=simple Restart=always RestartSec=1 User=YOUR_USER_ACCOUNT WorkingDirectory=/path/to/your/install/directory/NotifierBot ExecStart=/path/to/your/install/directory/NotifierBot/Notifier[Install] WantedBy=multi-user.target