Improve getStarWithdrawalUrl.
This commit is contained in:
parent
9288aa5f16
commit
ebe83764eb
@ -10705,11 +10705,11 @@ getChatRevenueWithdrawalUrl chat_id:int53 password:string = HttpUrl;
|
||||
getChatRevenueTransactions chat_id:int53 offset:int32 limit:int32 = ChatRevenueTransactions;
|
||||
|
||||
|
||||
//@description Returns URL for Telegram star withdrawal from a bot or a chat; requires owner privileges for the bot or in the chat
|
||||
//@chat_id Chat identifier
|
||||
//@description Returns URL for Telegram star withdrawal
|
||||
//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true
|
||||
//@star_count The number of Telegram stars to withdraw
|
||||
//@password The 2-step verification password of the current user
|
||||
getStarWithdrawalUrl chat_id:int53 star_count:int53 password:string = HttpUrl;
|
||||
getStarWithdrawalUrl owner_id:MessageSender star_count:int53 password:string = HttpUrl;
|
||||
|
||||
|
||||
//@description Returns detailed statistics about a chat. Currently, this method can be used only for supergroups and channels. Can be used only if supergroupFullInfo.can_get_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application
|
||||
|
@ -286,10 +286,9 @@ void StarManager::refund_star_payment(UserId user_id, const string &telegram_pay
|
||||
->send(std::move(input_user), telegram_payment_charge_id);
|
||||
}
|
||||
|
||||
void StarManager::get_star_withdrawal_url(DialogId dialog_id, int64 star_count, const string &password,
|
||||
Promise<string> &&promise) {
|
||||
TRY_STATUS_PROMISE(promise, td_->dialog_manager_->check_dialog_access(dialog_id, false, AccessRights::Write,
|
||||
"get_star_withdrawal_url"));
|
||||
void StarManager::get_star_withdrawal_url(const td_api::object_ptr<td_api::MessageSender> &owner_id, int64 star_count,
|
||||
const string &password, Promise<string> &&promise) {
|
||||
TRY_RESULT_PROMISE(promise, dialog_id, get_message_sender_dialog_id(td_, owner_id, true, false));
|
||||
TRY_STATUS_PROMISE(promise, can_manage_stars(dialog_id));
|
||||
if (password.empty()) {
|
||||
return promise.set_error(Status::Error(400, "PASSWORD_HASH_INVALID"));
|
||||
|
@ -32,7 +32,8 @@ class StarManager final : public Actor {
|
||||
|
||||
void refund_star_payment(UserId user_id, const string &telegram_payment_charge_id, Promise<Unit> &&promise);
|
||||
|
||||
void get_star_withdrawal_url(DialogId dialog_id, int64 star_count, const string &password, Promise<string> &&promise);
|
||||
void get_star_withdrawal_url(const td_api::object_ptr<td_api::MessageSender> &owner_id, int64 star_count,
|
||||
const string &password, Promise<string> &&promise);
|
||||
|
||||
private:
|
||||
void tear_down() final;
|
||||
|
@ -8744,7 +8744,7 @@ void Td::on_request(uint64 id, const td_api::getStarWithdrawalUrl &request) {
|
||||
promise.set_value(td_api::make_object<td_api::httpUrl>(result.move_as_ok()));
|
||||
}
|
||||
});
|
||||
star_manager_->get_star_withdrawal_url(DialogId(request.chat_id_), request.star_count_, request.password_,
|
||||
star_manager_->get_star_withdrawal_url(request.owner_id_, request.star_count_, request.password_,
|
||||
std::move(query_promise));
|
||||
}
|
||||
|
||||
|
@ -6781,11 +6781,12 @@ class CliClient final : public Actor {
|
||||
get_args(args, chat_id, offset, limit);
|
||||
send_request(td_api::make_object<td_api::getChatRevenueTransactions>(chat_id, offset, as_limit(limit)));
|
||||
} else if (op == "gswu") {
|
||||
ChatId chat_id;
|
||||
string owner_id;
|
||||
int32 star_count;
|
||||
string password;
|
||||
get_args(args, chat_id, star_count, password);
|
||||
send_request(td_api::make_object<td_api::getStarWithdrawalUrl>(chat_id, star_count, password));
|
||||
get_args(args, owner_id, star_count, password);
|
||||
send_request(
|
||||
td_api::make_object<td_api::getStarWithdrawalUrl>(as_message_sender(owner_id), star_count, password));
|
||||
} else {
|
||||
op_not_found_count++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user