tgbotxx 1.2.9.5
Telegram Bot C++ Library
Loading...
Searching...
No Matches
tgbotxx::KeyboardButton Struct Reference

This object represents one button of the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, String can be used instead of this object to specify the button text. https://core.telegram.org/bots/api#keyboardbutton. More...

#include <KeyboardButton.hpp>

Public Member Functions

 KeyboardButton ()=default
 
 KeyboardButton (const nl::json &json)
 
nl::json toJson () const
 Serializes this object to JSON.
 
void fromJson (const nl::json &json)
 Deserializes this object from JSON.
 

Public Attributes

std::string 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.
 
std::string iconCustomEmojiId
 Optional. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription.
 
std::string style
 Optional. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used.
 
Ptr< KeyboardButtonRequestUsersrequestUsers
 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.
 
Ptr< KeyboardButtonRequestChatrequestChat
 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.
 
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.
 
Ptr< KeyboardButtonPollTyperequestPoll
 Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed.
 
Ptr< WebAppInfowebApp
 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.
 

Detailed Description

This object represents one button of the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, String can be used instead of this object to specify the button text. https://core.telegram.org/bots/api#keyboardbutton.

Definition at line 13 of file KeyboardButton.hpp.

Constructor & Destructor Documentation

◆ KeyboardButton() [1/2]

tgbotxx::KeyboardButton::KeyboardButton ( )
default

◆ KeyboardButton() [2/2]

tgbotxx::KeyboardButton::KeyboardButton ( const nl::json &  json)
inlineexplicit

Definition at line 15 of file KeyboardButton.hpp.

Member Function Documentation

◆ fromJson()

void tgbotxx::KeyboardButton::fromJson ( const nl::json &  json)
inline

Deserializes this object from JSON.

Definition at line 77 of file KeyboardButton.hpp.

◆ toJson()

nl::json tgbotxx::KeyboardButton::toJson ( ) const
inline

Serializes this object to JSON.

Returns
JSON representation of this object

Definition at line 61 of file KeyboardButton.hpp.

Member Data Documentation

◆ iconCustomEmojiId

std::string tgbotxx::KeyboardButton::iconCustomEmojiId

Optional. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription.

Definition at line 25 of file KeyboardButton.hpp.

◆ requestChat

Ptr<KeyboardButtonRequestChat> tgbotxx::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.

Note
Available in private chats only.

Definition at line 39 of file KeyboardButton.hpp.

◆ requestContact

bool tgbotxx::KeyboardButton::requestContact {}

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

Note
Available in private chats only.

Definition at line 43 of file KeyboardButton.hpp.

◆ requestLocation

bool tgbotxx::KeyboardButton::requestLocation {}

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

Note
Available in private chats only.

Definition at line 47 of file KeyboardButton.hpp.

◆ requestPoll

Ptr<KeyboardButtonPollType> tgbotxx::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.

Note
Available in private chats only.

Definition at line 51 of file KeyboardButton.hpp.

◆ requestUsers

Ptr<KeyboardButtonRequestUsers> tgbotxx::KeyboardButton::requestUsers

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.

Note
Available in private chats only.

Definition at line 34 of file KeyboardButton.hpp.

◆ style

std::string tgbotxx::KeyboardButton::style

Optional. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used.

Definition at line 29 of file KeyboardButton.hpp.

◆ text

std::string tgbotxx::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 20 of file KeyboardButton.hpp.

◆ webApp

Ptr<WebAppInfo> tgbotxx::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.

Note
Available in private chats only.

Definition at line 56 of file KeyboardButton.hpp.


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