Skip to content

A Python-based, self-hosted Discord bot designed to manage the Transmission BitTorrent client, leveraging the transmission-rpc library.

License

Notifications You must be signed in to change notification settings

demartini/transmission-discord-bot

Repository files navigation

Bot Logo

Transmission Discord Bot

Contributors Forks Stargazers Issues License

Table of Contents

About

The Transmission Discord Bot is a Python-based Discord bot built with the interactions.py framework. It seamlessly integrates with your Transmission BitTorrent client, empowering you to manage your downloads directly through Discord using intuitive slash commands. This user-friendly bot simplifies your torrent management experience, allowing you to effortlessly add, remove, list, pause, and resume torrents without ever leaving your favorite Discord server.

(back to top)

Features

  • Torrent Management Made Easy: Interact with your Transmission BitTorrent client directly from Discord.
  • Intuitive Slash Commands: Execute commands with the simple and familiar /torrents syntax.
  • Comprehensive Actions:
    • Add: Add torrents by URL or magnet link, optionally specifying download directory.
    • List: View a list of active torrents with progress information.
    • Pause: Pause active torrents.
    • Resume: Resume paused torrents.
    • Remove: Remove torrents and optionally delete downloaded data.
  • Informative Embeds: All bot responses are presented in visually appealing embeds for clarity and organization.
  • Error Handling: Robust error handling ensures a smooth user experience and provides helpful feedback in case of issues.
  • Logging: Detailed logging helps with troubleshooting and bot maintenance.
  • Help Command: A dedicated /torrents help command provides clear instructions on how to use all bot functionalities.

For full documentation and examples, please refer to the Documentation.

Commands

Command Description
/torrents add <url> [destination:<download_dir>] Add a torrent.
/torrents list List torrents.
/torrents pause <id> Pause a torrent.
/torrents remove <id> Remove a torrent.
/torrents resume <id> Resume a torrent.
/torrents help Get help.

(back to top)

Usage

To help you get started creating a container from this image you can either use docker-compose or the docker cli.

Docker Compose (Recommended)

---
services:
  transmission-discord-bot:
    container_name: transmission-discord-bot
    image: demartini/transmission-discord-bot:latest
    restart: unless-stopped
    environment:
      DISCORD_TOKEN: XXXXXXXXXX
      SERVER_ID: XXXXXXXXXX
      TRANSMISSION_HOST: localhost
      TRANSMISSION_PORT: 9091
      TRANSMISSION_USERNAME: admin
      TRANSMISSION_PASSWORD: password
    volumes:
      - ./logs:/app/logs

Docker CLI

docker run -d \
  --name=transmission-discord-bot \
  -e DISCORD_TOKEN= \
  -e SERVER_ID= \
  -e TRANSMISSION_HOST= \
  -e TRANSMISSION_PORT= \
  -e TRANSMISSION_USERNAME= \
  -e TRANSMISSION_PASSWORD= \
  -v /path/to/logs:/app/logs \
  --restart unless-stopped \
  demartini/transmission-discord-bot:latest

Source

  1. Clone the Repository:

    git clone https://github.com/demartini/transmission-discord-bot
  2. Install Dependencies:

    • Option 1: Using Poetry (Recommended):

      cd transmission-discord-bot
      poetry install
    • Option 2: Without Poetry:

      cd transmission-discord-bot
      python -m venv venv  # Create a virtual environment (optional but recommended)
      source venv/bin/activate  # Activate virtual env (Linux/macOS) or venv\Scripts\activate (Windows)
      pip install -r requirements.txt
  3. Create a .env File:

    • Copy the provided .env.example file and rename it to .env.
    • Fill in the required values in the .env file, including your Discord bot token and Transmission server details.
  4. Start the Bot:

    • If using Poetry:

      poetry shell  # Optional: Activate the virtual environment (if not already active)
      poetry run python src/main.py
    • Without Poetry:

      python src/main.py

(back to top)

Parameters

Containers are configured using parameters passed at runtime (such as those above).

Parameter Function
-e DISCORD_TOKEN Your Discord bot's token from the Developer Portal.
-e SERVER_ID The Discord server ID where the bot should operate.
-e TRANSMISSION_HOST The hostname or IP address of your Transmission server. (e.g., localhost).
-e TRANSMISSION_PORT The port used by Transmission's RPC interface. (e.g., 9091).
-e TRANSMISSION_USERNAME Your Transmission username if required.
-e TRANSMISSION_PASSWORD Your Transmission password if required.
-v /app/logs Logs directory in the container.

(back to top)

Environment variables from files (Docker secrets)

You can set any environment variable from a file by using a special prepend FILE__.

As an example:

-e FILE__MYVAR=/run/secrets/mysecretvariable

Will set the environment variable MYVAR based on the contents of the /run/secrets/mysecretvariable file.

(back to top)

Contributing

If you are interested in helping contribute, please take a look at our contribution guidelines and open an issue or pull request.

(back to top)

Changelog

See CHANGELOG for a human-readable history of changes.

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

About

A Python-based, self-hosted Discord bot designed to manage the Transmission BitTorrent client, leveraging the transmission-rpc library.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages