From e1651b15f37f194436fd4c8a30b9a6d5c9775232 Mon Sep 17 00:00:00 2001 From: llnulldisk <48621230+llnulldisk@users.noreply.github.com> Date: Tue, 30 Aug 2022 20:06:06 +0200 Subject: Update to API 4.8 --- src/TgTypeParser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/TgTypeParser.cpp') 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("type", ""); result->allowsMultipleAnswers = data.get("allows_multiple_answers", false); result->correctOptionId = data.get("correct_option_id", 0); + result->explanation = data.get("explanation", ""); + result->explanationEntities = parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetMessageEntity, data, "explanation_entities"); + result->openPeriod = data.get("open_period", 0); + result->closeDate = data.get("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()); + result->emoji = data.get("emoji", ""); result->value = data.get("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 += '}'; -- cgit v1.2.3