From 5d84d4cb291e5a93d512ddf51f24fa6964e6e4cd Mon Sep 17 00:00:00 2001 From: llnulldisk <48621230+llnulldisk@users.noreply.github.com> Date: Tue, 30 Aug 2022 21:58:26 +0200 Subject: Restore the order of parameters in sendMessage --- include/tgbot/Api.h | 23 ++++------------------- src/Api.cpp | 20 +++----------------- 2 files changed, 7 insertions(+), 36 deletions(-) diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index c2ba2e3..6a95139 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -104,30 +104,15 @@ public: * * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param text Text of the message to be sent - * @param parseMode Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. * @param disableWebPagePreview Optional. Disables link previews for links in this message - * @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound. * @param replyToMessageId Optional. If the message is a reply, ID of the original message * @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - * + * @param parseMode Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. + * @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound. + * * @return On success, the sent @ref Message is returned. */ - Message::Ptr sendMessage(boost::variant chatId, const std::string& text, const std::string& parseMode = "", - bool disableWebPagePreview = false, bool disableNotification = false, std::int32_t replyToMessageId = 0, - GenericReply::Ptr replyMarkup = std::make_shared()) const; - - /** - * @brief Deprecated. Use @ref Api::sendMessage - * @deprecated since Bot API 4.5. This remains unchanged for backward compatibility. - */ - Message::Ptr sendMessage(const std::string& chatId, const std::string& text, bool disableWebPagePreview = false, - std::int32_t replyToMessageId = 0, GenericReply::Ptr replyMarkup = std::make_shared(), const std::string& parseMode = "", - bool disableNotification = false) const; - /** - * @brief Deprecated. Use @ref Api::sendMessage - * @deprecated since Bot API 4.5. This remains unchanged for backward compatibility. - */ - Message::Ptr sendMessage(std::int64_t chatId, const std::string& text, bool disableWebPagePreview = false, + Message::Ptr sendMessage(boost::variant chatId, const std::string& text, bool disableWebPagePreview = false, std::int32_t replyToMessageId = 0, GenericReply::Ptr replyMarkup = std::make_shared(), const std::string& parseMode = "", bool disableNotification = false) const; diff --git a/src/Api.cpp b/src/Api.cpp index 24ae56f..9cb7f6e 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -84,9 +84,9 @@ User::Ptr Api::getMe() const { return _tgTypeParser.parseJsonAndGetUser(sendRequest("getMe")); } -Message::Ptr Api::sendMessage(boost::variant chatId, const std::string& text, const std::string& parseMode, - bool disableWebPagePreview, bool disableNotification, std::int32_t replyToMessageId, - GenericReply::Ptr replyMarkup) const { +Message::Ptr Api::sendMessage(boost::variant chatId, const std::string& text, bool disableWebPagePreview, + std::int32_t replyToMessageId, GenericReply::Ptr replyMarkup, const std::string& parseMode, + bool disableNotification) const { vector args; args.reserve(7); @@ -111,20 +111,6 @@ Message::Ptr Api::sendMessage(boost::variant c return _tgTypeParser.parseJsonAndGetMessage(sendRequest("sendMessage", args)); } -Message::Ptr Api::sendMessage(const std::string& chatId, const std::string& text, bool disableWebPagePreview, - std::int32_t replyToMessageId, GenericReply::Ptr replyMarkup, const std::string& parseMode, - bool disableNotification) const { - - return sendMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup); -} - -Message::Ptr Api::sendMessage(std::int64_t chatId, const std::string& text, bool disableWebPagePreview, - std::int32_t replyToMessageId, GenericReply::Ptr replyMarkup, const std::string& parseMode, - bool disableNotification) const { - - return sendMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup); -} - Message::Ptr Api::forwardMessage(std::int64_t chatId, std::int64_t fromChatId, std::int32_t messageId, bool disableNotification) const { vector args; args.reserve(4); -- cgit v1.2.3