๐Ÿค– rcmltb

April 20, 2026 ยท View on GitHub

๐Ÿค– rcmltb

Rclone Mirror-Leech Telegram Bot

Python Pyrogram Docker License

An asynchronous Telegram bot for transferring files between cloud storage services and Telegram.

Mirror โ†’ Cloud | Leech โ†’ Telegram | Clone โ†’ Cloud to Cloud

Features โ€ข Commands โ€ข Deployment โ€ข Configuration


โš ๏ธ Stability Notice: The project is currently in a large refactor phase. During this period, behavior may be unstable and breaking changes can happen between updates until the refactor is completed.


๐ŸŒŸ Features

โ˜๏ธ Rclone

  • Copy file/folder from cloud to cloud
  • Leech file/folder from cloud to Telegram
  • Mirror Link/Torrent/Magnets/Mega/Telegram-Files to cloud
  • Mirror from Telegram to multiple clouds at the same time
  • Telegram Navigation Button Menus to interact with cloud
  • File Manager: size, mkdir, delete, dedupe and rename
  • Service Accounts support with automatic switching
  • Create cloud index as http or webdav webserver
  • Sync between clouds (not folders)
  • Search files on cloud
  • Clean cloud trash
  • View cloud storage info

๐Ÿ”ง Core Features

FeatureDescription
Queue SystemAdvanced queuing with QUEUE_ALL, QUEUE_DOWNLOAD, QUEUE_UPLOAD limits
Private ChannelsMirror/leech from private Telegram channels
Upload TemplatesDynamic paths with variables like {username}, {date}, {category}
Media MetadataRich media captions and live status details
ScreenshotsUser-configurable screenshot generation
Name SubstitutionPattern-based filename renaming (old::new)
Force StartBypass queue for urgent tasks
JDownloaderIntegration with JDownloader
Status FiltersPer-chat pagination with DL/UL/Seed/Clone/Queue filters

๐Ÿ“ฆ Additional Features

  • Send rclone config file from bot
  • Renaming menu for Telegram files
  • Index support (rclone index for all remotes)
  • Search TMDB titles
  • Mirror and Leech files in batch from Telegram private/restricted channels
  • Mirror and Leech links in batch from .txt file
  • Extract and zip link/file from Telegram to cloud
  • Extract and zip folder/file from cloud to Telegram
  • Mirror to local host (no cloud upload)
  • Refactored to use Pyrogram with asyncio
  • Docker-based image (Ubuntu)
  • Compatible with Linux amd64, arm64/v8, arm/v7

๐Ÿค– Bot Commands

Set these commands through @BotFather.

๐Ÿ“ฅ Mirror Commands

CommandDescription
mirror or /mMirror to selected cloud
mirror_batch or /mbMirror Telegram files/links in batch
mirror_select or /msSelect a fixed cloud/folder for mirror
jdmirror or /jmMirror via JDownloader
ytdl or /yMirror yt-dlp supported link
ytdleech or /ylLeech yt-dlp supported link
jdleech or /jlLeech via JDownloader

๐Ÿ“ค Leech Commands

CommandDescription
leech or /lLeech from cloud/link to Telegram
leech_batch or /lbLeech Telegram files/links in batch

โ˜๏ธ Cloud Management

CommandDescription
copyCopy from cloud to cloud
cloneClone Google Drive link file/folder
countCount file/folder from Google Drive link
rcfmRclone File Manager
syncSync two clouds
bisyncBidirectional cloud sync
cleanupClean cloud trash
storageCloud storage details
serveServe cloud as web index

โš™๏ธ System & Tools

CommandDescription
files or /bfBot configuration files
cancelCancel a task
force_start or /fsForce start a queued task
usettingUser settings
bsettingOwner settings
tmdbSearch titles
torrschSearch for torrents
cancel_allCancel all tasks

๐Ÿ“Š Status & Info

CommandDescription
statusStatus message of tasks
statsBot statistics
logBot log
ipShow IP address
pingPing bot

๐Ÿ”ง Admin Commands

CommandDescription
shellRun commands in shell
execRun Python code
restartRestart bot

๐Ÿš€ Deployment

1๏ธโƒฃ Installing Requirements

Clone the repository:

git clone https://github.com/Sam-Max/rcmltb rcmltb/ && cd rcmltb

For Debian-based distros:

sudo apt install python3 python3-pip

Install Docker by following the official Docker docs

For Arch and derivatives:

sudo pacman -S docker python

Install dependencies for setup scripts:

pip3 install -r requirements-cli.txt

2๏ธโƒฃ Configuration

Copy the sample config file:

cp sample_config.env config.env

NOTE: All values must be filled between quotes, even if it's Int, Bool, or List.

Required Configuration

VariableDescriptionType
TELEGRAM_API_IDGet from https://my.telegram.orgInt
TELEGRAM_API_HASHGet from https://my.telegram.orgStr
BOT_TOKENTelegram Bot Token from @BotFatherStr
OWNER_IDYour Telegram User ID (not username)Int

Optional Configuration

