Skip to main content

pyrolisten

client.listen() and client.ask() for Pyrogram, Kurigram and other Pyrogram forks. Methods your library already provides are never overridden.

Install

pip install pyrolisten

pyrolisten does not force a Pyrogram library on you, because most forks install the same pyrogram module and two of them in one environment break each other. If you already have one (pyrogram, kurigram, ...), you're done. If not, pick one with an extra:

pip install "pyrolisten[kurigram]"

Extras: pyrogram, kurigram. Choose one.

Usage

import pyrolisten.listen        # once, at startup (e.g. main.py), before your plugins load
from pyrogram import Client, filters, ListenerTimeout, ListenerCanceled

app = Client("my_bot", api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN)

@app.on_message(filters.command("name"))
async def name(client, message):
    try:
        reply = await client.ask(
            message.chat.id, "What's your name?",
            user_id=message.from_user.id, timeout=30,
        )
        await reply.reply(f"Hi {reply.text}!")
    except ListenerTimeout:
        await message.reply("Too slow!")
    except ListenerCanceled:
        pass  # client.cancel_listener(...) was called

app.run()

API

Method Description
await client.listen(chat_id=None, filters=None, timeout=60, user_id=None) Wait for the next matching message. timeout=None waits forever.
await client.ask(chat_id, text, filters=None, timeout=60, user_id=None, **send_kwargs) Send text, then wait. The sent message is response.request.
client.cancel_listener(chat_id=None, user_id=None) Cancel pending listeners (all if no arguments). Returns the count. Alias: stop_listening.

After import pyrolisten.listen the exceptions can be imported from pyrogram (from pyrogram import ListenerTimeout, ListenerCanceled), pyrogram.errors (from pyrogram.errors import ListenerTimeout), or directly from pyrolisten. This needs pyrolisten.listen to be imported first; editors and type checkers won't know about patched names on pyrogram, so from pyrolisten import ... is the safer choice for typed projects.

Exceptions: ListenerTimeout (also an asyncio.TimeoutError) and ListenerCanceled (aliases: ListenerCancelled, ListenerStopped).

Author

Maharam Ali Khan

Based on the idea of Kurikit; the listen/ask API is inspired by pyromod. No pyromod code is used.

License

MIT (see LICENSE)

Metadata

Release files for pyrolisten 0.1.1

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

Source distribution (sdist)

Source distribution for pyrolisten 0.1.1
File Size Uploaded Provenance Actions
pyrolisten-0.1.1.tar.gz 5.4 kB With provenance Details for pyrolisten-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 11.7 kB

Release files / pyrolisten-0.1.1.tar.gz

Download URL pyrolisten-0.1.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ca367530111d78e2f0da959938addb31a459995fea1edccabf580713cec51a11
BLAKE2b-256 checksum
How to use checksums
365f533d65c4e1d3fdf27c2642d82a5fd979d5c846ab49ad32b9c437939cbe62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / pyrolisten-0.1.1-py3-none-any.whl

Download URL pyrolisten-0.1.1-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d0e8f3f56df86a45e06f64ba0e1656e0edf24a83391de47b6aac383bad3918d
BLAKE2b-256 checksum
How to use checksums
bdc435841e05632712afd488e38c1c63d953b4d17e7f150095a8e70a98c23d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for pyrolisten 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyrolisten-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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