tgbotxx  1.1.6.9
Telegram Bot C++ Library
tgbotxx::ForceReply Struct Reference

Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. https://core.telegram.org/bots/features#privacy-mode Example. A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll: More...

#include <ForceReply.hpp>

Inheritance diagram for tgbotxx::ForceReply:
tgbotxx::IReplyMarkup

Public Member Functions

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

Public Attributes

bool forceReply {}
 Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'. More...
 
std::string inputFieldPlaceholder
 Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters. More...
 
bool selective {}
 Optional. Use this parameter if you want to force reply from specific users only. Targets: More...
 

Detailed Description

Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. https://core.telegram.org/bots/features#privacy-mode Example. A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:

  • Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
  • Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'. The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions - without any extra work for the user. https://core.telegram.org/bots/api#forcereply

Definition at line 15 of file ForceReply.hpp.

Constructor & Destructor Documentation

◆ ForceReply() [1/2]

tgbotxx::ForceReply::ForceReply ( )
default

◆ ForceReply() [2/2]

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

Definition at line 17 of file ForceReply.hpp.

Member Function Documentation

◆ fromJson()

void tgbotxx::ForceReply::fromJson ( const nl::json &  json)
inlineoverridevirtual

Deserializes this object from JSON.

Implements tgbotxx::IReplyMarkup.

Definition at line 45 of file ForceReply.hpp.

◆ toJson()

nl::json tgbotxx::ForceReply::toJson ( ) const
inlineoverridevirtual

Serializes this object to JSON.

Returns
JSON representation of this object

Implements tgbotxx::IReplyMarkup.

Definition at line 36 of file ForceReply.hpp.

Member Data Documentation

◆ forceReply

bool tgbotxx::ForceReply::forceReply {}

Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'.

Definition at line 22 of file ForceReply.hpp.

◆ inputFieldPlaceholder

std::string tgbotxx::ForceReply::inputFieldPlaceholder

Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters.

Definition at line 25 of file ForceReply.hpp.

◆ selective

bool tgbotxx::ForceReply::selective {}

Optional. Use this parameter if you want to force reply from specific users only. Targets:

  • 1) users that are @mentioned in the text of the Message object;
  • 2) if the bot's message is a reply (has replyToMessageId), sender of the original message.

Definition at line 31 of file ForceReply.hpp.


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