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

This object contains information about a poll. https://core.telegram.org/bots/api#poll. More...

#include <Poll.hpp>

Public Member Functions

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

Public Attributes

std::string id
 Unique poll identifier. More...
 
std::string question
 Poll question, 1-300 characters. More...
 
std::vector< Ptr< PollOption > > options
 List of poll options. More...
 
std::int32_t totalVoterCount {}
 Total number of users that voted in the poll. More...
 
bool isClosed {}
 True, if the poll is closed. More...
 
bool isAnonymous {}
 True, if the poll is anonymous. More...
 
std::string type
 Poll type, currently can be “regular” or “quiz” More...
 
bool allowsMultipleAnswers {}
 True, if the poll allows multiple answers. More...
 
std::int32_t correctOptionId {}
 Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. More...
 
std::string explanation
 Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters. More...
 
std::vector< Ptr< MessageEntity > > explanationEntities
 Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation. More...
 
std::int32_t openPeriod {}
 Optional. Amount of time in seconds the poll will be active after creation. More...
 
std::time_t closeDate {}
 Optional. Point in time (Unix timestamp) when the poll will be automatically closed. More...
 

Detailed Description

This object contains information about a poll. https://core.telegram.org/bots/api#poll.

Definition at line 9 of file Poll.hpp.

Constructor & Destructor Documentation

◆ Poll() [1/2]

tgbotxx::Poll::Poll ( )
default

◆ Poll() [2/2]

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

Definition at line 11 of file Poll.hpp.

Member Function Documentation

◆ fromJson()

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

Deserializes this object from JSON.

Definition at line 76 of file Poll.hpp.

◆ toJson()

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

Serializes this object to JSON.

Returns
JSON representation of this object

Definition at line 57 of file Poll.hpp.

Member Data Documentation

◆ allowsMultipleAnswers

bool tgbotxx::Poll::allowsMultipleAnswers {}

True, if the poll allows multiple answers.

Definition at line 37 of file Poll.hpp.

◆ closeDate

std::time_t tgbotxx::Poll::closeDate {}

Optional. Point in time (Unix timestamp) when the poll will be automatically closed.

Definition at line 53 of file Poll.hpp.

◆ correctOptionId

std::int32_t tgbotxx::Poll::correctOptionId {}

Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.

Definition at line 41 of file Poll.hpp.

◆ explanation

std::string tgbotxx::Poll::explanation

Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters.

Definition at line 44 of file Poll.hpp.

◆ explanationEntities

std::vector<Ptr<MessageEntity> > tgbotxx::Poll::explanationEntities

Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation.

Definition at line 47 of file Poll.hpp.

◆ id

std::string tgbotxx::Poll::id

Unique poll identifier.

Definition at line 16 of file Poll.hpp.

◆ isAnonymous

bool tgbotxx::Poll::isAnonymous {}

True, if the poll is anonymous.

Definition at line 31 of file Poll.hpp.

◆ isClosed

bool tgbotxx::Poll::isClosed {}

True, if the poll is closed.

Definition at line 28 of file Poll.hpp.

◆ openPeriod

std::int32_t tgbotxx::Poll::openPeriod {}

Optional. Amount of time in seconds the poll will be active after creation.

Definition at line 50 of file Poll.hpp.

◆ options

std::vector<Ptr<PollOption> > tgbotxx::Poll::options

List of poll options.

Definition at line 22 of file Poll.hpp.

◆ question

std::string tgbotxx::Poll::question

Poll question, 1-300 characters.

Definition at line 19 of file Poll.hpp.

◆ totalVoterCount

std::int32_t tgbotxx::Poll::totalVoterCount {}

Total number of users that voted in the poll.

Definition at line 25 of file Poll.hpp.

◆ type

std::string tgbotxx::Poll::type

Poll type, currently can be “regular” or “quiz”

Definition at line 34 of file Poll.hpp.


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