summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--include/tgbot/Api.h2
-rw-r--r--include/tgbot/types/Dice.h4
-rw-r--r--include/tgbot/types/InlineQueryResult.h19
-rw-r--r--include/tgbot/types/InlineQueryResultGif.h15
-rw-r--r--include/tgbot/types/InlineQueryResultMpeg4Gif.h16
-rw-r--r--include/tgbot/types/Message.h5
-rw-r--r--src/TgTypeParser.cpp82
8 files changed, 91 insertions, 54 deletions
diff --git a/README.md b/README.md
index e3b47b2..0aa45e9 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Documentation is located [here](http://reo7sp.github.io/tgbot-cpp).
## State
- [x] Bot API 3.0 ~ 3.6
-- [x] Bot API 4.0 ~ 4.8 (Implemented all APIs except 'Telegram Passport')
+- [x] Bot API 4.0 ~ 4.9 (Implemented all APIs except 'Telegram Passport')
## Sample
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 9613c15..c2ba2e3 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -378,7 +378,7 @@ public:
* @brief Use this method to send a dice, which will have a random value from 1 to 6.
*
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
- * @param emoji Optional. Emoji on which the dice throw animation is based. Currently, must be one of “🎲” or “🎯”. Defauts to “🎲”
+ * @param emoji Optional. Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, or “🏀”. Dice can have values 1-6 for “🎲” and “🎯”, and values 1-5 for “🏀”. Defaults to “🎲”
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
diff --git a/include/tgbot/types/Dice.h b/include/tgbot/types/Dice.h
index 3179f4a..4c2a68e 100644
--- a/include/tgbot/types/Dice.h
+++ b/include/tgbot/types/Dice.h
@@ -6,7 +6,7 @@
namespace TgBot {
/**
- * @brief This object represents a dice with a random value from 1 to 6 for currently supported base emoji.
+ * @brief This object represents an animated emoji that displays a random value.
*
* @ingroup types
*/
@@ -21,7 +21,7 @@ public:
std::string emoji;
/**
- * @brief Value of the dice, 1-6 for currently supported base emoji
+ * @brief Value of the dice, 1-6 for “🎲” and “🎯” base emoji, 1-5 for “🏀” base emoji
*/
std::int8_t value;
};
diff --git a/include/tgbot/types/InlineQueryResult.h b/include/tgbot/types/InlineQueryResult.h
index ee385f9..5674015 100644
--- a/include/tgbot/types/InlineQueryResult.h
+++ b/include/tgbot/types/InlineQueryResult.h
@@ -23,32 +23,41 @@ public:
virtual ~InlineQueryResult() { }
/**
- * @brief Type of the result.
+ * @brief Type of the result
*/
std::string type;
/**
- * @brief Unique identifier for this result. (1-64 bytes)
+ * @brief Unique identifier for this result, 1-64 bytes
*/
std::string id;
/**
- * @brief Requred, optional or missing. See description of derived classes. Title of the result.
+ * @brief Requred, optional or missing. See description of derived classes.
+ * Title for the result
*/
std::string title;
/**
- * @brief Optional or missing. See description of derived classes. Caption of the file to be sent, 0-200 characters
+ * @brief Optional or missing. See description of derived classes.
+ * Caption of the file to be sent, 0-1024 characters after entities parsing
*/
std::string caption;
/**
+ * @brief Optional or missing. See description of derived classes.
+ * Mode for parsing entities in the caption.
+ */
+ std::string parseMode;
+
+ /**
* @brief Optional. Inline keyboard attached to the message
*/
InlineKeyboardMarkup::Ptr replyMarkup;
/**
- * @brief Requred, optional or missing. See description of derived classes. Content of the message to be sent
+ * @brief Requred, optional or missing. See description of derived classes.
+ * Content of the message to be sent
*/
InputMessageContent::Ptr inputMessageContent;
};
diff --git a/include/tgbot/types/InlineQueryResultGif.h b/include/tgbot/types/InlineQueryResultGif.h
index e957d0f..118da7b 100644
--- a/include/tgbot/types/InlineQueryResultGif.h
+++ b/include/tgbot/types/InlineQueryResultGif.h
@@ -11,6 +11,8 @@ namespace TgBot {
/**
* @brief Represents a link to an animated GIF file.
+ * By default, this animated GIF file will be sent by the user with optional caption.
+ * Alternatively, you can use @ref InlineQueryResult::inputMessageContent to send a message with the specified content instead of the animation.
*
* @ingroup types
*/
@@ -27,17 +29,17 @@ public:
}
/**
- * @brief A valid URL for the GIF file.
+ * @brief A valid URL for the GIF file. File size must not exceed 1MB
*/
std::string gifUrl;
/**
- * @brief Optional. Width of the GIF.
+ * @brief Optional. Width of the GIF
*/
std::int32_t gifWidth;
/**
- * @brief Optional. Height of the GIF.
+ * @brief Optional. Height of the GIF
*/
std::int32_t gifHeight;
@@ -47,10 +49,15 @@ public:
std::int32_t gifDuration;
/**
- * @brief URL of the static thumbnail for the result (jpeg or gif)
+ * @brief URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
*/
std::string thumbUrl;
+ /**
+ * @brief Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”.
+ * Defaults to “image/jpeg”
+ */
+ std::string thumbMimeType;
};
}
diff --git a/include/tgbot/types/InlineQueryResultMpeg4Gif.h b/include/tgbot/types/InlineQueryResultMpeg4Gif.h
index 2109e7b..f6319a9 100644
--- a/include/tgbot/types/InlineQueryResultMpeg4Gif.h
+++ b/include/tgbot/types/InlineQueryResultMpeg4Gif.h
@@ -9,6 +9,8 @@ namespace TgBot {
/**
* @brief Represents a link to a video animation (H.264/MPEG-4 AVC video without sound).
+ * By default, this animated MPEG-4 file will be sent by the user with optional caption.
+ * Alternatively, you can use @ref InlineQueryResult::inputMessageContent to send a message with the specified content instead of the animation.
*
* @ingroup types
*/
@@ -26,29 +28,35 @@ public:
/**
* @brief A valid URL for the MP4 file.
+ * File size must not exceed 1MB
*/
std::string mpeg4Url;
/**
- * @brief Optional. Video width.
+ * @brief Optional. Video width
*/
std::int32_t mpeg4Width;
/**
- * @brief Optional. Video height.
+ * @brief Optional. Video height
*/
std::int32_t mpeg4Height;
/**
- * @brief Optional. Video duration.
+ * @brief Optional. Video duration
*/
std::int32_t mpeg4Duration;
/**
- * @brief URL of the static thumbnail (jpeg or gif) for the result
+ * @brief URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
*/
std::string thumbUrl;
+ /**
+ * @brief Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”.
+ * Defaults to “image/jpeg”
+ */
+ std::string thumbMimeType;
};
}
diff --git a/include/tgbot/types/Message.h b/include/tgbot/types/Message.h
index 41612d1..753e393 100644
--- a/include/tgbot/types/Message.h
+++ b/include/tgbot/types/Message.h
@@ -96,6 +96,11 @@ public:
Message::Ptr replyToMessage;
/**
+ * @brief Optional. Bot through which the message was sent
+ */
+ User::Ptr viaBot;
+
+ /**
* @brief Optional. Date the message was last edited in Unix time
*/
std::int32_t editDate;
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index d1d0ecb..daa6184 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -144,6 +144,7 @@ Message::Ptr TgTypeParser::parseJsonAndGetMessage(const ptree& data) const {
result->forwardSenderName = data.get<string>("forward_sender_name", "");
result->forwardDate = data.get<int32_t>("forward_date", 0);
result->replyToMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "reply_to_message");
+ result->viaBot = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "via_bot");
result->editDate = data.get<int32_t>("edit_date", 0);
result->mediaGroupId = data.get<string>("media_group_id", "");
result->authorSignature = data.get<string>("author_signature", "");
@@ -202,6 +203,7 @@ string TgTypeParser::parseMessage(const Message::Ptr& object) const {
appendToJson(result, "forward_sender_name", object->forwardSenderName);
appendToJson(result, "forward_date", object->forwardDate);
appendToJson(result, "reply_to_message", parseMessage(object->replyToMessage));
+ appendToJson(result, "via_bot", parseUser(object->viaBot));
appendToJson(result, "edit_date", object->editDate);
appendToJson(result, "media_group_id", object->mediaGroupId);
appendToJson(result, "author_signature", object->authorSignature);
@@ -1260,8 +1262,8 @@ std::string TgTypeParser::parseInlineQuery(const InlineQuery::Ptr& object) const
return result;
}
-InlineQueryResult::Ptr TgTypeParser::parseJsonAndGetInlineQueryResult(const boost::property_tree::ptree& data) const {
- string type = data.get<string>("type");
+InlineQueryResult::Ptr TgTypeParser::parseJsonAndGetInlineQueryResult(const ptree& data) const {
+ string type = data.get<string>("type", "");
InlineQueryResult::Ptr result;
if (type == InlineQueryResultCachedAudio::TYPE) {
@@ -1308,26 +1310,27 @@ InlineQueryResult::Ptr TgTypeParser::parseJsonAndGetInlineQueryResult(const boos
result = make_shared<InlineQueryResult>();
}
- result->id = data.get<string>("id");
+ result->id = data.get<string>("id", "");
result->title = data.get<string>("title", "");
result->caption = data.get<string>("caption", "");
+ result->parseMode = data.get<string>("parse_mode", "");
result->replyMarkup = tryParseJson<InlineKeyboardMarkup>(&TgTypeParser::parseJsonAndGetInlineKeyboardMarkup, data, "reply_markup");
result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
return result;
}
-std::string TgTypeParser::parseInlineQueryResult(const InlineQueryResult::Ptr& object) const {
+string TgTypeParser::parseInlineQueryResult(const InlineQueryResult::Ptr& object) const {
if (!object){
return "";
}
-
string result;
result += '{';
appendToJson(result, "id", object->id);
appendToJson(result, "type", object->type);
appendToJson(result, "title", object->title);
appendToJson(result, "caption", object->caption);
+ appendToJson(result, "parse_mode", object->parseMode);
appendToJson(result, "reply_markup", parseInlineKeyboardMarkup(object->replyMarkup));
appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
@@ -1398,7 +1401,7 @@ std::string TgTypeParser::parseInlineQueryResult(const InlineQueryResult::Ptr& o
}
InlineQueryResultCachedAudio::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedAudio(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultCachedAudio>());
result->audioFileId = data.get<string>("audio_file_id");
return result;
@@ -1417,7 +1420,7 @@ std::string TgTypeParser::parseInlineQueryResultCachedAudio(const InlineQueryRes
}
InlineQueryResultCachedDocument::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedDocument(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultCachedDocument>());
result->documentFileId = data.get<string>("document_file_id");
result->description = data.get<string>("description", "");
@@ -1439,7 +1442,7 @@ std::string TgTypeParser::parseInlineQueryResultCachedDocument(const InlineQuery
InlineQueryResultCachedGif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedGif(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultCachedGif>());
result->gifFileId = data.get<string>("gif_file_id");
return result;
@@ -1459,7 +1462,7 @@ std::string TgTypeParser::parseInlineQueryResultCachedGif(const InlineQueryResul
InlineQueryResultCachedMpeg4Gif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedMpeg4Gif(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultCachedMpeg4Gif>());
result->mpeg4FileId = data.get<string>("mpeg4_file_id");
return result;
@@ -1479,7 +1482,7 @@ std::string TgTypeParser::parseInlineQueryResultCachedMpeg4Gif(const InlineQuery
InlineQueryResultCachedPhoto::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedPhoto(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultCachedPhoto>());
result->photoFileId = data.get<string>("photo_file_id");
result->description = data.get<string>("description", "");
@@ -1501,7 +1504,7 @@ std::string TgTypeParser::parseInlineQueryResultCachedPhoto(const InlineQueryRes
InlineQueryResultCachedSticker::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedSticker(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultCachedSticker>());
result->stickerFileId = data.get<string>("sticker_file_id");
return result;
@@ -1520,7 +1523,7 @@ std::string TgTypeParser::parseInlineQueryResultCachedSticker(const InlineQueryR
}
InlineQueryResultCachedVideo::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedVideo(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultCachedVideo>());
result->videoFileId = data.get<string>("video_file_id");
result->description = data.get<string>("description", "");
@@ -1542,7 +1545,7 @@ std::string TgTypeParser::parseInlineQueryResultCachedVideo(const InlineQueryRes
InlineQueryResultCachedVoice::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedVoice(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultCachedVoice>());
result->voiceFileId = data.get<string>("voice_file_id");
return result;
@@ -1561,7 +1564,7 @@ std::string TgTypeParser::parseInlineQueryResultCachedVoice(const InlineQueryRes
}
InlineQueryResultArticle::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultArticle(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultArticle>());
result->url = data.get<string>("url", "");
result->hideUrl = data.get("hide_url", false);
@@ -1590,7 +1593,7 @@ std::string TgTypeParser::parseInlineQueryResultArticle(const InlineQueryResultA
}
InlineQueryResultAudio::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultAudio(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultAudio>());
result->audioUrl = data.get<string>("audio_url");
result->performer = data.get<string>("performer", "");
@@ -1614,7 +1617,7 @@ std::string TgTypeParser::parseInlineQueryResultAudio(const InlineQueryResultAud
InlineQueryResultContact::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultContact(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultContact>());
result->phoneNumber = data.get<string>("phone_number");
result->firstName = data.get<string>("first_name");
@@ -1646,7 +1649,7 @@ std::string TgTypeParser::parseInlineQueryResultContact(const InlineQueryResultC
InlineQueryResultGame::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultGame(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultGame>());
result->gameShortName = data.get<string>("game_short_name");
return result;
@@ -1665,7 +1668,7 @@ std::string TgTypeParser::parseInlineQueryResultGame(const InlineQueryResultGame
}
InlineQueryResultDocument::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultDocument(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultDocument>());
result->documentUrl = data.get<string>("document_url");
result->mimeType = data.get<string>("mime_type");
@@ -1694,7 +1697,7 @@ std::string TgTypeParser::parseInlineQueryResultDocument(const InlineQueryResult
}
InlineQueryResultLocation::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultLocation(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultLocation>());
result->latitude = data.get<float>("latitude");
result->longitude = data.get<float>("longitude");
@@ -1722,7 +1725,7 @@ std::string TgTypeParser::parseInlineQueryResultLocation(const InlineQueryResult
InlineQueryResultVenue::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVenue(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultVenue>());
result->latitude = data.get<float>("latitude");
result->longitude = data.get<float>("longitude");
@@ -1755,7 +1758,7 @@ std::string TgTypeParser::parseInlineQueryResultVenue(const InlineQueryResultVen
}
InlineQueryResultVoice::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVoice(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultVoice>());
result->voiceUrl = data.get<string>("voice_url");
result->voiceDuration = data.get<int32_t>("voice_duration", 0);
@@ -1776,7 +1779,7 @@ std::string TgTypeParser::parseInlineQueryResultVoice(const InlineQueryResultVoi
}
InlineQueryResultPhoto::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultPhoto(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultPhoto>());
result->photoUrl = data.get<string>("photo_url", "");
result->thumbUrl = data.get<string>("thumb_url");
@@ -1802,17 +1805,19 @@ std::string TgTypeParser::parseInlineQueryResultPhoto(const InlineQueryResultPho
return result;
}
-InlineQueryResultGif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultGif(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+InlineQueryResultGif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultGif(const ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultGif>());
result->gifUrl = data.get<string>("gif_url", "");
- result->gifWidth = data.get("gif_width", 0);
- result->gifHeight = data.get("gif_height", 0);
- result->gifDuration = data.get("gif_duration", 0);
- result->thumbUrl = data.get<string>("thumb_url");
+ result->gifWidth = data.get<int32_t>("gif_width", 0);
+ result->gifHeight = data.get<int32_t>("gif_height", 0);
+ result->gifDuration = data.get<int32_t>("gif_duration", 0);
+ result->thumbUrl = data.get<string>("thumb_url", "");
+ result->thumbMimeType = data.get<string>("thumb_mime_type", "");
return result;
}
-std::string TgTypeParser::parseInlineQueryResultGif(const InlineQueryResultGif::Ptr& object) const {
+
+string TgTypeParser::parseInlineQueryResultGif(const InlineQueryResultGif::Ptr& object) const {
if (!object){
return "";
}
@@ -1824,18 +1829,20 @@ std::string TgTypeParser::parseInlineQueryResultGif(const InlineQueryResultGif::
appendToJson(result, "gif_height", object->gifHeight);
appendToJson(result, "gif_duration", object->gifDuration);
appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumb_mime_type", object->thumbMimeType);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
-InlineQueryResultMpeg4Gif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultMpeg4Gif(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+InlineQueryResultMpeg4Gif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultMpeg4Gif(const ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultMpeg4Gif>());
- result->mpeg4Url = data.get<string>("mpeg4_url");
- result->mpeg4Width = data.get("mpeg4_width", 0);
- result->mpeg4Height = data.get("mpeg4_height", 0);
- result->mpeg4Duration = data.get("mpeg4_duration", 0);
- result->thumbUrl = data.get<string>("thumb_url");
+ result->mpeg4Url = data.get<string>("mpeg4_url", "");
+ result->mpeg4Width = data.get<int32_t>("mpeg4_width", 0);
+ result->mpeg4Height = data.get<int32_t>("mpeg4_height", 0);
+ result->mpeg4Duration = data.get<int32_t>("mpeg4_duration", 0);
+ result->thumbUrl = data.get<string>("thumb_url", "");
+ result->thumbMimeType = data.get<string>("thumb_mime_type", "");
return result;
}
@@ -1851,12 +1858,13 @@ std::string TgTypeParser::parseInlineQueryResultMpeg4Gif(const InlineQueryResult
appendToJson(result, "mpeg4_height", object->mpeg4Height);
appendToJson(result, "mpeg4_duration", object->mpeg4Duration);
appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumb_mime_type", object->thumbMimeType);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
InlineQueryResultVideo::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVideo(const boost::property_tree::ptree& data) const {
- // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ // NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(make_shared<InlineQueryResultVideo>());
result->videoUrl = data.get<string>("video_url");
result->mimeType = data.get<string>("mime_type");