Skip to main content

pawabot

ci documentation pypi version gitter

My personal Telegram bot: aria2 management, torrent sites crawling, media organization with mvodb and Plex, etc.

This bot provides a command to search for torrents on the web, and let you select them for download. There is a basic permission system allowing to manage multiple users for one bot.

Installation

pip install pawabot

With uv:

uv tool install pawabot

Setup

  1. Create your Telegram bot account by talking to the @botfather bot.
  2. Write your bot token in ~/.config/pawabot/bot_token.txt, or set and export the environment variable BOT_TOKEN.
  3. Register your Telegram main account as administrator in the database with:
pawabot create-admin -i MY_TG_ID -u MY_TG_USERNAME

Usage

usage: pawabot [-h] [-L {TRACE,DEBUG,INFO,SUCCESS,WARNING,ERROR,CRITICAL}]
               ...

optional arguments:
  -h, --help            show this help message and exit

Commands:

    run                 Run the bot.
    create-admin        Create an administrator in the database.
    create-user         Create a user in the database.
    list-users          List registered users.

Global options:
  -L {TRACE,DEBUG,INFO,SUCCESS,WARNING,ERROR,CRITICAL}, --log-level {TRACE,DEBUG,INFO,SUCCESS,WARNING,ERROR,CRITICAL}
                        Log level to use

Commands:

create-admin

usage: pawabot create-admin [-h] [-i UID] [-u USERNAME]

Create an administrator in the database.

optional arguments:
  -h, --help            Show this help message and exit.
  -i UID, --uid UID     Telegram user id.
  -u USERNAME, --username USERNAME
                        Telegram user name.

create-user

usage: pawabot create-user [-h] [-i UID] [-u USERNAME] [-a]

Create a user in the database.

optional arguments:
  -h, --help            Show this help message and exit.
  -i UID, --uid UID     Telegram user id.
  -u USERNAME, --username USERNAME
                        Telegram user name.
  -a, --admin           Give admin access.

list-users

usage: pawabot list-users [-h]

List registered users.

optional arguments:
  -h, --help  Show this help message and exit.

run

usage: pawabot run [-h]

Run the bot.

optional arguments:
  -h, --help  Show this help message and exit.
/search <movie name>
/search <imdb_id>            (e.g. /search tt1254207)
/cancel

In Telegram, search for a movie, choose its number, then choose a torrent to download with aria2. Results show release quality, seeders and size when available. Use Next/Previous to browse torrents, /cancel to leave, or /search to start again. Only movies are supported.

Title search tries OMDb when OMDB_API_KEY is set, then TMDB when TMDB_API_KEY is set, and finally Cinemeta (no API key needed). TMDB IMDb IDs are resolved only after selecting a movie. Searching by IMDb ID skips title lookup.

Torrentio uses its public Stremio JSON interface; no Stremio installation or debrid account is required. Set TORRENTIO_BASE_URL to override its base URL (default: https://torrentio.strem.fun, without /manifest.json). The endpoint must return raw torrent streams; HTTP/debrid-only results are not downloadable through this search flow. Provider failures are reported separately from empty results.

Searching requires the Downloader privilege. Starting a download additionally requires Verified Downloader, or administrator access. The bot preserves Torrentio's file selection for movies inside multi-file torrents. Administrator approval requests are not implemented; users without Verified Downloader must ask an administrator for access.

The implementation is grouped under src/pawabot/_internal/search/:

  • __init__.py: the search entry points and metadata-provider fallback order used by the bot.
  • models.py: shared movie and torrent data.
  • metadata.py: OMDb, TMDB, and Cinemeta clients, including IMDb ID resolution.
  • torrentio.py: Torrentio requests and conversion of stream responses into torrents.
  • _http.py: shared JSON requests, response validation, and provider errors.

Telegram conversations and the aria2 download handoff live in callbacks.py.

Metadata

Release files for pawabot 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pawabot 0.2.0
File Size Uploaded
pawabot-0.2.0.tar.gz 43.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pawabot 0.2.0
File Interpreter ABI Platform
pawabot-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 71.3 kB

Release files / pawabot-0.2.0.tar.gz

Download URL pawabot-0.2.0.tar.gz
Size 43.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dca0481f1753a062d27f050b25aef08683f4c6270ac1536ef12fba7edec62ba2
BLAKE2b-256 checksum
How to use checksums
9477d9bb7f0a137e859f891de07f641b5a28a75ff05a586dc799b17be0f18765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pawabot-0.2.0-py3-none-any.whl

Download URL pawabot-0.2.0-py3-none-any.whl
Size 27.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7465e5976b33ad97d6de998c365002c5d1f438fe556ef459cfbe46699615a959
BLAKE2b-256 checksum
How to use checksums
b72491be39e05afd7af8ce22f51ef3095f9fbbcf02460beaac250a39a52d24e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page