Add method createChatSubscriptionInviteLink.

This commit is contained in:
levlam 2024-08-14 00:26:20 +03:00
parent 6478c25096
commit 76e5ed31c0
2 changed files with 18 additions and 0 deletions

View File

@ -258,6 +258,7 @@ bool Client::init_methods() {
methods_.emplace("answerprecheckoutquery", &Client::process_answer_pre_checkout_query_query);
methods_.emplace("exportchatinvitelink", &Client::process_export_chat_invite_link_query);
methods_.emplace("createchatinvitelink", &Client::process_create_chat_invite_link_query);
methods_.emplace("createchatsubscriptioninvitelink", &Client::process_create_chat_subscription_invite_link_query);
methods_.emplace("editchatinvitelink", &Client::process_edit_chat_invite_link_query);
methods_.emplace("revokechatinvitelink", &Client::process_revoke_chat_invite_link_query);
methods_.emplace("getbusinessconnection", &Client::process_get_business_connection_query);
@ -11201,6 +11202,22 @@ td::Status Client::process_create_chat_invite_link_query(PromisedQueryPtr &query
return td::Status::OK();
}
td::Status Client::process_create_chat_subscription_invite_link_query(PromisedQueryPtr &query) {
auto chat_id = query->arg("chat_id");
auto name = query->arg("name");
auto subscription_period = get_integer_arg(query.get(), "subscription_period", 0, 0, 1000000000);
auto subscription_price = get_integer_arg(query.get(), "subscription_price", 0, 0, 1000000);
check_chat(chat_id, AccessRights::Write, std::move(query),
[this, name = name.str(), subscription_period, subscription_price](int64 chat_id, PromisedQueryPtr query) {
send_request(make_object<td_api::createChatSubscriptionInviteLink>(
chat_id, name,
make_object<td_api::starSubscriptionPricing>(subscription_period, subscription_price)),
td::make_unique<TdOnGetChatInviteLinkCallback>(this, std::move(query)));
});
return td::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");

View File

@ -683,6 +683,7 @@ class Client final : public WebhookActor::Callback {
td::Status process_answer_pre_checkout_query_query(PromisedQueryPtr &query);
td::Status process_export_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_create_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_create_chat_subscription_invite_link_query(PromisedQueryPtr &query);
td::Status process_edit_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_revoke_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_get_business_connection_query(PromisedQueryPtr &query);