summaryrefslogtreecommitdiff
path: root/src/Api.cpp
diff options
context:
space:
mode:
authorOleg Morozenkov <omorozenkov@gmail.com>2016-04-03 00:09:06 +0400
committerOleg Morozenkov <omorozenkov@gmail.com>2016-04-03 00:09:06 +0400
commitb6fd8d8ff899240580c5973bd75d74c5167b8d3d (patch)
treeb24d43cd2a13ba923de495961bf9a5e613ae683a /src/Api.cpp
parent2195ce0768fa8903633164c0c45060c412cd5670 (diff)
parentb937e88dd43a7708f40af6a3c333046e3121a77a (diff)
Merge pull request #19 from aadeg/master
Implementing inline mode BIS
Diffstat (limited to 'src/Api.cpp')
-rw-r--r--src/Api.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index 2e27e1d..ed06d27 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -255,6 +255,18 @@ void Api::setWebhook(const string& url) const {
sendRequest("setWebhook", args);
}
+void Api::answerInlineQuery(const std::string& inlineQueryId, const std::vector<InlineQueryResult::Ptr>& results,
+ int32_t cacheTime, bool isPersonal, const std::string& nextOffset) const {
+ vector<HttpReqArg> args;
+ args.push_back(HttpReqArg("inline_query_id", inlineQueryId));
+ string resultsJson = TgTypeParser::getInstance().parseArray<InlineQueryResult>(&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));
+ sendRequest("answerInlineQuery", args);
+}
+
ptree Api::sendRequest(const string& method, const vector<HttpReqArg>& args) const {
string url = "https://api.telegram.org/bot";