Add editChatInviteLink method.

This commit is contained in:
levlam 2021-02-25 22:25:33 +03:00
parent 1db5521027
commit c8bc4c9d3a
2 changed files with 17 additions and 0 deletions

View File

@ -213,6 +213,7 @@ bool Client::init_methods() {
methods_.emplace("answerprecheckoutquery", &Client::process_answer_pre_checkout_query_query); methods_.emplace("answerprecheckoutquery", &Client::process_answer_pre_checkout_query_query);
methods_.emplace("exportchatinvitelink", &Client::process_export_chat_invite_link_query); methods_.emplace("exportchatinvitelink", &Client::process_export_chat_invite_link_query);
methods_.emplace("createchatinvitelink", &Client::process_create_chat_invite_link_query); methods_.emplace("createchatinvitelink", &Client::process_create_chat_invite_link_query);
methods_.emplace("editchatinvitelink", &Client::process_edit_chat_invite_link_query);
methods_.emplace("getchat", &Client::process_get_chat_query); methods_.emplace("getchat", &Client::process_get_chat_query);
methods_.emplace("setchatphoto", &Client::process_set_chat_photo_query); methods_.emplace("setchatphoto", &Client::process_set_chat_photo_query);
methods_.emplace("deletechatphoto", &Client::process_delete_chat_photo_query); methods_.emplace("deletechatphoto", &Client::process_delete_chat_photo_query);
@ -6828,6 +6829,21 @@ td::Status Client::process_create_chat_invite_link_query(PromisedQueryPtr &query
return Status::OK(); return Status::OK();
} }
td::Status Client::process_edit_chat_invite_link_query(PromisedQueryPtr &query) {
auto chat_id = query->arg("chat_id");
auto invite_link = query->arg("invite_link");
auto expire_date = get_integer_arg(query.get(), "expire_date", 0, 0);
auto member_limit = get_integer_arg(query.get(), "member_limit", 0, 0, 100000);
check_chat(
chat_id, AccessRights::Write, std::move(query),
[this, invite_link = invite_link.str(), expire_date, member_limit](int64 chat_id, PromisedQueryPtr query) {
send_request(make_object<td_api::editChatInviteLink>(chat_id, invite_link, expire_date, member_limit),
std::make_unique<TdOnGetChatInviteLinkCallback>(this, std::move(query)));
});
return Status::OK();
}
td::Status Client::process_get_chat_query(PromisedQueryPtr &query) { td::Status Client::process_get_chat_query(PromisedQueryPtr &query) {
auto chat_id = query->arg("chat_id"); auto chat_id = query->arg("chat_id");

View File

@ -446,6 +446,7 @@ class Client : public WebhookActor::Callback {
Status process_answer_pre_checkout_query_query(PromisedQueryPtr &query); Status process_answer_pre_checkout_query_query(PromisedQueryPtr &query);
Status process_export_chat_invite_link_query(PromisedQueryPtr &query); Status process_export_chat_invite_link_query(PromisedQueryPtr &query);
Status process_create_chat_invite_link_query(PromisedQueryPtr &query); Status process_create_chat_invite_link_query(PromisedQueryPtr &query);
Status process_edit_chat_invite_link_query(PromisedQueryPtr &query);
Status process_get_chat_query(PromisedQueryPtr &query); Status process_get_chat_query(PromisedQueryPtr &query);
Status process_set_chat_photo_query(PromisedQueryPtr &query); Status process_set_chat_photo_query(PromisedQueryPtr &query);
Status process_delete_chat_photo_query(PromisedQueryPtr &query); Status process_delete_chat_photo_query(PromisedQueryPtr &query);