summaryrefslogtreecommitdiff
path: root/src/TgTypeParser.cpp
diff options
context:
space:
mode:
authorllnulldisk <48621230+llnulldisk@users.noreply.github.com>2022-08-30 20:06:06 +0200
committerllnulldisk <48621230+llnulldisk@users.noreply.github.com>2022-08-30 20:06:06 +0200
commite1651b15f37f194436fd4c8a30b9a6d5c9775232 (patch)
tree78a3193074de8fbc837af82dc12f67eca7fed500 /src/TgTypeParser.cpp
parent4aa6af3180aef70f9a4320a2f6d818f68f5bb669 (diff)
Update to API 4.8
Diffstat (limited to 'src/TgTypeParser.cpp')
-rw-r--r--src/TgTypeParser.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index 41cf642..d1d0ecb 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -430,6 +430,10 @@ Poll::Ptr TgTypeParser::parseJsonAndGetPoll(const ptree& data) const {
result->type = data.get<string>("type", "");
result->allowsMultipleAnswers = data.get<bool>("allows_multiple_answers", false);
result->correctOptionId = data.get<int32_t>("correct_option_id", 0);
+ result->explanation = data.get<string>("explanation", "");
+ result->explanationEntities = parseJsonAndGetArray<MessageEntity>(&TgTypeParser::parseJsonAndGetMessageEntity, data, "explanation_entities");
+ result->openPeriod = data.get<int32_t>("open_period", 0);
+ result->closeDate = data.get<int64_t>("close_date", 0);
return result;
}
@@ -448,6 +452,10 @@ string TgTypeParser::parsePoll(const Poll::Ptr& object) const {
appendToJson(result, "type", object->type);
appendToJson(result, "allows_multiple_answers", object->allowsMultipleAnswers);
appendToJson(result, "correct_option_id", object->correctOptionId);
+ appendToJson(result, "explanation", object->correctOptionId);
+ appendToJson(result, "explanation_entities", parseArray(&TgTypeParser::parseMessageEntity, object->explanationEntities));
+ appendToJson(result, "open_period", object->openPeriod);
+ appendToJson(result, "close_date", object->closeDate);
removeLastComma(result);
result += '}';
return result;
@@ -455,6 +463,7 @@ string TgTypeParser::parsePoll(const Poll::Ptr& object) const {
Dice::Ptr TgTypeParser::parseJsonAndGetDice(const ptree& data) const {
auto result(make_shared<Dice>());
+ result->emoji = data.get<string>("emoji", "");
result->value = data.get<int8_t>("value", 0);
return result;
}
@@ -465,6 +474,7 @@ string TgTypeParser::parseDice(const Dice::Ptr& object) const {
}
string result;
result += '{';
+ appendToJson(result, "emoji", object->emoji);
appendToJson(result, "value", object->value);
removeLastComma(result);
result += '}';