MCPcopy Create free account
hub / github.com/TechifyBots/Rename-Bot

github.com/TechifyBots/Rename-Bot @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
120 symbols 428 edges 13 files ⚖ Apache-2.0 1 documented · 1% ● updated 6d ago★ 42

Browse by type

⨍ Functions 113◇ Types & classes 6↳ Endpoints 1
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

A powerful, open-source, and feature-rich Telegram bot designed to rename, customize, and transform files effortlessly with support for custom thumbnails, metadata, captions, and video conversion.

⚡ Fast • 📝 Flexible • 🖼️ Customizable

Last Commit

GitHub Stars GitHub Forks

Repo Size

divider

📑 Table of Contents


🌸 Overview

Rename Bot is a powerful Telegram file management bot that goes far beyond simple renaming. It combines 4GB file support, premium plans, thumbnails, metadata, captions, and file conversion into one convenient Telegram-based workflow.

💡 Take full control of your files with powerful customization tools.

🤔 Why Choose This Project?

  • ⚡ Fast & Powerful — Process and rename files quickly with support for large files.
  • 🎨 Highly Flexible — Customize your files with powerful options tailored to your needs.
  • 💎 Premium Ready — Built-in plans and premium features for enhanced capabilities.
  • 🚀 Easy to Deploy — Ready for self-hosting across multiple popular platforms.

🔄 How It Works

  1. 📤 Send Your File — Upload the file you want to rename or process.
  2. ⚙️ Choose Your Options — Configure your filename and preferred customization settings.
  3. 🔄 Let the Bot Process — The bot applies your selected settings automatically.
  4. 📥 Get the Result — Receive your customized file back through Telegram.

📜 Architecture

Runtime overview

