From a071ebee5b2f6c418e7f3916bd6f50b152aaf300 Mon Sep 17 00:00:00 2001 From: kukin-konstantin Date: Fri, 30 Dec 2016 14:07:32 +0300 Subject: edit Message type --- include/tgbot/types/Message.h | 15 +++++++++++++++ src/TgTypeParser.cpp | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/include/tgbot/types/Message.h b/include/tgbot/types/Message.h index be1d313..415f616 100644 --- a/include/tgbot/types/Message.h +++ b/include/tgbot/types/Message.h @@ -85,6 +85,16 @@ public: */ User::Ptr forwardFrom; + /** + * Optional. For messages forwarded from a channel, information about the original channel + */ + Chat::Ptr forwardFromChat; + + /** + * Optional. For forwarded channel posts, identifier of the original message in the channel + */ + int32_t forwardFromMessageId; + /** * Optional. For forwarded messages, date the original message was sent in Unix time. */ @@ -95,6 +105,11 @@ public: */ Message::Ptr replyToMessage; + /** + * Optional. Date the message was last edited in Unix time + */ + int32_t editDate; + /** * Optional. For text messages, the actual UTF-8 text of the message. */ diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp index 71da2ac..20b8ea2 100644 --- a/src/TgTypeParser.cpp +++ b/src/TgTypeParser.cpp @@ -120,8 +120,11 @@ Message::Ptr TgTypeParser::parseJsonAndGetMessage(const ptree& data) const { result->date = data.get("date"); 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->forwardDate = data.get("forward_date", 0); result->replyToMessage = tryParseJson(&TgTypeParser::parseJsonAndGetMessage, data, "reply_to_message"); + result->editDate = data.get("edit_date", 0); result->text = data.get("text", ""); result->entities = parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetEntity, data, "entities"); result->audio = tryParseJson