tgbot-cpp
Loading...
Searching...
No Matches
TgBot::KeyboardButton Class Reference

This object represents one button of the reply keyboard. More...

#include <KeyboardButton.h>

Public Types

typedef std::shared_ptr< KeyboardButtonPtr
 

Public Attributes

std::string text
 Text of the button.
 
KeyboardButtonRequestUsers::Ptr requestUsers
 Optional. If specified, pressing the button will open a list of suitable users.
 
KeyboardButtonRequestChat::Ptr requestChat
 Optional. If specified, pressing the button will open a list of suitable chats.
 
bool requestContact
 Optional. If True, the user's phone number will be sent as a contact when the button is pressed.
 
bool requestLocation
 Optional. If True, the user's current location will be sent when the button is pressed.
 
KeyboardButtonPollType::Ptr requestPoll
 Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed.
 
WebAppInfo::Ptr webApp
 Optional. If specified, the described Web App will be launched when the button is pressed.
 

Detailed Description

This object represents one button of the reply keyboard.

For simple text buttons, String can be used instead of this object to specify the button text. The optional fields KeyboardButton::webApp, KeyboardButton::requestUsers, KeyboardButton::requestChat, KeyboardButton::requestContact, KeyboardButton::requestLocation, and KeyboardButton::requestPoll are mutually exclusive.

Note: KeyboardButton::requestUsers and KeyboardButton::requestChat options will only work in Telegram versions released after 3 February, 2023. Older clients will display unsupported message.

Definition at line 25 of file KeyboardButton.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<KeyboardButton> TgBot::KeyboardButton::Ptr

Definition at line 28 of file KeyboardButton.h.

Member Data Documentation

◆ requestChat

KeyboardButtonRequestChat::Ptr TgBot::KeyboardButton::requestChat

Optional. If specified, pressing the button will open a list of suitable chats.

Tapping on a chat will send its identifier to the bot in a “chatShared” service message. Available in private chats only.

Definition at line 51 of file KeyboardButton.h.

◆ requestContact

bool TgBot::KeyboardButton::requestContact

Optional. If True, the user's phone number will be sent as a contact when the button is pressed.

Available in private chats only.

Definition at line 58 of file KeyboardButton.h.

◆ requestLocation

bool TgBot::KeyboardButton::requestLocation

Optional. If True, the user's current location will be sent when the button is pressed.

Available in private chats only.

Definition at line 65 of file KeyboardButton.h.

◆ requestPoll

KeyboardButtonPollType::Ptr TgBot::KeyboardButton::requestPoll

Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed.

Available in private chats only.

Definition at line 72 of file KeyboardButton.h.

◆ requestUsers

KeyboardButtonRequestUsers::Ptr TgBot::KeyboardButton::requestUsers

Optional. If specified, pressing the button will open a list of suitable users.

Identifiers of selected users will be sent to the bot in a “usersShared” service message. Available in private chats only.

Definition at line 43 of file KeyboardButton.h.

◆ text

std::string TgBot::KeyboardButton::text

Text of the button.

If none of the optional fields are used, it will be sent as a message when the button is pressed

Definition at line 35 of file KeyboardButton.h.

◆ webApp

WebAppInfo::Ptr TgBot::KeyboardButton::webApp

Optional. If specified, the described Web App will be launched when the button is pressed.

The Web App will be able to send a “webAppData” service message. Available in private chats only.

Definition at line 80 of file KeyboardButton.h.


The documentation for this class was generated from the following file: