diff options
Diffstat (limited to 'src/Api.cpp')
-rw-r--r-- | src/Api.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Api.cpp b/src/Api.cpp index 202fb73..f238a70 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -6,7 +6,7 @@ namespace TgBot { Api::Api(std::string token, const HttpClient& httpClient, const std::string& url) - : _token(std::move(token)), _httpClient(httpClient), _tgTypeParser(), _url(url) { + : _httpClient(httpClient), _token(std::move(token)), _tgTypeParser(), _url(url) { } std::vector<Update::Ptr> Api::getUpdates(std::int32_t offset, @@ -1144,13 +1144,17 @@ bool Api::unbanChatMember(boost::variant<std::int64_t, std::string> chatId, bool Api::restrictChatMember(boost::variant<std::int64_t, std::string> chatId, std::int64_t userId, TgBot::ChatPermissions::Ptr permissions, - std::int64_t untilDate) const { + std::int64_t untilDate, + bool useIndependentChatPermissions) const { std::vector<HttpReqArg> args; - args.reserve(4); + args.reserve(5); args.emplace_back("chat_id", chatId); args.emplace_back("user_id", userId); args.emplace_back("permissions", _tgTypeParser.parseChatPermissions(permissions)); + if (useIndependentChatPermissions) { + args.emplace_back("use_independent_chat_permissions", useIndependentChatPermissions); + } if (untilDate) { args.emplace_back("until_date", untilDate); } @@ -1253,12 +1257,16 @@ bool Api::unbanChatSenderChat(boost::variant<std::int64_t, std::string> chatId, } bool Api::setChatPermissions(boost::variant<std::int64_t, std::string> chatId, - ChatPermissions::Ptr permissions) const { + ChatPermissions::Ptr permissions, + bool useIndependentChatPermissions) const { std::vector<HttpReqArg> args; - args.reserve(2); + args.reserve(3); args.emplace_back("chat_id", chatId); args.emplace_back("permissions", _tgTypeParser.parseChatPermissions(permissions)); + if (useIndependentChatPermissions) { + args.emplace_back("use_independent_chat_permissions", useIndependentChatPermissions); + } return sendRequest("setChatPermissions", args).get<bool>("", false); } |