General Settings
VariableDescriptionType
DOWNLOAD_DIRPath to local downloads folderStr
SUDO_USERSUser IDs with sudo permission (space-separated)Str
ALLOWED_CHATSAllowed chat IDs (space-separated)Str
AUTO_MIRRORAuto mirror files sent to bot. Default: FalseBool
DATABASE_URLMongoDB connection stringStr
CMD_INDEXIndex number added to commandsStr
GD_INDEX_URLGoogle Drive Index URLStr
VIEW_LINKView link button instead of direct download. Default: FalseBool
STATUS_LIMITNumber of tasks shown in statusInt
LOCAL_MIRRORKeep files on host. Default: FalseBool
TORRENT_TIMEOUTTimeout for dead torrents (qBittorrent)Int
AUTO_DELETE_MESSAGE_DURATIONAuto-delete messages after X seconds. -1 to disableInt
TMDB_API_KEYTMDB API key (Get here)Str
TMDB_LANGUAGETMDB search language. Default: enStr
PARALLEL_TASKSNumber of parallel tasks for queueInt
Update Settings
VariableDescriptionType
UPSTREAM_REPOGitHub repository link (supports private repos with token)Str
UPSTREAM_BRANCHUpstream branch. Default: masterStr

NOTE: If docker or requirements change, rebuild the image for changes to apply.


โ˜๏ธ Rclone Settings
VariableDescriptionType
DEFAULT_OWNER_REMOTEDefault remote for ownerStr
DEFAULT_GLOBAL_REMOTEDefault remote from global configStr
MULTI_RCLONE_CONFIGAllow each user their own config. Default: FalseBool
REMOTE_SELECTIONSelect cloud each mirror. Default: FalseBool
MULTI_REMOTE_UPUpload to multiple clouds. Default: FalseBool
USE_SERVICE_ACCOUNTSEnable Service Accounts. Default: FalseBool
SERVICE_ACCOUNTS_REMOTEShared drive remote nameStr
SERVER_SIDEEnable server-side copy. Default: FalseBool
RCLONE_COPY_FLAGSCopy flags (key:value,key)Str
RCLONE_UPLOAD_FLAGSUpload flagsStr
RCLONE_DOWNLOAD_FLAGSDownload flagsStr
RC_INDEX_URLPublic IP/domain for indexStr
RC_INDEX_PORTIndex port. Default: 8080Str
RC_INDEX_USERIndex user. Default: adminStr
RC_INDEX_PASSIndex password. Default: adminStr
UPLOAD_PATH_TEMPLATEDynamic path template (e.g., "remote:/{username}/{category}/{date}/")Str

Template Variables: {username}, {user_id}, {date}, {year}, {month}, {day}, {category}, {task_type}


๐Ÿ“ Google Drive Settings
VariableDescriptionType
GDRIVE_FOLDER_IDFolder/TeamDrive ID or rootStr
IS_TEAM_DRIVESet True if TeamDriveBool
EXTENSION_FILTERExcluded file extensions (space-separated)Str

Note: Add token.pickle to root for cloning. Use /files command to add via bot.


๐Ÿ“ค Leech Settings
VariableDescriptionType
LEECH_SPLIT_SIZEUpload limit (2GB non-premium, 4GB premium)Int
EQUAL_SPLITSSplit into equal parts. Default: FalseBool
USER_SESSION_STRINGPyrogram session string (Generate)Str
LEECH_LOGChat ID(s) for uploads (space-separated, add -100 prefix)Str
BOT_PMSend files to user's PM. Default: FalseBool
NAME_SUBSTITUTEFilename substitution pattern (old::new|old2::new2)Str

โ˜๏ธ MEGA Settings
VariableDescriptionType
MEGA_EMAILMEGA account emailStr
MEGA_PASSWORDMEGA account passwordStr

โฌ‡๏ธ JDownloader Settings
VariableDescriptionType
JD_EMAILJDownloader account emailStr
JD_PASSWORDJDownloader account passwordStr

๐Ÿ“Š Queue System Settings
VariableDescriptionType
QUEUE_ALLMax total concurrent tasks (0 = unlimited)Int
QUEUE_DOWNLOADMax concurrent downloads (0 = unlimited)Int
QUEUE_UPLOADMax concurrent uploads (0 = unlimited)Int

๐ŸŒ qBittorrent/Aria2c Settings
VariableDescriptionType
QB_BASE_URLBot URL for qBittorrent web selectionStr
QB_SERVER_PORTPort. Default: 80Int
WEB_PINCODERequire pincode for torrent selection. Default: FalseBool

qBittorrent Note: For RAM issues, limit MaxConnecs, decrease AsyncIOThreadsCount, and set DiskWriteCacheSize to 32.


๐Ÿ” Torrent Search Settings
VariableDescriptionType
SEARCH_API_LINKTorrent search API (Deploy)Str
SEARCH_LIMITResults per site. Default: 0Int
SEARCH_PLUGINSqBittorrent search plugin URLsList

3๏ธโƒฃ Deploying with Docker

