Button

class telegram_bot_discussion.button.button.Button(chat_id, recipient_id=None, **kwargs)[source]

Bases: ABC

Button is base class for creating Telegram-button.

Parameters:
  • chat_id (int)

  • recipient_id (int)

class Meta[source]

Bases: ButtonMeta

params: Params

its values need to be stored in button.

Type:

Params

chat_id: int
recipient_id: int
abstractmethod async classmethod on_click(update, context)[source]

Reaction to a user’s button click

Parameters:
  • update (Update)

  • context (CallbackContext)

classmethod action()[source]
Return type:

str

classmethod life_time()[source]
Return type:

Optional[timedelta]

get_title()[source]
Return type:

str

set_title(title)[source]

Method for force set Telegram-button title

Return type:

Button

Parameters:

title (str)

equals(other, callback_data_coder)[source]

Method for comparing a Button object with another Button object or a native Telegram-button (e.g. InlineKeyboardButton).

Return type:

bool

Parameters:
as_button(callback_data_coder)[source]

Method for create Telegram-button

Return type:

InlineKeyboardButton

Parameters:

callback_data_coder (CoderInterface)