https://github.com/graveeatermadison/raspberry_pi_telegram_bot
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 .
https://github.com/graveeatermadison/raspberry_pi_telegram_bot
bot home-automation iot notifications python-library raspberry-pi-4b sensors telegram-bot
Last synced: 8 months ago
JSON representation
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 .
- Host: GitHub
- URL: https://github.com/graveeatermadison/raspberry_pi_telegram_bot
- Owner: GraveEaterMadison
- License: mit
- Created: 2024-08-23T05:33:50.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-15T15:27:35.000Z (about 1 year ago)
- Last Synced: 2025-05-15T16:39:47.246Z (about 1 year ago)
- Topics: bot, home-automation, iot, notifications, python-library, raspberry-pi-4b, sensors, telegram-bot
- Language: Python
- Homepage:
- Size: 106 KB
- Stars: 13
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Raspberry Pi Telegram Bot


[](https://opensource.org/licenses/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](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Commands](#commands)
- [File Structure](#file-structure)
- [Contributing](#contributing)
- [License](#license)
- [Acknowledgements](#acknowledgements)
## 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**:
```bash
git clone https://github.com/GraveEaterMadison/Raspberry_pi_telegram_bot.git
cd Raspberry_pi_telegram_bot
```
2. **Install Required Dependencies**:
```bash
pip install -r requirements.txt
```
3. **Create a Telegram Bot**:
- Message [@BotFather](https://t.me/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**:
```bash
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.
```python
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**:
```text
/start
```
- **List all available command**:
```text
/help
```
- **Reboot the Raspberry Pi**:
```text
/reboot
```
- **Shutdown the Raspberry Pi**:
```text
/shutdown
```
- **execute command remotely**:
```text
/exec
```
- **Check CPU usage**:
```text
/cpu
```
- **Check ram usage**:
```text
/ram
```
- **Check disk space**:
```text
/disk
```
- **Turn on an LED connected to GPIO pin**:
```text
/gpio on
```
- **Turn off an LED connected to GPIO pin**:
```text
/gpio oFF
```
### File Structure
```bash
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](https://github.com/GraveEaterMadison/Raspberry_pi_telegram_bot/blob/main/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](https://github.com/GraveEaterMadison)
```vbnet
You can copy and paste this content into your `README.md` file under the relevant sections. Let me know if you need further adjustments!
```