Skip to content

๐Ÿ“ A powerful Telegram bot for organizing, browsing, and sharing media collections. Features secure sharing codes, a full admin panel, real-time batch upload status, and support for mixed media types (Photos, Videos, Documents).

License

Notifications You must be signed in to change notification settings

Omer-Dahan/Collections-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

62 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ Collections Telegram Bot

Python Telegram SQLite

A powerful Telegram bot that helps you store, organize, browse, share, and manage collections of media and text.

๐Ÿ‡ฎ๐Ÿ‡ฑ ืขื‘ืจื™ืช โ€ข ๐Ÿ‡บ๐Ÿ‡ธ English


โœจ Key Features

Feature Description
๐Ÿ“ฆ Collections Create and manage multiple media collections
โ˜๏ธ Media Storage Store photos, videos, documents, audio, and text
๐Ÿ”— Secure Sharing Share collections via unique codes with access tracking
๐Ÿ“Š Batch Status Real-time updates during mass uploads
๐Ÿ›ก๏ธ Admin Panel Full user management and analytics dashboard
๐Ÿ“ Auto-Captions Automatically saves captions with media
๐Ÿ‘๏ธ Browsing Native Telegram UI for browsing stored content
โšก Performance Asynchronous design with flood protection

๐Ÿš€ Installation

1๏ธโƒฃ Clone the project

git clone https://github.com/Omer-Dahan/Collections-bot
cd Collections-bot

2๏ธโƒฃ Create virtual environment

# Windows
python -m venv venv
venv\Scripts\activate

# Linux/macOS
python3 -m venv venv
source venv/bin/activate

3๏ธโƒฃ Install dependencies

pip install -r requirements.txt

4๏ธโƒฃ Configuration

Create a config.py file based on the example below:

BOT_TOKEN = "your_bot_token_here"
ADMIN_IDS = [123456789]  # List of admin Telegram IDs

# Optional custom settings
MAX_CAPTION_LENGTH = 800

5๏ธโƒฃ Run the bot

python bot.py

๐Ÿค– Usage

Using the bot is simple and intuitive. Here is the basic workflow:

  1. Start: Send /start to open the main menu.
  2. Create Collection: Select "๐Ÿ“ New Collection", name it, and it will become "active".
  3. Save Content: Any message you send to the bot (photo, video, file, text) will be automatically saved to the active collection.
  4. Manage: Use the menus to browse, delete, or share your collections.

๐ŸŽฎ Available Commands

Command Description
/start ๐Ÿ  Return to main menu and show status
/new_collection ๐Ÿ†• Create a new collection quickly (e.g. /new_collection MyTops)
/list_collections ๐Ÿ“‹ List your collections and select an active one
/browse ๐Ÿ“‚ Browse files stored in your collections
/manage_collections โš™๏ธ Advanced management (Delete, Export, Share)
/remove ๐Ÿ—‘๏ธ Activate single item deletion mode
/id_file ๐Ÿ†” Get the File ID of a file (Developer tool)
/access ๐Ÿ”‘ Access a shared collection via code (e.g. /access CODE123)

๐Ÿ”„ Workflow

graph TD
    A[Start /start] --> B{Main Menu}
    B -->|New Collection| C[Create Collection]
    B -->|Select Existing| D[Set Active Collection]
    B -->|Browse| E[View Items]
    B -->|Manage| F[Options: Export/Delete/Share]
    
    C --> G[๐Ÿ“ฅ Collecting Mode]
    D --> G
    
    G -->|User sends file| H[DB Store]
    H -->|Feedback| G
    
    F -->|Share| I[Generate Code]
    I -->|Send to Friend| J[User B enters Code]
    J --> E
Loading

๐Ÿงฑ Project Structure

Collections-bot/
โ”œโ”€โ”€ ๐Ÿ“„ bot.py               # ๐Ÿง  Main bot entry point
โ”œโ”€โ”€ ๐Ÿ“„ admin_panel.py       # ๐Ÿ›ก๏ธ Admin interface & stats
โ”œโ”€โ”€ ๐Ÿ“„ db.py                # ๐Ÿ—„๏ธ Database operations
โ”œโ”€โ”€ ๐Ÿ“„ utils.py             # ๐Ÿ› ๏ธ Helper functions
โ”œโ”€โ”€ ๐Ÿ“„ config.py            # โš™๏ธ Configuration (Sensitive)
โ”œโ”€โ”€ ๐Ÿ“‚ handlers/            # ๐ŸŽฎ Logic handlers
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ commands.py      # /start, /help, etc.
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ callbacks.py     # Button interactions
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ messages.py      # Media & text handling
โ”œโ”€โ”€ ๐Ÿ“„ constants.py         # ๐Ÿ“ Constant values
โ”œโ”€โ”€ ๐Ÿ“„ message_tracker.py   # ๐Ÿ“จ Message tracking
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt     # ๐Ÿ“ฆ Dependencies
โ”œโ”€โ”€ ๐Ÿ“„ run_bot.bat          # ๐Ÿš€ Windows runner
โ”œโ”€โ”€ ๐Ÿ“„ LICENSE.txt          # ๐Ÿ“œ GPL-3.0
โ””โ”€โ”€ ๐Ÿ“„ README.md            # You are here! ๐Ÿ‘‹

๐Ÿ—„๏ธ Database Architecture

The bot uses SQLite for efficient local storage. Tables are automatically created on first run:

  • Collections: Stores collection metadata
  • Items: Links media files to collections
  • Users: User profiles and stats
  • Shared_Collections: Active share codes and permissions
  • Access_Logs: Tracks who accessed shared content

๐Ÿ›ก๏ธ Security & Privacy

  • ๐Ÿ”’ Private by Default: Collections are private unless explicitly shared.
  • ๐Ÿ”‘ Unique Codes: Sharing uses randomly generated unique access codes.
  • ๐Ÿšซ Access Control: Owners can revoke share codes at any time.
  • ๐Ÿ“ Logging: Comprehensive logging of user actions and errors.

โš ๏ธ Important Notes

Important

Telegram Limits: File uploads are subject to Telegram size limits (up to 2GB per file, or 4GB for Premium subscribers).

Warning

Data Privacy: The database (bot_data.db) is stored locally. Deleting this file will result in losing all collection data! Regular backups are recommended.

Tip

Efficiency: The bot stores only the File ID of files, not the files themselves, saving significant server storage and ensuring fast performance.

Note

Deletion: Deleting a message from the chat does not remove it from the bot's database. Use the bot's deletion tools to permanently remove items.


๐Ÿ“œ License

This project is licensed under GNU General Public License v3.0.

Any redistribution or modification must comply with the terms of this license.


โš ๏ธ Disclaimer

This bot is intended for lawful use only. Responsibility for downloaded content and compliance with local laws and platform policies lies solely with the user.


Made with โค๏ธ by Omer

About

๐Ÿ“ A powerful Telegram bot for organizing, browsing, and sharing media collections. Features secure sharing codes, a full admin panel, real-time batch upload status, and support for mixed media types (Photos, Videos, Documents).

Topics

Resources

License

Stars

Watchers

Forks

Languages