Allow messagePremiumGiftCode.creator_id == null.

This commit is contained in:
levlam 2023-12-22 12:51:58 +03:00
parent d60bb8da91
commit 5b8fff9643
2 changed files with 9 additions and 6 deletions

View File

@ -2882,7 +2882,7 @@ messagePaymentSuccessfulBot currency:string total_amount:int53 is_recurring:Bool
messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent;
//@description A Telegram Premium gift code was created for the user
//@creator_id Identifier of a chat or a user that created the gift code
//@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown
//@is_from_giveaway True, if the gift code was created for a giveaway
//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen
//@month_count Number of month the Telegram Premium subscription will be active after code activation

View File

@ -6392,9 +6392,9 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
LOG(ERROR) << "Receive invalid " << oneline(to_string(action));
break;
}
}
if (dialog_id.get_type() != DialogType::User) {
td->messages_manager_->force_create_dialog(dialog_id, "messageActionGiftCode", true);
if (dialog_id.get_type() != DialogType::User) {
td->messages_manager_->force_create_dialog(dialog_id, "messageActionGiftCode", true);
}
}
return td::make_unique<MessageGiftCode>(dialog_id, action->months_, action->via_giveaway_, action->unclaimed_,
std::move(action->slug_));
@ -6781,8 +6781,11 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
case MessageContentType::GiftCode: {
const auto *m = static_cast<const MessageGiftCode *>(content);
return td_api::make_object<td_api::messagePremiumGiftCode>(
get_message_sender_object(td, m->creator_dialog_id, "messagePremiumGiftCode"), m->via_giveaway,
m->is_unclaimed, m->months, td->stickers_manager_->get_premium_gift_sticker_object(m->months), m->code);
m->creator_dialog_id.is_valid()
? get_message_sender_object(td, m->creator_dialog_id, "messagePremiumGiftCode")
: nullptr,
m->via_giveaway, m->is_unclaimed, m->months,
td->stickers_manager_->get_premium_gift_sticker_object(m->months), m->code);
}
case MessageContentType::Giveaway: {
const auto *m = static_cast<const MessageGiveaway *>(content);