A Telegram bot for remotely starting services on your machine. This bot provides a secure, password-protected interface to execute start.sh scripts in service directories.
- 🔐 Password authentication
- 🚀 Start services remotely via Telegram
- 📋 Automatic service discovery
- 🔄 Refresh service list
- 💬 Interactive button-based interface
- Python 3.7 or higher
- A Telegram account
- Services with
start.shscripts in the parent directory
-
Clone this repository:
git clone https://github.com/Chuwee/botmaster.git cd botmaster -
Install dependencies:
pip install -r requirements.txt
-
Create a Telegram bot:
- Open Telegram and search for @BotFather
- Send
/newbotand follow the instructions - Copy the bot token provided by BotFather
-
Configure the bot:
cp .env.example .env # Edit .env and add your bot token and passwordOr set environment variables directly:
export TELEGRAM_BOT_TOKEN="your_bot_token_here" export BOT_PASSWORD="your_secure_password_here"
python3 bot.pyOr make it executable and run:
chmod +x bot.py
./bot.py- Start a conversation with your bot in Telegram
- Send
/startcommand - Enter the password you configured
- Select a service from the list of buttons
- The bot will execute the
start.shscript for that service
/start- Authenticate and show available services/help- Show help message/logout- Log out from the bot
The bot looks for services in the parent directory (../). Each service should be a directory containing a start.sh script.
Example structure:
/home/user/projects/
├── botmaster/ # This bot
│ ├── bot.py
│ └── requirements.txt
├── service1/ # Service 1
│ └── start.sh
├── service2/ # Service 2
│ └── start.sh
└── my-app/ # Service 3
└── start.sh
The bot will discover and display: service1, service2, and my-app.
- Keep your bot token secure and never commit it to version control
- Use a strong password for authentication
- The bot stores authenticated user IDs in memory (cleared on restart)
- Only authorized users can execute services after authentication
- Service execution has a 30-second timeout to prevent hanging
Bot doesn't start:
- Check that
TELEGRAM_BOT_TOKENis set correctly - Verify your internet connection
No services found:
- Ensure service directories are in the parent directory (
../) - Verify each service has a
start.shfile - Check that
start.shfiles have execute permissions
Service fails to start:
- Check the error message in Telegram
- Verify the
start.shscript works when run manually - Check permissions on the service directory and script
MIT