summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorllnulldisk <48621230+llnulldisk@users.noreply.github.com>2024-04-14 23:43:12 +0200
committerllnulldisk <48621230+llnulldisk@users.noreply.github.com>2024-04-14 23:43:12 +0200
commit7b72d7a35fce82049fa63444b0ce5f2a3fc22129 (patch)
tree4d38ab085ea8853776cf9f36f5fe3524b970afdc /src
parent0910c166a920cdac931d40bcb63bfb28039005f1 (diff)
Update to Bot API 6.6
Diffstat (limited to 'src')
-rw-r--r--src/Api.cpp374
-rw-r--r--src/TgTypeParser.cpp198
2 files changed, 395 insertions, 177 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index c8ce399..bb0ac45 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -293,7 +293,7 @@ Message::Ptr Api::sendAudio(boost::variant<std::int64_t, std::string> chatId,
std::int32_t duration,
const std::string& performer,
const std::string& title,
- boost::variant<InputFile::Ptr, std::string> thumb,
+ boost::variant<InputFile::Ptr, std::string> thumbnail,
std::int32_t replyToMessageId,
GenericReply::Ptr replyMarkup,
const std::string& parseMode,
@@ -333,13 +333,13 @@ Message::Ptr Api::sendAudio(boost::variant<std::int64_t, std::string> chatId,
if (!title.empty()) {
args.emplace_back("title", title);
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (disableNotification) {
@@ -363,7 +363,7 @@ Message::Ptr Api::sendAudio(boost::variant<std::int64_t, std::string> chatId,
Message::Ptr Api::sendDocument(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> document,
- boost::variant<InputFile::Ptr, std::string> thumb,
+ boost::variant<InputFile::Ptr, std::string> thumbnail,
const std::string& caption,
std::int32_t replyToMessageId,
GenericReply::Ptr replyMarkup,
@@ -387,13 +387,13 @@ Message::Ptr Api::sendDocument(boost::variant<std::int64_t, std::string> chatId,
} else { // std::string
args.emplace_back("document", boost::get<std::string>(document));
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (!caption.empty()) {
@@ -433,7 +433,7 @@ Message::Ptr Api::sendVideo(boost::variant<std::int64_t, std::string> chatId,
std::int32_t duration,
std::int32_t width,
std::int32_t height,
- boost::variant<InputFile::Ptr, std::string> thumb,
+ boost::variant<InputFile::Ptr, std::string> thumbnail,
const std::string& caption ,
std::int32_t replyToMessageId,
GenericReply::Ptr replyMarkup,
@@ -466,13 +466,13 @@ Message::Ptr Api::sendVideo(boost::variant<std::int64_t, std::string> chatId,
if (height != 0) {
args.emplace_back("height", height);
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (!caption.empty()) {
@@ -514,7 +514,7 @@ Message::Ptr Api::sendAnimation(boost::variant<std::int64_t, std::string> chatId
std::int32_t duration,
std::int32_t width,
std::int32_t height,
- boost::variant<InputFile::Ptr, std::string> thumb,
+ boost::variant<InputFile::Ptr, std::string> thumbnail,
const std::string& caption,
std::int32_t replyToMessageId,
GenericReply::Ptr replyMarkup,
@@ -547,13 +547,13 @@ Message::Ptr Api::sendAnimation(boost::variant<std::int64_t, std::string> chatId
if (height != 0) {
args.emplace_back("height", height);
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (!caption.empty()) {
@@ -649,7 +649,7 @@ Message::Ptr Api::sendVideoNote(boost::variant<std::int64_t, std::string> chatId
bool disableNotification,
std::int32_t duration,
std::int32_t length,
- boost::variant<InputFile::Ptr, std::string> thumb,
+ boost::variant<InputFile::Ptr, std::string> thumbnail,
GenericReply::Ptr replyMarkup,
bool allowSendingWithoutReply,
bool protectContent,
@@ -673,13 +673,13 @@ Message::Ptr Api::sendVideoNote(boost::variant<std::int64_t, std::string> chatId
if (length) {
args.emplace_back("length", length);
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (disableNotification) {
@@ -797,8 +797,14 @@ Message::Ptr Api::editMessageLiveLocation(float latitude,
std::vector<HttpReqArg> args;
args.reserve(9);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -831,8 +837,14 @@ Message::Ptr Api::stopMessageLiveLocation(boost::variant<std::int64_t, std::stri
std::vector<HttpReqArg> args;
args.reserve(4);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -1539,7 +1551,7 @@ ForumTopic::Ptr Api::createForumTopic(boost::variant<std::int64_t, std::string>
bool Api::editForumTopic(boost::variant<std::int64_t, std::string> chatId,
std::int32_t messageThreadId,
const std::string& name,
- boost::variant<std::int8_t, std::string> iconCustomEmojiId) const {
+ boost::variant<std::int32_t, std::string> iconCustomEmojiId) const {
std::vector<HttpReqArg> args;
args.reserve(4);
@@ -1548,8 +1560,14 @@ bool Api::editForumTopic(boost::variant<std::int64_t, std::string> chatId,
if (!name.empty()) {
args.emplace_back("name", name);
}
- if (iconCustomEmojiId.which() == 1) { // std::string
- args.emplace_back("icon_custom_emoji_id", boost::get<std::string>(iconCustomEmojiId));
+ if (iconCustomEmojiId.which() == 0) { // std::int32_t
+ if (boost::get<std::int32_t>(iconCustomEmojiId) != 0) {
+ args.emplace_back("icon_custom_emoji_id", iconCustomEmojiId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(iconCustomEmojiId) != "") {
+ args.emplace_back("icon_custom_emoji_id", iconCustomEmojiId);
+ }
}
return sendRequest("editForumTopic", args).get<bool>("", false);
@@ -1689,7 +1707,7 @@ bool Api::setMyCommands(const std::vector<BotCommand::Ptr>& commands,
}
bool Api::deleteMyCommands(BotCommandScope::Ptr scope,
- const std::string& languageCode) const {
+ const std::string& languageCode) const {
std::vector<HttpReqArg> args;
args.reserve(2);
@@ -1707,7 +1725,7 @@ std::vector<BotCommand::Ptr> Api::getMyCommands(BotCommandScope::Ptr scope,
const std::string& languageCode) const {
std::vector<HttpReqArg> args;
args.reserve(2);
-;
+
if (scope != nullptr) {
args.emplace_back("scope", _tgTypeParser.parseBotCommandScope(scope));
}
@@ -1718,6 +1736,58 @@ std::vector<BotCommand::Ptr> Api::getMyCommands(BotCommandScope::Ptr scope,
return _tgTypeParser.parseJsonAndGetArray<BotCommand>(&TgTypeParser::parseJsonAndGetBotCommand, sendRequest("getMyCommands", args));
}
+bool Api::setMyDescription(const std::string& description,
+ const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ if (!description.empty()) {
+ args.emplace_back("description", description);
+ }
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return sendRequest("setMyDescription", args).get<bool>("", false);
+}
+
+BotDescription::Ptr Api::getMyDescription(const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(1);
+
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return _tgTypeParser.parseJsonAndGetBotDescription(sendRequest("getMyDescription", args));
+}
+
+bool Api::setMyShortDescription(const std::string& shortDescription,
+ const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ if (!shortDescription.empty()) {
+ args.emplace_back("short_description", shortDescription);
+ }
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return sendRequest("setMyShortDescription", args).get<bool>("", false);
+}
+
+BotShortDescription::Ptr Api::getMyShortDescription(const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(1);
+
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return _tgTypeParser.parseJsonAndGetBotShortDescription(sendRequest("getMyShortDescription", args));
+}
+
bool Api::setChatMenuButton(std::int64_t chatId,
MenuButton::Ptr menuButton) const {
std::vector<HttpReqArg> args;
@@ -1781,8 +1851,14 @@ Message::Ptr Api::editMessageText(const std::string& text,
std::vector<HttpReqArg> args;
args.reserve(8);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -1822,8 +1898,14 @@ Message::Ptr Api::editMessageCaption(boost::variant<std::int64_t, std::string> c
std::vector<HttpReqArg> args;
args.reserve(7);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -1861,10 +1943,16 @@ Message::Ptr Api::editMessageMedia(InputMedia::Ptr media,
std::vector<HttpReqArg> args;
args.reserve(5);
- args.emplace_back("media", _tgTypeParser.parseInputMedia(media));
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
+ args.emplace_back("media", _tgTypeParser.parseInputMedia(media));
if (messageId) {
args.emplace_back("message_id", messageId);
}
@@ -1891,8 +1979,14 @@ Message::Ptr Api::editMessageReplyMarkup(boost::variant<std::int64_t, std::strin
std::vector<HttpReqArg> args;
args.reserve(4);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -1945,9 +2039,10 @@ Message::Ptr Api::sendSticker(boost::variant<std::int64_t, std::string> chatId,
bool disableNotification,
bool allowSendingWithoutReply,
bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ const std::string& emoji) const {
std::vector<HttpReqArg> args;
- args.reserve(8);
+ args.reserve(9);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -1959,6 +2054,9 @@ Message::Ptr Api::sendSticker(boost::variant<std::int64_t, std::string> chatId,
} else { // std::string
args.emplace_back("sticker", boost::get<std::string>(sticker));
}
+ if (!emoji.empty()) {
+ args.emplace_back("emoji", emoji);
+ }
if (disableNotification) {
args.emplace_back("disable_notification", disableNotification);
}
@@ -1991,7 +2089,8 @@ std::vector<Sticker::Ptr> Api::getCustomEmojiStickers(const std::vector<std::str
std::vector<HttpReqArg> args;
args.reserve(1);
- args.emplace_back("custom_emoji_ids", _tgTypeParser.parseArray<std::string>([] (const std::string& customEmojiId) -> std::string {
+ args.emplace_back("custom_emoji_ids", _tgTypeParser.parseArray<std::string>(
+ [] (const std::string& customEmojiId) -> std::string {
return "\"" + StringTools::escapeJsonString(customEmojiId) + "\"";
}, customEmojiIds));
@@ -1999,12 +2098,14 @@ std::vector<Sticker::Ptr> Api::getCustomEmojiStickers(const std::vector<std::str
}
File::Ptr Api::uploadStickerFile(std::int64_t userId,
- const InputFile::Ptr pngSticker) const {
+ InputFile::Ptr sticker,
+ const std::string& stickerFormat) const {
std::vector<HttpReqArg> args;
- args.reserve(2);
+ args.reserve(3);
args.emplace_back("user_id", userId);
- args.emplace_back("png_sticker", pngSticker->data, true, pngSticker->mimeType, pngSticker->fileName);
+ args.emplace_back("sticker", sticker->data, true, sticker->mimeType, sticker->fileName);
+ args.emplace_back("sticker_format", stickerFormat);
return _tgTypeParser.parseJsonAndGetFile(sendRequest("uploadStickerFile", args));
}
@@ -2012,70 +2113,37 @@ File::Ptr Api::uploadStickerFile(std::int64_t userId,
bool Api::createNewStickerSet(std::int64_t userId,
const std::string& name,
const std::string& title,
- const std::string& emojis,
- MaskPosition::Ptr maskPosition,
- boost::variant<InputFile::Ptr, std::string> pngSticker,
- InputFile::Ptr tgsSticker,
- InputFile::Ptr webmSticker,
- const std::string& stickerType) const {
+ const std::vector<InputSticker::Ptr>& stickers,
+ const std::string& stickerFormat,
+ const std::string& stickerType,
+ bool needsRepainting) const {
std::vector<HttpReqArg> args;
- args.reserve(10);
+ args.reserve(7);
args.emplace_back("user_id", userId);
args.emplace_back("name", name);
args.emplace_back("title", title);
- if (pngSticker.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(pngSticker);
- args.emplace_back("png_sticker", file->data, true, file->mimeType, file->fileName);
- } else { // std::string
- args.emplace_back("png_sticker", boost::get<std::string>(pngSticker));
- }
- if (tgsSticker != nullptr) {
- args.emplace_back("tgs_sticker", tgsSticker->data, true, tgsSticker->mimeType, tgsSticker->fileName);
- }
- if (webmSticker != nullptr) {
- args.emplace_back("webm_sticker", webmSticker->data, true, webmSticker->mimeType, webmSticker->fileName);
- }
+ args.emplace_back("stickers", _tgTypeParser.parseArray<InputSticker>(&TgTypeParser::parseInputSticker, stickers));
+ args.emplace_back("sticker_format", stickerFormat);
if (!stickerType.empty()) {
args.emplace_back("sticker_type", stickerType);
}
- args.emplace_back("emojis", emojis);
- if (maskPosition != nullptr) {
- args.emplace_back("mask_position", _tgTypeParser.parseMaskPosition(maskPosition));
+ if (needsRepainting) {
+ args.emplace_back("needs_repainting", needsRepainting);
}
return sendRequest("createNewStickerSet", args).get<bool>("", false);
}
bool Api::addStickerToSet(std::int64_t userId,
- const std::string& name,
- const std::string& emojis,
- MaskPosition::Ptr maskPosition,
- boost::variant<InputFile::Ptr, std::string> pngSticker,
- InputFile::Ptr tgsSticker,
- InputFile::Ptr webmSticker) const {
+ const std::string& name,
+ InputSticker::Ptr sticker) const {
std::vector<HttpReqArg> args;
- args.reserve(7);
+ args.reserve(3);
args.emplace_back("user_id", userId);
args.emplace_back("name", name);
-
- if (pngSticker.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(pngSticker);
- args.emplace_back("png_sticker", file->data, true, file->mimeType, file->fileName);
- } else { // std::string
- args.emplace_back("png_sticker", boost::get<std::string>(pngSticker));
- }
- if (tgsSticker != nullptr) {
- args.emplace_back("tgs_sticker", tgsSticker->data, true, tgsSticker->mimeType, tgsSticker->fileName);
- }
- if (webmSticker != nullptr) {
- args.emplace_back("webm_sticker", webmSticker->data, true, webmSticker->mimeType, webmSticker->fileName);
- }
- args.emplace_back("emojis", emojis);
- if (maskPosition != nullptr) {
- args.emplace_back("mask_position", _tgTypeParser.parseMaskPosition(maskPosition));
- }
+ args.emplace_back("sticker", _tgTypeParser.parseInputSticker(sticker));
return sendRequest("addStickerToSet", args).get<bool>("", false);
}
@@ -2100,22 +2168,102 @@ bool Api::deleteStickerFromSet(const std::string& sticker) const {
return sendRequest("deleteStickerFromSet", args).get<bool>("", false);
}
-bool Api::setStickerSetThumb(const std::string& name,
- std::int64_t userId,
- boost::variant<InputFile::Ptr, std::string> thumb) const {
+bool Api::setStickerEmojiList(const std::string& sticker,
+ const std::vector<std::string>& emojiList) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("sticker", sticker);
+ args.emplace_back("emoji_list", _tgTypeParser.parseArray<std::string>(
+ [](const std::string& emoji)->std::string {
+ return "\"" + StringTools::escapeJsonString(emoji) + "\"";
+ }, emojiList));
+
+ return sendRequest("setStickerEmojiList", args).get<bool>("", false);
+}
+
+bool Api::setStickerKeywords(const std::string& sticker,
+ const std::vector<std::string>& keywords) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("sticker", sticker);
+ if (!keywords.empty()) {
+ args.emplace_back("keywords", _tgTypeParser.parseArray<std::string>(
+ [](const std::string& keyword)->std::string {
+ return "\"" + StringTools::escapeJsonString(keyword) + "\"";
+ }, keywords));
+ }
+
+ return sendRequest("setStickerKeywords", args).get<bool>("", false);
+}
+
+bool Api::setStickerMaskPosition(const std::string& sticker,
+ MaskPosition::Ptr maskPosition) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("sticker", sticker);
+ if (maskPosition != nullptr) {
+ args.emplace_back("mask_position", _tgTypeParser.parseMaskPosition(maskPosition));
+ }
+
+ return sendRequest("setStickerMaskPosition", args).get<bool>("", false);
+}
+
+bool Api::setStickerSetTitle(const std::string& name,
+ const std::string& title) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("name", name);
+ args.emplace_back("title", title);
+
+ return sendRequest("setStickerSetTitle", args).get<bool>("", false);
+}
+
+bool Api::setStickerSetThumbnail(const std::string& name,
+ std::int64_t userId,
+ boost::variant<InputFile::Ptr, std::string> thumbnail) const {
std::vector<HttpReqArg> args;
args.reserve(3);
args.emplace_back("name", name);
args.emplace_back("user_id", userId);
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ if (boost::get<InputFile::Ptr>(thumbnail) != nullptr) {
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
+ }
} else { // std::string
- args.emplace_back("thumb", boost::get<std::string>(thumb));
+ if (boost::get<std::string>(thumbnail) != "") {
+ args.emplace_back("thumbnail", boost::get<std::string>(thumbnail));
+ }
+ }
+
+ return sendRequest("setStickerSetThumbnail", args).get<bool>("", false);
+}
+
+bool Api::setCustomEmojiStickerSetThumbnail(const std::string& name,
+ const std::string& customEmojiId) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("name", name);
+ if (!customEmojiId.empty()) {
+ args.emplace_back("custom_emoji_id", customEmojiId);
}
- return sendRequest("setStickerSetThumb", args).get<bool>("", false);
+ return sendRequest("setCustomEmojiStickerSetThumbnail", args).get<bool>("", false);
+}
+
+bool Api::deleteStickerSet(const std::string& name) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(1);
+
+ args.emplace_back("name", name);
+
+ return sendRequest("deleteStickerSet", args).get<bool>("", false);
}
bool Api::answerInlineQuery(const std::string& inlineQueryId,
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index 9e04851..efd1c08 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -531,7 +531,7 @@ Animation::Ptr TgTypeParser::parseJsonAndGetAnimation(const boost::property_tree
result->width = data.get<std::int32_t>("width", 0);
result->height = data.get<std::int32_t>("height", 0);
result->duration = data.get<std::int32_t>("duration", 0);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
result->fileName = data.get<std::string>("file_name", "");
result->mimeType = data.get<std::string>("mime_type", "");
result->fileSize = data.get<std::int64_t>("file_size", 0);
@@ -549,7 +549,7 @@ std::string TgTypeParser::parseAnimation(const Animation::Ptr& object) const {
appendToJson(result, "width", object->width);
appendToJson(result, "height", object->height);
appendToJson(result, "duration", object->duration);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "file_name", object->fileName);
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "file_size", object->fileSize);
@@ -568,7 +568,7 @@ Audio::Ptr TgTypeParser::parseJsonAndGetAudio(const boost::property_tree::ptree&
result->fileName = data.get<std::string>("file_name", "");
result->mimeType = data.get<std::string>("mime_type", "");
result->fileSize = data.get<std::int64_t>("file_size", 0);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
return result;
}
@@ -586,7 +586,7 @@ std::string TgTypeParser::parseAudio(const Audio::Ptr& object) const {
appendToJson(result, "file_name", object->fileName);
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "file_size", object->fileSize);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
removeLastComma(result);
result += '}';
return result;
@@ -596,7 +596,7 @@ Document::Ptr TgTypeParser::parseJsonAndGetDocument(const boost::property_tree::
auto result(std::make_shared<Document>());
result->fileId = data.get<std::string>("file_id", "");
result->fileUniqueId = data.get<std::string>("file_unique_id", "");
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
result->fileName = data.get<std::string>("file_name", "");
result->mimeType = data.get<std::string>("mime_type", "");
result->fileSize = data.get<std::int64_t>("file_size", 0);
@@ -611,7 +611,7 @@ std::string TgTypeParser::parseDocument(const Document::Ptr& object) const {
result += '{';
appendToJson(result, "file_id", object->fileId);
appendToJson(result, "file_unique_id", object->fileUniqueId);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "file_name", object->fileName);
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "file_size", object->fileSize);
@@ -627,7 +627,7 @@ Video::Ptr TgTypeParser::parseJsonAndGetVideo(const boost::property_tree::ptree&
result->width = data.get<std::int32_t>("width", 0);
result->height = data.get<std::int32_t>("height", 0);
result->duration = data.get<std::int32_t>("duration", 0);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
result->fileName = data.get<std::string>("file_name", "");
result->mimeType = data.get<std::string>("mime_type", "");
result->fileSize = data.get<std::int64_t>("file_size", 0);
@@ -645,7 +645,7 @@ std::string TgTypeParser::parseVideo(const Video::Ptr& object) const {
appendToJson(result, "width", object->width);
appendToJson(result, "height", object->height);
appendToJson(result, "duration", object->duration);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "file_name", object->fileName);
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "file_size", object->fileSize);
@@ -660,7 +660,7 @@ VideoNote::Ptr TgTypeParser::parseJsonAndGetVideoNote(const boost::property_tree
result->fileUniqueId = data.get<std::string>("file_unique_id", "");
result->length = data.get<std::int32_t>("length", 0);
result->duration = data.get<std::int32_t>("duration", 0);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
result->fileSize = data.get("file_size", 0);
return result;
}
@@ -675,7 +675,7 @@ std::string TgTypeParser::parseVideoNote(const VideoNote::Ptr& object) const {
appendToJson(result, "file_unique_id", object->fileUniqueId);
appendToJson(result, "length", object->length);
appendToJson(result, "duration", object->duration);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "file_size", object->fileSize);
removeLastComma(result);
result += '}';
@@ -2220,6 +2220,36 @@ std::string TgTypeParser::parseBotCommandScopeChatMember(const BotCommandScopeCh
return result;
}
+BotDescription::Ptr TgTypeParser::parseJsonAndGetBotDescription(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BotDescription>());
+ result->description = data.get<std::string>("description", "");
+ return result;
+}
+
+std::string TgTypeParser::parseBotDescription(const BotDescription::Ptr& object) const {
+ std::string result;
+ result += '{';
+ appendToJson(result, "description", object->description);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+BotShortDescription::Ptr TgTypeParser::parseJsonAndGetBotShortDescription(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BotShortDescription>());
+ result->shortDescription = data.get<std::string>("short_description", "");
+ return result;
+}
+
+std::string TgTypeParser::parseBotShortDescription(const BotShortDescription::Ptr& object) const {
+ std::string result;
+ result += '{';
+ appendToJson(result, "short_description", object->shortDescription);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
MenuButton::Ptr TgTypeParser::parseJsonAndGetMenuButton(const boost::property_tree::ptree& data) const {
std::string type = data.get<std::string>("type", "");
MenuButton::Ptr result;
@@ -2413,7 +2443,7 @@ std::string TgTypeParser::parseInputMediaPhoto(const InputMediaPhoto::Ptr& objec
InputMediaVideo::Ptr TgTypeParser::parseJsonAndGetInputMediaVideo(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetInputMedia().
auto result(std::make_shared<InputMediaVideo>());
- result->thumb = data.get<std::string>("thumb", "");
+ result->thumbnail = data.get<std::string>("thumbnail", "");
result->width = data.get<std::int32_t>("width", 0);
result->height = data.get<std::int32_t>("height", 0);
result->duration = data.get<std::int32_t>("duration", 0);
@@ -2429,7 +2459,7 @@ std::string TgTypeParser::parseInputMediaVideo(const InputMediaVideo::Ptr& objec
// This function will be called by parseInputMedia(), so I don't add
// curly brackets to the result std::string.
std::string result;
- appendToJson(result, "thumb", object->thumb);
+ appendToJson(result, "thumbnail", object->thumbnail);
appendToJson(result, "width", object->width);
appendToJson(result, "height", object->height);
appendToJson(result, "duration", object->duration);
@@ -2442,7 +2472,7 @@ std::string TgTypeParser::parseInputMediaVideo(const InputMediaVideo::Ptr& objec
InputMediaAnimation::Ptr TgTypeParser::parseJsonAndGetInputMediaAnimation(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetInputMedia().
auto result(std::make_shared<InputMediaAnimation>());
- result->thumb = data.get<std::string>("thumb", "");
+ result->thumbnail = data.get<std::string>("thumbnail", "");
result->width = data.get<std::int32_t>("width", 0);
result->height = data.get<std::int32_t>("height", 0);
result->duration = data.get<std::int32_t>("duration", 0);
@@ -2457,7 +2487,7 @@ std::string TgTypeParser::parseInputMediaAnimation(const InputMediaAnimation::Pt
// This function will be called by parseInputMedia(), so I don't add
// curly brackets to the result std::string.
std::string result;
- appendToJson(result, "thumb", object->thumb);
+ appendToJson(result, "thumbnail", object->thumbnail);
appendToJson(result, "width", object->width);
appendToJson(result, "height", object->height);
appendToJson(result, "duration", object->duration);
@@ -2469,7 +2499,7 @@ std::string TgTypeParser::parseInputMediaAnimation(const InputMediaAnimation::Pt
InputMediaAudio::Ptr TgTypeParser::parseJsonAndGetInputMediaAudio(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetInputMedia().
auto result(std::make_shared<InputMediaAudio>());
- result->thumb = data.get<std::string>("thumb", "");
+ result->thumbnail = data.get<std::string>("thumbnail", "");
result->duration = data.get<std::int32_t>("duration", 0);
result->performer = data.get<std::string>("performer", "");
result->title = data.get<std::string>("title", "");
@@ -2483,7 +2513,7 @@ std::string TgTypeParser::parseInputMediaAudio(const InputMediaAudio::Ptr& objec
// This function will be called by parseInputMedia(), so I don't add
// curly brackets to the result std::string.
std::string result;
- appendToJson(result, "thumb", object->thumb);
+ appendToJson(result, "thumbnail", object->thumbnail);
appendToJson(result, "duration", object->duration);
appendToJson(result, "performer", object->performer);
appendToJson(result, "title", object->title);
@@ -2494,7 +2524,7 @@ std::string TgTypeParser::parseInputMediaAudio(const InputMediaAudio::Ptr& objec
InputMediaDocument::Ptr TgTypeParser::parseJsonAndGetInputMediaDocument(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetInputMedia().
auto result(std::make_shared<InputMediaDocument>());
- result->thumb = data.get<std::string>("thumb", "");
+ result->thumbnail = data.get<std::string>("thumbnail", "");
result->disableContentTypeDetection = data.get<bool>("disable_content_type_detection", false);
return result;
}
@@ -2506,7 +2536,7 @@ std::string TgTypeParser::parseInputMediaDocument(const InputMediaDocument::Ptr&
// This function will be called by parseInputMedia(), so I don't add
// curly brackets to the result std::string.
std::string result;
- appendToJson(result, "thumb", object->thumb);
+ appendToJson(result, "thumbnail", object->thumbnail);
appendToJson(result, "disable_content_type_detection", object->disableContentTypeDetection);
// The last comma will be erased by parseInputMedia().
return result;
@@ -2528,12 +2558,13 @@ Sticker::Ptr TgTypeParser::parseJsonAndGetSticker(const boost::property_tree::pt
result->height = data.get<std::int32_t>("height", 0);
result->isAnimated = data.get<bool>("is_animated", false);
result->isVideo = data.get<bool>("is_video", false);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
result->emoji = data.get<std::string>("emoji", "");
result->setName = data.get<std::string>("set_name", "");
result->premiumAnimation = tryParseJson<File>(&TgTypeParser::parseJsonAndGetFile, data, "premium_animation");
result->maskPosition = tryParseJson<MaskPosition>(&TgTypeParser::parseJsonAndGetMaskPosition, data, "mask_position");
result->customEmojiId = data.get<std::string>("custom_emoji_id", "");
+ result->needsRepainting = data.get<bool>("needs_repainting", true);
result->fileSize = data.get<std::int32_t>("file_size", 0);
return result;
}
@@ -2557,12 +2588,13 @@ std::string TgTypeParser::parseSticker(const Sticker::Ptr& object) const {
appendToJson(result, "height", object->height);
appendToJson(result, "is_animated", object->isAnimated);
appendToJson(result, "is_video", object->isVideo);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "emoji", object->emoji);
appendToJson(result, "set_name", object->setName);
appendToJson(result, "premium_animation", parseFile(object->premiumAnimation));
appendToJson(result, "mask_position", parseMaskPosition(object->maskPosition));
appendToJson(result, "custom_emoji_id", object->customEmojiId);
+ appendToJson(result, "needs_repainting", object->needsRepainting);
appendToJson(result, "file_size", object->fileSize);
removeLastComma(result);
result += '}';
@@ -2584,7 +2616,7 @@ StickerSet::Ptr TgTypeParser::parseJsonAndGetStickerSet(const boost::property_tr
result->isAnimated = data.get<bool>("is_animated", false);
result->isVideo = data.get<bool>("is_video", false);
result->stickers = parseJsonAndGetArray<Sticker>(&TgTypeParser::parseJsonAndGetSticker, data, "stickers");
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
return result;
}
@@ -2606,7 +2638,7 @@ std::string TgTypeParser::parseStickerSet(const StickerSet::Ptr& object) const {
appendToJson(result, "is_animated", object->isAnimated);
appendToJson(result, "is_video", object->isVideo);
appendToJson(result, "stickers", parseArray(&TgTypeParser::parseSticker, object->stickers));
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
removeLastComma(result);
result += '}';
return result;
@@ -2636,6 +2668,44 @@ std::string TgTypeParser::parseMaskPosition(const MaskPosition::Ptr& object) con
return result;
}
+InputSticker::Ptr TgTypeParser::parseJsonAndGetInputSticker(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<InputSticker>());
+ result->sticker = data.get<std::string>("sticker", "");
+ result->emojiList = parseJsonAndGetArray<std::string>(
+ [] (const boost::property_tree::ptree& innerData)->std::string {
+ return innerData.get<std::string>("");
+ }
+ , data, "emoji_list");
+ result->maskPosition = tryParseJson<MaskPosition>(&TgTypeParser::parseJsonAndGetMaskPosition, data, "mask_position");
+ result->keywords = parseJsonAndGetArray<std::string>(
+ [] (const boost::property_tree::ptree& innerData)->std::string {
+ return innerData.get<std::string>("");
+ }
+ , data, "keywords");
+ return result;
+}
+
+std::string TgTypeParser::parseInputSticker(const InputSticker::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "sticker", object->sticker);
+ appendToJson(result, "emoji_list", parseArray<std::string>(
+ [] (const std::string& s)->std::string {
+ return s;
+ }, object->emojiList));
+ appendToJson(result, "mask_position", parseMaskPosition(object->maskPosition));
+ appendToJson(result, "keywords", parseArray<std::string>(
+ [] (const std::string& s)->std::string {
+ return s;
+ }, object->keywords));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
InlineQuery::Ptr TgTypeParser::parseJsonAndGetInlineQuery(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<InlineQuery>());
result->id = data.get<std::string>("id", "");
@@ -2784,9 +2854,9 @@ InlineQueryResultArticle::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultArti
result->url = data.get<std::string>("url", "");
result->hideUrl = data.get<bool>("hide_url", false);
result->description = data.get<std::string>("description", "");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -2802,9 +2872,9 @@ std::string TgTypeParser::parseInlineQueryResultArticle(const InlineQueryResultA
appendToJson(result, "url", object->url);
appendToJson(result, "hide_url", object->hideUrl);
appendToJson(result, "description", object->description);
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -2813,7 +2883,7 @@ InlineQueryResultPhoto::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultPhoto(
// NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(std::make_shared<InlineQueryResultPhoto>());
result->photoUrl = data.get<std::string>("photo_url", "");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
result->photoWidth = data.get<std::int32_t>("photo_width", 0);
result->photoHeight = data.get<std::int32_t>("photo_height", 0);
result->title = data.get<std::string>("title", "");
@@ -2833,7 +2903,7 @@ std::string TgTypeParser::parseInlineQueryResultPhoto(const InlineQueryResultPho
// curly brackets to the result std::string.
std::string result;
appendToJson(result, "photo_url", object->photoUrl);
- appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
appendToJson(result, "photo_width", object->photoWidth);
appendToJson(result, "photo_height", object->photoHeight);
appendToJson(result, "title", object->title);
@@ -2853,8 +2923,8 @@ InlineQueryResultGif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultGif(cons
result->gifWidth = data.get<std::int32_t>("gif_width", 0);
result->gifHeight = data.get<std::int32_t>("gif_height", 0);
result->gifDuration = data.get<std::int32_t>("gif_duration", 0);
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbMimeType = data.get<std::string>("thumb_mime_type", "");
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailMimeType = data.get<std::string>("thumbnail_mime_type", "");
result->title = data.get<std::string>("title", "");
result->caption = data.get<std::string>("caption", "");
result->parseMode = data.get<std::string>("parse_mode", "");
@@ -2874,8 +2944,8 @@ std::string TgTypeParser::parseInlineQueryResultGif(const InlineQueryResultGif::
appendToJson(result, "gif_width", object->gifWidth);
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);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_mime_type", object->thumbnailMimeType);
appendToJson(result, "title", object->title);
appendToJson(result, "caption", object->caption);
appendToJson(result, "parse_mode", object->parseMode);
@@ -2892,8 +2962,8 @@ InlineQueryResultMpeg4Gif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultMpe
result->mpeg4Width = data.get<std::int32_t>("mpeg4_width", 0);
result->mpeg4Height = data.get<std::int32_t>("mpeg4_height", 0);
result->mpeg4Duration = data.get<std::int32_t>("mpeg4_duration", 0);
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbMimeType = data.get<std::string>("thumb_mime_type", "");
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailMimeType = data.get<std::string>("thumbnail_mime_type", "");
result->title = data.get<std::string>("title", "");
result->caption = data.get<std::string>("caption", "");
result->parseMode = data.get<std::string>("parse_mode", "");
@@ -2913,8 +2983,8 @@ std::string TgTypeParser::parseInlineQueryResultMpeg4Gif(const InlineQueryResult
appendToJson(result, "mpeg4_width", object->mpeg4Width);
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);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_mime_type", object->thumbnailMimeType);
appendToJson(result, "title", object->title);
appendToJson(result, "caption", object->caption);
appendToJson(result, "parse_mode", object->parseMode);
@@ -2929,7 +2999,7 @@ InlineQueryResultVideo::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVideo(
auto result(std::make_shared<InlineQueryResultVideo>());
result->videoUrl = data.get<std::string>("video_url", "");
result->mimeType = data.get<std::string>("mime_type", "");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
result->title = data.get<std::string>("title", "");
result->caption = data.get<std::string>("caption", "");
result->parseMode = data.get<std::string>("parse_mode", "");
@@ -2951,7 +3021,7 @@ std::string TgTypeParser::parseInlineQueryResultVideo(const InlineQueryResultVid
std::string result;
appendToJson(result, "video_url", object->videoUrl);
appendToJson(result, "mime_type", object->mimeType);
- appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
appendToJson(result, "title", object->title);
appendToJson(result, "caption", object->caption);
appendToJson(result, "parse_mode", object->parseMode);
@@ -3040,9 +3110,9 @@ InlineQueryResultDocument::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultDoc
result->mimeType = data.get<std::string>("mime_type", "");
result->description = data.get<std::string>("description", "");
result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -3061,9 +3131,9 @@ std::string TgTypeParser::parseInlineQueryResultDocument(const InlineQueryResult
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "description", object->description);
appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -3079,9 +3149,9 @@ InlineQueryResultLocation::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultLoc
result->heading = data.get<std::int32_t>("heading", 0);
result->proximityAlertRadius = data.get<std::int32_t>("proximity_alert_radius", 0);
result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -3100,9 +3170,9 @@ std::string TgTypeParser::parseInlineQueryResultLocation(const InlineQueryResult
appendToJson(result, "heading", object->heading);
appendToJson(result, "proximity_alert_radius", object->proximityAlertRadius);
appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -3119,9 +3189,9 @@ InlineQueryResultVenue::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVenue(
result->googlePlaceId = data.get<std::string>("google_place_id", "");
result->googlePlaceType = data.get<std::string>("google_place_type", "");
result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -3141,9 +3211,9 @@ std::string TgTypeParser::parseInlineQueryResultVenue(const InlineQueryResultVen
appendToJson(result, "google_place_id", object->googlePlaceId);
appendToJson(result, "google_place_type", object->googlePlaceType);
appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -3156,9 +3226,9 @@ InlineQueryResultContact::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCont
result->lastName = data.get<std::string>("last_name", "");
result->vcard = data.get<std::string>("vcard", "");
result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -3174,9 +3244,9 @@ std::string TgTypeParser::parseInlineQueryResultContact(const InlineQueryResultC
appendToJson(result, "last_name", object->lastName);
appendToJson(result, "vcard", object->vcard);
appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}