Skip to content

The Raspberry Pi Telegram Bot is a lightweight, customizable bot built for Raspberry Pi users. It leverages Python and the Telegram Bot API to enable users to execute commands, receive updates, and automate processes from their Telegram account. Ideal for DIY projects, home automation, and remote control applications, this bot is easy to set up .

License

Notifications You must be signed in to change notification settings

GraveEaterMadison/Raspberry_pi_telegram_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raspberry Pi Telegram Bot

Python Raspberry Pi License: MIT

A versatile Telegram bot that runs on a Raspberry Pi, allowing you to control your Pi and interact with it remotely via Telegram. This project is designed to help you automate tasks, gather system information, and manage your Raspberry Pi from anywhere.

Table of Contents

Features

  • Remote Access: Control your Raspberry Pi remotely via Telegram.
  • System Monitoring: Fetch real-time system information such as CPU usage, memory stats, and disk space.
  • Automation: Set up custom commands to automate various tasks.
  • Modular Design: Easily extend functionality by adding new modules to the bot.
  • Secure: Uses Telegram's secure API for bot communication, with customizable access controls.

Installation

Prerequisites

  • A Raspberry Pi running a Debian-based OS (e.g., Raspbian).
  • Python 3.11 installed.
  • A Telegram account to create a bot.

Steps

  1. Clone the Repository:

    git clone https://github.com/GraveEaterMadison/Raspberry_pi_telegram_bot.git
    cd Raspberry_pi_telegram_bot
  2. Install Required Dependencies:

    pip install -r requirements.txt
  3. Create a Telegram Bot:

    • Message @BotFather on Telegram.
    • Use the /newbot command to create your bot and get the API token.
  4. Configure the Bot:

    • Copy the config.py and add your bot token and other configuration details.
  5. Run the Bot:

    python main.py

Configuration

Edit the config.py file to set your bot's configuration. Here's a breakdown of the essential settings:

  • TOKEN: Your Telegram bot token provided by BotFather.
  • AUTHORIZED_USERS: A list of Telegram user IDs allowed to interact with the bot.
TOKEN = 'YOUR_TELEGRAM_BOT_TOKEN'
AUTHORIZED_USERS = [123456789, 987654321]

Usage

Once the bot is up and running, you can start sending commands via Telegram. The bot will respond with the requested information or perform the specified task.

Commands

You can add more commands by modifying the main.py file and defining new functions to handle those commands.

Example Commands

Here are some example commands you can use:

  • Start the bot:

    /start
    
  • List all available command:

    /help
    
  • Reboot the Raspberry Pi:

    /reboot
    
  • Shutdown the Raspberry Pi:

    /shutdown
    
  • execute command remotely:

    /exec
    
  • Check CPU usage:

    /cpu
    
  • Check ram usage:

    /ram
    
  • Check disk space:

    /disk
    
  • Turn on an LED connected to GPIO pin:

    /gpio on
    
  • Turn off an LED connected to GPIO pin:

    /gpio oFF
    

File Structure

Raspberry_pi_telegram_bot/
│
├── handlers
├── utils
├── main.py              # Main bot script
├── config.py           # Sample configuration file
├── requirements.txt    # Python dependencies
├── README.md           # This README file
└── LICENSE             # License file

Contributing

Contributions are welcome! Please fork this repository and submit a pull request with your improvements or bug fixes.

License

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

Acknowledgements

This project was inspired by various online resources and tutorials that guide the creation of Raspberry Pi-based Telegram bots.

You can add custom commands by creating new handlers in the handlers/ directory.

Developed with ❤️ by GraveEaterMadison

You can copy and paste this content into your `README.md` file under the relevant sections. Let me know if you need further adjustments!

About

The Raspberry Pi Telegram Bot is a lightweight, customizable bot built for Raspberry Pi users. It leverages Python and the Telegram Bot API to enable users to execute commands, receive updates, and automate processes from their Telegram account. Ideal for DIY projects, home automation, and remote control applications, this bot is easy to set up .

Topics

Resources

License

Stars

Watchers

Forks

Languages