From 50674897366b37a02a7838c2fc1f3726a7210d2c Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Tue, 15 Aug 2017 01:11:03 +0900 Subject: Bug Fix Fixed an error that caused a TgException if the message contained "" --- src/Api.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') 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& args) const { - string url = "https://api.telegram.org/bot"; url += _token; url += "/"; url += method; string serverResponse = HttpClient::getInstance().makeRequest(url, args); - if (serverResponse.find("") != serverResponse.npos) { + if (!serverResponse.compare(0, 6, "")) { throw TgException("tgbot-cpp library have got html page instead of json response. Maybe you entered wrong bot token."); } -- cgit v1.2.3