tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
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.
 
void fromJson (const nl::json &json)
 Deserializes this object from JSON.
 

Public Attributes

std::string id
 Unique poll identifier.
 
std::string question
 Poll question, 1-300 characters.
 
std::vector< Ptr< MessageEntity > > questionEntities
 Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions.
 
std::vector< Ptr< PollOption > > options
 List of poll options.
 
std::int32_t totalVoterCount {}
 Total number of users that voted in the poll.
 
bool isClosed {}
 True, if the poll is closed.
 
bool isAnonymous {}
 True, if the poll is anonymous.
 
std::string type
 Poll type, currently can be “regular” or “quiz”
 
bool allowsMultipleAnswers {}
 True, if the poll allows multiple answers.
 
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.
 
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.
 
std::vector< Ptr< MessageEntity > > explanationEntities
 Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation.
 
std::int32_t openPeriod {}
 Optional. Amount of time in seconds the poll will be active after creation.
 
std::time_t closeDate {}
 Optional. Point in time (Unix timestamp) when the poll will be automatically closed.
 

Detailed Description

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

Definition at line 10 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 12 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 81 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 61 of file Poll.hpp.

Member Data Documentation

◆ allowsMultipleAnswers

bool tgbotxx::Poll::allowsMultipleAnswers {}

True, if the poll allows multiple answers.

Definition at line 41 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 57 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 45 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 48 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 51 of file Poll.hpp.

◆ id

std::string tgbotxx::Poll::id

Unique poll identifier.

Definition at line 17 of file Poll.hpp.

◆ isAnonymous

bool tgbotxx::Poll::isAnonymous {}

True, if the poll is anonymous.

Definition at line 35 of file Poll.hpp.

◆ isClosed

bool tgbotxx::Poll::isClosed {}

True, if the poll is closed.

Definition at line 32 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 54 of file Poll.hpp.

◆ options

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

List of poll options.

Definition at line 26 of file Poll.hpp.

◆ question

std::string tgbotxx::Poll::question

Poll question, 1-300 characters.

Definition at line 20 of file Poll.hpp.

◆ questionEntities

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

Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions.

Definition at line 23 of file Poll.hpp.

◆ totalVoterCount

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

Total number of users that voted in the poll.

Definition at line 29 of file Poll.hpp.

◆ type

std::string tgbotxx::Poll::type

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

Definition at line 38 of file Poll.hpp.


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