diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index e3f9c22867..4356ec6ebd 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: 183 -// SHA256: 2fe40c704d7e99cee6c66ba26009eb804559e4909d4ec6c26cee752c4ae35549 +// Layer: 184 +// SHA256: a37868b9861499415a8c27ae47e42b3cd96eb175bd49a91f272e43dd57261c51 boolFalse#bc799737 = Bool; @@ -170,7 +170,7 @@ channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull; -channelFull#bbab348d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet = ChatFull; +channelFull#bbab348d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -312,6 +312,8 @@ messageActionBoostApply#cc02aa6d boosts:int = MessageAction; messageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector = MessageAction; +messageActionPaymentRefunded#41b3e202 flags:# peer:Peer currency:string total_amount:long payload:flags.0?bytes charge:PaymentCharge = MessageAction; + dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -3943,4 +3945,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 183 +// LAYER 184 diff --git a/_schema/telegram.tl b/_schema/telegram.tl index aaaba8cd38..18dc73ea4a 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: 183 -// SHA256: 2fe40c704d7e99cee6c66ba26009eb804559e4909d4ec6c26cee752c4ae35549 +// Layer: 184 +// SHA256: a37868b9861499415a8c27ae47e42b3cd96eb175bd49a91f272e43dd57261c51 boolFalse#bc799737 = Bool; @@ -171,7 +171,7 @@ channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull; -channelFull#bbab348d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet = ChatFull; +channelFull#bbab348d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -313,6 +313,8 @@ messageActionBoostApply#cc02aa6d boosts:int = MessageAction; messageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector = MessageAction; +messageActionPaymentRefunded#41b3e202 flags:# peer:Peer currency:string total_amount:long payload:flags.0?bytes charge:PaymentCharge = MessageAction; + dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -3976,4 +3978,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 183 +// LAYER 184 diff --git a/tg/tl_chat_full_gen.go b/tg/tl_chat_full_gen.go index f4523a0a3e..203127d9d3 100644 --- a/tg/tl_chat_full_gen.go +++ b/tg/tl_chat_full_gen.go @@ -1156,6 +1156,8 @@ type ChannelFull struct { CanViewRevenue bool // PaidMediaAllowed field of ChannelFull. PaidMediaAllowed bool + // CanViewStarsRevenue field of ChannelFull. + CanViewStarsRevenue bool // ID of the channel ID int64 // Info about the channel @@ -1427,6 +1429,9 @@ func (c *ChannelFull) Zero() bool { if !(c.PaidMediaAllowed == false) { return false } + if !(c.CanViewStarsRevenue == false) { + return false + } if !(c.ID == 0) { return false } @@ -1582,6 +1587,7 @@ func (c *ChannelFull) FillFrom(from interface { GetRestrictedSponsored() (value bool) GetCanViewRevenue() (value bool) GetPaidMediaAllowed() (value bool) + GetCanViewStarsRevenue() (value bool) GetID() (value int64) GetAbout() (value string) GetParticipantsCount() (value int, ok bool) @@ -1641,6 +1647,7 @@ func (c *ChannelFull) FillFrom(from interface { c.RestrictedSponsored = from.GetRestrictedSponsored() c.CanViewRevenue = from.GetCanViewRevenue() c.PaidMediaAllowed = from.GetPaidMediaAllowed() + c.CanViewStarsRevenue = from.GetCanViewStarsRevenue() c.ID = from.GetID() c.About = from.GetAbout() if val, ok := from.GetParticipantsCount(); ok { @@ -1888,6 +1895,11 @@ func (c *ChannelFull) TypeInfo() tdp.Type { SchemaName: "paid_media_allowed", Null: !c.Flags2.Has(14), }, + { + Name: "CanViewStarsRevenue", + SchemaName: "can_view_stars_revenue", + Null: !c.Flags2.Has(15), + }, { Name: "ID", SchemaName: "id", @@ -2141,6 +2153,9 @@ func (c *ChannelFull) SetFlags() { if !(c.PaidMediaAllowed == false) { c.Flags2.Set(14) } + if !(c.CanViewStarsRevenue == false) { + c.Flags2.Set(15) + } if !(c.ParticipantsCount == 0) { c.Flags.Set(0) } @@ -2467,6 +2482,7 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { c.RestrictedSponsored = c.Flags2.Has(11) c.CanViewRevenue = c.Flags2.Has(12) c.PaidMediaAllowed = c.Flags2.Has(14) + c.CanViewStarsRevenue = c.Flags2.Has(15) { value, err := b.Long() if err != nil { @@ -3100,6 +3116,25 @@ func (c *ChannelFull) GetPaidMediaAllowed() (value bool) { return c.Flags2.Has(14) } +// SetCanViewStarsRevenue sets value of CanViewStarsRevenue conditional field. +func (c *ChannelFull) SetCanViewStarsRevenue(value bool) { + if value { + c.Flags2.Set(15) + c.CanViewStarsRevenue = true + } else { + c.Flags2.Unset(15) + c.CanViewStarsRevenue = false + } +} + +// GetCanViewStarsRevenue returns value of CanViewStarsRevenue conditional field. +func (c *ChannelFull) GetCanViewStarsRevenue() (value bool) { + if c == nil { + return + } + return c.Flags2.Has(15) +} + // GetID returns value of ID field. func (c *ChannelFull) GetID() (value int64) { if c == nil { diff --git a/tg/tl_message_action_gen.go b/tg/tl_message_action_gen.go index 9824cc690d..f20ec15c6a 100644 --- a/tg/tl_message_action_gen.go +++ b/tg/tl_message_action_gen.go @@ -8011,6 +8011,292 @@ func (m *MessageActionRequestedPeerSentMe) MapPeers() (value RequestedPeerClassA return RequestedPeerClassArray(m.Peers) } +// MessageActionPaymentRefunded represents TL type `messageActionPaymentRefunded#41b3e202`. +// +// See https://core.telegram.org/constructor/messageActionPaymentRefunded for reference. +type MessageActionPaymentRefunded struct { + // Flags field of MessageActionPaymentRefunded. + Flags bin.Fields + // Peer field of MessageActionPaymentRefunded. + Peer PeerClass + // Currency field of MessageActionPaymentRefunded. + Currency string + // TotalAmount field of MessageActionPaymentRefunded. + TotalAmount int64 + // Payload field of MessageActionPaymentRefunded. + // + // Use SetPayload and GetPayload helpers. + Payload []byte + // Charge field of MessageActionPaymentRefunded. + Charge PaymentCharge +} + +// MessageActionPaymentRefundedTypeID is TL type id of MessageActionPaymentRefunded. +const MessageActionPaymentRefundedTypeID = 0x41b3e202 + +// construct implements constructor of MessageActionClass. +func (m MessageActionPaymentRefunded) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionPaymentRefunded. +var ( + _ bin.Encoder = &MessageActionPaymentRefunded{} + _ bin.Decoder = &MessageActionPaymentRefunded{} + _ bin.BareEncoder = &MessageActionPaymentRefunded{} + _ bin.BareDecoder = &MessageActionPaymentRefunded{} + + _ MessageActionClass = &MessageActionPaymentRefunded{} +) + +func (m *MessageActionPaymentRefunded) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.Peer == nil) { + return false + } + if !(m.Currency == "") { + return false + } + if !(m.TotalAmount == 0) { + return false + } + if !(m.Payload == nil) { + return false + } + if !(m.Charge.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionPaymentRefunded) String() string { + if m == nil { + return "MessageActionPaymentRefunded(nil)" + } + type Alias MessageActionPaymentRefunded + return fmt.Sprintf("MessageActionPaymentRefunded%+v", Alias(*m)) +} + +// FillFrom fills MessageActionPaymentRefunded from given interface. +func (m *MessageActionPaymentRefunded) FillFrom(from interface { + GetPeer() (value PeerClass) + GetCurrency() (value string) + GetTotalAmount() (value int64) + GetPayload() (value []byte, ok bool) + GetCharge() (value PaymentCharge) +}) { + m.Peer = from.GetPeer() + m.Currency = from.GetCurrency() + m.TotalAmount = from.GetTotalAmount() + if val, ok := from.GetPayload(); ok { + m.Payload = val + } + + m.Charge = from.GetCharge() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionPaymentRefunded) TypeID() uint32 { + return MessageActionPaymentRefundedTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionPaymentRefunded) TypeName() string { + return "messageActionPaymentRefunded" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionPaymentRefunded) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionPaymentRefunded", + ID: MessageActionPaymentRefundedTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "TotalAmount", + SchemaName: "total_amount", + }, + { + Name: "Payload", + SchemaName: "payload", + Null: !m.Flags.Has(0), + }, + { + Name: "Charge", + SchemaName: "charge", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageActionPaymentRefunded) SetFlags() { + if !(m.Payload == nil) { + m.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (m *MessageActionPaymentRefunded) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionPaymentRefunded#41b3e202 as nil") + } + b.PutID(MessageActionPaymentRefundedTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionPaymentRefunded) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionPaymentRefunded#41b3e202 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionPaymentRefunded#41b3e202: field flags: %w", err) + } + if m.Peer == nil { + return fmt.Errorf("unable to encode messageActionPaymentRefunded#41b3e202: field peer is nil") + } + if err := m.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionPaymentRefunded#41b3e202: field peer: %w", err) + } + b.PutString(m.Currency) + b.PutLong(m.TotalAmount) + if m.Flags.Has(0) { + b.PutBytes(m.Payload) + } + if err := m.Charge.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionPaymentRefunded#41b3e202: field charge: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionPaymentRefunded) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionPaymentRefunded#41b3e202 to nil") + } + if err := b.ConsumeID(MessageActionPaymentRefundedTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionPaymentRefunded) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionPaymentRefunded#41b3e202 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field flags: %w", err) + } + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field peer: %w", err) + } + m.Peer = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field currency: %w", err) + } + m.Currency = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field total_amount: %w", err) + } + m.TotalAmount = value + } + if m.Flags.Has(0) { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field payload: %w", err) + } + m.Payload = value + } + { + if err := m.Charge.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionPaymentRefunded#41b3e202: field charge: %w", err) + } + } + return nil +} + +// GetPeer returns value of Peer field. +func (m *MessageActionPaymentRefunded) GetPeer() (value PeerClass) { + if m == nil { + return + } + return m.Peer +} + +// GetCurrency returns value of Currency field. +func (m *MessageActionPaymentRefunded) GetCurrency() (value string) { + if m == nil { + return + } + return m.Currency +} + +// GetTotalAmount returns value of TotalAmount field. +func (m *MessageActionPaymentRefunded) GetTotalAmount() (value int64) { + if m == nil { + return + } + return m.TotalAmount +} + +// SetPayload sets value of Payload conditional field. +func (m *MessageActionPaymentRefunded) SetPayload(value []byte) { + m.Flags.Set(0) + m.Payload = value +} + +// GetPayload returns value of Payload conditional field and +// boolean which is true if field was set. +func (m *MessageActionPaymentRefunded) GetPayload() (value []byte, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(0) { + return value, false + } + return m.Payload, true +} + +// GetCharge returns value of Charge field. +func (m *MessageActionPaymentRefunded) GetCharge() (value PaymentCharge) { + if m == nil { + return + } + return m.Charge +} + // MessageActionClassName is schema name of MessageActionClass. const MessageActionClassName = "MessageAction" @@ -8068,6 +8354,7 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionGiveawayResults: // messageActionGiveawayResults#2a9fadc5 // case *tg.MessageActionBoostApply: // messageActionBoostApply#cc02aa6d // case *tg.MessageActionRequestedPeerSentMe: // messageActionRequestedPeerSentMe#93b31848 +// case *tg.MessageActionPaymentRefunded: // messageActionPaymentRefunded#41b3e202 // default: panic(v) // } type MessageActionClass interface { @@ -8397,6 +8684,13 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) } return &v, nil + case MessageActionPaymentRefundedTypeID: + // Decoding messageActionPaymentRefunded#41b3e202. + v := MessageActionPaymentRefunded{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode MessageActionClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_message_action_slices_gen.go b/tg/tl_message_action_slices_gen.go index 0085aa7b10..19107d5273 100644 --- a/tg/tl_message_action_slices_gen.go +++ b/tg/tl_message_action_slices_gen.go @@ -571,6 +571,19 @@ func (s MessageActionClassArray) AsMessageActionRequestedPeerSentMe() (to Messag return to } +// AsMessageActionPaymentRefunded returns copy with only MessageActionPaymentRefunded constructors. +func (s MessageActionClassArray) AsMessageActionPaymentRefunded() (to MessageActionPaymentRefundedArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionPaymentRefunded) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // MessageActionChatCreateArray is adapter for slice of MessageActionChatCreate. type MessageActionChatCreateArray []MessageActionChatCreate @@ -3440,3 +3453,85 @@ func (s *MessageActionRequestedPeerSentMeArray) Pop() (v MessageActionRequestedP return v, true } + +// MessageActionPaymentRefundedArray is adapter for slice of MessageActionPaymentRefunded. +type MessageActionPaymentRefundedArray []MessageActionPaymentRefunded + +// Sort sorts slice of MessageActionPaymentRefunded. +func (s MessageActionPaymentRefundedArray) Sort(less func(a, b MessageActionPaymentRefunded) bool) MessageActionPaymentRefundedArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionPaymentRefunded. +func (s MessageActionPaymentRefundedArray) SortStable(less func(a, b MessageActionPaymentRefunded) bool) MessageActionPaymentRefundedArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionPaymentRefunded. +func (s MessageActionPaymentRefundedArray) Retain(keep func(x MessageActionPaymentRefunded) bool) MessageActionPaymentRefundedArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s MessageActionPaymentRefundedArray) First() (v MessageActionPaymentRefunded, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionPaymentRefundedArray) Last() (v MessageActionPaymentRefunded, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *MessageActionPaymentRefundedArray) PopFirst() (v MessageActionPaymentRefunded, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero MessageActionPaymentRefunded + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *MessageActionPaymentRefundedArray) Pop() (v MessageActionPaymentRefunded, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index 1ff51cfb2c..c1c78c3f9f 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 183 +const Layer = 184 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -191,6 +191,7 @@ func TypesMap() map[uint32]string { MessageActionGiveawayResultsTypeID: "messageActionGiveawayResults#2a9fadc5", MessageActionBoostApplyTypeID: "messageActionBoostApply#cc02aa6d", MessageActionRequestedPeerSentMeTypeID: "messageActionRequestedPeerSentMe#93b31848", + MessageActionPaymentRefundedTypeID: "messageActionPaymentRefunded#41b3e202", DialogTypeID: "dialog#d58a08c6", DialogFolderTypeID: "dialogFolder#71bd134c", PhotoEmptyTypeID: "photoEmpty#2331b22d", @@ -2178,6 +2179,7 @@ func NamesMap() map[string]uint32 { "messageActionGiveawayResults": MessageActionGiveawayResultsTypeID, "messageActionBoostApply": MessageActionBoostApplyTypeID, "messageActionRequestedPeerSentMe": MessageActionRequestedPeerSentMeTypeID, + "messageActionPaymentRefunded": MessageActionPaymentRefundedTypeID, "dialog": DialogTypeID, "dialogFolder": DialogFolderTypeID, "photoEmpty": PhotoEmptyTypeID, @@ -4165,6 +4167,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageActionGiveawayResultsTypeID: func() bin.Object { return &MessageActionGiveawayResults{} }, MessageActionBoostApplyTypeID: func() bin.Object { return &MessageActionBoostApply{} }, MessageActionRequestedPeerSentMeTypeID: func() bin.Object { return &MessageActionRequestedPeerSentMe{} }, + MessageActionPaymentRefundedTypeID: func() bin.Object { return &MessageActionPaymentRefunded{} }, DialogTypeID: func() bin.Object { return &Dialog{} }, DialogFolderTypeID: func() bin.Object { return &DialogFolder{} }, PhotoEmptyTypeID: func() bin.Object { return &PhotoEmpty{} }, @@ -6711,6 +6714,7 @@ func ClassConstructorsMap() map[string][]uint32 { MessageActionGiveawayResultsTypeID, MessageActionBoostApplyTypeID, MessageActionRequestedPeerSentMeTypeID, + MessageActionPaymentRefundedTypeID, }, MessageClassName: { MessageEmptyTypeID,