diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 3e3bc4d55..9b8b5abda 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -2824,10 +2824,11 @@ messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocur //@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 //@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 //@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 sticker:sticker code:string = MessageContent; +messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool month_count:int32 sticker:sticker code:string = MessageContent; //@description A Telegram Premium giveaway was created for the chat messagePremiumGiveawayCreated = MessageContent; @@ -3497,7 +3498,7 @@ chatBoostSourceGiftCode user_id:int53 gift_code:string = ChatBoostSource; //@user_id Identifier of a user that won in the giveaway; 0 if none //@gift_code The created Telegram Premium gift code used by the user; or an empty string if none //@giveaway_message_id Identifier of the corresponding giveaway message; can be an identifier of a deleted message -//@is_unclaimed True, if the winner for the corresponding Premium subscription wasn't chosen +//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen chatBoostSourceGiveaway user_id:int53 gift_code:string giveaway_message_id:int53 is_unclaimed:Bool = ChatBoostSource; //@description A user with Telegram Premium subscription or gifted Telegram Premium boosted the chat diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 469a0fcd5..ca98d1a85 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -960,11 +960,16 @@ class MessageGiftCode final : public MessageContent { DialogId creator_dialog_id; int32 months = 0; bool via_giveaway = false; + bool is_unclaimed = false; string code; MessageGiftCode() = default; - MessageGiftCode(DialogId creator_dialog_id, int32 months, bool via_giveaway, string &&code) - : creator_dialog_id(creator_dialog_id), months(months), via_giveaway(via_giveaway), code(std::move(code)) { + MessageGiftCode(DialogId creator_dialog_id, int32 months, bool via_giveaway, bool is_unclaimed, string &&code) + : creator_dialog_id(creator_dialog_id) + , months(months) + , via_giveaway(via_giveaway || is_unclaimed) + , is_unclaimed(is_unclaimed) + , code(std::move(code)) { } MessageContentType get_type() const final { @@ -1419,6 +1424,7 @@ static void store(const MessageContent *content, StorerT &storer) { BEGIN_STORE_FLAGS(); STORE_FLAG(m->via_giveaway); STORE_FLAG(has_creator_dialog_id); + STORE_FLAG(m->is_unclaimed); END_STORE_FLAGS(); if (has_creator_dialog_id) { store(m->creator_dialog_id, storer); @@ -2006,6 +2012,7 @@ static void parse(unique_ptr &content, ParserT &parser) { BEGIN_PARSE_FLAGS(); PARSE_FLAG(m->via_giveaway); PARSE_FLAG(has_creator_dialog_id); + PARSE_FLAG(m->is_unclaimed); END_PARSE_FLAGS(); if (has_creator_dialog_id) { parse(m->creator_dialog_id, parser); @@ -4466,7 +4473,8 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo const auto *old_ = static_cast(old_content); const auto *new_ = static_cast(new_content); if (old_->creator_dialog_id != new_->creator_dialog_id || old_->months != new_->months || - old_->via_giveaway != new_->via_giveaway || old_->code != new_->code) { + old_->via_giveaway != new_->via_giveaway || old_->is_unclaimed != new_->is_unclaimed || + old_->code != new_->code) { need_update = true; } break; @@ -6089,7 +6097,7 @@ unique_ptr get_action_message_content(Td *td, tl_object_ptrmessages_manager_->force_create_dialog(dialog_id, "messageActionGiftCode", true); } - return td::make_unique(dialog_id, action->months_, action->via_giveaway_, + return td::make_unique(dialog_id, action->months_, action->via_giveaway_, action->unclaimed_, std::move(action->slug_)); } default: @@ -6451,8 +6459,8 @@ tl_object_ptr get_message_content_object(const MessageCo case MessageContentType::GiftCode: { const auto *m = static_cast(content); return td_api::make_object( - get_message_sender_object(td, m->creator_dialog_id, "messagePremiumGiftCode"), m->via_giveaway, m->months, - td->stickers_manager_->get_premium_gift_sticker_object(m->months), m->code); + 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); } case MessageContentType::Giveaway: { const auto *m = static_cast(content);