From d2baea74a0ac09db992ab36a861d09caccdab697 Mon Sep 17 00:00:00 2001 From: Andrea Giove Date: Sun, 27 Mar 2016 16:31:11 +0200 Subject: Add answerInlineQuery method --- include/tgbot/Api.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/tgbot/Api.h') diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index b33cd03..96dc683 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -35,6 +35,7 @@ #include "tgbot/types/InputFile.h" #include "tgbot/types/UserProfilePhotos.h" #include "tgbot/types/Update.h" +#include "tgbot/types/InlineQueryResult.h" namespace TgBot { @@ -229,8 +230,21 @@ public: * Ports currently supported for Webhooks: 443, 80, 88, 8443. * @param url Optional. HTTPS url to send updates to. Use an empty string to remove webhook integration. */ + // TODO Add support to self-signed certificate void setWebhook(const std::string& url = "") const; + /** + * Use this method to send answers to an inline query. + * No mode that 50 results per query are allowed. + * @param inlineQueryId Unique identifier for the answered query. + * @param results Array of results for the inline query. + * @param cacheTime The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. + * @param isPersonal Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query. + * @param nextOffset Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes. + */ + void answerInlineQuery(const std::string inlineQueryId, const std::vector results, + int32_t cacheTime=300, bool isPersonal=false, const std::string& nextOffset=""); + private: boost::property_tree::ptree sendRequest(const std::string& method, const std::vector& args = std::vector()) const; -- cgit v1.2.3 From 405d973af3460ee2860d01c7169cf6749fa98b07 Mon Sep 17 00:00:00 2001 From: Andrea Giove Date: Sun, 27 Mar 2016 18:24:03 +0200 Subject: Fixed compilation errors --- include/tgbot/Api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/tgbot/Api.h') diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index 96dc683..22dbe30 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -242,7 +242,7 @@ public: * @param isPersonal Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query. * @param nextOffset Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes. */ - void answerInlineQuery(const std::string inlineQueryId, const std::vector results, + void answerInlineQuery(const std::string& inlineQueryId, const std::vector& results, int32_t cacheTime=300, bool isPersonal=false, const std::string& nextOffset=""); private: -- cgit v1.2.3 From de33e2e08049c3698920789f769b7f361414f4b0 Mon Sep 17 00:00:00 2001 From: Andrea Giove Date: Tue, 29 Mar 2016 17:13:38 +0200 Subject: Edited answerInlineQuery --- include/tgbot/Api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/tgbot/Api.h') diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index 22dbe30..66f41b5 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -243,7 +243,7 @@ public: * @param nextOffset Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes. */ void answerInlineQuery(const std::string& inlineQueryId, const std::vector& results, - int32_t cacheTime=300, bool isPersonal=false, const std::string& nextOffset=""); + int32_t cacheTime=300, bool isPersonal=false, const std::string& nextOffset="") const; private: boost::property_tree::ptree sendRequest(const std::string& method, const std::vector& args = std::vector()) const; -- cgit v1.2.3