diff options
author | Oleg Morozenkov <omorozenkov@gmail.com> | 2016-04-13 16:56:37 +0300 |
---|---|---|
committer | Oleg Morozenkov <omorozenkov@gmail.com> | 2016-04-13 16:56:37 +0300 |
commit | 5d73c438a57b5d0c0846972febc13c1710461185 (patch) | |
tree | dc6d6365cbb287cfdd572206391db6f41c48ea2e | |
parent | b2e4048cf9ce6d4dc4969a52cffc2ad36ec19f21 (diff) | |
parent | 842710df60e16f4f320353af9f4862b8a1153a91 (diff) |
Merge pull request #20 from xdqi/master
Add parseMode parameter to sendMessage
-rw-r--r-- | include/tgbot/Api.h | 3 | ||||
-rw-r--r-- | src/Api.cpp | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index 66f41b5..17d0493 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -65,9 +65,10 @@ public: * @param disableWebPagePreview Optional. Disables link previews for links in this message. * @param replyToMessageId Optional. If the message is a reply, ID of the original message. * @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. + * @param parseMode Optional. Set it to "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. * @return On success, the sent message is returned. */ - Message::Ptr sendMessage(int64_t chatId, const std::string& text, bool disableWebPagePreview = false, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const; + Message::Ptr sendMessage(int64_t chatId, const std::string& text, bool disableWebPagePreview = false, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), const std::string& parseMode = "") const; /** * Use this method to forward messages of any kind. diff --git a/src/Api.cpp b/src/Api.cpp index ed06d27..6419780 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -38,7 +38,7 @@ User::Ptr Api::getMe() const { return TgTypeParser::getInstance().parseJsonAndGetUser(sendRequest("getMe")); } -Message::Ptr Api::sendMessage(int64_t chatId, const string& text, bool disableWebPagePreview, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup) const { +Message::Ptr Api::sendMessage(int64_t chatId, const string& text, bool disableWebPagePreview, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, const string& parseMode) const { vector<HttpReqArg> args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("text", text)); @@ -51,6 +51,9 @@ Message::Ptr Api::sendMessage(int64_t chatId, const string& text, bool disableWe if (replyMarkup) { args.push_back(HttpReqArg("reply_markup", TgTypeParser::getInstance().parseGenericReply(replyMarkup))); } + if (!parseMode.empty()) { + args.push_back(HttpReqArg("parse_mode", parseMode)); + } return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendMessage", args)); } |