diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index a10dac90c..d31ff5572 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -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 diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 27d5bdc73..94d1eabe3 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -6392,9 +6392,9 @@ unique_ptr get_action_message_content(Td *td, tl_object_ptrmessages_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(dialog_id, action->months_, action->via_giveaway_, action->unclaimed_, std::move(action->slug_)); @@ -6781,8 +6781,11 @@ 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->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(content);