TorrServer Telegram Bot

April 27, 2026 · View on GitHub

GitHub License TorrServer Integrated

Introduction

Telegram bot for managing TorrServer — add torrents, stream, search, and control the server directly from Telegram.

Features

  • Torrent management — add, remove, drop, list via magnet, hash, or torrs://
  • Export & import — magnets list; import multiple from text
  • Streaming — playback links, M3U playlists, preload
  • Search — RuTor and Torznab with one-click add
  • Inline mode — @botname in any chat: list torrents or search
  • Status & snake — real-time status, cache visualization
  • File operations — browse files, download to Telegram
  • FFprobe — media metadata via /ffp
  • Localization — Russian and English
  • Admin — shutdown, settings, presets (whitelist users only)

Getting Started

Enable the Bot

Start TorrServer with a Telegram bot token:

TorrServer --tg YOUR_BOT_TOKEN

Or use -T:

TorrServer -T YOUR_BOT_TOKEN

Create a bot via @BotFather to get the token.

Configuration

Config file tg.cfg (JSON) in the TorrServer data directory:

FieldDescription
HostTGTelegram API URL (default: https://api.telegram.org)
HostWebBase URL for stream links (auto-detected if empty)
Socks5Optional SOCKS5 for reaching Telegram (e.g. 127.0.0.1:1080, socks5://user:pass@host:port) if direct access to api.telegram.org is blocked or times out
WhiteIdsAllowed user IDs (empty = allow all)
BlackIdsBlocked user IDs

Example:

{
  "HostTG": "https://api.telegram.org",
  "HostWeb": "http://192.168.1.100:8090",
  "Socks5": "127.0.0.1:1080",
  "WhiteIds": [123456789],
  "BlackIds": []
}

If your network cannot connect to Telegram’s API directly, run a local SOCKS5 proxy (for example sing-box, v2ray, or ssh -D) and set Socks5 to its address.

Commands

Core

CommandDescription
/help, /start, /idHelp and user ID
/list [compact]List torrents with buttons
/add <link>Add torrent (magnet, hash, torrs://)
/clearRemove all (with confirmation)
/hash [N]Show info hashes

Management

CommandDescription
/remove <hash|N>Remove torrent
/drop <hash|N>Disconnect (keep in DB)
/set <hash|N> <title>Set title
/status [hash|N]Status with refresh/stop
/cache <hash|N>Cache stats
/preload <hash|N> <index>Preload file
CommandDescription
/link, /playStream URL
/m3u, /m3uallM3U playlist
CommandDescription
/search <query>RuTor + Torznab (all sources)
/rutor <query>RuTor only
/torznab <query> [index]Torznab indexers

Other

CommandDescription
/export, /importExport/import magnets
/categoriesList categories
/server, /stats, /statServer info
/viewedViewed files
/ffp <hash|N> <id> [json]FFprobe metadata
/speedtest [size]Download test (1–100 MB)
/snake [hash|N] [cols] [rows]Cache visualization
/lang [RU|EN]Language

Admin Only

CommandDescription
/shutdownShut down server
/settingsInteractive settings menu (sub-pages: Search, Network, Other, Cache, Paths, Storage)
/preset <name>Apply named preset: performance, storage, streaming, low, default
/preset <key> <value> ...Apply key-value pairs: cache 256, preload 50, conn 100, etc.

Preset examples:

  • /preset performance — max cache, high preload, no limits
  • /preset cache 256 preload 50 — set cache 256 MB and preload 50%
  • /preset cache 512 conn 100 down 0 up 0 — multiple values

Preset keys: cache, preload, readahead, conn, timeout, port, down, up, retr, responsive, cachedrop

Inline Mode

Type @YourBotName in any chat:

  • Empty, "list", or "play" — torrents with play links
  • 2+ characters — search RuTor + Torznab

Text Input

Paste as plain message to add torrent:

  • magnet:?xt=urn:btih:...
  • torrs://...
  • 40-char info hash

Reply to file list with 2-12 to download files 2–12 to Telegram.

Security

  • Whitelist — restrict to specific user IDs
  • Blacklist — block user IDs
  • Admin — when whitelist is used, admin = whitelisted users
  • Settings — sensitive values masked in /settings

Dependencies