Add messageGiftedPremium.gifter_user_id.

This commit is contained in:
levlam 2023-04-03 21:20:41 +03:00
parent e4717bae0e
commit 2e5bab9c48
2 changed files with 11 additions and 2 deletions

View File

@ -2600,13 +2600,14 @@ messagePaymentSuccessful invoice_chat_id:int53 invoice_message_id:int53 currency
messagePaymentSuccessfulBot currency:string total_amount:int53 is_recurring:Bool is_first_recurring:Bool invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent;
//@description Telegram Premium was gifted to the user
//@gifter_user_id The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous
//@currency Currency for the paid amount
//@amount The paid amount, in the smallest units of the currency
//@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none
//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency
//@month_count Number of month the Telegram Premium subscription will be active
//@sticker A sticker to be shown in the message; may be null if unknown
messageGiftedPremium currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent;
messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent;
//@description A contact has registered with Telegram
messageContactRegistered = MessageContent;

View File

@ -5736,8 +5736,16 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
}
case MessageContentType::GiftPremium: {
const auto *m = static_cast<const MessageGiftPremium *>(content);
int64 gifter_user_id = 0;
if (dialog_id.get_type() == DialogType::User) {
auto user_id = dialog_id.get_user_id();
if (user_id != ContactsManager::get_service_notifications_user_id() &&
!td->contacts_manager_->is_user_bot(user_id) && !td->contacts_manager_->is_user_support(user_id)) {
gifter_user_id = td->contacts_manager_->get_user_id_object(user_id, "MessageGiftPremium");
}
}
return make_tl_object<td_api::messageGiftedPremium>(
m->currency, m->amount, m->crypto_currency, m->crypto_amount, m->months,
gifter_user_id, m->currency, m->amount, m->crypto_currency, m->crypto_amount, m->months,
td->stickers_manager_->get_premium_gift_sticker_object(m->months));
}
case MessageContentType::TopicCreate: {