Skip to content

OnlyNoco/RenameBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 RenameBot

Python Version License Telegram Bot

A powerful Telegram bot that renames files, videos, and documents with custom thumbnails and advanced media processing capabilities.

Features β€’ Installation β€’ Configuration β€’ Usage β€’ Deployment


πŸ“‹ Overview

RenameBot is a feature-rich Telegram bot designed to help users rename their media files effortlessly. With support for videos, documents, custom thumbnails, and quality optimization, this bot provides a seamless file management experience directly in Telegram.

Whether you need to rename files, compress thumbnails, or batch process media, RenameBot has you covered with an intuitive interface and powerful backend.


✨ Features

🎯 Core Features

  • πŸ“ File Renaming - Rename videos and documents with custom names
  • πŸ–ΌοΈ Custom Thumbnails - Set and manage custom thumbnail images
  • πŸ“₯ Media Processing - Download, process, and upload files seamlessly
  • ⚑ Progress Tracking - Real-time progress bars for all operations
  • πŸ” Secure Operations - Safe file handling with automatic cleanup

πŸš€ Advanced Features

  • πŸ“Š Batch Processing - Process multiple files efficiently
  • 🎨 Thumbnail Optimization - Automatic image compression and resizing
  • πŸ’Ύ Smart Storage - Temporary file management with auto-cleanup
  • πŸ› οΈ Customizable Settings - Configurable download directory and quality settings
  • πŸ“± User-Friendly Interface - Intuitive inline buttons and clear instructions

πŸ›‘οΈ Administrator Tools

  • /start - Check bot status and get started
  • /help - View available commands and features
  • /report - Report issues to the bot administrator
  • /stats - View system statistics and resource usage

πŸš€ Quick Start

Prerequisites

Local Installation

  1. Clone the Repository
git clone https://github.com/OnlyNoco/RenameBot.git
cd RenameBot
  1. Install Dependencies
pip install -r requirements.txt
  1. Configure the Bot
cp sample_config.py config.py
# Edit config.py with your credentials
  1. Run the Bot
python main.py

βš™οΈ Configuration

Environment Variables

Create a config.py file based on sample_config.py with the following variables:

Variable Type Description
BOT_TOKEN string Your Telegram bot token from BotFather
API_ID integer Telegram API ID from my.telegram.org
API_HASH string Telegram API Hash from my.telegram.org
OWNER_ID integer Your Telegram user ID (admin)
WORKER integer Number of worker threads (default: 4)
PORT integer Port for web server (default: 8080)
DB_URL string MongoDB connection URL
DB_NAME string MongoDB database name
DOWNLOAD_DIR string Directory for temporary downloads (default: ./downloads)
START_MSG string Custom welcome message
ABOUT_MSG string About bot message
CMD_MSG string Commands help message
START_PIC list URLs for start command media

Example Configuration

BOT_TOKEN = "your_bot_token_here"
API_ID = 26254064
API_HASH = "your_api_hash_here"
OWNER_ID = 5296584067
WORKER = 4
PORT = 8080
DB_URL = "mongodb+srv://username:password@cluster.mongodb.net"
DB_NAME = "RenameBot"
DOWNLOAD_DIR = "./downloads"

πŸ“– Usage

User Commands

  1. Start the Bot

    • Use /start to initiate the bot and see the welcome message
  2. Send a File

    • Send a video or document file to the bot
    • The bot will ask for a custom filename
  3. Set Thumbnail

    • Send an image to the bot in private chat
    • The bot will save it as your custom thumbnail
  4. Rename Files

    • Send media with the custom thumbnail already set
    • Reply with the desired filename (without extension)
    • Choose between document or video format
    • The bot will process and send the renamed file
  5. Get Help

    • Use /help to view all available commands
    • Use /report to report issues to the admin

Example Workflow

1. /start                          β†’ Bot sends welcome message
2. Send photo                       β†’ Bot saves as thumbnail
3. Send video file                 β†’ Bot asks for filename
4. Reply with "MyVideo"            β†’ Bot asks for format
5. Click "Video" button            β†’ Bot processes and sends file

πŸ“ Project Structure

