diff options
-rw-r--r-- | include/tgbot/TgTypeParser.h | 3 | ||||
-rw-r--r-- | include/tgbot/tgbot.h | 2 | ||||
-rw-r--r-- | include/tgbot/types/InlineQueryResult.h | 6 | ||||
-rw-r--r-- | include/tgbot/types/ReplyKeyboardHide.h | 55 | ||||
-rw-r--r-- | src/TgTypeParser.cpp | 27 |
5 files changed, 8 insertions, 85 deletions
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index 66e2c41..48f7338 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -44,7 +44,6 @@ #include "tgbot/types/ReplyKeyboardMarkup.h" #include "tgbot/types/KeyboardButton.h" #include "tgbot/types/ReplyKeyboardRemove.h" -#include "tgbot/types/ReplyKeyboardHide.h" #include "tgbot/types/ForceReply.h" #include "tgbot/types/ChatMember.h" #include "tgbot/types/ResponseParameters.h" @@ -133,8 +132,6 @@ public: ReplyKeyboardRemove::Ptr parseJsonAndGetReplyKeyboardRemove(const boost::property_tree::ptree& data) const; std::string parseReplyKeyboardRemove(const ReplyKeyboardRemove::Ptr& object) const; - ReplyKeyboardHide::Ptr parseJsonAndGetReplyKeyboardHide(const boost::property_tree::ptree& data) const; - std::string parseReplyKeyboardHide(const ReplyKeyboardHide::Ptr& object) const; ForceReply::Ptr parseJsonAndGetForceReply(const boost::property_tree::ptree& data) const; std::string parseForceReply(const ForceReply::Ptr& object) const; diff --git a/include/tgbot/tgbot.h b/include/tgbot/tgbot.h index 34dc0a9..36b7dab 100644 --- a/include/tgbot/tgbot.h +++ b/include/tgbot/tgbot.h @@ -38,7 +38,7 @@ #include "tgbot/types/Location.h" #include "tgbot/types/Message.h" #include "tgbot/types/PhotoSize.h" -#include "tgbot/types/ReplyKeyboardHide.h" +#include "tgbot/types/ReplyKeyboardRemove.h" #include "tgbot/types/ReplyKeyboardMarkup.h" #include "tgbot/types/Sticker.h" #include "tgbot/types/Update.h" diff --git a/include/tgbot/types/InlineQueryResult.h b/include/tgbot/types/InlineQueryResult.h index 29e6f7a..d06bffd 100644 --- a/include/tgbot/types/InlineQueryResult.h +++ b/include/tgbot/types/InlineQueryResult.h @@ -38,12 +38,12 @@ public: std::string id; /** - * Optional. Title of the result. + * Requred, optional or missing. See description of derived classes. Title of the result. */ std::string title; /** - * Optional. Caption of the file to be sent, 0-200 characters + * Optional or missing. See description of derived classes. Caption of the file to be sent, 0-200 characters */ std::string caption; @@ -53,7 +53,7 @@ public: InlineKeyboardMarkup::Ptr replyMarkup; /** - * Content of the message to be sent + * Requred, optional or missing. See description of derived classes. Content of the message to be sent */ InputMessageContent::Ptr inputMessageContent; }; diff --git a/include/tgbot/types/ReplyKeyboardHide.h b/include/tgbot/types/ReplyKeyboardHide.h deleted file mode 100644 index acb0e5c..0000000 --- a/include/tgbot/types/ReplyKeyboardHide.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2015 Oleg Morozenkov - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef TGBOT_CPP_REPLYKEYBOARDHIDE_H -#define TGBOT_CPP_REPLYKEYBOARDHIDE_H - -#include <memory> - -#include "tgbot/types/GenericReply.h" - -namespace TgBot { - -/** - * Upon receiving a message with this object, Telegram clients will hide the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). - * @ingroup types - */ -class ReplyKeyboardHide : public GenericReply { - -public: - typedef std::shared_ptr<ReplyKeyboardHide> Ptr; - - /** - * Requests clients to hide the custom keyboard. - */ - const bool hideKeyboard = true; - - /** - * Optional. Use this parameter if you want to hide keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. - * Example: A user votes in a poll, bot returns confirmation message in reply to the vote and hides keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. - */ - bool selective = false; -}; - -} - -#endif //TGBOT_CPP_REPLYKEYBOARDHIDE_H diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp index 939d339..6b0914b 100644 --- a/src/TgTypeParser.cpp +++ b/src/TgTypeParser.cpp @@ -517,25 +517,6 @@ std::string TgTypeParser::parseReplyKeyboardRemove(const ReplyKeyboardRemove::Pt return result; } -ReplyKeyboardHide::Ptr TgTypeParser::parseJsonAndGetReplyKeyboardHide(const boost::property_tree::ptree& data) const { - ReplyKeyboardHide::Ptr result(new ReplyKeyboardHide); - result->selective = data.get<bool>("selective"); - return result; -} - -std::string TgTypeParser::parseReplyKeyboardHide(const ReplyKeyboardHide::Ptr& object) const { - if (!object) { - return ""; - } - string result; - result += '{'; - appendToJson(result, "hide_keyboard", object->hideKeyboard); - appendToJson(result, "selective", object->selective); - result.erase(result.length() - 1); - result += '}'; - return result; -} - ForceReply::Ptr TgTypeParser::parseJsonAndGetForceReply(const boost::property_tree::ptree& data) const { ForceReply::Ptr result(new ForceReply); result->selective = data.get<bool>("selective"); @@ -598,8 +579,8 @@ std::string TgTypeParser::parseResponseParameters(const ResponseParameters::Ptr& GenericReply::Ptr TgTypeParser::parseJsonAndGetGenericReply(const boost::property_tree::ptree& data) const { if (data.find("force_reply") != data.not_found()) { return static_pointer_cast<GenericReply>(parseJsonAndGetForceReply(data)); - } else if (data.find("hide_keyboard") != data.not_found()) { - return static_pointer_cast<GenericReply>(parseJsonAndGetReplyKeyboardHide(data)); + } else if (data.find("remove_keyboard") != data.not_found()) { + return static_pointer_cast<GenericReply>(parseJsonAndGetReplyKeyboardRemove(data)); } else if (data.find("keyboard") != data.not_found()) { return static_pointer_cast<GenericReply>(parseJsonAndGetReplyKeyboardMarkup(data)); } else if (data.find("inline_keyboard") != data.not_found()) { @@ -613,8 +594,8 @@ std::string TgTypeParser::parseGenericReply(const GenericReply::Ptr& object) con } if (dynamic_pointer_cast<ForceReply>(object) != nullptr) { return parseForceReply(static_pointer_cast<ForceReply>(object)); - } else if (dynamic_pointer_cast<ReplyKeyboardHide>(object) != nullptr) { - return parseReplyKeyboardHide(static_pointer_cast<ReplyKeyboardHide>(object)); + } else if (dynamic_pointer_cast<ReplyKeyboardRemove>(object) != nullptr) { + return parseReplyKeyboardRemove(static_pointer_cast<ReplyKeyboardRemove>(object)); } else if (dynamic_pointer_cast<ReplyKeyboardMarkup>(object) != nullptr){ return parseReplyKeyboardMarkup(static_pointer_cast<ReplyKeyboardMarkup>(object)); } else if (dynamic_pointer_cast<InlineKeyboardMarkup>(object) != nullptr){ |