Add td_api::telegramPaymentPurposeJoinChat.
This commit is contained in:
parent
d20a3f1552
commit
83be2c698c
@ -5715,6 +5715,9 @@ telegramPaymentPurposeStars currency:string amount:int53 star_count:int53 = Tele
|
||||
//@star_count Number of bought Telegram Stars
|
||||
telegramPaymentPurposeGiftedStars user_id:int53 currency:string amount:int53 star_count:int53 = TelegramPaymentPurpose;
|
||||
|
||||
//@description The user joins a chat and subscribes to regular Payments in Telegram Stars @invite_link Invite link to use
|
||||
telegramPaymentPurposeJoinChat invite_link:string = TelegramPaymentPurpose;
|
||||
|
||||
|
||||
//@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method.
|
||||
//-To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org
|
||||
|
@ -8,10 +8,12 @@
|
||||
|
||||
#include "td/telegram/AccessRights.h"
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/DialogInviteLink.h"
|
||||
#include "td/telegram/DialogManager.h"
|
||||
#include "td/telegram/GiveawayParameters.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/InputInvoice.h"
|
||||
#include "td/telegram/LinkManager.h"
|
||||
#include "td/telegram/MessageEntity.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/MessagesManager.h"
|
||||
@ -151,6 +153,18 @@ Result<InputInvoiceInfo> get_input_invoice_info(Td *td, td_api::object_ptr<td_ap
|
||||
result.input_invoice_ = telegram_api::make_object<telegram_api::inputInvoiceStars>(std::move(purpose));
|
||||
break;
|
||||
}
|
||||
case td_api::telegramPaymentPurposeJoinChat::ID: {
|
||||
auto p = static_cast<td_api::telegramPaymentPurposeJoinChat *>(invoice->purpose_.get());
|
||||
if (!DialogInviteLink::is_valid_invite_link(p->invite_link_)) {
|
||||
return Status::Error(400, "Invalid invite link");
|
||||
}
|
||||
auto hash = LinkManager::get_dialog_invite_link_hash(p->invite_link_);
|
||||
if (!clean_input_string(hash)) {
|
||||
return Status::Error(400, "Invalid invite link");
|
||||
}
|
||||
result.input_invoice_ = telegram_api::make_object<telegram_api::inputInvoiceChatInviteSubscription>(hash);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -1015,12 +1015,16 @@ class CliClient final : public Actor {
|
||||
int64 chat_id = 0;
|
||||
int64 message_id = 0;
|
||||
string invoice_name;
|
||||
string invite_link;
|
||||
|
||||
operator td_api::object_ptr<td_api::InputInvoice>() const {
|
||||
if (invoice_name.empty()) {
|
||||
return td_api::make_object<td_api::inputInvoiceMessage>(chat_id, message_id);
|
||||
} else {
|
||||
if (!invite_link.empty()) {
|
||||
return td_api::make_object<td_api::inputInvoiceTelegram>(
|
||||
td_api::make_object<td_api::telegramPaymentPurposeJoinChat>(invite_link));
|
||||
} else if (!invoice_name.empty()) {
|
||||
return td_api::make_object<td_api::inputInvoiceName>(invoice_name);
|
||||
} else {
|
||||
return td_api::make_object<td_api::inputInvoiceMessage>(chat_id, message_id);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1028,6 +1032,8 @@ class CliClient final : public Actor {
|
||||
void get_args(string &args, InputInvoice &arg) const {
|
||||
if (args.size() > 1 && (args[0] == '#' || args[0] == '$')) {
|
||||
arg.invoice_name = args.substr(1);
|
||||
} else if (args[0] == '+' || begins_with(args, "https://t.me/+")) {
|
||||
arg.invite_link = args;
|
||||
} else {
|
||||
string chat_id;
|
||||
string message_id;
|
||||
|
Loading…
Reference in New Issue
Block a user