pass_handler

pyrubrum.pass_handler(callback: Callable[[BaseHandler, pyrogram.client.client.Client, Any, Optional[Dict[str, Any]]], None], handler: pyrubrum.handlers.base_handler.BaseHandler) → 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.

Parameters
  • callback (Types.Callback) – The callback function which automatically gets called by the generated function.

  • handler (BaseHandler) – 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)