Add sticker to messagePremiumGiftCode.

This commit is contained in:
levlam 2023-10-13 16:06:55 +03:00
parent a6f0260cf2
commit cae7ba79ed
2 changed files with 16 additions and 3 deletions

View File

@ -2301,7 +2301,7 @@ messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia;
//@description Describes parameters of a Telegram Premium giveaway
//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription
//@additional_chat_ids Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats
//@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be from 1 minute to 365 days in the future in scheduled giveaways
//@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be from 1 minute to 7 days in the future in scheduled giveaways
//@only_new_subscribers True, if only new subscribers of the chats will be eligible for the giveaway
//@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, only users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries
premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector<int53> winners_selection_date:int32 only_new_subscribers:Bool country_codes:vector<string> = PremiumGiveawayParameters;
@ -2807,8 +2807,9 @@ messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocur
//@creator_id Identifier of a chat or a user that created the gift code
//@is_from_giveaway True, if the gift code was created for a giveaway
//@month_count Number of month the Telegram Premium subscription will be active after code activation
//@sticker A sticker to be shown in the message; may be null if unknown
//@code The gift code
messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool month_count:int32 code:string = MessageContent;
messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool month_count:int32 sticker:sticker code:string = MessageContent;
//@description A Telegram Premium giveaway was created
//@parameters Giveaway parameters

View File

@ -4536,6 +4536,9 @@ void register_message_content(Td *td, const MessageContent *content, MessageFull
case MessageContentType::GiftPremium:
return td->stickers_manager_->register_premium_gift(static_cast<const MessageGiftPremium *>(content)->months,
message_full_id, source);
case MessageContentType::GiftCode:
return td->stickers_manager_->register_premium_gift(static_cast<const MessageGiftCode *>(content)->months,
message_full_id, source);
case MessageContentType::SuggestProfilePhoto:
return td->contacts_manager_->register_suggested_profile_photo(
static_cast<const MessageSuggestProfilePhoto *>(content)->photo);
@ -4595,6 +4598,12 @@ void reregister_message_content(Td *td, const MessageContent *old_content, const
return;
}
break;
case MessageContentType::GiftCode:
if (static_cast<const MessageGiftCode *>(old_content)->months ==
static_cast<const MessageGiftCode *>(new_content)->months) {
return;
}
break;
case MessageContentType::Story:
if (static_cast<const MessageStory *>(old_content)->story_full_id ==
static_cast<const MessageStory *>(new_content)->story_full_id) {
@ -4638,6 +4647,9 @@ void unregister_message_content(Td *td, const MessageContent *content, MessageFu
case MessageContentType::GiftPremium:
return td->stickers_manager_->unregister_premium_gift(static_cast<const MessageGiftPremium *>(content)->months,
message_full_id, source);
case MessageContentType::GiftCode:
return td->stickers_manager_->unregister_premium_gift(static_cast<const MessageGiftCode *>(content)->months,
message_full_id, source);
case MessageContentType::Story:
return td->story_manager_->unregister_story(static_cast<const MessageStory *>(content)->story_full_id,
message_full_id, source);
@ -6277,7 +6289,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
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->months,
m->code);
td->stickers_manager_->get_premium_gift_sticker_object(m->months), m->code);
}
case MessageContentType::Giveaway: {
const auto *m = static_cast<const MessageGiveaway *>(content);