summaryrefslogtreecommitdiff
path: root/src/Api.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Api.cpp')
-rw-r--r--src/Api.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index 0a08353..9acf1bb 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -15,8 +15,8 @@ using namespace boost::property_tree;
namespace TgBot {
-Api::Api(string token, const HttpClient& httpClient)
- : _token(std::move(token)), _httpClient(httpClient), _tgTypeParser() {
+Api::Api(string token, const HttpClient& httpClient, const std::string& url)
+ : _token(std::move(token)), _httpClient(httpClient), _tgTypeParser(), _url(url) {
}
User::Ptr Api::getMe() const {
@@ -1172,7 +1172,8 @@ std::vector<BotCommand::Ptr> Api::getMyCommands() const
}
ptree Api::sendRequest(const string& method, const vector<HttpReqArg>& args) const {
- string url = "https://api.telegram.org/bot";
+ string url(_url);
+ url += "/bot";
url += _token;
url += "/";
url += method;
@@ -1195,7 +1196,8 @@ ptree Api::sendRequest(const string& method, const vector<HttpReqArg>& args) con
}
string Api::downloadFile(const string& filePath, const std::vector<HttpReqArg>& args) const {
- string url = "https://api.telegram.org/file/bot";
+ string url(_url);
+ url += "/file/bot";
url += _token;
url += "/";
url += filePath;