Types

class pyrubrum.Types
Callback = typing.Callable[[ForwardRef('BaseHandler'), pyrogram.client.client.Client, typing.Any, typing.Union[typing.Dict[str, typing.Any], NoneType]], NoneType]

This type defines the possible values for functions that work as callbacks in Pyrubrum (e.g. on_callback, on_message). They must implement the following pattern to be valid:

callback(handler, client, context, parameters=None)
Content = typing.Union[pyrogram.client.types.input_media.input_media.InputMedia, str, typing.Callable[[ForwardRef('Handler'), pyrogram.client.client.Client, typing.Any, typing.Dict[str, typing.Any]], typing.Union[pyrogram.client.types.input_media.input_media.InputMedia, str]]]

This type defines the possible values for the content that is provided as argument to a menu. A string or an instance of InputMedia is suitable for this type to be valid. A function that returns such values is valid as well and must follow this pattern:

content(handler, client, context, parameters=None)
Expire = typing.Union[bool, int, datetime.timedelta, NoneType]

This type defines the possible values for an expire (see BaseDatabase). A positive integer is suitable and indicates how many seconds a value can be kept within database. A datetime.timedelta can be provided and is valid as well. In order to indicate that there is no expire, False shall be provided.

Items = typing.Union[typing.List[pyrubrum.keyboard.element.Element], typing.Callable[[ForwardRef('ParameterizedHandler'), pyrogram.client.client.Client, typing.Any, typing.Dict[str, typing.Any]], typing.List[pyrubrum.keyboard.element.Element]]]

This type defines the possible values for items that are provided as argument to PageMenu. A list of Element is suitable for this type. A function that returns such list is valid as well and must follow this pattern:

items(handler, client, context, parameters)

This type defines the possible values for the link that is used to build an inline button that redirects to a website. A string is suitable for this type to be valid. A function that returns such value is valid as well and must follow this pattern:

link(handler, client, context, parameters=None)
Payload = typing.Union[str, typing.Callable[[ForwardRef('Handler'), pyrogram.client.client.Client, typing.Any, typing.Dict[str, typing.Any]], str]]

This type defines the possible values for the parameter that is passed to the bot using a deep-link. A string is suitable for this type to be valid. A function that returns such value is valid as well and must follow this pattern:

payload(handler, client, context, parameters=None)
Preliminary = typing.Union[typing.Callable[[ForwardRef('Handler'), pyrogram.client.client.Client, typing.Any, typing.Dict[str, typing.Any]], NoneType], typing.List[typing.Callable[[ForwardRef('Handler'), pyrogram.client.client.Client, typing.Any, typing.Dict[str, typing.Any]], NoneType]], NoneType]

This type defines the possible values which can be passed for a preliminary function. All the provided functions for this type must follow this pattern:

preliminary(handler, client, context, parameters=None)

A list of such functions can be provided as well for this type to be valid.

PyrogramCallback = typing.Callable[[pyrogram.client.client.Client, typing.Any], NoneType]

This type describes the pattern of functions which are added to a Pyrogram handler, being it:

callback(client, context)