RenameBot/
β”œβ”€β”€ main.py                 # Entry point and bot initialization
β”œβ”€β”€ bot.py                  # Bot class and core configuration
β”œβ”€β”€ config.py              # Configuration (create from sample_config.py)
β”œβ”€β”€ sample_config.py       # Configuration template
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ Dockerfile             # Docker configuration
β”œβ”€β”€ Procfile              # Deployment configuration
β”œβ”€β”€ LICENSE               # MIT License
β”œβ”€β”€ README.md             # This file
β”‚
β”œβ”€β”€ database/
β”‚   └── database.py       # MongoDB operations and user management
β”‚
β”œβ”€β”€ plugins/
β”‚   β”œβ”€β”€ __init__.py       # Web server initialization
β”‚   β”œβ”€β”€ route.py          # Web routing
β”‚   β”œβ”€β”€ start.py          # Start command handler
β”‚   β”œβ”€β”€ report.py         # Issue reporting
β”‚   β”‚
β”‚   └── core/
β”‚       β”œβ”€β”€ main_decorator.py     # Main file processing logic
β”‚       β”œβ”€β”€ thumb.py              # Thumbnail management
β”‚       β”œβ”€β”€ cleanup.py            # Temporary file cleanup
β”‚       └── progressbar.py        # Progress bar utilities
β”‚
└── thumbnails/           # User thumbnail storage directory

πŸ”§ Technology Stack


🌐 Deployment

🐳 Docker Deployment

docker build -t renamebot .
docker run -e BOT_TOKEN="your_token" -e API_ID="your_id" \
  -e API_HASH="your_hash" -e OWNER_ID="your_id" renamebot

☁️ Heroku Deployment

Deploy to Heroku

  1. Click the button above
  2. Fill in the environment variables
  3. Deploy and monitor logs

🎯 Render Deployment

Deploy to Render

Steps:

  1. Connect your GitHub repository
  2. Select Python as runtime
  3. Set build command: pip install -r requirements.txt
  4. Set start command: python main.py
  5. Add environment variables:
    • BOT_TOKEN
    • API_ID
    • API_HASH
    • OWNER_ID
    • DB_URL
    • DB_NAME
  6. Deploy

πŸš€ Koyeb Deployment

Deploy to Koyeb

Steps:

  1. Click deploy button above
  2. Connect your GitHub account
  3. Select this repository
  4. Configure environment variables:
    • BOT_TOKEN - Your Telegram bot token
    • API_ID - Telegram API ID
    • API_HASH - Telegram API Hash
    • OWNER_ID - Your Telegram user ID
    • DB_URL - MongoDB connection string
    • DB_NAME - Database name
    • PORT - Web server port (8080)
  5. Click "Deploy" and wait for completion

πŸ’» VPS/Local Deployment

Requirements:

  • Linux VPS or Local Machine
  • Python 3.11+
  • MongoDB access

Installation:

# Clone repository
git clone https://github.com/OnlyNoco/RenameBot.git
cd RenameBot

# Install dependencies
pip3 install -U -r requirements.txt

# Configure
cp sample_config.py config.py
nano config.py  # Edit with your credentials

# Run bot
python3 main.py

Using Systemd (for persistent running):

sudo nano /etc/systemd/system/renamebot.service

Add:

[Unit]
Description=RenameBot
After=network.target

[Service]
Type=simple
User=your_user
WorkingDirectory=/path/to/RenameBot
ExecStart=/usr/bin/python3 /path/to/RenameBot/main.py
Restart=always

[Install]
WantedBy=multi-user.target

Then run:

sudo systemctl daemon-reload
sudo systemctl enable renamebot
sudo systemctl start renamebot

πŸ› Troubleshooting

Bot Not Responding

  • Verify BOT_TOKEN is correct
  • Check internet connection
  • Ensure bot is running: python main.py
  • Check logs for error messages

File Download Issues

  • Verify bot has enough disk space
  • Check DOWNLOAD_DIR permissions
  • Ensure MongoDB is connected

Thumbnail Not Saving

  • Send image as file, not as photo
  • Ensure image file is under 5MB
  • Check directory permissions for thumbnails/

Database Connection Issues

  • Verify DB_URL is correct and accessible
  • Check MongoDB cluster IP whitelist
  • Ensure network connectivity
  • Test connection string with MongoDB Compass

🀝 Contributing

Contributions are welcome! Feel free to:

  • πŸ› Report bugs via /report command
  • πŸ’‘ Suggest new features
  • πŸ”§ Submit pull requests
  • πŸ“š Improve documentation

πŸ“ License

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

You are free to:

  • βœ… Use privately
  • βœ… Modify and distribute
  • βœ… Host yourself

We only ask that you provide proper credit by linking to the original repository.


πŸ‘¨β€πŸ’» Author & Credits

🌟 OnlyNoco

Portfolio: onlynoco.vercel.app
Telegram: @OnlyNoco
GitHub: github.com/OnlyNoco


πŸ“’ My Channels

Join our community for more amazing bots and content:


πŸ™ Special Thanks


πŸ“ž Support

For issues, questions, or suggestions:

  • Use /report command in the bot to report problems
  • Contact @OnlyNoco on Telegram
  • Open an issue on GitHub
  • Join support group for community help

⬆ Back to Top

Made with ❀️ by OnlyNoco

Python Telegram MongoDB License

About

Telegram bot for renaming media files with custom thumbnails, batch processing, and advanced file management capabilities.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages