diff options
author | Daniel Demidko <DanielDemidko@gmail.com> | 2021-07-11 02:19:17 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-11 02:19:17 +1000 |
commit | ff11276c9a3f58b7d1fbcbbae0892b438d193bb6 (patch) | |
tree | 2fb33dd85c237b824e29b08057f94feaeda89ebe /src/Api.cpp | |
parent | a0d31e277f0b62d24b5ee1777c07c7c942b92e1b (diff) |
Channels support
Diffstat (limited to 'src/Api.cpp')
-rw-r--r-- | src/Api.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Api.cpp b/src/Api.cpp index 9acf1bb..08b102a 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -45,6 +45,29 @@ Message::Ptr Api::sendMessage(std::int64_t chatId, const string& text, bool disa } return _tgTypeParser.parseJsonAndGetMessage(sendRequest("sendMessage", args)); } + +Message::Ptr Api::sendMessage(const std::string &chatId, const string& text, bool disableWebPagePreview, std::int32_t replyToMessageId, const GenericReply::Ptr replyMarkup, const string& parseMode, bool disableNotification) const { + vector<HttpReqArg> args; + args.reserve(7); + args.emplace_back("chat_id", chatId); + args.emplace_back("text", text); + if (disableWebPagePreview) { + args.emplace_back("disable_web_page_preview", disableWebPagePreview); + } + if (disableNotification){ + args.emplace_back("disable_notification", disableNotification); + } + if (replyToMessageId) { + args.emplace_back("reply_to_message_id", replyToMessageId); + } + if (replyMarkup) { + args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup)); + } + if (!parseMode.empty()) { + args.emplace_back("parse_mode", parseMode); + } + return _tgTypeParser.parseJsonAndGetMessage(sendRequest("sendMessage", args)); +} Message::Ptr Api::forwardMessage(std::int64_t chatId, std::int64_t fromChatId, std::int32_t messageId, bool disableNotification) const { vector<HttpReqArg> args; |