summaryrefslogtreecommitdiff
path: root/src/TgTypeParser.cpp
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2020-08-21 01:41:36 +0300
committerGitHub <noreply@github.com>2020-08-21 01:41:36 +0300
commit4009b7ea603dcd7f21c6e852497daba7b0a1a6b3 (patch)
tree6dd10e3c92accb9aa250bc30862a59f6f7d9067b /src/TgTypeParser.cpp
parent3230b1b5d84a7a948324949eb607082dc40fe01e (diff)
parentffc3c38882d669ea6b2abeea5c0f7c7b322fa6e7 (diff)
Merge pull request #143 from sebest06/master
* add SetMyCommand to the api
Diffstat (limited to 'src/TgTypeParser.cpp')
-rw-r--r--src/TgTypeParser.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index 06a2b2a..95c60c9 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -2026,6 +2026,23 @@ string TgTypeParser::parseLabeledPrice(const LabeledPrice::Ptr& object) const {
return result;
}
+BotCommand::Ptr TgTypeParser::parseJsonAndGetBotCommand(const boost::property_tree::ptree& data) const {
+ auto result(make_shared<BotCommand>());
+ result->command = data.get("command", "");
+ result->description = data.get("description","");
+ return result;
+}
+
+string TgTypeParser::parseBotCommand(const BotCommand::Ptr& object) const {
+ std::string result;
+ result += '{';
+ appendToJson(result, "command", object->command);
+ appendToJson(result, "description", object->description);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
OrderInfo::Ptr TgTypeParser::parseJsonAndGetOrderInfo(const boost::property_tree::ptree& data) const {
auto result(make_shared<OrderInfo>());
result->name = data.get<string>("name", "");