From 2d7d1a269383ec1db99b6759f9c58ba08d1d29fe Mon Sep 17 00:00:00 2001 From: Konstantin Kukin Date: Fri, 30 Dec 2016 11:38:22 +0300 Subject: add Webhook functions --- src/Api.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index 54cb692..c4baa2b 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -381,16 +381,50 @@ vector Api::getUpdates(int32_t offset, int32_t limit, int32_t timeo return TgTypeParser::getInstance().parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetUpdate, sendRequest("getUpdates", args)); } -void Api::setWebhook(const string& url, const InputFile::Ptr& certificate) const { +void Api::setWebhook(const string& url, const InputFile::Ptr& certificate, int32_t maxConnection, const StringArrayPtr &allowedUpdates) const { vector args; if (!url.empty()) args.push_back(HttpReqArg("url", url)); if (certificate != nullptr) args.push_back(HttpReqArg("certificate", certificate->data, true, certificate->mimeType, certificate->fileName)); + if (maxConnection!=40) + args.push_back(HttpReqArg("max_connections", maxConnection)); + + if (allowedUpdates!=nullptr) + { + string allowedUpdatesJson = TgTypeParser::getInstance().parseArray( + [](const std::string &s)->std::string { + return s; + }, *allowedUpdates); + args.push_back(HttpReqArg("allowed_updates", allowedUpdatesJson)); + } sendRequest("setWebhook", args); } +bool Api::deleteWebhook() const +{ + ptree p = sendRequest("deleteWebhook"); + return p.get("", false); +} + +WebhookInfo::Ptr Api::getWebhookInfo() const +{ + ptree p = sendRequest("getWebhookInfo"); + + if (!p.get_child_optional("url")) + return nullptr; + + if (p.get("url","")!=string("")) + { + return TgTypeParser::getInstance().parseJsonAndGetWebhookInfo(p); + } + else + { + return nullptr; + } +} + void Api::answerInlineQuery(const std::string& inlineQueryId, const std::vector& results, int32_t cacheTime, bool isPersonal, const std::string& nextOffset) const { vector args; -- cgit v1.2.3 From 728e758eee9b22328abc6e75f6cef7e7197be0f0 Mon Sep 17 00:00:00 2001 From: kukin-konstantin Date: Fri, 30 Dec 2016 15:05:22 +0300 Subject: fix send Video, Voice etc --- src/Api.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 8 deletions(-) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index c4baa2b..451a8c0 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -109,10 +109,13 @@ Message::Ptr Api::sendPhoto(int64_t chatId, const string& photoId, const string& return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendPhoto", args)); } -Message::Ptr Api::sendAudio(int64_t chatId, const InputFile::Ptr& audio, int32_t duration, const string& performer, const string& title, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { +Message::Ptr Api::sendAudio(int64_t chatId, const InputFile::Ptr& audio, const std::string &caption, int32_t duration, const string& performer, const string& title, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("audio", audio->data, true, audio->mimeType, audio->fileName)); + if (!caption.empty()) { + args.push_back(HttpReqArg("caption", caption)); + } if (duration) { args.push_back(HttpReqArg("duration", duration)); } @@ -134,10 +137,13 @@ Message::Ptr Api::sendAudio(int64_t chatId, const InputFile::Ptr& audio, int32_t return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendAudio", args)); } -Message::Ptr Api::sendAudio(int64_t chatId, const string& audioId, int32_t duration, const string& performer, const string& title, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { +Message::Ptr Api::sendAudio(int64_t chatId, const string& audioId, const std::string &caption, int32_t duration, const string& performer, const string& title, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("audio", audioId)); + if (!caption.empty()) { + args.push_back(HttpReqArg("caption", caption)); + } if (duration) { args.push_back(HttpReqArg("duration", duration)); } @@ -159,10 +165,13 @@ Message::Ptr Api::sendAudio(int64_t chatId, const string& audioId, int32_t durat return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendAudio", args)); } -Message::Ptr Api::sendDocument(int64_t chatId, const InputFile::Ptr& document, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { +Message::Ptr Api::sendDocument(int64_t chatId, const InputFile::Ptr& document, const std::string &caption, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("document", document->data, true, document->mimeType, document->fileName)); + if (!caption.empty()) { + args.push_back(HttpReqArg("caption", caption)); + } if (replyToMessageId) { args.push_back(HttpReqArg("reply_to_message_id", replyToMessageId)); } @@ -175,10 +184,13 @@ Message::Ptr Api::sendDocument(int64_t chatId, const InputFile::Ptr& document, i return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendDocument", args)); } -Message::Ptr Api::sendDocument(int64_t chatId, const string& document, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { +Message::Ptr Api::sendDocument(int64_t chatId, const string& document, const std::string &caption, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("document", document)); + if (!caption.empty()) { + args.push_back(HttpReqArg("caption", caption)); + } if (replyToMessageId) { args.push_back(HttpReqArg("reply_to_message_id", replyToMessageId)); } @@ -223,10 +235,22 @@ Message::Ptr Api::sendSticker(int64_t chatId, const string& stickerId, int32_t r return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendSticker", args)); } -Message::Ptr Api::sendVideo(int64_t chatId, const InputFile::Ptr& video, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { +Message::Ptr Api::sendVideo(int64_t chatId, const InputFile::Ptr& video, int32_t duration, int32_t width, int32_t height, const std::string &caption, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("video", video->data, true, video->mimeType, video->fileName)); + if (duration) { + args.push_back(HttpReqArg("duration", duration)); + } + if (width) { + args.push_back(HttpReqArg("width", width)); + } + if (height) { + args.push_back(HttpReqArg("height", height)); + } + if (!caption.empty()) { + args.push_back(HttpReqArg("caption", caption)); + } if (replyToMessageId) { args.push_back(HttpReqArg("reply_to_message_id", replyToMessageId)); } @@ -239,10 +263,22 @@ Message::Ptr Api::sendVideo(int64_t chatId, const InputFile::Ptr& video, int32_t return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendVideo", args)); } -Message::Ptr Api::sendVideo(int64_t chatId, const string& videoId, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { +Message::Ptr Api::sendVideo(int64_t chatId, const string& videoId, int32_t duration, int32_t width, int32_t height, const std::string &caption, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("video", videoId)); + if (duration) { + args.push_back(HttpReqArg("duration", duration)); + } + if (width) { + args.push_back(HttpReqArg("width", width)); + } + if (height) { + args.push_back(HttpReqArg("height", height)); + } + if (!caption.empty()) { + args.push_back(HttpReqArg("caption", caption)); + } if (replyToMessageId) { args.push_back(HttpReqArg("reply_to_message_id", replyToMessageId)); } @@ -255,10 +291,13 @@ Message::Ptr Api::sendVideo(int64_t chatId, const string& videoId, int32_t reply return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendVideo", args)); } -Message::Ptr Api::sendVoice(int64_t chatId, const InputFile::Ptr& voice, int duration, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { +Message::Ptr Api::sendVoice(int64_t chatId, const InputFile::Ptr& voice, const std::string &caption, int duration, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("voice", voice->data, true, voice->mimeType, voice->fileName)); + if (!caption.empty()) { + args.push_back(HttpReqArg("caption", caption)); + } if (duration){ args.push_back(HttpReqArg("duration", duration)); } @@ -274,10 +313,13 @@ Message::Ptr Api::sendVoice(int64_t chatId, const InputFile::Ptr& voice, int dur return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendVideo", args)); } -Message::Ptr Api::sendVoice(int64_t chatId, const std::string& voiceId, int duration, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { +Message::Ptr Api::sendVoice(int64_t chatId, const std::string& voiceId, const std::string &caption, int duration, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("voice", voiceId)); + if (!caption.empty()) { + args.push_back(HttpReqArg("caption", caption)); + } if (duration){ args.push_back(HttpReqArg("duration", duration)); } -- cgit v1.2.3 From 156bac1c6b2d8ce28f1a13b11bca3e8da285aa3d Mon Sep 17 00:00:00 2001 From: kukin-konstantin Date: Fri, 30 Dec 2016 16:01:00 +0300 Subject: Add Chat functions --- src/Api.cpp | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index 451a8c0..4b08f98 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -410,7 +410,36 @@ UserProfilePhotos::Ptr Api::getUserProfilePhotos(int32_t userId, int32_t offset, return TgTypeParser::getInstance().parseJsonAndGetUserProfilePhotos(sendRequest("getUserProfilePhotos", args)); } -vector Api::getUpdates(int32_t offset, int32_t limit, int32_t timeout) const { +Chat::Ptr Api::getChat(int32_t chatId) const +{ + vector args; + args.push_back(HttpReqArg("chat_id", chatId)); + return TgTypeParser::getInstance().parseJsonAndGetChat(sendRequest("getChat", args)); +} + +std::vector Api::getChatAdministrators(int32_t chatId) const +{ + vector args; + args.push_back(HttpReqArg("chat_id", chatId)); + return TgTypeParser::getInstance().parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetChatMember, sendRequest("getChatAdministrators", args)); +} + +int32_t Api::getChatMembersCount(int32_t chatId) const +{ + vector args; + args.push_back(HttpReqArg("chat_id", chatId)); + return sendRequest("getChatMembersCount", args).get("", 0); +} + +ChatMember::Ptr Api::getChatMember(int32_t chatId, int32_t userId) const +{ + vector args; + args.push_back(HttpReqArg("chat_id", chatId)); + args.push_back(HttpReqArg("user_id", userId)); + return TgTypeParser::getInstance().parseJsonAndGetChatMember(sendRequest("getChatMember", args)); +} + +vector Api::getUpdates(int32_t offset, int32_t limit, int32_t timeout, const StringArrayPtr &allowedUpdates) const { vector args; if (offset) { args.push_back(HttpReqArg("offset", offset)); @@ -420,6 +449,13 @@ vector Api::getUpdates(int32_t offset, int32_t limit, int32_t timeo if (timeout) { args.push_back(HttpReqArg("timeout", timeout)); } + if (allowedUpdates!=nullptr) { + string allowedUpdatesJson = TgTypeParser::getInstance().parseArray( + [](const std::string &s)->std::string { + return s; + }, *allowedUpdates); + args.push_back(HttpReqArg("allowed_updates", allowedUpdatesJson)); + } return TgTypeParser::getInstance().parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetUpdate, sendRequest("getUpdates", args)); } -- cgit v1.2.3 From 9863c73094324724733787807c67f72542970b69 Mon Sep 17 00:00:00 2001 From: kukin-konstantin Date: Fri, 30 Dec 2016 16:23:18 +0300 Subject: Add getFile, edit kickChatMember, urbanChatMember --- src/Api.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index 4b08f98..673f368 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -410,6 +410,13 @@ UserProfilePhotos::Ptr Api::getUserProfilePhotos(int32_t userId, int32_t offset, return TgTypeParser::getInstance().parseJsonAndGetUserProfilePhotos(sendRequest("getUserProfilePhotos", args)); } +File::Ptr Api::getFile(int32_t fileId) const +{ + vector args; + args.push_back(HttpReqArg("file_id", fileId)); + return TgTypeParser::getInstance().parseJsonAndGetFile(sendRequest("getFile", args)); +} + Chat::Ptr Api::getChat(int32_t chatId) const { vector args; @@ -515,18 +522,18 @@ void Api::answerInlineQuery(const std::string& inlineQueryId, const std::vector< sendRequest("answerInlineQuery", args); } -void Api::kickChatMember(int64_t chatId, int32_t userId) const { +bool Api::kickChatMember(int64_t chatId, int32_t userId) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("user_id", userId)); - sendRequest("kickChatMember", args); + return sendRequest("kickChatMember", args).get("", false); } -void Api::unbanChatMember(int64_t chatId, int32_t userId) const { +bool Api::unbanChatMember(int64_t chatId, int32_t userId) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("user_id", userId)); - sendRequest("unbanChatMember", args); + return sendRequest("unbanChatMember", args).get("", false); } ptree Api::sendRequest(const string& method, const vector& args) const { -- cgit v1.2.3 From 4f3a56bf7fcfae055d5f513ff86cf4e1e75e83b7 Mon Sep 17 00:00:00 2001 From: kukin-konstantin Date: Fri, 30 Dec 2016 17:24:35 +0300 Subject: add leaveChat method --- src/Api.cpp | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index 673f368..2df8a50 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -417,28 +417,54 @@ File::Ptr Api::getFile(int32_t fileId) const return TgTypeParser::getInstance().parseJsonAndGetFile(sendRequest("getFile", args)); } -Chat::Ptr Api::getChat(int32_t chatId) const +bool Api::leaveChat(int64_t chatId) const +{ + vector args; + args.push_back(HttpReqArg("chat_id", chatId)); + return sendRequest("leaveChat", args).get("", false); +} + +Chat::Ptr Api::getChat(int64_t chatId) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); return TgTypeParser::getInstance().parseJsonAndGetChat(sendRequest("getChat", args)); } -std::vector Api::getChatAdministrators(int32_t chatId) const +std::vector Api::getChatAdministrators(int64_t chatId) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); return TgTypeParser::getInstance().parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetChatMember, sendRequest("getChatAdministrators", args)); } -int32_t Api::getChatMembersCount(int32_t chatId) const +int32_t Api::getChatMembersCount(int64_t chatId) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); return sendRequest("getChatMembersCount", args).get("", 0); } -ChatMember::Ptr Api::getChatMember(int32_t chatId, int32_t userId) const +bool Api::answerCallbackQuery(const std::string & callbackQueryId, const std::string & text, bool showAlert, const std::string &url, int32_t cacheTime) const +{ + vector args; + args.push_back(HttpReqArg("callback_query_id", callbackQueryId)); + if (!text.empty()) { + args.push_back(HttpReqArg("text", text)); + } + if (showAlert) { + args.push_back(HttpReqArg("show_alert", showAlert)); + } + if (!url.empty()) { + args.push_back(HttpReqArg("url", url)); + } + if (cacheTime) { + args.push_back(HttpReqArg("cache_time", cacheTime)); + } + return sendRequest("answerCallbackQuery", args).get("", false); +} + +ChatMember::Ptr Api::getChatMember(int64_t chatId, int32_t userId) const { vector args; args.push_back(HttpReqArg("chat_id", chatId)); @@ -516,9 +542,15 @@ void Api::answerInlineQuery(const std::string& inlineQueryId, const std::vector< args.push_back(HttpReqArg("inline_query_id", inlineQueryId)); string resultsJson = TgTypeParser::getInstance().parseArray(&TgTypeParser::parseInlineQueryResult, results); args.push_back(HttpReqArg("results", resultsJson)); - args.push_back(HttpReqArg("cache_time", cacheTime)); - args.push_back(HttpReqArg("is_personal", isPersonal)); - args.push_back(HttpReqArg("next_offset", nextOffset)); + if (cacheTime) { + args.push_back(HttpReqArg("cache_time", cacheTime)); + } + if (isPersonal) { + args.push_back(HttpReqArg("is_personal", isPersonal)); + } + if (!nextOffset.empty()) { + args.push_back(HttpReqArg("next_offset", nextOffset)); + } sendRequest("answerInlineQuery", args); } -- cgit v1.2.3 From 0466be7b03710caec9cf1037342b4004b2360af2 Mon Sep 17 00:00:00 2001 From: kukin-konstantin Date: Mon, 2 Jan 2017 22:08:51 +0300 Subject: add editMessage methods --- src/Api.cpp | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 3 deletions(-) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index 2df8a50..361b4d6 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -464,6 +464,89 @@ bool Api::answerCallbackQuery(const std::string & callbackQueryId, const std::st return sendRequest("answerCallbackQuery", args).get("", false); } +Message::Ptr Api::editMessageText(const std::string& text, int64_t chatId, int32_t messageId, const std::string& inlineMessageId, + const std::string& parseMode, bool disableWebPagePreview, const GenericReply::Ptr& replyMarkup) const { + + vector args; + args.push_back(HttpReqArg("text", text)); + if (chatId) { + args.push_back(HttpReqArg("chat_id", chatId)); + } + if (messageId) { + args.push_back(HttpReqArg("message_id", messageId)); + } + if (!inlineMessageId.empty()) { + args.push_back(HttpReqArg("inline_message_id", inlineMessageId)); + } + if (!parseMode.empty()) { + args.push_back(HttpReqArg("parse_mode", parseMode)); + } + if (disableWebPagePreview) { + args.push_back(HttpReqArg("disable_web_page_preview", disableWebPagePreview)); + } + if (replyMarkup) { + args.push_back(HttpReqArg("reply_markup", TgTypeParser::getInstance().parseGenericReply(replyMarkup))); + } + ptree p = sendRequest("editMessageText", args); + if (p.get_child_optional("message_id")) { + return TgTypeParser::getInstance().parseJsonAndGetMessage(p); + } else { + return nullptr; + } +} + +Message::Ptr Api::editMessageCaption(int64_t chatId, int32_t messageId, const std::string& caption, + const std::string& inlineMessageId, const GenericReply::Ptr& replyMarkup) const { + + vector args; + if (chatId) { + args.push_back(HttpReqArg("chat_id", chatId)); + } + if (messageId) { + args.push_back(HttpReqArg("message_id", messageId)); + } + if (!caption.empty()) { + args.push_back(HttpReqArg("caption", caption)); + } + if (!inlineMessageId.empty()) { + args.push_back(HttpReqArg("inline_message_id", inlineMessageId)); + } + if (replyMarkup) { + args.push_back(HttpReqArg("reply_markup", TgTypeParser::getInstance().parseGenericReply(replyMarkup))); + } + ptree p = sendRequest("editMessageCaption", args); + if (p.get_child_optional("message_id")) { + return TgTypeParser::getInstance().parseJsonAndGetMessage(p); + } else { + return nullptr; + } + +} + +Message::Ptr Api::editMessageReplyMarkup(int64_t chatId, int32_t messageId, const std::string& inlineMessageId, + const GenericReply::Ptr& replyMarkup) const { + + vector args; + if (chatId) { + args.push_back(HttpReqArg("chat_id", chatId)); + } + if (messageId) { + args.push_back(HttpReqArg("message_id", messageId)); + } + if (!inlineMessageId.empty()) { + args.push_back(HttpReqArg("inline_message_id", inlineMessageId)); + } + if (replyMarkup) { + args.push_back(HttpReqArg("reply_markup", TgTypeParser::getInstance().parseGenericReply(replyMarkup))); + } + ptree p = sendRequest("editMessageReplyMarkup", args); + if (p.get_child_optional("message_id")) { + return TgTypeParser::getInstance().parseJsonAndGetMessage(p); + } else { + return nullptr; + } +} + ChatMember::Ptr Api::getChatMember(int64_t chatId, int32_t userId) const { vector args; @@ -536,8 +619,8 @@ WebhookInfo::Ptr Api::getWebhookInfo() const } } -void Api::answerInlineQuery(const std::string& inlineQueryId, const std::vector& results, - int32_t cacheTime, bool isPersonal, const std::string& nextOffset) const { +bool Api::answerInlineQuery(const std::string& inlineQueryId, const std::vector& results, + int32_t cacheTime, bool isPersonal, const std::string& nextOffset, const std::string& switchPmText, const std::string& switchPmParameter) const { vector args; args.push_back(HttpReqArg("inline_query_id", inlineQueryId)); string resultsJson = TgTypeParser::getInstance().parseArray(&TgTypeParser::parseInlineQueryResult, results); @@ -551,7 +634,13 @@ void Api::answerInlineQuery(const std::string& inlineQueryId, const std::vector< if (!nextOffset.empty()) { args.push_back(HttpReqArg("next_offset", nextOffset)); } - sendRequest("answerInlineQuery", args); + if (!switchPmText.empty()) { + args.push_back(HttpReqArg("switch_pm_text", switchPmText)); + } + if (!switchPmParameter.empty()) { + args.push_back(HttpReqArg("switch_pm_parameter", switchPmParameter)); + } + return sendRequest("answerInlineQuery", args).get("", false); } bool Api::kickChatMember(int64_t chatId, int32_t userId) const { -- cgit v1.2.3