Skip to content

🛡️✉️ Message Guardian Bot is a Telegram bot that safeguards group messages by tracking edits and deletions, ensuring no message is lost. Built with telethon and SQLAlchemy, it offers seamless management and restoration of chat history.

License

Notifications You must be signed in to change notification settings

JM1k1/MessageGuardianBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


QRKot

Message Guardan


Message Guardian Bot is a Telegram bot designed to manage messages in groups, including saving messages, tracking changes, and restoring deleted messages. The bot is built using the Telethon framework for handling Telegram updates and SQLAlchemy for database interactions.

Table of Contents

Installation

  1. Clone this repository:
git clone git@github.com/JM1k1/MessageGuardianBot.git
  1. Cd into MessageGuardianBot:
cd MessageGuardianBot
  1. Install Python 3.11+
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3 -y
sudo apt install python3-pip -y
  1. Install Poetry:
curl -sSL https://install.python-poetry.org | python3 -
  1. Install all dependencies:
poetry install

Usage

  1. Configure your environment variables. Create a .env file in the root directory of the project and add the following:
TELEGRAM_TOKEN=YOUR_TOKEN
FORWARD_CHAT_ID=YOUR_FORWARD_CHAT_ID
DATABASE_ENGINE=sqlite+aiosqlite:///database.db
  1. Initialize the database:
poetry run alembic upgrade head
  1. Run the bot:
poetry run python /src/application.py

Project Structure

  • handlers.py: Handlers for processing different types of messages.
  • logs/: Directory containing logs.
  • logger.py: Configures logging for the application.
  • settings.py: Contains configuration settings, including the bot token.
  • crud.py: Contains CRUD operations for interacting with the database.
  • database.py: Database setup and session management.
  • models.py: SQLAlchemy models for the database schema.
  • env.py: Alembic environment configuration file.
  • script.py.mako: Template for new migration scripts.
  • versions/: Directory containing migration scripts.

License

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

Contributors

For anyone who is interested in contributing to MessageGuardianBot, please make sure you fork the project and make a pull request.

About

🛡️✉️ Message Guardian Bot is a Telegram bot that safeguards group messages by tracking edits and deletions, ensuring no message is lost. Built with telethon and SQLAlchemy, it offers seamless management and restoration of chat history.

Topics

Resources

License

Stars

Watchers

Forks