MoiuBot is a distributed qBittorrent management bot that uses Telegram as the control plane. It is built with Node.js, Telegraf, Express, and SQLite, and supports rclone-based archiving workflows (download, move, cleanup) across multiple hosts.
- Bot (
bot/): Telegraf Telegram bot. Orchestrates user workflows and persists state in SQLite. - Agent (
agent/): Express API deployed per qBittorrent host. Talks to the qBittorrent Web API, runs rclone operations, and monitors completed downloads. - Config Server (
config-server/, optional): Express service that distributes a sharedrclone.confto Agents for centralized rclone remote management.
- Manage multiple qBittorrent instances from a single Telegram bot.
- Guided "add torrent" workflow with optional auto-archive to cloud storage via rclone.
- Agent-side completion monitoring with post-move cleanup.
- Optional centralized rclone configuration distribution with basic versioning.
- SQLite-backed persistence for users, servers, tasks, and category mappings.
- Docker Compose and systemd deployment assets included in this repository.
- Node.js 18+ (Node 22 recommended)
- Telegram bot token (from BotFather)
- qBittorrent with Web UI enabled on each Agent host
- rclone installed on each Agent host (and on the Config Server host if used)
- Install dependencies:
npm install- Create environment files:
cp .env.bot.example .env.bot
cp .env.agent.example .env.agent
cp .env.config-server.example .env.config-server-
Edit the env files and set secrets (Telegram token, API keys, qBittorrent credentials). If you do not use the Config Server, you can skip
.env.config-serverand theconfig-server/service. -
Initialize the database:
npm run init-db- Start services:
npm run start:agent
npm startThis repo includes docker-compose.yml plus Dockerfile.bot and Dockerfile.agent.
docker compose up --buildNotes:
- The Agent container is configured to reach a qBittorrent instance running on the Docker host via
QBT_URL=http://host.docker.internal:18080(seedocker-compose.yml). - The Bot can optionally expose an Agent-to-Bot webhook listener when
BOT_WEBHOOK_PORTis set (see.env.bot.exampleandbot/webhook-server.js).
- Secrets and local state must not be committed.
.gitignoreexcludes.env*, database files, andruntime/by default. - SQLite path is controlled by
DATABASE_PATH(default./database/qbt-bot.db). - Bot access can be restricted with
ALLOWED_USERS(comma-separated Telegram user IDs). If unset, the bot allows all users. - The Agent protects all
/api/*endpoints withAPI_KEY. - Optional rclone config distribution: run the Config Server with
RCLONE_CONFIGpointing to a writable path (a safe default for this repo isruntime/rclone/rclone.conf), and configure Agents withCONFIG_SERVER_URL,CONFIG_SERVER_API_KEY, andRCLONE_SYNC_ON_START=true.
- systemd unit templates are in
deploy/systemd/. start.shprovides a local process launcher for the services.
MIT