From e96015a3043f7da0359dc8887b543803041ceef9 Mon Sep 17 00:00:00 2001 From: Florian Scheibner Date: Thu, 12 Nov 2015 14:28:53 +0100 Subject: Output boolean values correctly as json previously 1 was printed instead of true fixes showing custom keyboards --- include/tgbot/TgTypeParser.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/tgbot') diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index f7c9791..07eb1b6 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -187,6 +187,17 @@ private: json += ','; } + void appendToJson(std::string& json, const std::string& varName, const bool& value) const { + if (value == 0) { + return; + } + json += '"'; + json += varName; + json += "\":"; + json += (value ? "true" : "false"); + json += ','; + } + void appendToJson(std::string& json, const std::string& varName, const std::string& value) const; }; -- cgit v1.2.3