korone.decorators package

Submodules

class korone.decorators.factory.HandlerObject(func, filters, group, event)[source]

Bases: object

A dataclass to store information about the handler.

This dataclass is used to store information about the handler, it stores the function, the filters, the group number and the event name.

func

The function to be executed when the event is triggered.

Type:

collections.abc.Callable

filters

The filter object used to determine if the function should be executed.

Type:

hydrogram.filters.Filter

group

The group number for the function, used for ordering the execution of multiple functions.

Type:

int

event

The event handler.

Type:

collections.abc.Callable

class korone.decorators.factory.Factory(event_name)[source]

Bases: object

Factory class to create decorators.

This class is used to create a decorator. It receives the name of the event as a parameter and returns the class that will be used to create the decorator.

Parameters:

event_name (str) – The name of the event.

event_name

The name of the event.

Type:

str

events_observed

A dictionary that stores the events observed by the factory.

Type:

dict

exception korone.decorators.router.RouterError[source]

Bases: Exception

An exception that is raised when a unsupported event is called.

This exception is raised when a unsupported event is called by the user.

class korone.decorators.router.Router[source]

Bases: object

A class that represents a decorators router.

This class is used to create a router for the decorators, it receives the name of the decorator as a parameter and returns the class that will be used to create the decorator.

message

A Factory instance for creating message decorators.

Type:

Factory

callback_query

A Factory instance for creating callback query decorators.

Type:

Factory