summaryrefslogtreecommitdiff
path: root/src/Api.cpp
diff options
context:
space:
mode:
authorJellyBrick <shlee1503@naver.com>2017-08-15 01:11:03 +0900
committerGitHub <noreply@github.com>2017-08-15 01:11:03 +0900
commit50674897366b37a02a7838c2fc1f3726a7210d2c (patch)
treee7f4ae1e420e204fe3e60c0c326021f4ce8c8e0a /src/Api.cpp
parent778f0c54bce8186ace310c70bdd797aa0d759869 (diff)
Bug Fix
Fixed an error that caused a TgException if the message contained "<html>"
Diffstat (limited to 'src/Api.cpp')
-rw-r--r--src/Api.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index b9ea183..31e08f3 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -662,14 +662,13 @@ void Api::deleteMessage(int64_t chatId, int32_t messageId) 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) {
+ if (!serverResponse.compare(0, 6, "<html>")) {
throw TgException("tgbot-cpp library have got html page instead of json response. Maybe you entered wrong bot token.");
}