Code Monkey home page Code Monkey logo

executor_bot's Introduction

Telegram Bot Script Executor

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.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Python 3.x
  • pip (Python package manager)
  • Virtual environment (recommended)

Installing

1. Clone the Repository

Start by cloning the repository to your local machine.

git clone <repository-url>
cd <repository-directory>

2. Set Up a Virtual Environment

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

3. Install Dependencies

With the virtual environment activated, install the required dependencies using:

pip install -r requirements.txt

4. Configure the Environment Variables

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

Running the Bot

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.

Usage

  • 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.

License

This project is licensed under the MIT License - see the LICENSE.md file for details. EOF

executor_bot's People

Contributors

dcorral avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.