peyk.dispatcher.middlewares.utils

Classes

CallbackAnswer([text, show_alert])

Configuration for automatic callback-query acknowledgement.

CallbackAnswerMiddleware()

Automatically acknowledge callback queries after a handler succeeds.

ChatActionMiddleware()

Send the action named by flags.chat_action around a handler.

ChatActionSender(bot, chat_id[, action, ...])

Keep a chat action alive while a handler is running.

class peyk.dispatcher.middlewares.utils.ChatActionSender(bot: _BotLike, chat_id: int | str, action: str = 'typing', interval: float = 4.0)[source]

Bases: object

Keep a chat action alive while a handler is running.

bot: _BotLike
chat_id: int | str
action: str = 'typing'
interval: float = 4.0
classmethod typing(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the typing operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

classmethod upload_photo(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the upload photo operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

classmethod record_video(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the record video operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

classmethod upload_video(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the upload video operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

classmethod record_voice(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the record voice operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

classmethod upload_document(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the upload document operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

classmethod choose_sticker(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the choose sticker operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

classmethod find_location(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the find location operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

classmethod record_video_note(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the record video note operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

classmethod upload_video_note(bot: _BotLike, chat_id: int | str, interval: float = 4.0) ChatActionSender[source]

Performs the upload video note operation for the dispatcher client.

Parameters:
  • bot – Value used by this operation.

  • chat_id – Identifier of the target chat.

  • interval – Value used by this operation.

Returns:

Result produced by the dispatcher operation.

class peyk.dispatcher.middlewares.utils.ChatActionMiddleware[source]

Bases: object

Send the action named by flags.chat_action around a handler.

class peyk.dispatcher.middlewares.utils.CallbackAnswer(text: str | None = None, show_alert: bool = False)[source]

Bases: object

Configuration for automatic callback-query acknowledgement.

text: str | None = None
show_alert: bool = False
class peyk.dispatcher.middlewares.utils.CallbackAnswerMiddleware[source]

Bases: object

Automatically acknowledge callback queries after a handler succeeds.