flowchart TB
    subgraph TG["Telegram"]
        U["👤 User"]
        API["☁️ Telegram API

(MTProto)"]
        CH["📢 Channels

BIN / LOG / FSUB"]
    end
    subgraph PROC["bot.py — one process"]
        MAIN["🤖 TechifyBots client

bot token · workers=200 · 50 xmit"]
        USER["👤 app client (file_rename)

STRING_SESSION · 4GB uploads"]
        WEB["🌐 aiohttp web server

:$PORT → welcome.html"]
        MW["🛡️ middleware chain

maintenance → fsub → user-mw"]
        FEAT["⚙️ feature plugins

rename · admin · plans · metadata"]
    end
    subgraph DATA["MongoDB — Rename_Bot"]
        CDB[("👥 user

profile + quota")]
        PDB[("💎 premium

expiry keyed by id")]
        JDB[("🔐 join_requests

+ fsub_cache")]
        SDB[("🔧 settings

maintenance flag")]
    end
    U <--> API
    API <--> MAIN & USER
    MAIN --> CH
    USER --> CH
    MAIN --> MW --> FEAT
    FEAT <--> CDB & PDB
    MW <--> JDB & SDB
    WEB --> CDB & PDB

Two Telegram clients share the process: the main bot client handles all commands, and an optional user-session client (STRING_SESSION) uploads files >2GB. The aiohttp status page lives in the same process on $PORT.

Request pipeline (Pyrogram handler groups)

flowchart LR
    M["📩 any update"] --> G1["🚧 maintenance

group -1

drop + notice"]
    G1 -->|bot alive| G2["🔐 fsub gate

group -10

join check"]
    G2 -->|member| G3["👤 user middleware

register · ban check"]
    G3 --> OK["✅ feature handler

rename · admin · plans"]
    G1 -->|under maintenance| STOP1["⛔ stopped"]
    G2 -->|not joined| STOP2["🔒 join prompt"]
    G3 -->|banned| STOP3["🚫 banned notice"]

Earlier groups run first and StopPropagation halts the chain — maintenance blocks everything (except bypass IDs), force-subscribe blocks non-members, banned users never reach features.

Rename flow

flowchart TB
    S["📤 user sends file"] --> INFO["📋 rename_start

media info + ForceReply"]
    INFO --> NAME["✏️ refunc

new name → type buttons"]
    NAME --> CB["🔘 upload# callback

document · video · audio"]
    CB --> DL["⬇️ download to Renames/"]
    DL --> META{"🏷️ metadata mode?"}
    META -->|on| FF["🎞️ ffmpeg copy-codec

+ titles → Metadata/"]
    META -->|off| UP["⬆️ upload"]
    FF --> UP
    UP --> TH["🖼️ thumbnail

custom or media · 320px"]
    TH --> BIG{"📦 >2GB?"}
    BIG -->|yes| U4["👤 user-session upload

→ BIN + user, cleanup"]
    BIG -->|no| U2["🤖 bot upload

→ BIN copy, cleanup"]

Downloads land in Renames/, metadata rewrites in Metadata/, every path is cleaned via remove_path. Premium daily quota is reserved before download and refunded on failure.

Web status page

flowchart LR
    H["🔄 GET /"] --> GS["📊 get_status()

cached counts 60s"]
    H --> SP["🚀 network_speed_label()

Ookla · cached 10min"]
    GS & SP --> T["📝 fill 17 placeholders

welcome.html"]
    T --> R["🌐 styled dashboard"]

Tech visuals

Core stack

Kurigram aiohttp ffmpeg Ookla uvloop


📝 Tech Stack

Layer Technology Version Role
Language Python 3.14.7 (python:3.14-slim in Docker) Async runtime, pinned in .python-version
Telegram Kurigram (+ TgCryptoRust) 2.2.26 / 1.3.1 Pyrogram fork — bot + user-session clients, workers=200
Web aiohttp 3.14.3 Status dashboard (/, 17-placeholder template)
Database MongoDB (pymongo AsyncMongoClient) 4.18.1 user (profile + quota) · premium (expiry keyed by id, indexed) · join_requests · fsub_cache · settings — one shared client
Media ffmpeg / ffprobe system (Docker-baked) Duration probe, copy-codec metadata rewrite, 320px thumbnails (Pillow 12.3.0)
Loop uvloop 0.22.1 Fast event loop, stdlib fallback
Metrics psutil + Ookla speedtest 7.2.2 CPU/RAM/disk + live network label (10-min cache)
Config python-dotenv 1.2.3 14 env vars (config.py ↔ app.json ↔ render.yaml, CI-checked)
CI/CD GitHub Actions + CodeQL + Dependabot — build · audit · validate gates, weekly CodeQL + pip updates
Deploy Docker · Heroku · Render · Koyeb/Railway — Dockerfile · app.json · render.yaml in repo

Single-process design: bot + optional 4GB user client + web server share one event loop and one Mongo client — no inter-service wiring, SIGINT/SIGTERM graceful shutdown.


✨ Features

  • ⚡ Fast File Renaming — Rename files quickly with an efficient Telegram-based workflow.
  • 📦 4GB File Support — Process large files with upgraded 4GB support.
  • 💎 Premium Plans — Offer upgraded limits and premium capabilities for users.
  • 🖼️ Thumbnail Customization — Set permanent custom thumbnails for your files.
  • 📝 File Customization — Personalize filenames, captions, prefixes, suffixes, and metadata.
  • 🔄 File Conversion — Convert supported files between video and document formats.
  • ♾️ Unlimited Renaming — Rename multiple files without a fixed renaming limit.
  • 📢 Broadcast System — Send announcements and updates to all registered users.
  • 🔐 Force Subscribe — Require users to join configured channels before using the bot.
  • 🛡️ User Management — Ban, unban, and manage users directly from the bot.
  • 🔧 Maintenance Mode — Temporarily pause bot services whenever maintenance is required.
  • 🚀 Multi-Platform Deployment — Deploy easily on Koyeb, Heroku, Railway, and Render.

🎥 Quick Start

New to this project?

Watch this short video to understand what the bot is, why it's useful, how it works, explore its key features, and learn the required configuration before deployment.

📺 Watch on YouTube: Project Overview


📝 Configuration

Variable Description
API_ID Telegram API ID
API_HASH Telegram API Hash
BOT_TOKEN Telegram Bot Token
DB_URL MongoDB URI
DB_NAME MongoDB database name (default: Rename_Bot)
ADMIN Telegram User ID
PIC Start image URL
BIN_CHANNEL Bin Channel
IS_FSUB Enable / Disable Force Subscribe
FSUB_EXPIRE Force Subscribe Expire Time
AUTH_CHANNELS Force Subscribe Channels
AUTH_REQ_CHANNELS Request FSUB Channels (membership verified live)
LOG_CHANNEL Log Channel
STRING_SESSION Session string required for 4GB file processing
PORT Web server port (default: 8080)

📝 Notes

💎 4GB Support — STRING_SESSION is optional. Add a Kurigram v2 String Session (Pyrogram-compatible) to enable 4GB file processing.

⚠️ Without STRING_SESSION, the bot will continue to work with its standard file-size limit.

📚 Setup Guides


🤖 Commands

👤 User Commands

start - Check Bot Alive.
setprefix - Set Your Prefix
seeprefix - See Your Prefix
delprefix - Delete Your Prefix
viewthumb - To View Current Thumbnail.
delthumb - To Delete Current Thumbnail.
setcaption - To Set A Custom Caption.
seecaption - To See Your Custom Caption.
delcaption - To Delete Custom Caption.
setsuffix - Set Your Suffix
seesuffix - See Your Suffix
delsuffix - Delete Your Suffix
plans - to check all available plans.
myplan - to check your active plan.
metadata - To set custom metadata.

🔒 Owner Commands

ban - ban a user.
unban - unban a user.
banned - list all banned users.
status - get bot statistics.
broadcast - Send message to users.
logs - get recent bot logs.
addpremium - add a user to premium
removepremium - remove a user from premium
restart - restart the bot.
maintenance - Toggle maintenance mode.
delreq - Clear pending force-subscribe join requests.

🚀 Deployment

Need help deploying this project? We've got you covered.

[!TIP] 📺 Complete Deployment Playlist — Follow the step-by-step video tutorials to get started.

▶ Watch on YouTube

Prerequisites

  • Python 3.14.7 (see .python-version; Docker uses python:3.14-slim)
  • ffmpeg on PATH (metadata + thumbnails; ffprobe too)
  • MongoDB database (URI for DB_URL)
  • Telegram API_ID / API_HASH / BOT_TOKEN, plus ADMIN user ID

Run locally

pip install -r requirements.txt
export API_ID=… API_HASH=… BOT_TOKEN=… ADMIN=… DB_URL=mongodb://localhost:27017 LOG_CHANNEL=…
python bot.py

Deploy targets (all wired in this repo)

Platform File Notes
Docker (any host) Dockerfile ffmpeg + Ookla speedtest baked in; CMD ["python", "bot.py"] (bot.py entrypoint)
Heroku app.json, Procfile, heroku.yml One-click via app.json; all 14 env vars declared
Render render.yaml (runtime: docker, health check /) Docker build of Dockerfile (ffmpeg + Ookla inside), autoDeploy: false; all 14 env vars declared
Koyeb / Railway Dockerfile Deploy from repo, use the Docker builder, set env vars below

Required environment variables

All 14 are declared in app.json and render.yaml (CI's validate job fails the PR if they drift from config.py):

API_ID · API_HASH · BOT_TOKEN · DB_URL · DB_NAME · ADMIN · PIC · BIN_CHANNEL · LOG_CHANNEL · STRING_SESSION · IS_FSUB · AUTH_CHANNELS · AUTH_REQ_CHANNELS · FSUB_EXPIRE · (PORT is injected by the host, default 8080)

💎 4GB Support — STRING_SESSION is optional. Add a Kurigram v2 String Session (Pyrogram-compatible) to enable 4GB file processing. Without it the bot keeps its standard 2GB limit.

CI — what runs before deploy

Every push/PR runs .github/workflows/ci.yml (badge ↑ top):

Job What it catches
build Syntax errors (compileall), bug-clas

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 62
Method 51
Class 6
Route 1

Languages

Python100%

Modules by API surface

helper/database.py39 symbols
plugins/fsub.py18 symbols
plugins/start_and_cb.py16 symbols
plugins/admin.py10 symbols
helper/utils.py10 symbols
plugins/maintenance.py7 symbols
bot.py6 symbols
plugins/web_support.py4 symbols
plugins/file_rename.py4 symbols
plugins/metadata.py2 symbols
config.py2 symbols
plugins/__init__.py1 symbols

For agents

$ claude mcp add Rename-Bot \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page