summaryrefslogtreecommitdiff
path: root/src/Api.cpp
diff options
context:
space:
mode:
authorOleg Morozenkov <reo7sp@users.noreply.github.com>2017-03-21 18:50:45 +0300
committerGitHub <noreply@github.com>2017-03-21 18:50:45 +0300
commit4d9e96d9c91e1faeefb67de2164c026f84be020e (patch)
tree60af55841a59d7af13bb492d248e0744478e8056 /src/Api.cpp
parent1c7d4c17062644d28f485b0ff6cbc213e975ac29 (diff)
parent156c087f3eeeeffb949ae6a572dd7b52815eb0e5 (diff)
Merge pull request #43 from kukin-konstantin/master
fix errors and new function
Diffstat (limited to 'src/Api.cpp')
-rw-r--r--src/Api.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index 984deb5..b7a53c1 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -310,7 +310,7 @@ Message::Ptr Api::sendVoice(int64_t chatId, const InputFile::Ptr voice, const st
if (disableNotification){
args.push_back(HttpReqArg("disable_notification", disableNotification));
}
- return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendVideo", args));
+ return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendVoice", args));
}
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 {
@@ -410,7 +410,7 @@ 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
+File::Ptr Api::getFile(const std::string &fileId) const
{
vector<HttpReqArg> args;
args.push_back(HttpReqArg("file_id", fileId));
@@ -681,4 +681,15 @@ ptree Api::sendRequest(const string& method, const vector<HttpReqArg>& args) con
}
}
+std::string Api::downloadFile(const std::string& filePath, const std::vector<HttpReqArg>& args) const {
+ string url = "https://api.telegram.org/file/bot";
+ url += _token;
+ url += "/";
+ url += filePath;
+
+ string serverResponse = HttpClient::getInstance().makeRequest(url, args);
+
+ return serverResponse;
+}
+
}