Build Docker image:

sudo docker build . -t rcmltb

Run the image:

sudo docker run -p 80:80 -p 8080:8080 rcmltb

Stop container:

sudo docker ps
sudo docker stop <container_id>

Clear container:

sudo docker container prune

Delete images:

sudo docker image prune -a

4๏ธโƒฃ Deploying with Docker Compose

NOTE: Change ports in docker-compose.yml if not using 80 (torrents) or 8080 (rclone).

Install docker-compose:

sudo apt install docker-compose

Build and run:

sudo docker-compose up

After editing files:

sudo docker-compose up --build

Stop/Start:

sudo docker-compose stop
sudo docker-compose start

๐Ÿ” Session Generation

To generate USER_SESSION_STRING:

python3 session_generator.py

Run this on your PC from the repository folder.


๐Ÿ—„๏ธ MongoDB Setup

Local MongoDB with Docker Compose (No Auth)

docker-compose.yml includes a local mongo service with persistent storage.

  1. Set DATABASE_URL in config.env:
DATABASE_URL="mongodb://mongo:27017/rcmltb"
  1. Start services:
docker compose up -d
  1. Verify both containers:
docker compose ps

MongoDB data persists in the mongo_data volume.

MongoDB Atlas (Cloud)

  1. Go to mongodb.com and sign up
  2. Create a Shared Cluster (Free)
  3. Add username and password, click Add my current IP Address
  4. Click Connect โ†’ Connect your application
  5. Choose Driver: Python, Version: 3.6 or later
  6. Copy the connection string, replace <password> with your user's password
  7. Go to Network Access, click Edit โ†’ Allow access from anywhere โ†’ Confirm

โ˜๏ธ Rclone Configuration

Video Tutorial: YouTube Guide

Quick Tips:

  • Add at least two accounts in rclone.conf for cloud-to-cloud copy
  • Android users: Use RCX app

Supported Providers:

1Fichier, Amazon Drive, Amazon S3, Backblaze B2, Box, Ceph, DigitalOcean Spaces, Dreamhost, Dropbox, Enterprise File Fabric, FTP, GetSky, Google Cloud Storage, Google Drive, Google Photos, HDFS, HTTP, Hubic, IBM COS S3, Koofr, Mail.ru Cloud, Mega, Microsoft Azure Blob Storage, Microsoft OneDrive, Nextcloud, OVH, OpenDrive, Oracle Cloud Storage, ownCloud, pCloud, premiumize.me, put.io, Scaleway, Seafile, SFTP, WebDAV, Yandex Disk, and more.

View all providers


๐Ÿ”‘ Google OAuth Setup

Requirements: OS with a browser. Windows users need Python3 and pip.

  1. Visit Google Cloud Console
  2. Go to OAuth Consent tab, fill it, save
  3. Credentials tab โ†’ Create Credentials โ†’ OAuth Client ID
  4. Choose Desktop and Create
  5. Publish your OAuth consent to prevent token expiry
  6. Download credentials, move to bot root, rename to credentials.json
  7. Visit Google API Library
  8. Search and enable Google Drive API
  9. Generate token:
pip3 install google-api-python-client google-auth-httplib2 google-auth-oauthlib
python3 generate_drive_token.py

๐ŸŒฑ Bittorrent Seeding

Using -d alone uses global options for aria2c/qBittorrent.

qBittorrent Global Options:

  • GlobalMaxRatio and GlobalMaxSeedingMinutes in qbittorrent.conf
  • -1 = no limit
  • Don't change MaxRatioAction

๐Ÿ”ง Service Accounts (Google Drive)

Set USE_SERVICE_ACCOUNTS="True" to enable. Recommended for Team Drive only.

Limits

  • 1 Service Account = ~750 GB/day
  • 1 Project = 100 Service Accounts = ~75 TB/day

Generate Service Accounts

List projects:

python3 gen_sa_accounts.py --list-projects

Enable services:

python3 gen_sa_accounts.py --enable-services $PROJECTID

Create Service Accounts:

python3 gen_sa_accounts.py --create-sas $PROJECTID

Download keys:

python3 gen_sa_accounts.py --download-keys $PROJECTID

Quick setup (new project):

python3 gen_sa_accounts.py --quick-setup 1 --new-only

Add to Team Drive

Method 1: Via Google Group (Recommended)

cd accounts
# Extract emails
grep -oPh '"client_email": "\K[^"]+' *.json > emails.txt
cd ..
# Add emails.txt to Google Group, then add Group to Team Drive as Manager

Method 2: Direct add:

python3 add_to_team_drive.py -d SharedTeamDriveSrcID

๐Ÿ” .netrc Authentication

For yt-dlp premium accounts or protected Index Links, create .netrc:

machine host login username password my_password

Example:

machine instagram login user.name password mypassword

Notes:

  • Instagram: Must login even for public posts; confirm login from new IP
  • YouTube: Use cookies.txt instead

Aria2c index link example:

machine example.workers.dev password index_password

โ˜• Support

ko-fi