A feature-rich Telegram bot that provides a convenient interface for managing Transmission BitTorrent client. Control your torrent downloads remotely through Telegram with an intuitive interface.
- Add Torrents: Add torrents via magnet links or
.torrentfiles - Smart Categorization: Automatically categorize torrents based on RuTracker categories
- Torrent Management: Start, stop, pause, and remove torrents
- Queue Control: Change torrent priority (move up/down/top/bottom in queue)
- Real-time Status: Get detailed information about torrent status and progress
- Search Functionality: Search torrents by name with prefix
t:(e.g.,t:Ubuntu) - File Management: View files within torrents and their download status
- Notifications: Receive messages when torrents complete downloading
- RuTracker Integration: Automatically fetch torrent images from RuTracker when available
- Multi-category Support: Organize downloads into configurable categories
- Go 1.25.4 or later
- Transmission daemon running with RPC enabled
- Telegram Bot Token (from @BotFather)
Configuration has the following structure:
app:
error_media: "./tmp/media/error.png" # Path to error image
auto_categories: true # Enable auto-categorization
dirs:
working: "./tmp" # Working directory
images: "./tmp/images" # Directory for torrent images
download: "./tmp/downloads/" # Base download directory
categories:
Films:
path: "Films" # Subdirectory for Films
matcher: "Зарубежное кино,Арт-хаус и авторское кино,HD Video,UHD Video,Мультфильмы"
TVSeries:
path: "TVSeries" # Subdirectory for TV Series
matcher: "Сериалы,Мультсериалы"
Anime:
path: "Anime" # Subdirectory for Anime
matcher: "Аниме"
Soft:
path: "Soft" # Subdirectory for Software
matcher: "Программы и Дизайн"
Education:
path: "Education" # Subdirectory for Educational content
matcher: "Обучение иностранным языкам,Обучающие видео"
Games:
path: "Games" # Subdirectory for Games
matcher: "Игры"
telegram:
token: "YOUR_TELEGRAM_BOT_TOKEN" # Bot token from @BotFather
chat_id: YOUR_CHAT_ID # Optional: Restrict to specific chat
transmission:
config:
uri: "http://localhost:9091/transmission/rpc" # Transmission RPC URL
user: "admin" # Transmission username
password: "admin" # Transmission password# Start the bot with your configuration
./torrbot serve --config config.yaml
# Or specify a different config path
./torrbot serve -c /path/to/config.yaml/startor/help- Show help message and main keyboard/status- Show Transmission server status (active/paused torrents, speeds, free space)/config- Show Transmission session configuration
- Magnet Links: Send any magnet link directly to the bot
- Torrent Files: Upload
.torrentfiles directly to the bot - RuTracker Integration: When adding
.torrentfiles from RuTracker, the bot automatically:- Fetches the torrent image
- Suggests appropriate category based on RuTracker categories
- Shows the image in Telegram with category selection buttons
- Search: Type any text to search torrents by name
- Filter Views: Use the main keyboard buttons to view:
- "All torrents" - Show all torrents
- "Active torrents" - Show only active downloads/uploads
- "Not Active torrents" - Show only paused/stopped torrents
When viewing a torrent, you can:
- Start/Stop - Control torrent activity
- Priority - Change queue position (move up/down/top/bottom)
- Files - View files within the torrent
- Delete - Remove torrent (with or without data)
- Refresh - Update torrent information
t:searchterm- Search torrents by name (e.g.,t:Ubuntu)- Plain text - Also searches torrents by name
# Clone the repository
git clone https://github.com/0x0BSoD/torrBotGo.git
cd torrBotGo
# Build manually
docker build -t torrbotgo .# Create config.yaml from the example
cp config/config.yaml.example config.yaml
# Edit config.yaml with your settings
# Run the container
docker run --rm \
-v "$(pwd)/config.yaml":/app/config.yaml:ro \
torrbotgo serve# docker-compose.yml
version: '3.8'
services:
torrbotgo:
build: .
container_name: torrbotgo
restart: unless-stopped
volumes:
- ./config.yaml:/app/config.yaml:ro
# Optional: mount download directory for persistence
# - ./downloads:/downloads
environment:
- TZ=UTCRun with:
docker-compose up -d- Multi-stage build: Small final image (~13MB) using distroless base
- Non-root user: Runs as nonroot user for security
- Build arguments: Supports version, git commit, and build date injection
- Timezone support: Includes timezone data for proper time handling
- SSL certificates: Includes CA certificates for secure connections
You can override configuration using environment variables:
docker run --rm \
-e TELEGRAM_TOKEN="your_token_here" \
-e TRANSMISSION_HOST="transmission" \
-e TRANSMISSION_PORT=9091 \
-e TRANSMISSION_USERNAME="admin" \
-e TRANSMISSION_PASSWORD="password" \
torrbotgo serve# Build manually with build args
docker build \
--build-arg VERSION="2.0.1" \
--build-arg GIT_COMMIT="$(git rev-parse --short HEAD)" \
--build-arg BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-t torrbotgo:2.0.1 .An Ansible role is available for automated deployment: https://github.com/0x0BSoD/ansible/tree/master/transmission
Check the vars/main.yml and defaults/main.yml directories for configuration options.
Default Ansible variables:
user: root
rpc_user: user
rpc_password: pass123See config.example.yaml for a complete configuration template with detailed comments.
Quick start:
cp config/config.yaml.example config.yaml
# Edit config.yaml with your settingsKey configuration sections:
telegram: Bot token and proxy settingstransmission: RPC connection detailsapp: Application behavior and directorieslogging: Log level and format control
torrBotGo/
├── cmd/ # CLI commands (Cobra framework)
│ ├── root.go # Root command definition
│ └── serve.go # Serve command implementation
├── config/ # Configuration management
│ ├── config.go # YAML config parsing and validation
│ └── config.yaml.example # Example configuration file
├── internal/ # Core application logic
│ ├── app/ # Telegram message handlers
│ │ ├── router.go # Message routing
│ │ ├── handleCommand.go # Command handlers
│ │ ├── handleMessage.go # Message handlers
│ │ ├── handleInline.go # Inline button handlers
│ │ └── helpers.go # Helper functions
│ ├── telegram/ # Telegram API integration
│ │ ├── telegram.go # Telegram client
│ │ ├── keyboards.go # Inline keyboard definitions
│ │ ├── templates.go # Message templates
│ │ └── helpers.go # Telegram helpers
│ ├── transmission/ # Transmission RPC client
│ │ ├── transmission.go # Transmission client
│ │ ├── torrent.go # Torrent operations
│ │ ├── fetcher.go # RuTracker web scraping
│ │ ├── watcher.go # Torrent state watcher
│ │ └── helpers.go # Transmission helpers
│ ├── events/ # Event bus system
│ │ ├── events.go # Event definitions
│ │ └── bus.go # Event bus implementation
│ └── cache/ # In-memory cache
│ └── cache.go # Torrent cache implementation
├── pkg/logger/ # Logging utilities
│ └── logger.go # Zap logger configuration
├── main.go # Application entry point
├── go.mod # Go module definition
├── go.sum # Dependency checksums
├── config.yaml # Configuration template
└── README.MD # This file
- Telegram Integration: Handles all Telegram Bot API interactions
- Transmission Client: Manages all Transmission RPC communications
- Event Bus: Enables decoupled communication between components
- Cache System: Maintains in-memory torrent state for efficient operations
- RuTracker Fetcher: Scrapes RuTracker for torrent metadata and images
# Clone the repository
git clone https://github.com/0x0BSoD/torrBotGo.git
cd torrBotGo
# Install dependencies
go mod download
# Build the application
go build -o torrbot
# Run tests (if available)
go test ./...- Cobra: CLI framework
- Zap: Structured logging
- goquery: HTML parsing for RuTracker integration
- transmission: Transmission RPC client library
- telegram-bot-api: Telegram Bot API wrapper
The project follows standard Go conventions:
gofmtfor code formatting- Descriptive package and function names
- Comprehensive error handling
- Context-aware operations for cancellation
- Thread-safe data structures
-
Transmission Connection Failed
- Verify Transmission RPC is enabled
- Check URI format:
http://host:port/transmission/rpc - Confirm username and password are correct
-
Telegram Bot Not Responding
- Verify bot token is correct
- Check that the bot has been started with
/start - Ensure
chat_idis set if restricting to specific chat
-
RuTracker Images Not Loading
- RuTracker may block requests from certain IPs
- Check network connectivity to RuTracker
- Images directory must be writable
-
Permission Errors
- Ensure download directories exist and are writable
- Docker containers need proper volume mounts with correct permissions
The application uses structured logging with Zap. Log level can be controlled via configuration. Check logs for detailed error information.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the terms of the LICENSE file included in the repository.
- Transmission for the excellent BitTorrent client
- RuTracker for torrent metadata
- All contributors and users of torrBotGo
For issues, questions, or feature requests:
- Open an issue on GitHub
- Check existing issues for solutions
Note: This bot is intended for personal use with content you have the rights to download. Always respect copyright laws and terms of service.