summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tgbot/TgTypeParser.h1
-rw-r--r--src/TgTypeParser.cpp9
2 files changed, 10 insertions, 0 deletions
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index 17e9553..9e5a1d7 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -73,6 +73,7 @@ public:
std::string parseChat(const Chat::Ptr& object) const;
User::Ptr parseJsonAndGetUser(const boost::property_tree::ptree& data) const;
std::string parseUser(const User::Ptr& object) const;
+ MessageEntity::Ptr parseJsonAndGetEntity(const boost::property_tree::ptree& data) const;
Message::Ptr parseJsonAndGetMessage(const boost::property_tree::ptree& data) const;
std::string parseMessage(const Message::Ptr& object) const;
PhotoSize::Ptr parseJsonAndGetPhotoSize(const boost::property_tree::ptree& data) const;
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index 05a287d..63ff3ce 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -102,6 +102,15 @@ string TgTypeParser::parseUser(const User::Ptr& object) const {
return result;
}
+MessageEntity::Ptr TgTypeParser::parseJsonAndGetEntity(const ptree& data) const{
+ MessageEntity::Ptr result(new MessageEntity);
+ result->type=data.get<string>("type");
+ result->offset=data.get<int32_t>("offset");
+ result->length=data.get<int32_t>("length");
+ result->url=data.get<string>("url", "");
+ return result;
+}
+
Message::Ptr TgTypeParser::parseJsonAndGetMessage(const ptree& data) const {
Message::Ptr result(new Message);
result->messageId = data.get<int32_t>("message_id");