korone.handlers package

class korone.handlers.CallbackQueryHandler[source]

Bases: ABC

Abstract base class for callback query handlers.

This class is an abstract base class for callback query handlers. It defines the interface for callback query handlers. All callback query handlers must inherit from this class.

abstract async handle(client, callback)[source]

Handle a callback query.

TThis method is called when a callback query is received. It takes a Client object and a CallbackQuery object as parameters and performs some action based on the callback query content or metadata. This method must be implemented by subclasses.

Parameters:
class korone.handlers.MagicMessageHandler(callback, filters=None)[source]

Bases: MessageHandler

A message handler that can use magic filters.

This class is a subclass of the MessageHandler class. It allows the use of magic filters in the handler. Magic filters are filters that can be used to determine if the handler should be executed.

Parameters:
  • callback (collections.abc.Callable) – The function to be executed when the event is triggered.

  • filters (hydrogram.filters.Filter | magic_filter.MagicFilter | None) – The filter object used to determine if the function should be executed.

References

async check(client, message)[source]

Check if the handler should be executed.

This method is used to check if the handler should be executed. It checks if the message has a matching listener and if the filters return True.

Parameters:
  • client (Client) – The client that received the message.

  • message (Message) – The message that was received.

Returns:

bool – True if the handler should be executed, False otherwise.

class korone.handlers.MessageHandler[source]

Bases: ABC

Abstract base class for message handlers.

This class is an abstract base class for message handlers. It defines the interface for message handlers. All message handlers must inherit from this class.

abstract async handle(client, message)[source]

Handle a message.

This method is called when a message is received. It takes a Client object and a Message object as parameters and performs some action based on the message content or metadata. This method must be implemented by subclasses.

Parameters:

Submodules

class korone.handlers.message_handler.MagicMessageHandler(callback, filters=None)[source]

Bases: MessageHandler

A message handler that can use magic filters.

This class is a subclass of the MessageHandler class. It allows the use of magic filters in the handler. Magic filters are filters that can be used to determine if the handler should be executed.

Parameters:
  • callback (collections.abc.Callable) – The function to be executed when the event is triggered.

  • filters (hydrogram.filters.Filter | magic_filter.MagicFilter | None) – The filter object used to determine if the function should be executed.

References

async check(client, message)[source]

Check if the handler should be executed.

This method is used to check if the handler should be executed. It checks if the message has a matching listener and if the filters return True.

Parameters:
  • client (Client) – The client that received the message.

  • message (Message) – The message that was received.

Returns:

bool – True if the handler should be executed, False otherwise.