A Python-based Telegram bot that monitors your X-UI panel and sends periodic database status updates.
- 🔐 Secure credential management
- 🕒 Hourly database status updates
- 📊 Monitor X-UI panel status
- 🔄 Automatic reconnection
- 💾 Persistent storage of settings
- Python 3.7+
- Root access (for installation)
- Linux-based operating system
- Active Telegram Bot Token
curl -sSL https://raw.githubusercontent.com/yourusername/telegram-xui-bot/main/install.sh | sudo bash- Clone the repository:
git clone https://github.com/yourusername/telegram-xui-bot.git
cd telegram-xui-bot- Install dependencies:
python3 -m pip install -r requirements.txt-
Configure the bot:
- Edit
src/config.py - Replace
YOUR_BOT_TOKENwith your Telegram Bot Token
- Edit
-
Run the bot:
python3 src/bot.py-
Get a Telegram Bot Token:
- Message @BotFather on Telegram
- Create a new bot using
/newbot - Copy the provided token
-
Configure the bot:
- The token can be set during installation
- Or manually in
src/config.py
-
Start the bot:
- Send
/startto your bot on Telegram - Follow the setup prompts
- Send
-
Available commands:
/start- Begin setup process/status- Check monitoring status/cancel- Cancel current operation
Monitor and control the bot service:
# Check service status
systemctl status telegram-xui-bot
# View real-time logs
journalctl -u telegram-xui-bot -f
# Restart the service
systemctl restart telegram-xui-bot
# Stop the service
systemctl stop telegram-xui-bot
# Start the service
systemctl start telegram-xui-bottelegram-xui-bot/
├── src/
│ ├── bot.py # Main bot application
│ ├── config.py # Configuration settings
│ ├── handlers/ # Command handlers
│ │ ├── auth_handler.py
│ │ ├── status_handler.py
│ │ └── conversation_states.py
│ ├── services/ # Business logic
│ │ └── update_service.py
│ └── storage/ # Data persistence
│ └── credentials.py
├── install.sh # Installation script
├── requirements.txt # Python dependencies
└── README.md # Documentation
- Credentials are stored in
/opt/telegram-xui-bot/data/credentials.json - File permissions are set to 755 for the installation directory
- The service runs as root (required for system monitoring)
- Regular updates are recommended for security patches
-
Bot not responding:
# Check if service is running systemctl status telegram-xui-bot # View error logs journalctl -u telegram-xui-bot -e
-
Installation fails:
- Ensure you have root access
- Check system requirements
- Verify internet connectivity
-
Authentication issues:
- Confirm your bot token is correct
- Ensure X-UI panel credentials are valid
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Open an issue on GitHub
- Contact the maintainer
- python-telegram-bot for the Telegram Bot API wrapper
- The X-UI community for inspiration and feedback