master
AI SLOP WARNING
Server Manager Bot
A Telegram bot for managing qBittorrent torrents and Jellyfin media library.
Project Structure
server-manager/
├── config.py # Configuration and environment loading
├── utils.py # Utility functions
├── handlers.py # Keyboard layouts and state management
├── bot.py # Main bot class with all handlers
├── main.py # Application entry point
├── .env.example # Environment variables template
├── requirements.txt # Python dependencies
├── Dockerfile # Docker container configuration
└── services/
├── __init__.py
├── qbittorrent_service.py # qBittorrent API wrapper
└── jellyfin_service.py # Jellyfin API wrapper
Key Features
1. Modular Architecture
- Separated concerns into dedicated service modules
- Clean separation between configuration, business logic, and bot handlers
- Easy to extend with new services
2. Configuration Management
- All credentials and settings moved to environment variables
- Type-safe configuration using dataclasses
- Custom Telegram API server support
3. Error Handling & Logging
- Proper exception handling throughout
- Structured logging instead of print statements
- Graceful error recovery
4. Code Quality
- Type hints for better IDE support and catch errors early
- Docstrings for all public functions and classes
- Consistent code style following PEP 8
Setup
1. Install Dependencies
pip install -r requirements.txt
2. Configure Environment
Copy .env.example to .env and update values:
cp .env.example .env
# Edit .env with your credentials
Important: Never commit .env file to version control!
3. Run the Bot
python main.py
Docker Usage
Build and run with Docker:
docker build -t server-manager .
docker run --env-file .env server-manager
Features
qBittorrent Management
- Add torrents via magnet links
- Delete completed torrents
- View active downloads with ETA
- Get transfer statistics
Jellyfin Integration
- Trigger library refresh
- Upload video files directly to Jellyfin
Security Notes
- Store credentials in environment variables, never in code
- Use
.gitignoreto exclude.envand*.sessionfiles - Consider using Telegram's secret chats for sensitive operations
Description
Vibecoded "server manager" - telegram bot for starting qBittorrent downloads and refreshing Jellyfin library
41 KiB
Languages
Python
99.1%
Dockerfile
0.9%