DeepLinkMenu¶
-
class
pyrubrum.DeepLinkMenu(name: str, menu_id: str, payload: Union[str, Callable[[Handler, pyrogram.client.client.Client, Any, Dict[str, Any]], str]], deep_link_type: Optional[str] = 'start')¶ Implementation of a menu which automatically creates a deep-link, given a parameter that shall be passed.
- Parameters
name (str) – The name you give to the menu, which will be used as the text of callback button, if needed. See
BaseMenufor more information.menu_id (str) – The unique identifier given to the menu, which will refer unequivocally to this entity. The hash for this class is generated relying on the content of this field. Avoid using
0as it is used for buttons whose purpose is only related to design (i.e. they do not point to any menu, see Null-pointer button). SeeBaseMenufor more information.payload (Types.Payload) –
What will be passed to as payload using the deep-linking. A function can be provided as well and must follow the following arguments pattern:
func(handler, client, context, parameters)
deep_link_type (Optional[str]) – The type of deep-link that is being generated, which must be either
startorstartgroup. Defaults tostart.
-
button(handler: BaseHandler, client: Client, context: Any, parameters: Optional[Dict[str, Any]] = None) → pyrubrum.keyboard.button.Button¶ Create an inline button which makes use of deep-linking, following the defined
DeepLinkMenu.deep_link_typeand passing the parameter retrieved fromDeepLinkMenu.payload.- Parameters
handler (BaseHandler) – The handler which coordinates the management of the menus.
client (Client) – The client which is linked to the handler.
context (Union[CallbackQuery, Message]) – The context for which button is generated for.
parameters (Optional[Dict[str, Any]]) – The parameters which were passed to the handler. Defaults to
None.
- Returns
The generated button.
- Return type