summaryrefslogtreecommitdiff
path: root/src/Api.cpp
diff options
context:
space:
mode:
authorOleg Morozenkov <omorozenkov@gmail.com>2015-11-23 14:44:20 +0300
committerOleg Morozenkov <omorozenkov@gmail.com>2015-11-23 14:44:20 +0300
commit6fd3160feba7dc1228221ff4c8626cad48406d06 (patch)
tree186bd84429f9af6f5406d5a04a6fc339116f3c17 /src/Api.cpp
parent3040a62a71050e53624583bd83b3bffeb6aca9f0 (diff)
parent03a1a5b66037df5df46a7beba980a4931f38f1a3 (diff)
Merge pull request #8 from naveenvhegde/master
Add Chat class ( instead of user or group).
Diffstat (limited to 'src/Api.cpp')
-rw-r--r--src/Api.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index 9c8259f..d4a1c69 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -256,14 +256,17 @@ void Api::setWebhook(const string& url) const {
}
ptree Api::sendRequest(const string& method, const vector<HttpReqArg>& args) const {
+
string url = "https://api.telegram.org/bot";
url += _token;
url += "/";
url += method;
+
string serverResponse = HttpClient::getInstance().makeRequest(url, args);
if (serverResponse.find("<html>") != serverResponse.npos) {
throw TgException("tgbot-cpp library have got html page instead of json response. Maybe you entered wrong bot token.");
}
+
ptree result = TgTypeParser::getInstance().parseJson(serverResponse);
try {
if (result.get<bool>("ok", false)) {