From e1651b15f37f194436fd4c8a30b9a6d5c9775232 Mon Sep 17 00:00:00 2001 From: llnulldisk <48621230+llnulldisk@users.noreply.github.com> Date: Tue, 30 Aug 2022 20:06:06 +0200 Subject: Update to API 4.8 --- src/Api.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index def9243..24ae56f 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -533,10 +533,11 @@ Message::Ptr Api::sendContact(std::int64_t chatId, const string& phoneNumber, co Message::Ptr Api::sendPoll(std::int64_t chatId, const std::string& question, const std::vector& options, bool isAnonymous, const std::string& type, bool allowsMultipleAnswers, - std::int32_t correctOptionId, bool isClosed, bool disableNotification, - std::int32_t replyToMessageId, GenericReply::Ptr replyMarkup) const { + std::int32_t correctOptionId, const std::string& explanation, const std::string& explanationParseMode, + std::int32_t openPeriod, std::int64_t closeDate, bool isClosed, + bool disableNotification, std::int32_t replyToMessageId, GenericReply::Ptr replyMarkup) const { vector args; - args.reserve(11); + args.reserve(15); args.emplace_back("chat_id", chatId); args.emplace_back("question", question); @@ -555,6 +556,18 @@ Message::Ptr Api::sendPoll(std::int64_t chatId, const std::string& question, con if (correctOptionId != 0) { args.emplace_back("correct_option_id", correctOptionId); } + if (!explanation.empty()) { + args.emplace_back("explanation", explanation); + } + if (!explanationParseMode.empty()) { + args.emplace_back("explanation_parse_mode", explanationParseMode); + } + if (openPeriod != 0) { + args.emplace_back("open_period", openPeriod); + } + if (closeDate != 0) { + args.emplace_back("close_date", closeDate); + } if (isClosed) { args.emplace_back("is_closed", isClosed); } @@ -574,18 +587,21 @@ Message::Ptr Api::sendPoll(std::int64_t chatId, const std::string& question, con Message::Ptr Api::sendPoll(std::int64_t chatId, const std::string& question, const std::vector& options, bool disableNotification, std::int32_t replyToMessageId, GenericReply::Ptr replyMarkup) const { - return sendPoll(chatId, question, options, true, "", false, 0, false, disableNotification, replyToMessageId, replyMarkup); + return sendPoll(chatId, question, options, true, "", false, 0, "", "", 0, 0, false, false, 0); } -Message::Ptr Api::sendDice(std::int64_t chatId, bool disableNotification, std::int32_t replyToMessageId, - GenericReply::Ptr replyMarkup) const { +Message::Ptr Api::sendDice(std::int64_t chatId, const std::string& emoji, bool disableNotification, + std::int32_t replyToMessageId, GenericReply::Ptr replyMarkup) const { vector args; - args.reserve(4); + args.reserve(5); args.emplace_back("chat_id", chatId); if (disableNotification) { args.emplace_back("disable_notification", disableNotification); } + if (!emoji.empty()) { + args.emplace_back("emoji", emoji); + } if (replyToMessageId != 0) { args.emplace_back("reply_to_message_id", replyToMessageId); } -- cgit v1.2.3