diff options
author | kukin-konstantin <kukin.konstantin@gmail.com> | 2016-12-30 14:07:32 +0300 |
---|---|---|
committer | kukin-konstantin <kukin.konstantin@gmail.com> | 2016-12-30 14:07:32 +0300 |
commit | a071ebee5b2f6c418e7f3916bd6f50b152aaf300 (patch) | |
tree | fab4acf9468510339a0bc456a185c3f846a56dc7 | |
parent | 2d7d1a269383ec1db99b6759f9c58ba08d1d29fe (diff) |
edit Message type
-rw-r--r-- | include/tgbot/types/Message.h | 15 | ||||
-rw-r--r-- | src/TgTypeParser.cpp | 6 |
2 files changed, 21 insertions, 0 deletions
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 @@ -86,6 +86,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. */ int32_t forwardDate; @@ -96,6 +106,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. */ std::string text; 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<int32_t>("date"); result->chat = parseJsonAndGetChat(data.find("chat")->second); result->forwardFrom = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "forward_from"); + result->forwardFromChat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "forward_from_chat"); + result->forwardFromMessageId = data.get<int32_t>("forward_from_message_id", 0); result->forwardDate = data.get("forward_date", 0); result->replyToMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "reply_to_message"); + result->editDate = data.get<int32_t>("edit_date", 0); result->text = data.get("text", ""); result->entities = parseJsonAndGetArray<MessageEntity>(&TgTypeParser::parseJsonAndGetEntity, data, "entities"); result->audio = tryParseJson<Audio>(&TgTypeParser::parseJsonAndGetAudio, data, "audio"); @@ -156,8 +159,11 @@ string TgTypeParser::parseMessage(const Message::Ptr& object) const { appendToJson(result, "date", object->date); appendToJson(result, "chat", parseChat(object->chat)); appendToJson(result, "forward_from", parseUser(object->forwardFrom)); + appendToJson(result, "forward_from_chat", parseChat(object->forwardFromChat)); + appendToJson(result, "forward_from_message_id", object->forwardFromMessageId); appendToJson(result, "forward_date", object->forwardDate); appendToJson(result, "reply_to_message", parseMessage(object->replyToMessage)); + appendToJson(result, "edit_date", object->editDate); appendToJson(result, "text", object->text); appendToJson(result, "audio", parseAudio(object->audio)); appendToJson(result, "document", parseDocument(object->document)); |