diff options
author | Nuno Esculcas <Nuno.Esculcas@ctw.bmwgroup.com> | 2020-11-08 12:01:39 +0000 |
---|---|---|
committer | Nuno Esculcas <Nuno.Esculcas@ctw.bmwgroup.com> | 2020-11-08 12:01:39 +0000 |
commit | 0bf49aa347de2512370c96aef7b5477423f14318 (patch) | |
tree | e2111fe529bf0d2fa13ad5fbfc29bb67c50f1cf4 /include | |
parent | 9fe48a3628b58dc259c36a106630d8134d029da5 (diff) |
Add support to configure the API bot server url
Now creating the bot class it is possible to override the API bot
server url that defaults to: 'https://api.telegram.org'
This enables you to connect your bot to the local API bot server.
Diffstat (limited to 'include')
-rw-r--r-- | include/tgbot/Api.h | 3 | ||||
-rw-r--r-- | include/tgbot/Bot.h | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index e48da6f..1adbbe5 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -46,7 +46,7 @@ typedef std::shared_ptr<std::vector<std::string>> StringArrayPtr; friend class Bot; public: - Api(std::string token, const HttpClient& httpClient); + Api(std::string token, const HttpClient& httpClient, const std::string& url); /** * @brief A simple method for testing your bot's auth token. @@ -823,6 +823,7 @@ private: const std::string _token; const HttpClient& _httpClient; const TgTypeParser _tgTypeParser; + const std::string _url; }; } diff --git a/include/tgbot/Bot.h b/include/tgbot/Bot.h index 023a71b..36d3cb4 100644 --- a/include/tgbot/Bot.h +++ b/include/tgbot/Bot.h @@ -21,7 +21,7 @@ class HttpClient; class TGBOT_API Bot { public: - explicit Bot(std::string token, const HttpClient &httpClient = _getDefaultHttpClient()); + explicit Bot(std::string token, const HttpClient &httpClient = _getDefaultHttpClient(), const std::string& url="https://api.telegram.org"); /** * @return Token for accessing api. |