diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index 2f1a727d74..78cf7393f6 100644 --- a/_schema/tdesktop.tl +++ b/_schema/tdesktop.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl -// Layer: 189 -// SHA256: 274a71c5b60947275de376cce5cecb0a907181439ae6d53c54f4a0331c66be75 +// Layer: 190 +// SHA256: c11f249c649c94dceb1f98240ae67b6ada880367eb6f94805c66b69ff1237848 boolFalse#bc799737 = Bool; @@ -292,7 +292,7 @@ messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; -messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long = MessageAction; +messageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction; messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; @@ -304,7 +304,7 @@ messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAc messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; +messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction; messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; @@ -2248,7 +2248,7 @@ inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgra inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose; inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; @@ -4057,4 +4057,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 189 +// LAYER 190 diff --git a/_schema/telegram.tl b/_schema/telegram.tl index 97265ef4c9..75a7881ca9 100644 --- a/_schema/telegram.tl +++ b/_schema/telegram.tl @@ -2,8 +2,8 @@ // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl // Merge: _schema/legacy.tl -// Layer: 189 -// SHA256: 274a71c5b60947275de376cce5cecb0a907181439ae6d53c54f4a0331c66be75 +// Layer: 190 +// SHA256: c11f249c649c94dceb1f98240ae67b6ada880367eb6f94805c66b69ff1237848 boolFalse#bc799737 = Bool; @@ -293,7 +293,7 @@ messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; -messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long = MessageAction; +messageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction; messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; @@ -305,7 +305,7 @@ messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAc messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; +messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction; messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; @@ -2249,7 +2249,7 @@ inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgra inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose; inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; @@ -4090,4 +4090,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 189 +// LAYER 190 diff --git a/tg/tl_input_store_payment_purpose_gen.go b/tg/tl_input_store_payment_purpose_gen.go index 3237790472..9166b087a2 100644 --- a/tg/tl_input_store_payment_purpose_gen.go +++ b/tg/tl_input_store_payment_purpose_gen.go @@ -434,7 +434,7 @@ func (i *InputStorePaymentGiftPremium) GetAmount() (value int64) { return i.Amount } -// InputStorePaymentPremiumGiftCode represents TL type `inputStorePaymentPremiumGiftCode#a3805f3f`. +// InputStorePaymentPremiumGiftCode represents TL type `inputStorePaymentPremiumGiftCode#fb790393`. // Used to gift Telegram Premium¹ subscriptions only to some specific subscribers of a // channel/supergroup or to some of our contacts, see here »² for more info on // giveaways and gifts. @@ -480,10 +480,14 @@ type InputStorePaymentPremiumGiftCode struct { // Links: // 1) https://core.telegram.org/bots/payments/currencies.json Amount int64 + // Message field of InputStorePaymentPremiumGiftCode. + // + // Use SetMessage and GetMessage helpers. + Message TextWithEntities } // InputStorePaymentPremiumGiftCodeTypeID is TL type id of InputStorePaymentPremiumGiftCode. -const InputStorePaymentPremiumGiftCodeTypeID = 0xa3805f3f +const InputStorePaymentPremiumGiftCodeTypeID = 0xfb790393 // construct implements constructor of InputStorePaymentPurposeClass. func (i InputStorePaymentPremiumGiftCode) construct() InputStorePaymentPurposeClass { return &i } @@ -517,6 +521,9 @@ func (i *InputStorePaymentPremiumGiftCode) Zero() bool { if !(i.Amount == 0) { return false } + if !(i.Message.Zero()) { + return false + } return true } @@ -536,6 +543,7 @@ func (i *InputStorePaymentPremiumGiftCode) FillFrom(from interface { GetBoostPeer() (value InputPeerClass, ok bool) GetCurrency() (value string) GetAmount() (value int64) + GetMessage() (value TextWithEntities, ok bool) }) { i.Users = from.GetUsers() if val, ok := from.GetBoostPeer(); ok { @@ -544,6 +552,10 @@ func (i *InputStorePaymentPremiumGiftCode) FillFrom(from interface { i.Currency = from.GetCurrency() i.Amount = from.GetAmount() + if val, ok := from.GetMessage(); ok { + i.Message = val + } + } // TypeID returns type id in TL schema. @@ -586,6 +598,11 @@ func (i *InputStorePaymentPremiumGiftCode) TypeInfo() tdp.Type { Name: "Amount", SchemaName: "amount", }, + { + Name: "Message", + SchemaName: "message", + Null: !i.Flags.Has(1), + }, } return typ } @@ -595,12 +612,15 @@ func (i *InputStorePaymentPremiumGiftCode) SetFlags() { if !(i.BoostPeer == nil) { i.Flags.Set(0) } + if !(i.Message.Zero()) { + i.Flags.Set(1) + } } // Encode implements bin.Encoder. func (i *InputStorePaymentPremiumGiftCode) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStorePaymentPremiumGiftCode#a3805f3f as nil") + return fmt.Errorf("can't encode inputStorePaymentPremiumGiftCode#fb790393 as nil") } b.PutID(InputStorePaymentPremiumGiftCodeTypeID) return i.EncodeBare(b) @@ -609,41 +629,46 @@ func (i *InputStorePaymentPremiumGiftCode) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputStorePaymentPremiumGiftCode) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStorePaymentPremiumGiftCode#a3805f3f as nil") + return fmt.Errorf("can't encode inputStorePaymentPremiumGiftCode#fb790393 as nil") } i.SetFlags() if err := i.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field flags: %w", err) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field flags: %w", err) } b.PutVectorHeader(len(i.Users)) for idx, v := range i.Users { if v == nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field users element with index %d: %w", idx, err) } } if i.Flags.Has(0) { if i.BoostPeer == nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field boost_peer is nil") + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field boost_peer is nil") } if err := i.BoostPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field boost_peer: %w", err) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field boost_peer: %w", err) } } b.PutString(i.Currency) b.PutLong(i.Amount) + if i.Flags.Has(1) { + if err := i.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field message: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (i *InputStorePaymentPremiumGiftCode) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStorePaymentPremiumGiftCode#a3805f3f to nil") + return fmt.Errorf("can't decode inputStorePaymentPremiumGiftCode#fb790393 to nil") } if err := b.ConsumeID(InputStorePaymentPremiumGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: %w", err) } return i.DecodeBare(b) } @@ -651,17 +676,17 @@ func (i *InputStorePaymentPremiumGiftCode) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputStorePaymentPremiumGiftCode) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStorePaymentPremiumGiftCode#a3805f3f to nil") + return fmt.Errorf("can't decode inputStorePaymentPremiumGiftCode#fb790393 to nil") } { if err := i.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field flags: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field flags: %w", err) } } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field users: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field users: %w", err) } if headerLen > 0 { @@ -670,7 +695,7 @@ func (i *InputStorePaymentPremiumGiftCode) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputUser(b) if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field users: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field users: %w", err) } i.Users = append(i.Users, value) } @@ -678,24 +703,29 @@ func (i *InputStorePaymentPremiumGiftCode) DecodeBare(b *bin.Buffer) error { if i.Flags.Has(0) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field boost_peer: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field boost_peer: %w", err) } i.BoostPeer = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field currency: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field currency: %w", err) } i.Currency = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field amount: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field amount: %w", err) } i.Amount = value } + if i.Flags.Has(1) { + if err := i.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field message: %w", err) + } + } return nil } @@ -741,6 +771,24 @@ func (i *InputStorePaymentPremiumGiftCode) GetAmount() (value int64) { return i.Amount } +// SetMessage sets value of Message conditional field. +func (i *InputStorePaymentPremiumGiftCode) SetMessage(value TextWithEntities) { + i.Flags.Set(1) + i.Message = value +} + +// GetMessage returns value of Message conditional field and +// boolean which is true if field was set. +func (i *InputStorePaymentPremiumGiftCode) GetMessage() (value TextWithEntities, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(1) { + return value, false + } + return i.Message, true +} + // MapUsers returns field Users wrapped in InputUserClassArray helper. func (i *InputStorePaymentPremiumGiftCode) MapUsers() (value InputUserClassArray) { return InputUserClassArray(i.Users) @@ -2324,7 +2372,7 @@ const InputStorePaymentPurposeClassName = "InputStorePaymentPurpose" // switch v := g.(type) { // case *tg.InputStorePaymentPremiumSubscription: // inputStorePaymentPremiumSubscription#a6751e66 // case *tg.InputStorePaymentGiftPremium: // inputStorePaymentGiftPremium#616f7fe8 -// case *tg.InputStorePaymentPremiumGiftCode: // inputStorePaymentPremiumGiftCode#a3805f3f +// case *tg.InputStorePaymentPremiumGiftCode: // inputStorePaymentPremiumGiftCode#fb790393 // case *tg.InputStorePaymentPremiumGiveaway: // inputStorePaymentPremiumGiveaway#160544ca // case *tg.InputStorePaymentStarsTopup: // inputStorePaymentStarsTopup#dddd0f56 // case *tg.InputStorePaymentStarsGift: // inputStorePaymentStarsGift#1d741ef7 @@ -2372,7 +2420,7 @@ func DecodeInputStorePaymentPurpose(buf *bin.Buffer) (InputStorePaymentPurposeCl } return &v, nil case InputStorePaymentPremiumGiftCodeTypeID: - // Decoding inputStorePaymentPremiumGiftCode#a3805f3f. + // Decoding inputStorePaymentPremiumGiftCode#fb790393. v := InputStorePaymentPremiumGiftCode{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputStorePaymentPurposeClass: %w", err) diff --git a/tg/tl_message_action_gen.go b/tg/tl_message_action_gen.go index 8717d41053..91ba31610a 100644 --- a/tg/tl_message_action_gen.go +++ b/tg/tl_message_action_gen.go @@ -5430,7 +5430,7 @@ func (m *MessageActionWebViewDataSent) GetText() (value string) { return m.Text } -// MessageActionGiftPremium represents TL type `messageActionGiftPremium#c83d6aec`. +// MessageActionGiftPremium represents TL type `messageActionGiftPremium#6c6274fa`. // Info about a gifted Telegram Premium subscription // // See https://core.telegram.org/constructor/messageActionGiftPremium for reference. @@ -5464,10 +5464,14 @@ type MessageActionGiftPremium struct { // // Use SetCryptoAmount and GetCryptoAmount helpers. CryptoAmount int64 + // Message field of MessageActionGiftPremium. + // + // Use SetMessage and GetMessage helpers. + Message TextWithEntities } // MessageActionGiftPremiumTypeID is TL type id of MessageActionGiftPremium. -const MessageActionGiftPremiumTypeID = 0xc83d6aec +const MessageActionGiftPremiumTypeID = 0x6c6274fa // construct implements constructor of MessageActionClass. func (m MessageActionGiftPremium) construct() MessageActionClass { return &m } @@ -5504,6 +5508,9 @@ func (m *MessageActionGiftPremium) Zero() bool { if !(m.CryptoAmount == 0) { return false } + if !(m.Message.Zero()) { + return false + } return true } @@ -5524,6 +5531,7 @@ func (m *MessageActionGiftPremium) FillFrom(from interface { GetMonths() (value int) GetCryptoCurrency() (value string, ok bool) GetCryptoAmount() (value int64, ok bool) + GetMessage() (value TextWithEntities, ok bool) }) { m.Currency = from.GetCurrency() m.Amount = from.GetAmount() @@ -5536,6 +5544,10 @@ func (m *MessageActionGiftPremium) FillFrom(from interface { m.CryptoAmount = val } + if val, ok := from.GetMessage(); ok { + m.Message = val + } + } // TypeID returns type id in TL schema. @@ -5583,6 +5595,11 @@ func (m *MessageActionGiftPremium) TypeInfo() tdp.Type { SchemaName: "crypto_amount", Null: !m.Flags.Has(0), }, + { + Name: "Message", + SchemaName: "message", + Null: !m.Flags.Has(1), + }, } return typ } @@ -5595,12 +5612,15 @@ func (m *MessageActionGiftPremium) SetFlags() { if !(m.CryptoAmount == 0) { m.Flags.Set(0) } + if !(m.Message.Zero()) { + m.Flags.Set(1) + } } // Encode implements bin.Encoder. func (m *MessageActionGiftPremium) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftPremium#c83d6aec as nil") + return fmt.Errorf("can't encode messageActionGiftPremium#6c6274fa as nil") } b.PutID(MessageActionGiftPremiumTypeID) return m.EncodeBare(b) @@ -5609,11 +5629,11 @@ func (m *MessageActionGiftPremium) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionGiftPremium) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftPremium#c83d6aec as nil") + return fmt.Errorf("can't encode messageActionGiftPremium#6c6274fa as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionGiftPremium#c83d6aec: field flags: %w", err) + return fmt.Errorf("unable to encode messageActionGiftPremium#6c6274fa: field flags: %w", err) } b.PutString(m.Currency) b.PutLong(m.Amount) @@ -5624,16 +5644,21 @@ func (m *MessageActionGiftPremium) EncodeBare(b *bin.Buffer) error { if m.Flags.Has(0) { b.PutLong(m.CryptoAmount) } + if m.Flags.Has(1) { + if err := m.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionGiftPremium#6c6274fa: field message: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (m *MessageActionGiftPremium) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftPremium#c83d6aec to nil") + return fmt.Errorf("can't decode messageActionGiftPremium#6c6274fa to nil") } if err := b.ConsumeID(MessageActionGiftPremiumTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: %w", err) } return m.DecodeBare(b) } @@ -5641,48 +5666,53 @@ func (m *MessageActionGiftPremium) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionGiftPremium) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftPremium#c83d6aec to nil") + return fmt.Errorf("can't decode messageActionGiftPremium#6c6274fa to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field flags: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field flags: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field currency: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field currency: %w", err) } m.Currency = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field amount: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field amount: %w", err) } m.Amount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field months: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field months: %w", err) } m.Months = value } if m.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field crypto_currency: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field crypto_currency: %w", err) } m.CryptoCurrency = value } if m.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field crypto_amount: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field crypto_amount: %w", err) } m.CryptoAmount = value } + if m.Flags.Has(1) { + if err := m.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field message: %w", err) + } + } return nil } @@ -5746,6 +5776,24 @@ func (m *MessageActionGiftPremium) GetCryptoAmount() (value int64, ok bool) { return m.CryptoAmount, true } +// SetMessage sets value of Message conditional field. +func (m *MessageActionGiftPremium) SetMessage(value TextWithEntities) { + m.Flags.Set(1) + m.Message = value +} + +// GetMessage returns value of Message conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftPremium) GetMessage() (value TextWithEntities, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(1) { + return value, false + } + return m.Message, true +} + // MessageActionTopicCreate represents TL type `messageActionTopicCreate#d999256`. // A forum topic¹ was created. // @@ -6895,7 +6943,7 @@ func (m *MessageActionSetChatWallPaper) GetWallpaper() (value WallPaperClass) { return m.Wallpaper } -// MessageActionGiftCode represents TL type `messageActionGiftCode#678c2e09`. +// MessageActionGiftCode represents TL type `messageActionGiftCode#56d03994`. // Contains a Telegram Premium giftcode link¹. // // Links: @@ -6965,10 +7013,14 @@ type MessageActionGiftCode struct { // // Use SetCryptoAmount and GetCryptoAmount helpers. CryptoAmount int64 + // Message field of MessageActionGiftCode. + // + // Use SetMessage and GetMessage helpers. + Message TextWithEntities } // MessageActionGiftCodeTypeID is TL type id of MessageActionGiftCode. -const MessageActionGiftCodeTypeID = 0x678c2e09 +const MessageActionGiftCodeTypeID = 0x56d03994 // construct implements constructor of MessageActionClass. func (m MessageActionGiftCode) construct() MessageActionClass { return &m } @@ -7017,6 +7069,9 @@ func (m *MessageActionGiftCode) Zero() bool { if !(m.CryptoAmount == 0) { return false } + if !(m.Message.Zero()) { + return false + } return true } @@ -7041,6 +7096,7 @@ func (m *MessageActionGiftCode) FillFrom(from interface { GetAmount() (value int64, ok bool) GetCryptoCurrency() (value string, ok bool) GetCryptoAmount() (value int64, ok bool) + GetMessage() (value TextWithEntities, ok bool) }) { m.ViaGiveaway = from.GetViaGiveaway() m.Unclaimed = from.GetUnclaimed() @@ -7066,6 +7122,10 @@ func (m *MessageActionGiftCode) FillFrom(from interface { m.CryptoAmount = val } + if val, ok := from.GetMessage(); ok { + m.Message = val + } + } // TypeID returns type id in TL schema. @@ -7134,6 +7194,11 @@ func (m *MessageActionGiftCode) TypeInfo() tdp.Type { SchemaName: "crypto_amount", Null: !m.Flags.Has(3), }, + { + Name: "Message", + SchemaName: "message", + Null: !m.Flags.Has(4), + }, } return typ } @@ -7161,12 +7226,15 @@ func (m *MessageActionGiftCode) SetFlags() { if !(m.CryptoAmount == 0) { m.Flags.Set(3) } + if !(m.Message.Zero()) { + m.Flags.Set(4) + } } // Encode implements bin.Encoder. func (m *MessageActionGiftCode) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftCode#678c2e09 as nil") + return fmt.Errorf("can't encode messageActionGiftCode#56d03994 as nil") } b.PutID(MessageActionGiftCodeTypeID) return m.EncodeBare(b) @@ -7175,18 +7243,18 @@ func (m *MessageActionGiftCode) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionGiftCode) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftCode#678c2e09 as nil") + return fmt.Errorf("can't encode messageActionGiftCode#56d03994 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionGiftCode#678c2e09: field flags: %w", err) + return fmt.Errorf("unable to encode messageActionGiftCode#56d03994: field flags: %w", err) } if m.Flags.Has(1) { if m.BoostPeer == nil { - return fmt.Errorf("unable to encode messageActionGiftCode#678c2e09: field boost_peer is nil") + return fmt.Errorf("unable to encode messageActionGiftCode#56d03994: field boost_peer is nil") } if err := m.BoostPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionGiftCode#678c2e09: field boost_peer: %w", err) + return fmt.Errorf("unable to encode messageActionGiftCode#56d03994: field boost_peer: %w", err) } } b.PutInt(m.Months) @@ -7203,16 +7271,21 @@ func (m *MessageActionGiftCode) EncodeBare(b *bin.Buffer) error { if m.Flags.Has(3) { b.PutLong(m.CryptoAmount) } + if m.Flags.Has(4) { + if err := m.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionGiftCode#56d03994: field message: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (m *MessageActionGiftCode) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftCode#678c2e09 to nil") + return fmt.Errorf("can't decode messageActionGiftCode#56d03994 to nil") } if err := b.ConsumeID(MessageActionGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: %w", err) } return m.DecodeBare(b) } @@ -7220,11 +7293,11 @@ func (m *MessageActionGiftCode) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionGiftCode) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftCode#678c2e09 to nil") + return fmt.Errorf("can't decode messageActionGiftCode#56d03994 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field flags: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field flags: %w", err) } } m.ViaGiveaway = m.Flags.Has(0) @@ -7232,52 +7305,57 @@ func (m *MessageActionGiftCode) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(1) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field boost_peer: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field boost_peer: %w", err) } m.BoostPeer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field months: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field months: %w", err) } m.Months = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field slug: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field slug: %w", err) } m.Slug = value } if m.Flags.Has(2) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field currency: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field currency: %w", err) } m.Currency = value } if m.Flags.Has(2) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field amount: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field amount: %w", err) } m.Amount = value } if m.Flags.Has(3) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field crypto_currency: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field crypto_currency: %w", err) } m.CryptoCurrency = value } if m.Flags.Has(3) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field crypto_amount: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field crypto_amount: %w", err) } m.CryptoAmount = value } + if m.Flags.Has(4) { + if err := m.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field message: %w", err) + } + } return nil } @@ -7425,6 +7503,24 @@ func (m *MessageActionGiftCode) GetCryptoAmount() (value int64, ok bool) { return m.CryptoAmount, true } +// SetMessage sets value of Message conditional field. +func (m *MessageActionGiftCode) SetMessage(value TextWithEntities) { + m.Flags.Set(4) + m.Message = value +} + +// GetMessage returns value of Message conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftCode) GetMessage() (value TextWithEntities, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(4) { + return value, false + } + return m.Message, true +} + // MessageActionGiveawayLaunch represents TL type `messageActionGiveawayLaunch#a80f51e4`. // A giveaway¹ was started. // @@ -9468,13 +9564,13 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionChatJoinedByRequest: // messageActionChatJoinedByRequest#ebbca3cb // case *tg.MessageActionWebViewDataSentMe: // messageActionWebViewDataSentMe#47dd8079 // case *tg.MessageActionWebViewDataSent: // messageActionWebViewDataSent#b4c38cb5 -// case *tg.MessageActionGiftPremium: // messageActionGiftPremium#c83d6aec +// case *tg.MessageActionGiftPremium: // messageActionGiftPremium#6c6274fa // case *tg.MessageActionTopicCreate: // messageActionTopicCreate#d999256 // case *tg.MessageActionTopicEdit: // messageActionTopicEdit#c0944820 // case *tg.MessageActionSuggestProfilePhoto: // messageActionSuggestProfilePhoto#57de635e // case *tg.MessageActionRequestedPeer: // messageActionRequestedPeer#31518e9b // case *tg.MessageActionSetChatWallPaper: // messageActionSetChatWallPaper#5060a3f4 -// case *tg.MessageActionGiftCode: // messageActionGiftCode#678c2e09 +// case *tg.MessageActionGiftCode: // messageActionGiftCode#56d03994 // case *tg.MessageActionGiveawayLaunch: // messageActionGiveawayLaunch#a80f51e4 // case *tg.MessageActionGiveawayResults: // messageActionGiveawayResults#87e2f155 // case *tg.MessageActionBoostApply: // messageActionBoostApply#cc02aa6d @@ -9736,7 +9832,7 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionGiftPremiumTypeID: - // Decoding messageActionGiftPremium#c83d6aec. + // Decoding messageActionGiftPremium#6c6274fa. v := MessageActionGiftPremium{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) @@ -9778,7 +9874,7 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionGiftCodeTypeID: - // Decoding messageActionGiftCode#678c2e09. + // Decoding messageActionGiftCode#56d03994. v := MessageActionGiftCode{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index df45f511ef..2a2bdcbfa7 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 189 +const Layer = 190 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -181,13 +181,13 @@ func TypesMap() map[uint32]string { MessageActionChatJoinedByRequestTypeID: "messageActionChatJoinedByRequest#ebbca3cb", MessageActionWebViewDataSentMeTypeID: "messageActionWebViewDataSentMe#47dd8079", MessageActionWebViewDataSentTypeID: "messageActionWebViewDataSent#b4c38cb5", - MessageActionGiftPremiumTypeID: "messageActionGiftPremium#c83d6aec", + MessageActionGiftPremiumTypeID: "messageActionGiftPremium#6c6274fa", MessageActionTopicCreateTypeID: "messageActionTopicCreate#d999256", MessageActionTopicEditTypeID: "messageActionTopicEdit#c0944820", MessageActionSuggestProfilePhotoTypeID: "messageActionSuggestProfilePhoto#57de635e", MessageActionRequestedPeerTypeID: "messageActionRequestedPeer#31518e9b", MessageActionSetChatWallPaperTypeID: "messageActionSetChatWallPaper#5060a3f4", - MessageActionGiftCodeTypeID: "messageActionGiftCode#678c2e09", + MessageActionGiftCodeTypeID: "messageActionGiftCode#56d03994", MessageActionGiveawayLaunchTypeID: "messageActionGiveawayLaunch#a80f51e4", MessageActionGiveawayResultsTypeID: "messageActionGiveawayResults#87e2f155", MessageActionBoostApplyTypeID: "messageActionBoostApply#cc02aa6d", @@ -1159,7 +1159,7 @@ func TypesMap() map[uint32]string { HelpPremiumPromoTypeID: "help.premiumPromo#5334759c", InputStorePaymentPremiumSubscriptionTypeID: "inputStorePaymentPremiumSubscription#a6751e66", InputStorePaymentGiftPremiumTypeID: "inputStorePaymentGiftPremium#616f7fe8", - InputStorePaymentPremiumGiftCodeTypeID: "inputStorePaymentPremiumGiftCode#a3805f3f", + InputStorePaymentPremiumGiftCodeTypeID: "inputStorePaymentPremiumGiftCode#fb790393", InputStorePaymentPremiumGiveawayTypeID: "inputStorePaymentPremiumGiveaway#160544ca", InputStorePaymentStarsTopupTypeID: "inputStorePaymentStarsTopup#dddd0f56", InputStorePaymentStarsGiftTypeID: "inputStorePaymentStarsGift#1d741ef7",