A Python script that monitors a Telegram bot's responsiveness by sending /check
commands and alerting specified users if the bot fails to respond within the timeout period.
- Monitors bot response time
- Sends alerts to specified users when bot is unresponsive
- Auto-restarts on crashes
- Rate limit handling
- Comprehensive error logging
- Python 3.7+
- Telegram account
- Telegram API credentials
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file with your credentials based on thesample.env
file.
- Visit Telegram API
- Log in with your phone number
- Go to 'API development tools'
- Create a new application
- Copy the
api_id
andapi_hash
to your.env
file
Run the script:
python main.py
The script will:
- Connect to Telegram using your credentials
- Send
/check
command to the target bot every 10 seconds - Wait up to 60 seconds for a response
- Send alerts to specified users if no response is received
- Auto-restart if any errors occur
To get a user's Telegram ID:
- Send a message to
@userinfobot
on Telegram - It will reply with the user's ID
- Add the ID to the
ALERT_USER_IDS
in your.env
file (comma-separated for multiple users)