pass_parameterized_handler¶
-
pyrubrum.
pass_parameterized_handler
(func: Callable[[BaseHandler, pyrogram.client.client.Client, Any, Optional[Dict[str, Any]]], None], handler: pyrubrum.handlers.parameterized_base_handler.ParameterizedBaseHandler) → Callable[[pyrogram.client.client.Client, Any], None]¶ Generate a function which, whenever it is called, subsequently calls
callback
, passing the handler from which this object was generated and the retrieved parameters (it creates an empty dictionary if non existent). It requires a subclass ofParameterizedBaseHandler
to be provided in order to work.- Parameters
callback (Types.Callback) – The callback function which automatically gets called by the generated function.
handler (ParameterizedBaseHandler) – The handler object which made use of this function in order to provide this one as a callback to a Pyrogram handler.
- Returns
The function which is being added to a Pyrogram handler.
- Return type
Types.PyrogramCallback
Warning
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)