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

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 webApp, requestUser, requestChat, requestContact, requestLocation, and requestPoll are mutually exclusive. More...

#include <KeyboardButton.h>

Public Types

typedef std::shared_ptr< KeyboardButtonPtr
 

Public Attributes

std::string text
 Text of the button.
 
KeyboardButtonRequestUser::Ptr requestUser
 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 webApp, requestUser, requestChat, requestContact, requestLocation, and requestPoll are mutually exclusive.

Definition at line 21 of file KeyboardButton.h.

Member Typedef Documentation

◆ Ptr

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

Definition at line 24 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 “chat_shared” service message. Available in private chats only.

Definition at line 47 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 54 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 61 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 68 of file KeyboardButton.h.

◆ requestUser

KeyboardButtonRequestUser::Ptr TgBot::KeyboardButton::requestUser

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

Tapping on any user will send their identifier to the bot in a “user_shared” service message. Available in private chats only.

Definition at line 39 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 31 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 “web_app_data” service message. Available in private chats only.

Definition at line 76 of file KeyboardButton.h.


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