Skip to content
module

tgintegration.containers.reply_keyboard

Classes
  • ReplyKeyboard Represents a regular keyboard in the Telegram UI and allows to click buttons in the menu.</>
class

tgintegration.containers.reply_keyboard.ReplyKeyboard(controller, chat_id, message_id, button_rows)

Represents a regular keyboard in the Telegram UI and allows to click buttons in the menu.

Attributes
  • num_buttons (int) Returns the total number of buttons in all underlying rows.</>
See Also
Methods
  • click(pattern, filters, quote) (Response) Uses find_button with the given pattern, clicks the button if found, and waits for the bot to react. For a ReplyKeyboard, this means that a message with the button's caption will be sent to the same chat.</>
  • find_button(pattern) (KeyboardButton) Attempts to retrieve a clickable button anywhere in the underlying rows by matching the button captions with the given pattern. If no button could be found, this method raises NoButtonFound.</>
method

find_button(pattern)

Attempts to retrieve a clickable button anywhere in the underlying rows by matching the button captions with the given pattern. If no button could be found, this method raises NoButtonFound.

Parameters
  • pattern (pattern) The button caption to look for (by re.match).
Returns (KeyboardButton)

The KeyboardButton if found.

method

click(pattern, filters=None, quote=False)

Uses find_button with the given pattern, clicks the button if found, and waits for the bot to react. For a ReplyKeyboard, this means that a message with the button's caption will be sent to the same chat.

If not button could be found, NoButtonFound will be raised.

Parameters
  • pattern (pattern) The button caption to look for (by re.match).
  • filters (Filter, optional) Additional filters to be given to collect. Will be merged with a "same chat" filter and filters.text | filters.edited.
  • quote (bool, optional) Whether to reply to the message containing the buttons.
Returns (Response)

The bot's Response.