A powerful asynchronous Telegram bot for transferring files between cloud storage services and Telegram.
Mirror → Cloud | Leech → Telegram | Clone → Cloud to Cloud
💡 Fork Notice: Originally based on mirror-leech-telegram-bot with enhanced Rclone support and additional features. The base repository has since added its own rclone implementation.
- 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
| Feature | Description |
|---|---|
| Queue System | Advanced queuing with QUEUE_ALL, QUEUE_DOWNLOAD, QUEUE_UPLOAD limits |
| RSS Feed | Monitor feeds with size detection, retry logic, and forum topic support |
| Private Channels | Mirror/leech from private Telegram channels (/pmirror, /pleech) |
| Upload Templates | Dynamic paths with variables like {username}, {date}, {category} |
| MediaInfo | Detailed media file analysis with /mediainfo |
| Screenshots | User-configurable screenshot generation |
| Name Substitution | Pattern-based filename renaming (old::new) |
| Force Start | Bypass queue for urgent tasks |
| JDownloader | Integration with JDownloader |
| Status Filters | Per-chat pagination with DL/UL/Seed/Clone/Queue filters |
- 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
.txtfile - 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)
- Debrid Manager (Real-Debrid support)
- Refactored to use Pyrogram with asyncio
- Docker-based image (Ubuntu)
- Compatible with Linux
amd64,arm64/v8,arm/v7
Set these commands through @BotFather.
| Command | Description |
|---|---|
mirror or /m |
Mirror to selected cloud |
mirror_batch or /mb |
Mirror Telegram files/links in batch |
mirror_select or /ms |
Select a fixed cloud/folder for mirror |
pmirror |
Mirror from private Telegram channels |
ytdl or /y |
Mirror yt-dlp supported link |
ytdl_leech or /yl |
Leech yt-dlp supported link |
| Command | Description |
|---|---|
leech or /l |
Leech from cloud/link to Telegram |
leech_batch or /lb |
Leech Telegram files/links in batch |
pleech |
Leech from private Telegram channels |
| Command | Description |
|---|---|
copy |
Copy from cloud to cloud |
clone |
Clone Google Drive link file/folder |
count |
Count file/folder from Google Drive link |
rcfm |
Rclone File Manager |
sync |
Sync two clouds |
cleanup |
Clean cloud trash |
storage |
Cloud storage details |
serve |
Serve cloud as web index |
| Command | Description |
|---|---|
files or /bf |
Bot configuration files |
debrid |
Debrid Manager |
rss |
RSS feed monitor |
mediainfo |
Get detailed media file information |
forcestart |
Force start a queued task |
user_setting |
User settings |
own_setting |
Owner settings |
tmdb |
Search titles |
torrsch |
Search for torrents |
cancel_all |
Cancel all tasks |
| Command | Description |
|---|---|
status |
Status message of tasks |
stats |
Bot statistics |
log |
Bot log |
ip |
Show IP address |
ping |
Ping bot |
| Command | Description |
|---|---|
shell |
Run commands in shell |
restart |
Restart bot |
Clone the repository:
git clone https://github.com/Sam-Max/rcmltb rcmltb/ && cd rcmltbFor Debian-based distros:
sudo apt install python3 python3-pipInstall Docker by following the official Docker docs
For Arch and derivatives:
sudo pacman -S docker pythonInstall dependencies for setup scripts:
pip3 install -r requirements-cli.txtCopy the sample config file:
cp sample_config.env config.envNOTE: All values must be filled between quotes, even if it's
Int,Bool, orList.
| Variable | Description | Type |
|---|---|---|
API_ID |
Get from https://my.telegram.org | Int |
API_HASH |
Get from https://my.telegram.org | Str |
BOT_TOKEN |
Telegram Bot Token from @BotFather | Str |
OWNER_ID |
Your Telegram User ID (not username) | Int |
| Variable | Description | Type |
|---|---|---|
DOWNLOAD_DIR |
Path to local downloads folder | Str |
SUDO_USERS |
User IDs with sudo permission (space-separated) | Str |
ALLOWED_CHATS |
Allowed chat IDs (space-separated) | Str |
AUTO_MIRROR |
Auto mirror files sent to bot. Default: False |
Bool |
DATABASE_URL |
MongoDB connection string | Str |
CMD_INDEX |
Index number added to commands | Str |
GD_INDEX_URL |
Google Drive Index URL | Str |
VIEW_LINK |
View link button instead of direct download. Default: False |
Bool |
STATUS_LIMIT |
Number of tasks shown in status | Int |
LOCAL_MIRROR |
Keep files on host. Default: False |
Bool |
TORRENT_TIMEOUT |
Timeout for dead torrents (qBittorrent) | Int |
AUTO_DELETE_MESSAGE_DURATION |
Auto-delete messages after X seconds. -1 to disable |
Int |
TMDB_API_KEY |
TMDB API key (Get here) | Str |
TMDB_LANGUAGE |
TMDB search language. Default: en |
Str |
PARALLEL_TASKS |
Number of parallel tasks for queue | Int |
| Variable | Description | Type |
|---|---|---|
UPSTREAM_REPO |
GitHub repository link (supports private repos with token) | Str |
UPSTREAM_BRANCH |
Upstream branch. Default: master |
Str |
NOTE: If docker or requirements change, rebuild the image for changes to apply.
| Variable | Description | Type |
|---|---|---|
DEFAULT_OWNER_REMOTE |
Default remote for owner | Str |
DEFAULT_GLOBAL_REMOTE |
Default remote from global config | Str |
MULTI_RCLONE_CONFIG |
Allow each user their own config. Default: False |
Bool |
REMOTE_SELECTION |
Select cloud each mirror. Default: False |
Bool |
MULTI_REMOTE_UP |
Upload to multiple clouds. Default: False |
Bool |
USE_SERVICE_ACCOUNTS |
Enable Service Accounts. Default: False |
Bool |
SERVICE_ACCOUNTS_REMOTE |
Shared drive remote name | Str |
SERVER_SIDE |
Enable server-side copy. Default: False |
Bool |
RCLONE_COPY_FLAGS |
Copy flags (key:value,key) | Str |
RCLONE_UPLOAD_FLAGS |
Upload flags | Str |
RCLONE_DOWNLOAD_FLAGS |
Download flags | Str |
RC_INDEX_URL |
Public IP/domain for index | Str |
RC_INDEX_PORT |
Index port. Default: 8080 |
Str |
RC_INDEX_USER |
Index user. Default: admin |
Str |
RC_INDEX_PASS |
Index password. Default: admin |
Str |
UPLOAD_PATH_TEMPLATE |
Dynamic path template (e.g., "remote:/{username}/{category}/{date}/") |
Str |
Template Variables: {username}, {user_id}, {date}, {year}, {month}, {day}, {category}, {task_type}
| Variable | Description | Type |
|---|---|---|
GDRIVE_FOLDER_ID |
Folder/TeamDrive ID or root |
Str |
IS_TEAM_DRIVE |
Set True if TeamDrive |
Bool |
EXTENSION_FILTER |
Excluded file extensions (space-separated) | Str |
Note: Add
token.pickleto root for cloning. Use/filescommand to add via bot.
| Variable | Description | Type |
|---|---|---|
LEECH_SPLIT_SIZE |
Upload limit (2GB non-premium, 4GB premium) | Int |
EQUAL_SPLITS |
Split into equal parts. Default: False |
Bool |
USER_SESSION_STRING |
Pyrogram session string (Generate) | Str |
LEECH_LOG |
Chat ID(s) for uploads (space-separated, add -100 prefix) |
Str |
BOT_PM |
Send files to user's PM. Default: False |
Bool |
NAME_SUBSTITUTE |
Filename substitution pattern (old::new|old2::new2) |
Str |
| Variable | Description | Type |
|---|---|---|
MEGA_EMAIL |
MEGA account email | Str |
MEGA_PASSWORD |
MEGA account password | Str |
| Variable | Description | Type |
|---|---|---|
JD_EMAIL |
JDownloader account email | Str |
JD_PASSWORD |
JDownloader account password | Str |
| Variable | Description | Type |
|---|---|---|
QUEUE_ALL |
Max total concurrent tasks (0 = unlimited) |
Int |
QUEUE_DOWNLOAD |
Max concurrent downloads (0 = unlimited) |
Int |
QUEUE_UPLOAD |
Max concurrent uploads (0 = unlimited) |
Int |
| Variable | Description | Type |
|---|---|---|
RSS_DELAY |
Refresh interval in seconds. Default: 900 |
Int |
RSS_CHAT_ID |
Chat ID for RSS messages. Supports chat_id|topic_id |
Int |
RSS_SIZE_LIMIT |
Max torrent size in bytes (0 = unlimited) |
Int |
RSS Features:
- ✅ Size detection from feed summaries
- ✅ Direct handler invocation
- ✅ Retry logic (3 attempts)
- ✅ Case-sensitive filters with
-stvflag - ✅ Forum topic support
- ✅ "Use This Chat" button
- ✅ Browser-like HTTP headers
RSS NOTE:
RSS_CHAT_IDis required. UseUSER_STRING_SESSIONOR a channel. For channels, add bot to both channel and linked group. WithoutDATABASE_URL, feeds during offline periods will be missed.
| Variable | Description | Type |
|---|---|---|
QB_BASE_URL |
Bot URL for qBittorrent web selection | Str |
QB_SERVER_PORT |
Port. Default: 80 |
Int |
WEB_PINCODE |
Require pincode for torrent selection. Default: False |
Bool |
qBittorrent Note: For RAM issues, limit
MaxConnecs, decreaseAsyncIOThreadsCount, and setDiskWriteCacheSizeto 32.
| Variable | Description | Type |
|---|---|---|
SEARCH_API_LINK |
Torrent search API (Deploy) | Str |
SEARCH_LIMIT |
Results per site. Default: 0 |
Int |
SEARCH_PLUGINS |
qBittorrent search plugin URLs | List |
Build Docker image:
sudo docker build . -t rcmltbRun the image:
sudo docker run -p 80:80 -p 8080:8080 rcmltbStop container:
sudo docker ps
sudo docker stop <container_id>Clear container:
sudo docker container pruneDelete images:
sudo docker image prune -aNOTE: Change ports in
docker-compose.ymlif not using 80 (torrents) or 8080 (rclone).
Install docker-compose:
sudo apt install docker-composeBuild and run:
sudo docker-compose upAfter editing files:
sudo docker-compose up --buildStop/Start:
sudo docker-compose stop
sudo docker-compose startTo generate USER_SESSION_STRING:
python3 session_generator.pyRun this on your PC from the repository folder.
- Go to mongodb.com and sign up
- Create a Shared Cluster (Free)
- Add
usernameandpassword, clickAdd my current IP Address - Click
Connect→Connect your application - Choose Driver: Python, Version: 3.6 or later
- Copy the connection string, replace
<password>with your user's password - Go to
Network Access, click Edit →Allow access from anywhere→ Confirm
Video Tutorial: YouTube Guide
- Add at least two accounts in
rclone.conffor cloud-to-cloud copy - Android users: Use RCX app
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.
Requirements: OS with a browser. Windows users need Python3 and pip.
- Visit Google Cloud Console
- Go to OAuth Consent tab, fill it, save
- Credentials tab → Create Credentials → OAuth Client ID
- Choose Desktop and Create
- Publish your OAuth consent to prevent token expiry
- Download credentials, move to bot root, rename to
credentials.json - Visit Google API Library
- Search and enable Google Drive API
- Generate token:
pip3 install google-api-python-client google-auth-httplib2 google-auth-oauthlib
python3 generate_drive_token.pyUsing -d alone uses global options for aria2c/qBittorrent.
GlobalMaxRatioandGlobalMaxSeedingMinutesinqbittorrent.conf-1= no limit- Don't change
MaxRatioAction
Set
USE_SERVICE_ACCOUNTS="True"to enable. Recommended for Team Drive only.
- 1 Service Account = ~750 GB/day
- 1 Project = 100 Service Accounts = ~75 TB/day
List projects:
python3 gen_sa_accounts.py --list-projectsEnable services:
python3 gen_sa_accounts.py --enable-services $PROJECTIDCreate Service Accounts:
python3 gen_sa_accounts.py --create-sas $PROJECTIDDownload keys:
python3 gen_sa_accounts.py --download-keys $PROJECTIDQuick setup (new project):
python3 gen_sa_accounts.py --quick-setup 1 --new-onlyMethod 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 ManagerMethod 2: Direct add:
python3 add_to_team_drive.py -d SharedTeamDriveSrcIDFor 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
