From 5aaaa79ee2441dd36a3af4e1c869717bf9b2c927 Mon Sep 17 00:00:00 2001 From: llnulldisk <48621230+llnulldisk@users.noreply.github.com> Date: Mon, 15 Apr 2024 12:46:10 +0200 Subject: Update to Bot API 6.8 --- src/Api.cpp | 9 ++++++++ src/TgTypeParser.cpp | 61 ++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 52 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/Api.cpp b/src/Api.cpp index 8a91aee..b3ce4ea 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -1664,6 +1664,15 @@ bool Api::unhideGeneralForumTopic(boost::variant chat return sendRequest("unhideGeneralForumTopic", args).get("", false); } +bool Api::unpinAllGeneralForumTopicMessages(boost::variant chatId) const { + std::vector args; + args.reserve(1); + + args.emplace_back("chat_id", chatId); + + return sendRequest("unpinAllGeneralForumTopicMessages", args).get("", false); +} + bool Api::answerCallbackQuery(const std::string& callbackQueryId, const std::string& text, bool showAlert, diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp index 76a4add..86a25c1 100644 --- a/src/TgTypeParser.cpp +++ b/src/TgTypeParser.cpp @@ -152,6 +152,7 @@ Chat::Ptr TgTypeParser::parseJsonAndGetChat(const boost::property_tree::ptree& d return innerData.get(""); }, data, "active_usernames"); result->emojiStatusCustomEmojiId = data.get("emoji_status_custom_emoji_id", ""); + result->emojiStatusExpirationDate = data.get("emoji_status_expiration_date", 0); result->bio = data.get("bio", ""); result->hasPrivateForwards = data.get("has_private_forwards", false); result->hasRestrictedVoiceAndVideoMessages = data.get("has_restricted_voice_and_video_messages", false); @@ -200,6 +201,7 @@ std::string TgTypeParser::parseChat(const Chat::Ptr& object) const { return s; }, object->activeUsernames)); appendToJson(result, "emoji_status_custom_emoji_id", object->emojiStatusCustomEmojiId); + appendToJson(result, "emoji_status_expiration_date", object->emojiStatusExpirationDate); appendToJson(result, "bio", object->bio); appendToJson(result, "has_private_forwards", object->hasPrivateForwards); appendToJson(result, "has_restricted_voice_and_video_messages", object->hasRestrictedVoiceAndVideoMessages); @@ -229,19 +231,19 @@ Message::Ptr TgTypeParser::parseJsonAndGetMessage(const boost::property_tree::pt result->messageThreadId = data.get("message_thread_id", 0); result->from = tryParseJson(&TgTypeParser::parseJsonAndGetUser, data, "from"); result->senderChat = tryParseJson(&TgTypeParser::parseJsonAndGetChat, data, "sender_chat"); - result->date = data.get("date", 0); + result->date = data.get("date", 0); result->chat = parseJsonAndGetChat(data.find("chat")->second); result->forwardFrom = tryParseJson(&TgTypeParser::parseJsonAndGetUser, data, "forward_from"); result->forwardFromChat = tryParseJson(&TgTypeParser::parseJsonAndGetChat, data, "forward_from_chat"); result->forwardFromMessageId = data.get("forward_from_message_id", 0); result->forwardSignature = data.get("forward_signature", ""); result->forwardSenderName = data.get("forward_sender_name", ""); - result->forwardDate = data.get("forward_date", 0); + result->forwardDate = data.get("forward_date", 0); result->isTopicMessage = data.get("is_topic_message", false); result->isAutomaticForward = data.get("is_automatic_forward", false); result->replyToMessage = tryParseJson(&TgTypeParser::parseJsonAndGetMessage, data, "reply_to_message"); result->viaBot = tryParseJson(&TgTypeParser::parseJsonAndGetUser, data, "via_bot"); - result->editDate = data.get("edit_date", 0); + result->editDate = data.get("edit_date", 0); result->hasProtectedContent = data.get("has_protected_content", false); result->mediaGroupId = data.get("media_group_id", ""); result->authorSignature = data.get("author_signature", ""); @@ -252,6 +254,7 @@ Message::Ptr TgTypeParser::parseJsonAndGetMessage(const boost::property_tree::pt result->document = tryParseJson(&TgTypeParser::parseJsonAndGetDocument, data, "document"); result->photo = parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetPhotoSize, data, "photo"); result->sticker = tryParseJson(&TgTypeParser::parseJsonAndGetSticker, data, "sticker"); + result->story = tryParseJson(&TgTypeParser::parseJsonAndGetStory, data, "story"); result->video = tryParseJson