This project contains a Telegram bot that executes predefined shell scripts located in a specified directory. It provides an interface through Telegram where authorized users can select and execute these scripts safely.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Python 3.x
- pip (Python package manager)
- Virtual environment (recommended)
Start by cloning the repository to your local machine.
git clone <repository-url>
cd <repository-directory>
It's recommended to use a virtual environment for Python projects to manage dependencies separately from your global Python installation.
To create a virtual environment, run:
python3 -m venv venv
Activate the virtual environment:
-
On Windows:
.\venv\Scripts\activate
-
On Unix or MacOS:
source venv/bin/activate
With the virtual environment activated, install the required dependencies using:
pip install -r requirements.txt
Copy the env-template
file to a new .env
file:
cp env-template .env
Then, open the .env
file and update the following configuration variables:
TOKEN
: Your Telegram bot token. You can obtain one by registering a new bot with BotFather on Telegram.THE_SCRIPTS_FOLDER
: The absolute path to the directory containing your.sh
script files.ALLOWED_CHAT_ID
: Your Telegram user ID or the ID of a group chat that is authorized to interact with the bot. You can get this ID by messaging userinfobot on Telegram.
Example .env
content:
TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
THE_SCRIPTS_FOLDER=/path/to/THE_SCRIPTS_FOLDER
ALLOWED_CHAT_ID=123456789
With the environment configured, run the bot using:
python main.py
The bot should now be running and responding to commands sent by the authorized user or group chat.
- Send
/start
to the bot to receive a list of available scripts. - Select a script to execute it. The bot will ask for confirmation before execution.
- Confirm to execute the script or cancel the operation.
This project is licensed under the MIT License - see the LICENSE.md file for details. EOF