summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorsebest <sebest@seba.seba>2020-05-25 15:49:44 -0300
committersebest <sebest@seba.seba>2020-05-25 15:49:44 -0300
commitffc3c38882d669ea6b2abeea5c0f7c7b322fa6e7 (patch)
tree0394904a1d5c09662825e77ee9ad6ec137b8ee64 /include
parent6436825328cd3bf4a1c964bc84638bc93cfaff1e (diff)
* add SetMyCommand to the api
Diffstat (limited to 'include')
-rw-r--r--include/tgbot/Api.h6
-rw-r--r--include/tgbot/TgTypeParser.h4
-rw-r--r--include/tgbot/tgbot.h2
-rw-r--r--include/tgbot/types/BotCommand.h36
4 files changed, 48 insertions, 0 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index eddbe50..e48da6f 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -20,6 +20,7 @@
#include "tgbot/types/GameHighScore.h"
#include "tgbot/types/LabeledPrice.h"
#include "tgbot/types/ShippingOption.h"
+#include "tgbot/types/BotCommand.h"
#include <boost/property_tree/ptree.hpp>
#include <boost/variant.hpp>
@@ -811,6 +812,11 @@ public:
Poll::Ptr stopPoll(std::int64_t chatId, std::int64_t messageId, InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>()) const;
+
+ bool setMyCommands(const std::vector<BotCommand::Ptr>& commands) const;
+
+ std::vector<BotCommand::Ptr> getMyCommands() const;
+
private:
boost::property_tree::ptree sendRequest(const std::string& method, const std::vector<HttpReqArg>& args = std::vector<HttpReqArg>()) const;
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index b080bc4..d8e2282 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -74,6 +74,7 @@
#include "tgbot/types/ShippingOption.h"
#include "tgbot/types/SuccessfulPayment.h"
#include "tgbot/types/LabeledPrice.h"
+#include "tgbot/types/BotCommand.h"
#include "tgbot/types/InputMedia.h"
#include "tgbot/types/InputMediaPhoto.h"
#include "tgbot/types/InputMediaVideo.h"
@@ -302,6 +303,9 @@ public:
LabeledPrice::Ptr parseJsonAndGetLabeledPrice(const boost::property_tree::ptree& data) const;
std::string parseLabeledPrice(const LabeledPrice::Ptr& object) const;
+ BotCommand::Ptr parseJsonAndGetBotCommand(const boost::property_tree::ptree& data) const;
+ std::string parseBotCommand(const BotCommand::Ptr& object) const;
+
OrderInfo::Ptr parseJsonAndGetOrderInfo(const boost::property_tree::ptree& data) const;
std::string parseOrderInfo(const OrderInfo::Ptr& object) const;
diff --git a/include/tgbot/tgbot.h b/include/tgbot/tgbot.h
index 8ebf51d..0868aa0 100644
--- a/include/tgbot/tgbot.h
+++ b/include/tgbot/tgbot.h
@@ -96,6 +96,8 @@
#include "tgbot/types/VideoNote.h"
#include "tgbot/types/Voice.h"
#include "tgbot/types/WebhookInfo.h"
+#include "tgbot/types/BotCommand.h"
+
/**
* @defgroup general
diff --git a/include/tgbot/types/BotCommand.h b/include/tgbot/types/BotCommand.h
new file mode 100644
index 0000000..5ad057b
--- /dev/null
+++ b/include/tgbot/types/BotCommand.h
@@ -0,0 +1,36 @@
+#ifndef TGBOT_BOTCOMMAND_H
+#define TGBOT_BOTCOMMAND_H
+
+#include <cstdint>
+#include <string>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a bot command.
+ *
+ * https://core.telegram.org/bots/api#botcommand
+ * @ingroup types
+ */
+class BotCommand {
+public:
+ typedef std::shared_ptr<BotCommand> Ptr;
+ BotCommand() { }
+
+ virtual ~BotCommand() { }
+
+ /**
+ * @brief command label.
+ */
+ std::string command;
+
+ /**
+ * @brief description label.
+ */
+ std::string description;
+
+};
+}
+
+#endif //TGBOT_BOTCOMMAND_H