Skip to content

raulmouzo/Simple_telegram_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple Telegram Bot

Phone Mockup

This project is a Telegram bot that responds to text messages. Based on:

Requirements

Before running the bot, ensure you have the following:

  • Python 3.7 or higher.
  • Pip (Python package manager).

Installation

  1. Clone this repository to your machine:

    git clone https://github.com/your_username/your_repository.git
    cd your_repository
  2. Install the necessary dependencies:

    pip install python-telegram-bot==21.6 sagemcom-api psutil   

Creating a Telegram Bot

  1. Open Telegram and search for the user BotFather.
  2. Start a conversation with BotFather and use the command /newbot to create a new bot.
  3. Follow the prompts to name your bot and give it a unique username. After creation, you will receive a token that you will need to access the Telegram Bot API.
  4. To enable the bot to receive messages in groups, you need to disable privacy mode. You can do this by sending the command /setprivacy to BotFather and selecting the bot you created. Choose the option to disable privacy mode.

Running the Bot

  1. Open the bot script (e.g., bot.py) and replace YOUR_BOT_TOKEN with the token you received from BotFather.

  2. To run the bot, use the following command:

    python telegram_bot.py

Adding the Bot as a Service

To run your bot as a service at system startup, you can create a systemd service file.

  1. Create a new service file:

    sudo nano /etc/systemd/system/telegram-bot.service
  2. Add the following content to the file, replacing /path/to/your/bot.py with the actual path to your bot script:

    [Unit]
    Description=Telegram Bot
    
    [Service]
    ExecStart=/usr/bin/python3 /path/to/your/bot.py
    WorkingDirectory=/path/to/your/dir
    Restart=always
    User=your_username
    
    [Install]
    WantedBy=multi-user.target
  3. Save the file and exit the editor.

  4. Enable and start the service:

    sudo systemctl enable telegram-bot.service
    sudo systemctl start telegram-bot.service
  5. To check the status of your bot, you can run:

    sudo systemctl status telegram-bot.service

About

Simple Telegram bot that interacts with Sagemcom devices, retrieving information about connected devices, showing VPN details, CPU, RAM, and storage usage, and allowing you to reboot or power off the device.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages