class pyrubrum.ParameterizedHandler(nodes: Set[pyrubrum.tree.node.Node], database: pyrubrum.database.base_database.BaseDatabase)

Implementation of an handler which mixes the features of Handler and ParameterizedBaseHandler and has got, by definition, multiple top-level nodes whose linked menu are displayed to the user whenever a message is being handled and matches one of their filters, and a database with which it is possible to perform parameterization (i.e. it supports parameters).

  • nodes (Set[Node]) – The top-level nodes, which represent the text commands that are available to the user. See Handler for more information.

  • database (BaseDatabase) – The storage for all the query parameters. It is used to pass parameters between menus. See ParameterizedBaseHandler for more information.

setup(client: pyrogram.client.client.Client)

Make all the defined menus reachable by the client by adding handlers that catch all their identifiers to it. It adds support to parameterization by applying ParameterizedBaseHandler.filter to all the handled callback queries. It also calls pass_parameterized_handler, which lets the callback functions get this handler as argument and deletes handled callback queries from the database relying on the passed identifiers.

Finally, it makes the top-level menus reachable whenever a message is sent to the bot and matches one of their filters.


client (Client) – The client which is being set up.


The functions the handlers make use of are not set up in the same way objects added using Pyrogram handlers are. Pyrubrum implements the following pattern:

callback(handler, client, context, parameters)