From b68611144a92b266ab20b7db8fbce723bb499b70 Mon Sep 17 00:00:00 2001 From: kukin-konstantin Date: Mon, 20 Mar 2017 18:43:36 +0300 Subject: fix errors --- src/Api.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index 984deb5..6fd86c2 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 args; args.push_back(HttpReqArg("file_id", fileId)); -- cgit v1.2.3 From 156c087f3eeeeffb949ae6a572dd7b52815eb0e5 Mon Sep 17 00:00:00 2001 From: kukin-konstantin Date: Mon, 20 Mar 2017 19:55:17 +0300 Subject: add function download file --- src/Api.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index 6fd86c2..b7a53c1 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -681,4 +681,15 @@ ptree Api::sendRequest(const string& method, const vector& args) con } } +std::string Api::downloadFile(const std::string& filePath, const std::vector& args) const { + string url = "https://api.telegram.org/file/bot"; + url += _token; + url += "/"; + url += filePath; + + string serverResponse = HttpClient::getInstance().makeRequest(url, args); + + return serverResponse; +} + } -- cgit v1.2.3