rcmltb

Sam-MaxGPL-3.0更新放缓

基于 Pyrogram 的 Telegram 机器人,用 rclone、aria2c、qBittorrent 在云盘和 Telegram 之间转存、镜像、离线下载文件。

A Telegram bot for transferring files between cloud storage services and Telegram.

暂无版本310star282fork同步于 2026-11-07 07:33 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/Sam-Max/rcmltb rcmltb/ && cd rcmltb
cp sample_config.env config.env
sudo docker build . -t rcmltb
sudo docker run -p 80:80 -p 8080:8080 rcmltb
硬件要求按 README 说明

README 未说明具体硬件要求;Docker 镜像基于 Ubuntu,兼容 Linux amd64、arm64/v8、arm/v7。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

异步 Telegram 机器人,用 rclone 在云盘与 Telegram 之间转存、镜像和克隆文件

基于 Pyrogram 的 Telegram 机器人,用 rclone、aria2c、qBittorrent 在云盘和 Telegram 之间转存、镜像、离线下载文件。

核心能力

  • 用 rclone 在云盘与 Telegram 间 mirror 和 leech
  • 支持云到云 copy、clone 与双向 bisync 同步
  • 内置队列系统,可分别限制总任务、下载与上传并发
  • 支持服务账号自动切换与多云端同时上传
  • 提供文件管理器、云盘搜索与 http/webdav 索引服务

容易踩的坑

项目处于大规模重构期,行为可能不稳定且更新间会有破坏性变更;config.env 中所有值都必须用引号包裹,即使是整数、布尔或列表;克隆 Google Drive 需在根目录放 token.pickle,且默认占用 80(种子)和 8080(rclone 索引)端口。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    🤖 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