From 9810375a5d7b58ce119515a1b2c17edc217538e1 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 14 Oct 2023 07:44:28 +0000 Subject: [PATCH] feat(schema): update TDLib to the latest layer --- _schema/tdapi.tl | 50 +- tdapi/tl_added_reaction_gen.go | 82 +- tdapi/tl_bot_write_access_allow_reason_gen.go | 801 ++++++++++++++++++ tdapi/tl_call_state_gen.go | 2 +- tdapi/tl_chat_boost_status_gen.go | 82 +- tdapi/tl_message_content_gen.go | 285 +------ tdapi/tl_message_forward_origin_gen.go | 181 ---- tdapi/tl_message_gen.go | 279 +++--- tdapi/tl_message_import_info_gen.go | 227 +++++ tdapi/tl_message_reaction_gen.go | 101 ++- tdapi/tl_registry_gen.go | 39 +- 11 files changed, 1473 insertions(+), 656 deletions(-) create mode 100644 tdapi/tl_bot_write_access_allow_reason_gen.go create mode 100644 tdapi/tl_message_import_info_gen.go diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index afd47f3cca..fe327b4024 100644 --- a/_schema/tdapi.tl +++ b/_schema/tdapi.tl @@ -1,7 +1,7 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/tdlib/td/master/td/generate/scheme/td_api.tl -// SHA256: a0a75f59a19dfe7e37e43c49cc30b4552866e9b763601de51c5a47da9612b2d1 +// SHA256: e2751095a82534b34946191be6b25566410f0af3343af7370609ac0fedcebca7 double#2210c154 ? = Double; @@ -1108,10 +1108,6 @@ messageForwardOriginHiddenUser#efd4eee3 sender_name:string = MessageForwardOrigi //@author_signature Original post author signature messageForwardOriginChannel#58dabee3 chat_id:int53 message_id:int53 author_signature:string = MessageForwardOrigin; -//@description The message was imported from an exported message history -//@sender_name Name of the sender -messageForwardOriginMessageImport#d3eb2e21 sender_name:string = MessageForwardOrigin; - //@class ReactionType @description Describes type of message reaction //@description A reaction with an emoji @@ -1130,6 +1126,11 @@ reactionTypeCustomEmoji#c50b42f3 custom_emoji_id:int64 = ReactionType; //@from_message_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown messageForwardInfo#ec7dcac8 origin:MessageForwardOrigin date:int32 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo; +//@description Contains information about a message created with importMessages +//@sender_name Name of the original sender +//@date Point in time (Unix timestamp) when the message was originally sent +messageImportInfo#e6dfabcf sender_name:string date:int32 = MessageImportInfo; + //@description Contains information about replies to a message //@reply_count Number of times the message was directly or indirectly replied //@recent_replier_ids Identifiers of at most 3 recent repliers to the message; available in channels with a discussion supergroup. The users and chats are expected to be inaccessible: only their photo and name will be available @@ -1142,8 +1143,9 @@ messageReplyInfo#69240cb9 reply_count:int32 recent_replier_ids:vector = MessageReaction; +messageReaction#7d9e9864 type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; //@description Contains information about interactions with a message //@view_count Number of times the message was viewed @@ -1209,6 +1211,7 @@ messageReplyToStory#708ca939 story_sender_chat_id:int53 story_id:int32 = Message //@date Point in time (Unix timestamp) when the message was sent //@edit_date Point in time (Unix timestamp) when the message was last edited //@forward_info Information about the initial message sender; may be null if none or unknown +//@import_info Information about the initial message for messages created with importMessages; may be null if the message isn't imported //@interaction_info Information about interactions with the message; may be null if none //@unread_reactions Information about unread reactions added to the message //@reply_to Information about the message or the story this message is replying to; may be null if none @@ -1222,7 +1225,7 @@ messageReplyToStory#708ca939 story_sender_chat_id:int53 story_id:int32 = Message //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message#a516cc02 id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message#12947545 id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages //@total_count Approximate total number of messages found @@ -2942,14 +2945,9 @@ messageUserShared#d4dcb77c user_id:int53 button_id:int32 = MessageContent; //@button_id Identifier of the keyboard button with the request messageChatShared#22db7091 chat_id:int53 button_id:int32 = MessageContent; -//@description The current user has connected a website by logging in using Telegram Login Widget on it -//@domain_name Domain name of the connected website -messageWebsiteConnected#bff3a408 domain_name:string = MessageContent; - //@description The user allowed the bot to send messages -//@web_app Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu -//@by_request True, if user allowed the bot to send messages by an explicit call to allowBotToSendMessages -messageBotWriteAccessAllowed#322dfdaa web_app:webApp by_request:Bool = MessageContent; +//@reason The reason why the bot was allowed to write messages +messageBotWriteAccessAllowed#9a8ab7b4 reason:BotWriteAccessAllowReason = MessageContent; //@description Data from a Web App has been sent to a bot //@button_text Text of the keyboardButtonTypeWebApp button, which opened the Web App @@ -3601,6 +3599,7 @@ storyInfo#8997c352 story_id:int32 date:int32 is_for_close_friends:Bool = StoryIn chatActiveStories#d923d773 chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; //@description Describes current boost status of a chat +//@boost_url An HTTP URL, which can be used to boost the chat //@is_boosted True, if the current user has already boosted the chat //@level Current boost level of the chat //@boost_count The number of times the chat was boosted @@ -3608,7 +3607,7 @@ chatActiveStories#d923d773 chat_id:int53 list:StoryList order:int53 max_read_sto //@next_level_boost_count The number of boosts needed to reach the next level; 0 if the next level isn't available //@premium_member_count Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat //@premium_member_percentage A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat -chatBoostStatus#cd6a3f87 is_boosted:Bool level:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double = ChatBoostStatus; +chatBoostStatus#dc02a4b2 boost_url:string is_boosted:Bool level:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double = ChatBoostStatus; //@description Describes a boost of a chat //@user_id Identifier of a user that boosted the chat @@ -3699,7 +3698,7 @@ callStateReady#ce59c044 protocol:callProtocol servers:vector config: callStateHangingUp#80d0f2aa = CallState; //@description The call has ended successfully -//@reason The reason, why the call has ended +//@reason The reason why the call has ended //@need_rating True, if the call rating must be sent to the server //@need_debug_information True, if the call debug information must be sent to the server //@need_log True, if the call log must be sent to the server @@ -3855,8 +3854,9 @@ phoneNumberAuthenticationSettings#c6e19fa1 allow_flash_call:Bool allow_missed_ca //@description Represents a reaction applied to a message //@type Type of the reaction //@sender_id Identifier of the chat member, applied the reaction +//@is_outgoing True, if the reaction was added by the current user //@date Point in time (Unix timestamp) when the reaction was added -addedReaction#63514a16 type:ReactionType sender_id:MessageSender date:int32 = AddedReaction; +addedReaction#4b04819d type:ReactionType sender_id:MessageSender is_outgoing:Bool date:int32 = AddedReaction; //@description Represents a list of reactions added to a message //@total_count The total number of found reactions @@ -3962,6 +3962,22 @@ attachmentMenuBot#2176d831 bot_user_id:int53 supports_self_chat:Bool supports_us //@inline_message_id Identifier of the sent inline message, if known sentWebAppMessage#4a24eec0 inline_message_id:string = SentWebAppMessage; +//@class BotWriteAccessAllowReason @description Describes a reason why a bot was allowed to write messages to the current user + +//@description The user connected a website by logging in using Telegram Login Widget on it +//@domain_name Domain name of the connected website +botWriteAccessAllowReasonConnectedWebsite#782eafe3 domain_name:string = BotWriteAccessAllowReason; + +//@description The user added the bot to attachment or side menu using toggleBotIsAddedToAttachmentMenu +botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d = BotWriteAccessAllowReason; + +//@description The user launched a Web App using getWebAppLinkUrl +//@web_app Information about the Web App +botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 web_app:webApp = BotWriteAccessAllowReason; + +//@description The user accepted bot's request to send messages with allowBotToSendMessages +botWriteAccessAllowReasonAcceptedRequest#89c63bfc = BotWriteAccessAllowReason; + //@description Contains an HTTP URL //@url The URL httpUrl#87b775a6 url:string = HttpUrl; diff --git a/tdapi/tl_added_reaction_gen.go b/tdapi/tl_added_reaction_gen.go index b80d80d50d..2c5e49a2e8 100644 --- a/tdapi/tl_added_reaction_gen.go +++ b/tdapi/tl_added_reaction_gen.go @@ -31,18 +31,20 @@ var ( _ = tdjson.Encoder{} ) -// AddedReaction represents TL type `addedReaction#63514a16`. +// AddedReaction represents TL type `addedReaction#4b04819d`. type AddedReaction struct { // Type of the reaction Type ReactionTypeClass // Identifier of the chat member, applied the reaction SenderID MessageSenderClass + // True, if the reaction was added by the current user + IsOutgoing bool // Point in time (Unix timestamp) when the reaction was added Date int32 } // AddedReactionTypeID is TL type id of AddedReaction. -const AddedReactionTypeID = 0x63514a16 +const AddedReactionTypeID = 0x4b04819d // Ensuring interfaces in compile-time for AddedReaction. var ( @@ -62,6 +64,9 @@ func (a *AddedReaction) Zero() bool { if !(a.SenderID == nil) { return false } + if !(a.IsOutgoing == false) { + return false + } if !(a.Date == 0) { return false } @@ -109,6 +114,10 @@ func (a *AddedReaction) TypeInfo() tdp.Type { Name: "SenderID", SchemaName: "sender_id", }, + { + Name: "IsOutgoing", + SchemaName: "is_outgoing", + }, { Name: "Date", SchemaName: "date", @@ -120,7 +129,7 @@ func (a *AddedReaction) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (a *AddedReaction) Encode(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't encode addedReaction#63514a16 as nil") + return fmt.Errorf("can't encode addedReaction#4b04819d as nil") } b.PutID(AddedReactionTypeID) return a.EncodeBare(b) @@ -129,20 +138,21 @@ func (a *AddedReaction) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (a *AddedReaction) EncodeBare(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't encode addedReaction#63514a16 as nil") + return fmt.Errorf("can't encode addedReaction#4b04819d as nil") } if a.Type == nil { - return fmt.Errorf("unable to encode addedReaction#63514a16: field type is nil") + return fmt.Errorf("unable to encode addedReaction#4b04819d: field type is nil") } if err := a.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode addedReaction#63514a16: field type: %w", err) + return fmt.Errorf("unable to encode addedReaction#4b04819d: field type: %w", err) } if a.SenderID == nil { - return fmt.Errorf("unable to encode addedReaction#63514a16: field sender_id is nil") + return fmt.Errorf("unable to encode addedReaction#4b04819d: field sender_id is nil") } if err := a.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode addedReaction#63514a16: field sender_id: %w", err) + return fmt.Errorf("unable to encode addedReaction#4b04819d: field sender_id: %w", err) } + b.PutBool(a.IsOutgoing) b.PutInt32(a.Date) return nil } @@ -150,10 +160,10 @@ func (a *AddedReaction) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (a *AddedReaction) Decode(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't decode addedReaction#63514a16 to nil") + return fmt.Errorf("can't decode addedReaction#4b04819d to nil") } if err := b.ConsumeID(AddedReactionTypeID); err != nil { - return fmt.Errorf("unable to decode addedReaction#63514a16: %w", err) + return fmt.Errorf("unable to decode addedReaction#4b04819d: %w", err) } return a.DecodeBare(b) } @@ -161,26 +171,33 @@ func (a *AddedReaction) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (a *AddedReaction) DecodeBare(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't decode addedReaction#63514a16 to nil") + return fmt.Errorf("can't decode addedReaction#4b04819d to nil") } { value, err := DecodeReactionType(b) if err != nil { - return fmt.Errorf("unable to decode addedReaction#63514a16: field type: %w", err) + return fmt.Errorf("unable to decode addedReaction#4b04819d: field type: %w", err) } a.Type = value } { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode addedReaction#63514a16: field sender_id: %w", err) + return fmt.Errorf("unable to decode addedReaction#4b04819d: field sender_id: %w", err) } a.SenderID = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode addedReaction#4b04819d: field is_outgoing: %w", err) + } + a.IsOutgoing = value + } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode addedReaction#63514a16: field date: %w", err) + return fmt.Errorf("unable to decode addedReaction#4b04819d: field date: %w", err) } a.Date = value } @@ -190,27 +207,30 @@ func (a *AddedReaction) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (a *AddedReaction) EncodeTDLibJSON(b tdjson.Encoder) error { if a == nil { - return fmt.Errorf("can't encode addedReaction#63514a16 as nil") + return fmt.Errorf("can't encode addedReaction#4b04819d as nil") } b.ObjStart() b.PutID("addedReaction") b.Comma() b.FieldStart("type") if a.Type == nil { - return fmt.Errorf("unable to encode addedReaction#63514a16: field type is nil") + return fmt.Errorf("unable to encode addedReaction#4b04819d: field type is nil") } if err := a.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addedReaction#63514a16: field type: %w", err) + return fmt.Errorf("unable to encode addedReaction#4b04819d: field type: %w", err) } b.Comma() b.FieldStart("sender_id") if a.SenderID == nil { - return fmt.Errorf("unable to encode addedReaction#63514a16: field sender_id is nil") + return fmt.Errorf("unable to encode addedReaction#4b04819d: field sender_id is nil") } if err := a.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addedReaction#63514a16: field sender_id: %w", err) + return fmt.Errorf("unable to encode addedReaction#4b04819d: field sender_id: %w", err) } b.Comma() + b.FieldStart("is_outgoing") + b.PutBool(a.IsOutgoing) + b.Comma() b.FieldStart("date") b.PutInt32(a.Date) b.Comma() @@ -222,31 +242,37 @@ func (a *AddedReaction) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (a *AddedReaction) DecodeTDLibJSON(b tdjson.Decoder) error { if a == nil { - return fmt.Errorf("can't decode addedReaction#63514a16 to nil") + return fmt.Errorf("can't decode addedReaction#4b04819d to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("addedReaction"); err != nil { - return fmt.Errorf("unable to decode addedReaction#63514a16: %w", err) + return fmt.Errorf("unable to decode addedReaction#4b04819d: %w", err) } case "type": value, err := DecodeTDLibJSONReactionType(b) if err != nil { - return fmt.Errorf("unable to decode addedReaction#63514a16: field type: %w", err) + return fmt.Errorf("unable to decode addedReaction#4b04819d: field type: %w", err) } a.Type = value case "sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode addedReaction#63514a16: field sender_id: %w", err) + return fmt.Errorf("unable to decode addedReaction#4b04819d: field sender_id: %w", err) } a.SenderID = value + case "is_outgoing": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode addedReaction#4b04819d: field is_outgoing: %w", err) + } + a.IsOutgoing = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode addedReaction#63514a16: field date: %w", err) + return fmt.Errorf("unable to decode addedReaction#4b04819d: field date: %w", err) } a.Date = value default: @@ -272,6 +298,14 @@ func (a *AddedReaction) GetSenderID() (value MessageSenderClass) { return a.SenderID } +// GetIsOutgoing returns value of IsOutgoing field. +func (a *AddedReaction) GetIsOutgoing() (value bool) { + if a == nil { + return + } + return a.IsOutgoing +} + // GetDate returns value of Date field. func (a *AddedReaction) GetDate() (value int32) { if a == nil { diff --git a/tdapi/tl_bot_write_access_allow_reason_gen.go b/tdapi/tl_bot_write_access_allow_reason_gen.go new file mode 100644 index 0000000000..f9c7e04b10 --- /dev/null +++ b/tdapi/tl_bot_write_access_allow_reason_gen.go @@ -0,0 +1,801 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// BotWriteAccessAllowReasonConnectedWebsite represents TL type `botWriteAccessAllowReasonConnectedWebsite#782eafe3`. +type BotWriteAccessAllowReasonConnectedWebsite struct { + // Domain name of the connected website + DomainName string +} + +// BotWriteAccessAllowReasonConnectedWebsiteTypeID is TL type id of BotWriteAccessAllowReasonConnectedWebsite. +const BotWriteAccessAllowReasonConnectedWebsiteTypeID = 0x782eafe3 + +// construct implements constructor of BotWriteAccessAllowReasonClass. +func (b BotWriteAccessAllowReasonConnectedWebsite) construct() BotWriteAccessAllowReasonClass { + return &b +} + +// Ensuring interfaces in compile-time for BotWriteAccessAllowReasonConnectedWebsite. +var ( + _ bin.Encoder = &BotWriteAccessAllowReasonConnectedWebsite{} + _ bin.Decoder = &BotWriteAccessAllowReasonConnectedWebsite{} + _ bin.BareEncoder = &BotWriteAccessAllowReasonConnectedWebsite{} + _ bin.BareDecoder = &BotWriteAccessAllowReasonConnectedWebsite{} + + _ BotWriteAccessAllowReasonClass = &BotWriteAccessAllowReasonConnectedWebsite{} +) + +func (b *BotWriteAccessAllowReasonConnectedWebsite) Zero() bool { + if b == nil { + return true + } + if !(b.DomainName == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotWriteAccessAllowReasonConnectedWebsite) String() string { + if b == nil { + return "BotWriteAccessAllowReasonConnectedWebsite(nil)" + } + type Alias BotWriteAccessAllowReasonConnectedWebsite + return fmt.Sprintf("BotWriteAccessAllowReasonConnectedWebsite%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotWriteAccessAllowReasonConnectedWebsite) TypeID() uint32 { + return BotWriteAccessAllowReasonConnectedWebsiteTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotWriteAccessAllowReasonConnectedWebsite) TypeName() string { + return "botWriteAccessAllowReasonConnectedWebsite" +} + +// TypeInfo returns info about TL type. +func (b *BotWriteAccessAllowReasonConnectedWebsite) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botWriteAccessAllowReasonConnectedWebsite", + ID: BotWriteAccessAllowReasonConnectedWebsiteTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "DomainName", + SchemaName: "domain_name", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BotWriteAccessAllowReasonConnectedWebsite) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonConnectedWebsite#782eafe3 as nil") + } + buf.PutID(BotWriteAccessAllowReasonConnectedWebsiteTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotWriteAccessAllowReasonConnectedWebsite) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonConnectedWebsite#782eafe3 as nil") + } + buf.PutString(b.DomainName) + return nil +} + +// Decode implements bin.Decoder. +func (b *BotWriteAccessAllowReasonConnectedWebsite) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonConnectedWebsite#782eafe3 to nil") + } + if err := buf.ConsumeID(BotWriteAccessAllowReasonConnectedWebsiteTypeID); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonConnectedWebsite#782eafe3: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotWriteAccessAllowReasonConnectedWebsite) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonConnectedWebsite#782eafe3 to nil") + } + { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonConnectedWebsite#782eafe3: field domain_name: %w", err) + } + b.DomainName = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BotWriteAccessAllowReasonConnectedWebsite) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonConnectedWebsite#782eafe3 as nil") + } + buf.ObjStart() + buf.PutID("botWriteAccessAllowReasonConnectedWebsite") + buf.Comma() + buf.FieldStart("domain_name") + buf.PutString(b.DomainName) + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BotWriteAccessAllowReasonConnectedWebsite) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonConnectedWebsite#782eafe3 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("botWriteAccessAllowReasonConnectedWebsite"); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonConnectedWebsite#782eafe3: %w", err) + } + case "domain_name": + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonConnectedWebsite#782eafe3: field domain_name: %w", err) + } + b.DomainName = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetDomainName returns value of DomainName field. +func (b *BotWriteAccessAllowReasonConnectedWebsite) GetDomainName() (value string) { + if b == nil { + return + } + return b.DomainName +} + +// BotWriteAccessAllowReasonAddedToAttachmentMenu represents TL type `botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d`. +type BotWriteAccessAllowReasonAddedToAttachmentMenu struct { +} + +// BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID is TL type id of BotWriteAccessAllowReasonAddedToAttachmentMenu. +const BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID = 0x828b5f9d + +// construct implements constructor of BotWriteAccessAllowReasonClass. +func (b BotWriteAccessAllowReasonAddedToAttachmentMenu) construct() BotWriteAccessAllowReasonClass { + return &b +} + +// Ensuring interfaces in compile-time for BotWriteAccessAllowReasonAddedToAttachmentMenu. +var ( + _ bin.Encoder = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} + _ bin.Decoder = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} + _ bin.BareEncoder = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} + _ bin.BareDecoder = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} + + _ BotWriteAccessAllowReasonClass = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} +) + +func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) Zero() bool { + if b == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) String() string { + if b == nil { + return "BotWriteAccessAllowReasonAddedToAttachmentMenu(nil)" + } + type Alias BotWriteAccessAllowReasonAddedToAttachmentMenu + return fmt.Sprintf("BotWriteAccessAllowReasonAddedToAttachmentMenu%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotWriteAccessAllowReasonAddedToAttachmentMenu) TypeID() uint32 { + return BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotWriteAccessAllowReasonAddedToAttachmentMenu) TypeName() string { + return "botWriteAccessAllowReasonAddedToAttachmentMenu" +} + +// TypeInfo returns info about TL type. +func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botWriteAccessAllowReasonAddedToAttachmentMenu", + ID: BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d as nil") + } + buf.PutID(BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d to nil") + } + if err := buf.ConsumeID(BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d as nil") + } + buf.ObjStart() + buf.PutID("botWriteAccessAllowReasonAddedToAttachmentMenu") + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("botWriteAccessAllowReasonAddedToAttachmentMenu"); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// BotWriteAccessAllowReasonLaunchedWebApp represents TL type `botWriteAccessAllowReasonLaunchedWebApp#f1a504d7`. +type BotWriteAccessAllowReasonLaunchedWebApp struct { + // Information about the Web App + WebApp WebApp +} + +// BotWriteAccessAllowReasonLaunchedWebAppTypeID is TL type id of BotWriteAccessAllowReasonLaunchedWebApp. +const BotWriteAccessAllowReasonLaunchedWebAppTypeID = 0xf1a504d7 + +// construct implements constructor of BotWriteAccessAllowReasonClass. +func (b BotWriteAccessAllowReasonLaunchedWebApp) construct() BotWriteAccessAllowReasonClass { + return &b +} + +// Ensuring interfaces in compile-time for BotWriteAccessAllowReasonLaunchedWebApp. +var ( + _ bin.Encoder = &BotWriteAccessAllowReasonLaunchedWebApp{} + _ bin.Decoder = &BotWriteAccessAllowReasonLaunchedWebApp{} + _ bin.BareEncoder = &BotWriteAccessAllowReasonLaunchedWebApp{} + _ bin.BareDecoder = &BotWriteAccessAllowReasonLaunchedWebApp{} + + _ BotWriteAccessAllowReasonClass = &BotWriteAccessAllowReasonLaunchedWebApp{} +) + +func (b *BotWriteAccessAllowReasonLaunchedWebApp) Zero() bool { + if b == nil { + return true + } + if !(b.WebApp.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotWriteAccessAllowReasonLaunchedWebApp) String() string { + if b == nil { + return "BotWriteAccessAllowReasonLaunchedWebApp(nil)" + } + type Alias BotWriteAccessAllowReasonLaunchedWebApp + return fmt.Sprintf("BotWriteAccessAllowReasonLaunchedWebApp%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotWriteAccessAllowReasonLaunchedWebApp) TypeID() uint32 { + return BotWriteAccessAllowReasonLaunchedWebAppTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotWriteAccessAllowReasonLaunchedWebApp) TypeName() string { + return "botWriteAccessAllowReasonLaunchedWebApp" +} + +// TypeInfo returns info about TL type. +func (b *BotWriteAccessAllowReasonLaunchedWebApp) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botWriteAccessAllowReasonLaunchedWebApp", + ID: BotWriteAccessAllowReasonLaunchedWebAppTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "WebApp", + SchemaName: "web_app", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BotWriteAccessAllowReasonLaunchedWebApp) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 as nil") + } + buf.PutID(BotWriteAccessAllowReasonLaunchedWebAppTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotWriteAccessAllowReasonLaunchedWebApp) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 as nil") + } + if err := b.WebApp.Encode(buf); err != nil { + return fmt.Errorf("unable to encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: field web_app: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BotWriteAccessAllowReasonLaunchedWebApp) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 to nil") + } + if err := buf.ConsumeID(BotWriteAccessAllowReasonLaunchedWebAppTypeID); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotWriteAccessAllowReasonLaunchedWebApp) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 to nil") + } + { + if err := b.WebApp.Decode(buf); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: field web_app: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BotWriteAccessAllowReasonLaunchedWebApp) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 as nil") + } + buf.ObjStart() + buf.PutID("botWriteAccessAllowReasonLaunchedWebApp") + buf.Comma() + buf.FieldStart("web_app") + if err := b.WebApp.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: field web_app: %w", err) + } + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BotWriteAccessAllowReasonLaunchedWebApp) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("botWriteAccessAllowReasonLaunchedWebApp"); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: %w", err) + } + case "web_app": + if err := b.WebApp.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: field web_app: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// GetWebApp returns value of WebApp field. +func (b *BotWriteAccessAllowReasonLaunchedWebApp) GetWebApp() (value WebApp) { + if b == nil { + return + } + return b.WebApp +} + +// BotWriteAccessAllowReasonAcceptedRequest represents TL type `botWriteAccessAllowReasonAcceptedRequest#89c63bfc`. +type BotWriteAccessAllowReasonAcceptedRequest struct { +} + +// BotWriteAccessAllowReasonAcceptedRequestTypeID is TL type id of BotWriteAccessAllowReasonAcceptedRequest. +const BotWriteAccessAllowReasonAcceptedRequestTypeID = 0x89c63bfc + +// construct implements constructor of BotWriteAccessAllowReasonClass. +func (b BotWriteAccessAllowReasonAcceptedRequest) construct() BotWriteAccessAllowReasonClass { + return &b +} + +// Ensuring interfaces in compile-time for BotWriteAccessAllowReasonAcceptedRequest. +var ( + _ bin.Encoder = &BotWriteAccessAllowReasonAcceptedRequest{} + _ bin.Decoder = &BotWriteAccessAllowReasonAcceptedRequest{} + _ bin.BareEncoder = &BotWriteAccessAllowReasonAcceptedRequest{} + _ bin.BareDecoder = &BotWriteAccessAllowReasonAcceptedRequest{} + + _ BotWriteAccessAllowReasonClass = &BotWriteAccessAllowReasonAcceptedRequest{} +) + +func (b *BotWriteAccessAllowReasonAcceptedRequest) Zero() bool { + if b == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotWriteAccessAllowReasonAcceptedRequest) String() string { + if b == nil { + return "BotWriteAccessAllowReasonAcceptedRequest(nil)" + } + type Alias BotWriteAccessAllowReasonAcceptedRequest + return fmt.Sprintf("BotWriteAccessAllowReasonAcceptedRequest%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotWriteAccessAllowReasonAcceptedRequest) TypeID() uint32 { + return BotWriteAccessAllowReasonAcceptedRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotWriteAccessAllowReasonAcceptedRequest) TypeName() string { + return "botWriteAccessAllowReasonAcceptedRequest" +} + +// TypeInfo returns info about TL type. +func (b *BotWriteAccessAllowReasonAcceptedRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botWriteAccessAllowReasonAcceptedRequest", + ID: BotWriteAccessAllowReasonAcceptedRequestTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (b *BotWriteAccessAllowReasonAcceptedRequest) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonAcceptedRequest#89c63bfc as nil") + } + buf.PutID(BotWriteAccessAllowReasonAcceptedRequestTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotWriteAccessAllowReasonAcceptedRequest) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonAcceptedRequest#89c63bfc as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BotWriteAccessAllowReasonAcceptedRequest) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc to nil") + } + if err := buf.ConsumeID(BotWriteAccessAllowReasonAcceptedRequestTypeID); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotWriteAccessAllowReasonAcceptedRequest) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BotWriteAccessAllowReasonAcceptedRequest) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode botWriteAccessAllowReasonAcceptedRequest#89c63bfc as nil") + } + buf.ObjStart() + buf.PutID("botWriteAccessAllowReasonAcceptedRequest") + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BotWriteAccessAllowReasonAcceptedRequest) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("botWriteAccessAllowReasonAcceptedRequest"); err != nil { + return fmt.Errorf("unable to decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// BotWriteAccessAllowReasonClassName is schema name of BotWriteAccessAllowReasonClass. +const BotWriteAccessAllowReasonClassName = "BotWriteAccessAllowReason" + +// BotWriteAccessAllowReasonClass represents BotWriteAccessAllowReason generic type. +// +// Example: +// +// g, err := tdapi.DecodeBotWriteAccessAllowReason(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.BotWriteAccessAllowReasonConnectedWebsite: // botWriteAccessAllowReasonConnectedWebsite#782eafe3 +// case *tdapi.BotWriteAccessAllowReasonAddedToAttachmentMenu: // botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d +// case *tdapi.BotWriteAccessAllowReasonLaunchedWebApp: // botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 +// case *tdapi.BotWriteAccessAllowReasonAcceptedRequest: // botWriteAccessAllowReasonAcceptedRequest#89c63bfc +// default: panic(v) +// } +type BotWriteAccessAllowReasonClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() BotWriteAccessAllowReasonClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + EncodeTDLibJSON(b tdjson.Encoder) error + DecodeTDLibJSON(b tdjson.Decoder) error +} + +// DecodeBotWriteAccessAllowReason implements binary de-serialization for BotWriteAccessAllowReasonClass. +func DecodeBotWriteAccessAllowReason(buf *bin.Buffer) (BotWriteAccessAllowReasonClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case BotWriteAccessAllowReasonConnectedWebsiteTypeID: + // Decoding botWriteAccessAllowReasonConnectedWebsite#782eafe3. + v := BotWriteAccessAllowReasonConnectedWebsite{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) + } + return &v, nil + case BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID: + // Decoding botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d. + v := BotWriteAccessAllowReasonAddedToAttachmentMenu{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) + } + return &v, nil + case BotWriteAccessAllowReasonLaunchedWebAppTypeID: + // Decoding botWriteAccessAllowReasonLaunchedWebApp#f1a504d7. + v := BotWriteAccessAllowReasonLaunchedWebApp{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) + } + return &v, nil + case BotWriteAccessAllowReasonAcceptedRequestTypeID: + // Decoding botWriteAccessAllowReasonAcceptedRequest#89c63bfc. + v := BotWriteAccessAllowReasonAcceptedRequest{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONBotWriteAccessAllowReason implements binary de-serialization for BotWriteAccessAllowReasonClass. +func DecodeTDLibJSONBotWriteAccessAllowReason(buf tdjson.Decoder) (BotWriteAccessAllowReasonClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "botWriteAccessAllowReasonConnectedWebsite": + // Decoding botWriteAccessAllowReasonConnectedWebsite#782eafe3. + v := BotWriteAccessAllowReasonConnectedWebsite{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) + } + return &v, nil + case "botWriteAccessAllowReasonAddedToAttachmentMenu": + // Decoding botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d. + v := BotWriteAccessAllowReasonAddedToAttachmentMenu{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) + } + return &v, nil + case "botWriteAccessAllowReasonLaunchedWebApp": + // Decoding botWriteAccessAllowReasonLaunchedWebApp#f1a504d7. + v := BotWriteAccessAllowReasonLaunchedWebApp{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) + } + return &v, nil + case "botWriteAccessAllowReasonAcceptedRequest": + // Decoding botWriteAccessAllowReasonAcceptedRequest#89c63bfc. + v := BotWriteAccessAllowReasonAcceptedRequest{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// BotWriteAccessAllowReason boxes the BotWriteAccessAllowReasonClass providing a helper. +type BotWriteAccessAllowReasonBox struct { + BotWriteAccessAllowReason BotWriteAccessAllowReasonClass +} + +// Decode implements bin.Decoder for BotWriteAccessAllowReasonBox. +func (b *BotWriteAccessAllowReasonBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode BotWriteAccessAllowReasonBox to nil") + } + v, err := DecodeBotWriteAccessAllowReason(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.BotWriteAccessAllowReason = v + return nil +} + +// Encode implements bin.Encode for BotWriteAccessAllowReasonBox. +func (b *BotWriteAccessAllowReasonBox) Encode(buf *bin.Buffer) error { + if b == nil || b.BotWriteAccessAllowReason == nil { + return fmt.Errorf("unable to encode BotWriteAccessAllowReasonClass as nil") + } + return b.BotWriteAccessAllowReason.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for BotWriteAccessAllowReasonBox. +func (b *BotWriteAccessAllowReasonBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode BotWriteAccessAllowReasonBox to nil") + } + v, err := DecodeTDLibJSONBotWriteAccessAllowReason(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.BotWriteAccessAllowReason = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for BotWriteAccessAllowReasonBox. +func (b *BotWriteAccessAllowReasonBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.BotWriteAccessAllowReason == nil { + return fmt.Errorf("unable to encode BotWriteAccessAllowReasonClass as nil") + } + return b.BotWriteAccessAllowReason.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_call_state_gen.go b/tdapi/tl_call_state_gen.go index 71ef4d18f7..83fb20e771 100644 --- a/tdapi/tl_call_state_gen.go +++ b/tdapi/tl_call_state_gen.go @@ -883,7 +883,7 @@ func (c *CallStateHangingUp) DecodeTDLibJSON(b tdjson.Decoder) error { // CallStateDiscarded represents TL type `callStateDiscarded#531b7c45`. type CallStateDiscarded struct { - // The reason, why the call has ended + // The reason why the call has ended Reason CallDiscardReasonClass // True, if the call rating must be sent to the server NeedRating bool diff --git a/tdapi/tl_chat_boost_status_gen.go b/tdapi/tl_chat_boost_status_gen.go index 77ef017352..6fba3672b8 100644 --- a/tdapi/tl_chat_boost_status_gen.go +++ b/tdapi/tl_chat_boost_status_gen.go @@ -31,8 +31,10 @@ var ( _ = tdjson.Encoder{} ) -// ChatBoostStatus represents TL type `chatBoostStatus#cd6a3f87`. +// ChatBoostStatus represents TL type `chatBoostStatus#dc02a4b2`. type ChatBoostStatus struct { + // An HTTP URL, which can be used to boost the chat + BoostURL string // True, if the current user has already boosted the chat IsBoosted bool // Current boost level of the chat @@ -53,7 +55,7 @@ type ChatBoostStatus struct { } // ChatBoostStatusTypeID is TL type id of ChatBoostStatus. -const ChatBoostStatusTypeID = 0xcd6a3f87 +const ChatBoostStatusTypeID = 0xdc02a4b2 // Ensuring interfaces in compile-time for ChatBoostStatus. var ( @@ -67,6 +69,9 @@ func (c *ChatBoostStatus) Zero() bool { if c == nil { return true } + if !(c.BoostURL == "") { + return false + } if !(c.IsBoosted == false) { return false } @@ -124,6 +129,10 @@ func (c *ChatBoostStatus) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "BoostURL", + SchemaName: "boost_url", + }, { Name: "IsBoosted", SchemaName: "is_boosted", @@ -159,7 +168,7 @@ func (c *ChatBoostStatus) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *ChatBoostStatus) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostStatus#cd6a3f87 as nil") + return fmt.Errorf("can't encode chatBoostStatus#dc02a4b2 as nil") } b.PutID(ChatBoostStatusTypeID) return c.EncodeBare(b) @@ -168,8 +177,9 @@ func (c *ChatBoostStatus) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatBoostStatus) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatBoostStatus#cd6a3f87 as nil") + return fmt.Errorf("can't encode chatBoostStatus#dc02a4b2 as nil") } + b.PutString(c.BoostURL) b.PutBool(c.IsBoosted) b.PutInt32(c.Level) b.PutInt32(c.BoostCount) @@ -183,10 +193,10 @@ func (c *ChatBoostStatus) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChatBoostStatus) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostStatus#cd6a3f87 to nil") + return fmt.Errorf("can't decode chatBoostStatus#dc02a4b2 to nil") } if err := b.ConsumeID(ChatBoostStatusTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: %w", err) } return c.DecodeBare(b) } @@ -194,54 +204,61 @@ func (c *ChatBoostStatus) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatBoostStatus) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatBoostStatus#cd6a3f87 to nil") + return fmt.Errorf("can't decode chatBoostStatus#dc02a4b2 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field boost_url: %w", err) + } + c.BoostURL = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field is_boosted: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field is_boosted: %w", err) } c.IsBoosted = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field level: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field level: %w", err) } c.Level = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field boost_count: %w", err) } c.BoostCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field current_level_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field current_level_boost_count: %w", err) } c.CurrentLevelBoostCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field next_level_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field next_level_boost_count: %w", err) } c.NextLevelBoostCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field premium_member_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field premium_member_count: %w", err) } c.PremiumMemberCount = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field premium_member_percentage: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field premium_member_percentage: %w", err) } c.PremiumMemberPercentage = value } @@ -251,11 +268,14 @@ func (c *ChatBoostStatus) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *ChatBoostStatus) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatBoostStatus#cd6a3f87 as nil") + return fmt.Errorf("can't encode chatBoostStatus#dc02a4b2 as nil") } b.ObjStart() b.PutID("chatBoostStatus") b.Comma() + b.FieldStart("boost_url") + b.PutString(c.BoostURL) + b.Comma() b.FieldStart("is_boosted") b.PutBool(c.IsBoosted) b.Comma() @@ -285,55 +305,61 @@ func (c *ChatBoostStatus) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *ChatBoostStatus) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatBoostStatus#cd6a3f87 to nil") + return fmt.Errorf("can't decode chatBoostStatus#dc02a4b2 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chatBoostStatus"); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: %w", err) + } + case "boost_url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field boost_url: %w", err) } + c.BoostURL = value case "is_boosted": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field is_boosted: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field is_boosted: %w", err) } c.IsBoosted = value case "level": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field level: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field level: %w", err) } c.Level = value case "boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field boost_count: %w", err) } c.BoostCount = value case "current_level_boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field current_level_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field current_level_boost_count: %w", err) } c.CurrentLevelBoostCount = value case "next_level_boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field next_level_boost_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field next_level_boost_count: %w", err) } c.NextLevelBoostCount = value case "premium_member_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field premium_member_count: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field premium_member_count: %w", err) } c.PremiumMemberCount = value case "premium_member_percentage": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#cd6a3f87: field premium_member_percentage: %w", err) + return fmt.Errorf("unable to decode chatBoostStatus#dc02a4b2: field premium_member_percentage: %w", err) } c.PremiumMemberPercentage = value default: @@ -343,6 +369,14 @@ func (c *ChatBoostStatus) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// GetBoostURL returns value of BoostURL field. +func (c *ChatBoostStatus) GetBoostURL() (value string) { + if c == nil { + return + } + return c.BoostURL +} + // GetIsBoosted returns value of IsBoosted field. func (c *ChatBoostStatus) GetIsBoosted() (value bool) { if c == nil { diff --git a/tdapi/tl_message_content_gen.go b/tdapi/tl_message_content_gen.go index e8704896d6..5f6501dcbd 100644 --- a/tdapi/tl_message_content_gen.go +++ b/tdapi/tl_message_content_gen.go @@ -11332,184 +11332,14 @@ func (m *MessageChatShared) GetButtonID() (value int32) { return m.ButtonID } -// MessageWebsiteConnected represents TL type `messageWebsiteConnected#bff3a408`. -type MessageWebsiteConnected struct { - // Domain name of the connected website - DomainName string -} - -// MessageWebsiteConnectedTypeID is TL type id of MessageWebsiteConnected. -const MessageWebsiteConnectedTypeID = 0xbff3a408 - -// construct implements constructor of MessageContentClass. -func (m MessageWebsiteConnected) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageWebsiteConnected. -var ( - _ bin.Encoder = &MessageWebsiteConnected{} - _ bin.Decoder = &MessageWebsiteConnected{} - _ bin.BareEncoder = &MessageWebsiteConnected{} - _ bin.BareDecoder = &MessageWebsiteConnected{} - - _ MessageContentClass = &MessageWebsiteConnected{} -) - -func (m *MessageWebsiteConnected) Zero() bool { - if m == nil { - return true - } - if !(m.DomainName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageWebsiteConnected) String() string { - if m == nil { - return "MessageWebsiteConnected(nil)" - } - type Alias MessageWebsiteConnected - return fmt.Sprintf("MessageWebsiteConnected%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageWebsiteConnected) TypeID() uint32 { - return MessageWebsiteConnectedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageWebsiteConnected) TypeName() string { - return "messageWebsiteConnected" -} - -// TypeInfo returns info about TL type. -func (m *MessageWebsiteConnected) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageWebsiteConnected", - ID: MessageWebsiteConnectedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DomainName", - SchemaName: "domain_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageWebsiteConnected) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageWebsiteConnected#bff3a408 as nil") - } - b.PutID(MessageWebsiteConnectedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageWebsiteConnected) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageWebsiteConnected#bff3a408 as nil") - } - b.PutString(m.DomainName) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageWebsiteConnected) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageWebsiteConnected#bff3a408 to nil") - } - if err := b.ConsumeID(MessageWebsiteConnectedTypeID); err != nil { - return fmt.Errorf("unable to decode messageWebsiteConnected#bff3a408: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageWebsiteConnected) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageWebsiteConnected#bff3a408 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageWebsiteConnected#bff3a408: field domain_name: %w", err) - } - m.DomainName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageWebsiteConnected) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageWebsiteConnected#bff3a408 as nil") - } - b.ObjStart() - b.PutID("messageWebsiteConnected") - b.Comma() - b.FieldStart("domain_name") - b.PutString(m.DomainName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageWebsiteConnected) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageWebsiteConnected#bff3a408 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageWebsiteConnected"); err != nil { - return fmt.Errorf("unable to decode messageWebsiteConnected#bff3a408: %w", err) - } - case "domain_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageWebsiteConnected#bff3a408: field domain_name: %w", err) - } - m.DomainName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDomainName returns value of DomainName field. -func (m *MessageWebsiteConnected) GetDomainName() (value string) { - if m == nil { - return - } - return m.DomainName -} - -// MessageBotWriteAccessAllowed represents TL type `messageBotWriteAccessAllowed#322dfdaa`. +// MessageBotWriteAccessAllowed represents TL type `messageBotWriteAccessAllowed#9a8ab7b4`. type MessageBotWriteAccessAllowed struct { - // Information about the Web App, which requested the access; may be null if none or the - // Web App was opened from the attachment menu - WebApp WebApp - // True, if user allowed the bot to send messages by an explicit call to - // allowBotToSendMessages - ByRequest bool + // The reason why the bot was allowed to write messages + Reason BotWriteAccessAllowReasonClass } // MessageBotWriteAccessAllowedTypeID is TL type id of MessageBotWriteAccessAllowed. -const MessageBotWriteAccessAllowedTypeID = 0x322dfdaa +const MessageBotWriteAccessAllowedTypeID = 0x9a8ab7b4 // construct implements constructor of MessageContentClass. func (m MessageBotWriteAccessAllowed) construct() MessageContentClass { return &m } @@ -11528,10 +11358,7 @@ func (m *MessageBotWriteAccessAllowed) Zero() bool { if m == nil { return true } - if !(m.WebApp.Zero()) { - return false - } - if !(m.ByRequest == false) { + if !(m.Reason == nil) { return false } @@ -11571,12 +11398,8 @@ func (m *MessageBotWriteAccessAllowed) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "WebApp", - SchemaName: "web_app", - }, - { - Name: "ByRequest", - SchemaName: "by_request", + Name: "Reason", + SchemaName: "reason", }, } return typ @@ -11585,7 +11408,7 @@ func (m *MessageBotWriteAccessAllowed) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageBotWriteAccessAllowed) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageBotWriteAccessAllowed#322dfdaa as nil") + return fmt.Errorf("can't encode messageBotWriteAccessAllowed#9a8ab7b4 as nil") } b.PutID(MessageBotWriteAccessAllowedTypeID) return m.EncodeBare(b) @@ -11594,22 +11417,24 @@ func (m *MessageBotWriteAccessAllowed) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageBotWriteAccessAllowed) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageBotWriteAccessAllowed#322dfdaa as nil") + return fmt.Errorf("can't encode messageBotWriteAccessAllowed#9a8ab7b4 as nil") } - if err := m.WebApp.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#322dfdaa: field web_app: %w", err) + if m.Reason == nil { + return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#9a8ab7b4: field reason is nil") + } + if err := m.Reason.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#9a8ab7b4: field reason: %w", err) } - b.PutBool(m.ByRequest) return nil } // Decode implements bin.Decoder. func (m *MessageBotWriteAccessAllowed) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageBotWriteAccessAllowed#322dfdaa to nil") + return fmt.Errorf("can't decode messageBotWriteAccessAllowed#9a8ab7b4 to nil") } if err := b.ConsumeID(MessageBotWriteAccessAllowedTypeID); err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#322dfdaa: %w", err) + return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#9a8ab7b4: %w", err) } return m.DecodeBare(b) } @@ -11617,19 +11442,14 @@ func (m *MessageBotWriteAccessAllowed) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageBotWriteAccessAllowed) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageBotWriteAccessAllowed#322dfdaa to nil") - } - { - if err := m.WebApp.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#322dfdaa: field web_app: %w", err) - } + return fmt.Errorf("can't decode messageBotWriteAccessAllowed#9a8ab7b4 to nil") } { - value, err := b.Bool() + value, err := DecodeBotWriteAccessAllowReason(b) if err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#322dfdaa: field by_request: %w", err) + return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#9a8ab7b4: field reason: %w", err) } - m.ByRequest = value + m.Reason = value } return nil } @@ -11637,18 +11457,18 @@ func (m *MessageBotWriteAccessAllowed) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageBotWriteAccessAllowed) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageBotWriteAccessAllowed#322dfdaa as nil") + return fmt.Errorf("can't encode messageBotWriteAccessAllowed#9a8ab7b4 as nil") } b.ObjStart() b.PutID("messageBotWriteAccessAllowed") b.Comma() - b.FieldStart("web_app") - if err := m.WebApp.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#322dfdaa: field web_app: %w", err) + b.FieldStart("reason") + if m.Reason == nil { + return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#9a8ab7b4: field reason is nil") + } + if err := m.Reason.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#9a8ab7b4: field reason: %w", err) } - b.Comma() - b.FieldStart("by_request") - b.PutBool(m.ByRequest) b.Comma() b.StripComma() b.ObjEnd() @@ -11658,25 +11478,21 @@ func (m *MessageBotWriteAccessAllowed) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageBotWriteAccessAllowed) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageBotWriteAccessAllowed#322dfdaa to nil") + return fmt.Errorf("can't decode messageBotWriteAccessAllowed#9a8ab7b4 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageBotWriteAccessAllowed"); err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#322dfdaa: %w", err) - } - case "web_app": - if err := m.WebApp.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#322dfdaa: field web_app: %w", err) + return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#9a8ab7b4: %w", err) } - case "by_request": - value, err := b.Bool() + case "reason": + value, err := DecodeTDLibJSONBotWriteAccessAllowReason(b) if err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#322dfdaa: field by_request: %w", err) + return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#9a8ab7b4: field reason: %w", err) } - m.ByRequest = value + m.Reason = value default: return b.Skip() } @@ -11684,20 +11500,12 @@ func (m *MessageBotWriteAccessAllowed) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetWebApp returns value of WebApp field. -func (m *MessageBotWriteAccessAllowed) GetWebApp() (value WebApp) { - if m == nil { - return - } - return m.WebApp -} - -// GetByRequest returns value of ByRequest field. -func (m *MessageBotWriteAccessAllowed) GetByRequest() (value bool) { +// GetReason returns value of Reason field. +func (m *MessageBotWriteAccessAllowed) GetReason() (value BotWriteAccessAllowReasonClass) { if m == nil { return } - return m.ByRequest + return m.Reason } // MessageWebAppDataSent represents TL type `messageWebAppDataSent#fb033912`. @@ -12945,8 +12753,7 @@ const MessageContentClassName = "MessageContent" // case *tdapi.MessageContactRegistered: // messageContactRegistered#a678fcff // case *tdapi.MessageUserShared: // messageUserShared#d4dcb77c // case *tdapi.MessageChatShared: // messageChatShared#22db7091 -// case *tdapi.MessageWebsiteConnected: // messageWebsiteConnected#bff3a408 -// case *tdapi.MessageBotWriteAccessAllowed: // messageBotWriteAccessAllowed#322dfdaa +// case *tdapi.MessageBotWriteAccessAllowed: // messageBotWriteAccessAllowed#9a8ab7b4 // case *tdapi.MessageWebAppDataSent: // messageWebAppDataSent#fb033912 // case *tdapi.MessageWebAppDataReceived: // messageWebAppDataReceived#ff7d1a15 // case *tdapi.MessagePassportDataSent: // messagePassportDataSent#26c5ed6b @@ -13362,15 +13169,8 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case MessageWebsiteConnectedTypeID: - // Decoding messageWebsiteConnected#bff3a408. - v := MessageWebsiteConnected{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil case MessageBotWriteAccessAllowedTypeID: - // Decoding messageBotWriteAccessAllowed#322dfdaa. + // Decoding messageBotWriteAccessAllowed#9a8ab7b4. v := MessageBotWriteAccessAllowed{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) @@ -13808,15 +13608,8 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil - case "messageWebsiteConnected": - // Decoding messageWebsiteConnected#bff3a408. - v := MessageWebsiteConnected{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil case "messageBotWriteAccessAllowed": - // Decoding messageBotWriteAccessAllowed#322dfdaa. + // Decoding messageBotWriteAccessAllowed#9a8ab7b4. v := MessageBotWriteAccessAllowed{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) diff --git a/tdapi/tl_message_forward_origin_gen.go b/tdapi/tl_message_forward_origin_gen.go index 6cac8645cc..82d0fe3789 100644 --- a/tdapi/tl_message_forward_origin_gen.go +++ b/tdapi/tl_message_forward_origin_gen.go @@ -798,172 +798,6 @@ func (m *MessageForwardOriginChannel) GetAuthorSignature() (value string) { return m.AuthorSignature } -// MessageForwardOriginMessageImport represents TL type `messageForwardOriginMessageImport#d3eb2e21`. -type MessageForwardOriginMessageImport struct { - // Name of the sender - SenderName string -} - -// MessageForwardOriginMessageImportTypeID is TL type id of MessageForwardOriginMessageImport. -const MessageForwardOriginMessageImportTypeID = 0xd3eb2e21 - -// construct implements constructor of MessageForwardOriginClass. -func (m MessageForwardOriginMessageImport) construct() MessageForwardOriginClass { return &m } - -// Ensuring interfaces in compile-time for MessageForwardOriginMessageImport. -var ( - _ bin.Encoder = &MessageForwardOriginMessageImport{} - _ bin.Decoder = &MessageForwardOriginMessageImport{} - _ bin.BareEncoder = &MessageForwardOriginMessageImport{} - _ bin.BareDecoder = &MessageForwardOriginMessageImport{} - - _ MessageForwardOriginClass = &MessageForwardOriginMessageImport{} -) - -func (m *MessageForwardOriginMessageImport) Zero() bool { - if m == nil { - return true - } - if !(m.SenderName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageForwardOriginMessageImport) String() string { - if m == nil { - return "MessageForwardOriginMessageImport(nil)" - } - type Alias MessageForwardOriginMessageImport - return fmt.Sprintf("MessageForwardOriginMessageImport%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageForwardOriginMessageImport) TypeID() uint32 { - return MessageForwardOriginMessageImportTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageForwardOriginMessageImport) TypeName() string { - return "messageForwardOriginMessageImport" -} - -// TypeInfo returns info about TL type. -func (m *MessageForwardOriginMessageImport) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageForwardOriginMessageImport", - ID: MessageForwardOriginMessageImportTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderName", - SchemaName: "sender_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageForwardOriginMessageImport) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForwardOriginMessageImport#d3eb2e21 as nil") - } - b.PutID(MessageForwardOriginMessageImportTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageForwardOriginMessageImport) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForwardOriginMessageImport#d3eb2e21 as nil") - } - b.PutString(m.SenderName) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageForwardOriginMessageImport) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForwardOriginMessageImport#d3eb2e21 to nil") - } - if err := b.ConsumeID(MessageForwardOriginMessageImportTypeID); err != nil { - return fmt.Errorf("unable to decode messageForwardOriginMessageImport#d3eb2e21: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageForwardOriginMessageImport) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForwardOriginMessageImport#d3eb2e21 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageForwardOriginMessageImport#d3eb2e21: field sender_name: %w", err) - } - m.SenderName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageForwardOriginMessageImport) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageForwardOriginMessageImport#d3eb2e21 as nil") - } - b.ObjStart() - b.PutID("messageForwardOriginMessageImport") - b.Comma() - b.FieldStart("sender_name") - b.PutString(m.SenderName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageForwardOriginMessageImport) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageForwardOriginMessageImport#d3eb2e21 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageForwardOriginMessageImport"); err != nil { - return fmt.Errorf("unable to decode messageForwardOriginMessageImport#d3eb2e21: %w", err) - } - case "sender_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageForwardOriginMessageImport#d3eb2e21: field sender_name: %w", err) - } - m.SenderName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderName returns value of SenderName field. -func (m *MessageForwardOriginMessageImport) GetSenderName() (value string) { - if m == nil { - return - } - return m.SenderName -} - // MessageForwardOriginClassName is schema name of MessageForwardOriginClass. const MessageForwardOriginClassName = "MessageForwardOrigin" @@ -980,7 +814,6 @@ const MessageForwardOriginClassName = "MessageForwardOrigin" // case *tdapi.MessageForwardOriginChat: // messageForwardOriginChat#5af51364 // case *tdapi.MessageForwardOriginHiddenUser: // messageForwardOriginHiddenUser#efd4eee3 // case *tdapi.MessageForwardOriginChannel: // messageForwardOriginChannel#58dabee3 -// case *tdapi.MessageForwardOriginMessageImport: // messageForwardOriginMessageImport#d3eb2e21 // default: panic(v) // } type MessageForwardOriginClass interface { @@ -1040,13 +873,6 @@ func DecodeMessageForwardOrigin(buf *bin.Buffer) (MessageForwardOriginClass, err return nil, fmt.Errorf("unable to decode MessageForwardOriginClass: %w", err) } return &v, nil - case MessageForwardOriginMessageImportTypeID: - // Decoding messageForwardOriginMessageImport#d3eb2e21. - v := MessageForwardOriginMessageImport{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageForwardOriginClass: %w", err) - } - return &v, nil default: return nil, fmt.Errorf("unable to decode MessageForwardOriginClass: %w", bin.NewUnexpectedID(id)) } @@ -1087,13 +913,6 @@ func DecodeTDLibJSONMessageForwardOrigin(buf tdjson.Decoder) (MessageForwardOrig return nil, fmt.Errorf("unable to decode MessageForwardOriginClass: %w", err) } return &v, nil - case "messageForwardOriginMessageImport": - // Decoding messageForwardOriginMessageImport#d3eb2e21. - v := MessageForwardOriginMessageImport{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageForwardOriginClass: %w", err) - } - return &v, nil default: return nil, fmt.Errorf("unable to decode MessageForwardOriginClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_message_gen.go b/tdapi/tl_message_gen.go index 374d21726b..238fb96ce5 100644 --- a/tdapi/tl_message_gen.go +++ b/tdapi/tl_message_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Message represents TL type `message#a516cc02`. +// Message represents TL type `message#12947545`. type Message struct { // Message identifier; unique for the chat to which the message belongs ID int64 @@ -92,6 +92,9 @@ type Message struct { EditDate int32 // Information about the initial message sender; may be null if none or unknown ForwardInfo MessageForwardInfo + // Information about the initial message for messages created with importMessages; may be + // null if the message isn't imported + ImportInfo MessageImportInfo // Information about interactions with the message; may be null if none InteractionInfo MessageInteractionInfo // Information about unread reactions added to the message @@ -127,7 +130,7 @@ type Message struct { } // MessageTypeID is TL type id of Message. -const MessageTypeID = 0xa516cc02 +const MessageTypeID = 0x12947545 // Ensuring interfaces in compile-time for Message. var ( @@ -216,6 +219,9 @@ func (m *Message) Zero() bool { if !(m.ForwardInfo.Zero()) { return false } + if !(m.ImportInfo.Zero()) { + return false + } if !(m.InteractionInfo.Zero()) { return false } @@ -391,6 +397,10 @@ func (m *Message) TypeInfo() tdp.Type { Name: "ForwardInfo", SchemaName: "forward_info", }, + { + Name: "ImportInfo", + SchemaName: "import_info", + }, { Name: "InteractionInfo", SchemaName: "interaction_info", @@ -450,7 +460,7 @@ func (m *Message) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *Message) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#a516cc02 as nil") + return fmt.Errorf("can't encode message#12947545 as nil") } b.PutID(MessageTypeID) return m.EncodeBare(b) @@ -459,27 +469,27 @@ func (m *Message) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *Message) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#a516cc02 as nil") + return fmt.Errorf("can't encode message#12947545 as nil") } b.PutInt53(m.ID) if m.SenderID == nil { - return fmt.Errorf("unable to encode message#a516cc02: field sender_id is nil") + return fmt.Errorf("unable to encode message#12947545: field sender_id is nil") } if err := m.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field sender_id: %w", err) + return fmt.Errorf("unable to encode message#12947545: field sender_id: %w", err) } b.PutInt53(m.ChatID) if m.SendingState == nil { - return fmt.Errorf("unable to encode message#a516cc02: field sending_state is nil") + return fmt.Errorf("unable to encode message#12947545: field sending_state is nil") } if err := m.SendingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field sending_state: %w", err) + return fmt.Errorf("unable to encode message#12947545: field sending_state: %w", err) } if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#a516cc02: field scheduling_state is nil") + return fmt.Errorf("unable to encode message#12947545: field scheduling_state is nil") } if err := m.SchedulingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field scheduling_state: %w", err) + return fmt.Errorf("unable to encode message#12947545: field scheduling_state: %w", err) } b.PutBool(m.IsOutgoing) b.PutBool(m.IsPinned) @@ -501,29 +511,32 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { b.PutInt32(m.Date) b.PutInt32(m.EditDate) if err := m.ForwardInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field forward_info: %w", err) + return fmt.Errorf("unable to encode message#12947545: field forward_info: %w", err) + } + if err := m.ImportInfo.Encode(b); err != nil { + return fmt.Errorf("unable to encode message#12947545: field import_info: %w", err) } if err := m.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field interaction_info: %w", err) + return fmt.Errorf("unable to encode message#12947545: field interaction_info: %w", err) } b.PutInt(len(m.UnreadReactions)) for idx, v := range m.UnreadReactions { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare message#a516cc02: field unread_reactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare message#12947545: field unread_reactions element with index %d: %w", idx, err) } } if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#a516cc02: field reply_to is nil") + return fmt.Errorf("unable to encode message#12947545: field reply_to is nil") } if err := m.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field reply_to: %w", err) + return fmt.Errorf("unable to encode message#12947545: field reply_to: %w", err) } b.PutInt53(m.MessageThreadID) if m.SelfDestructType == nil { - return fmt.Errorf("unable to encode message#a516cc02: field self_destruct_type is nil") + return fmt.Errorf("unable to encode message#12947545: field self_destruct_type is nil") } if err := m.SelfDestructType.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field self_destruct_type: %w", err) + return fmt.Errorf("unable to encode message#12947545: field self_destruct_type: %w", err) } b.PutDouble(m.SelfDestructIn) b.PutDouble(m.AutoDeleteIn) @@ -532,16 +545,16 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { b.PutLong(m.MediaAlbumID) b.PutString(m.RestrictionReason) if m.Content == nil { - return fmt.Errorf("unable to encode message#a516cc02: field content is nil") + return fmt.Errorf("unable to encode message#12947545: field content is nil") } if err := m.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field content: %w", err) + return fmt.Errorf("unable to encode message#12947545: field content: %w", err) } if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#a516cc02: field reply_markup is nil") + return fmt.Errorf("unable to encode message#12947545: field reply_markup is nil") } if err := m.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#12947545: field reply_markup: %w", err) } return nil } @@ -549,10 +562,10 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *Message) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#a516cc02 to nil") + return fmt.Errorf("can't decode message#12947545 to nil") } if err := b.ConsumeID(MessageTypeID); err != nil { - return fmt.Errorf("unable to decode message#a516cc02: %w", err) + return fmt.Errorf("unable to decode message#12947545: %w", err) } return m.DecodeBare(b) } @@ -560,190 +573,195 @@ func (m *Message) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *Message) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#a516cc02 to nil") + return fmt.Errorf("can't decode message#12947545 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field id: %w", err) } m.ID = value } { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field sender_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field sender_id: %w", err) } m.SenderID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field chat_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field chat_id: %w", err) } m.ChatID = value } { value, err := DecodeMessageSendingState(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field sending_state: %w", err) + return fmt.Errorf("unable to decode message#12947545: field sending_state: %w", err) } m.SendingState = value } { value, err := DecodeMessageSchedulingState(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field scheduling_state: %w", err) + return fmt.Errorf("unable to decode message#12947545: field scheduling_state: %w", err) } m.SchedulingState = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode message#12947545: field is_outgoing: %w", err) } m.IsOutgoing = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field is_pinned: %w", err) + return fmt.Errorf("unable to decode message#12947545: field is_pinned: %w", err) } m.IsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_edited: %w", err) } m.CanBeEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_forwarded: %w", err) } m.CanBeForwarded = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_saved: %w", err) } m.CanBeSaved = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_deleted_only_for_self: %w", err) } m.CanBeDeletedOnlyForSelf = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_deleted_for_all_users: %w", err) } m.CanBeDeletedForAllUsers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_added_reactions: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_added_reactions: %w", err) } m.CanGetAddedReactions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_statistics: %w", err) } m.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_message_thread: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_message_thread: %w", err) } m.CanGetMessageThread = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_viewers: %w", err) } m.CanGetViewers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_media_timestamp_links: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_media_timestamp_links: %w", err) } m.CanGetMediaTimestampLinks = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_report_reactions: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_report_reactions: %w", err) } m.CanReportReactions = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field has_timestamped_media: %w", err) + return fmt.Errorf("unable to decode message#12947545: field has_timestamped_media: %w", err) } m.HasTimestampedMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field is_channel_post: %w", err) + return fmt.Errorf("unable to decode message#12947545: field is_channel_post: %w", err) } m.IsChannelPost = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field is_topic_message: %w", err) + return fmt.Errorf("unable to decode message#12947545: field is_topic_message: %w", err) } m.IsTopicMessage = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field contains_unread_mention: %w", err) + return fmt.Errorf("unable to decode message#12947545: field contains_unread_mention: %w", err) } m.ContainsUnreadMention = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field date: %w", err) + return fmt.Errorf("unable to decode message#12947545: field date: %w", err) } m.Date = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#12947545: field edit_date: %w", err) } m.EditDate = value } { if err := m.ForwardInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field forward_info: %w", err) + return fmt.Errorf("unable to decode message#12947545: field forward_info: %w", err) + } + } + { + if err := m.ImportInfo.Decode(b); err != nil { + return fmt.Errorf("unable to decode message#12947545: field import_info: %w", err) } } { if err := m.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field interaction_info: %w", err) + return fmt.Errorf("unable to decode message#12947545: field interaction_info: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode message#12947545: field unread_reactions: %w", err) } if headerLen > 0 { @@ -752,7 +770,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value UnreadReaction if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare message#a516cc02: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode bare message#12947545: field unread_reactions: %w", err) } m.UnreadReactions = append(m.UnreadReactions, value) } @@ -760,77 +778,77 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { { value, err := DecodeMessageReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field reply_to: %w", err) + return fmt.Errorf("unable to decode message#12947545: field reply_to: %w", err) } m.ReplyTo = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field message_thread_id: %w", err) } m.MessageThreadID = value } { value, err := DecodeMessageSelfDestructType(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field self_destruct_type: %w", err) + return fmt.Errorf("unable to decode message#12947545: field self_destruct_type: %w", err) } m.SelfDestructType = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field self_destruct_in: %w", err) + return fmt.Errorf("unable to decode message#12947545: field self_destruct_in: %w", err) } m.SelfDestructIn = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field auto_delete_in: %w", err) + return fmt.Errorf("unable to decode message#12947545: field auto_delete_in: %w", err) } m.AutoDeleteIn = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field via_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field via_bot_user_id: %w", err) } m.ViaBotUserID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field author_signature: %w", err) + return fmt.Errorf("unable to decode message#12947545: field author_signature: %w", err) } m.AuthorSignature = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field media_album_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field media_album_id: %w", err) } m.MediaAlbumID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#12947545: field restriction_reason: %w", err) } m.RestrictionReason = value } { value, err := DecodeMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field content: %w", err) + return fmt.Errorf("unable to decode message#12947545: field content: %w", err) } m.Content = value } { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#12947545: field reply_markup: %w", err) } m.ReplyMarkup = value } @@ -840,7 +858,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode message#a516cc02 as nil") + return fmt.Errorf("can't encode message#12947545 as nil") } b.ObjStart() b.PutID("message") @@ -850,10 +868,10 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("sender_id") if m.SenderID == nil { - return fmt.Errorf("unable to encode message#a516cc02: field sender_id is nil") + return fmt.Errorf("unable to encode message#12947545: field sender_id is nil") } if err := m.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field sender_id: %w", err) + return fmt.Errorf("unable to encode message#12947545: field sender_id: %w", err) } b.Comma() b.FieldStart("chat_id") @@ -861,18 +879,18 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("sending_state") if m.SendingState == nil { - return fmt.Errorf("unable to encode message#a516cc02: field sending_state is nil") + return fmt.Errorf("unable to encode message#12947545: field sending_state is nil") } if err := m.SendingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field sending_state: %w", err) + return fmt.Errorf("unable to encode message#12947545: field sending_state: %w", err) } b.Comma() b.FieldStart("scheduling_state") if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#a516cc02: field scheduling_state is nil") + return fmt.Errorf("unable to encode message#12947545: field scheduling_state is nil") } if err := m.SchedulingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field scheduling_state: %w", err) + return fmt.Errorf("unable to encode message#12947545: field scheduling_state: %w", err) } b.Comma() b.FieldStart("is_outgoing") @@ -934,19 +952,24 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("forward_info") if err := m.ForwardInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field forward_info: %w", err) + return fmt.Errorf("unable to encode message#12947545: field forward_info: %w", err) + } + b.Comma() + b.FieldStart("import_info") + if err := m.ImportInfo.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode message#12947545: field import_info: %w", err) } b.Comma() b.FieldStart("interaction_info") if err := m.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field interaction_info: %w", err) + return fmt.Errorf("unable to encode message#12947545: field interaction_info: %w", err) } b.Comma() b.FieldStart("unread_reactions") b.ArrStart() for idx, v := range m.UnreadReactions { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field unread_reactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode message#12947545: field unread_reactions element with index %d: %w", idx, err) } b.Comma() } @@ -955,10 +978,10 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("reply_to") if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#a516cc02: field reply_to is nil") + return fmt.Errorf("unable to encode message#12947545: field reply_to is nil") } if err := m.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field reply_to: %w", err) + return fmt.Errorf("unable to encode message#12947545: field reply_to: %w", err) } b.Comma() b.FieldStart("message_thread_id") @@ -966,10 +989,10 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("self_destruct_type") if m.SelfDestructType == nil { - return fmt.Errorf("unable to encode message#a516cc02: field self_destruct_type is nil") + return fmt.Errorf("unable to encode message#12947545: field self_destruct_type is nil") } if err := m.SelfDestructType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field self_destruct_type: %w", err) + return fmt.Errorf("unable to encode message#12947545: field self_destruct_type: %w", err) } b.Comma() b.FieldStart("self_destruct_in") @@ -992,18 +1015,18 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("content") if m.Content == nil { - return fmt.Errorf("unable to encode message#a516cc02: field content is nil") + return fmt.Errorf("unable to encode message#12947545: field content is nil") } if err := m.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field content: %w", err) + return fmt.Errorf("unable to encode message#12947545: field content: %w", err) } b.Comma() b.FieldStart("reply_markup") if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#a516cc02: field reply_markup is nil") + return fmt.Errorf("unable to encode message#12947545: field reply_markup is nil") } if err := m.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a516cc02: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#12947545: field reply_markup: %w", err) } b.Comma() b.StripComma() @@ -1014,242 +1037,246 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *Message) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode message#a516cc02 to nil") + return fmt.Errorf("can't decode message#12947545 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("message"); err != nil { - return fmt.Errorf("unable to decode message#a516cc02: %w", err) + return fmt.Errorf("unable to decode message#12947545: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field id: %w", err) } m.ID = value case "sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field sender_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field sender_id: %w", err) } m.SenderID = value case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field chat_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field chat_id: %w", err) } m.ChatID = value case "sending_state": value, err := DecodeTDLibJSONMessageSendingState(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field sending_state: %w", err) + return fmt.Errorf("unable to decode message#12947545: field sending_state: %w", err) } m.SendingState = value case "scheduling_state": value, err := DecodeTDLibJSONMessageSchedulingState(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field scheduling_state: %w", err) + return fmt.Errorf("unable to decode message#12947545: field scheduling_state: %w", err) } m.SchedulingState = value case "is_outgoing": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode message#12947545: field is_outgoing: %w", err) } m.IsOutgoing = value case "is_pinned": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field is_pinned: %w", err) + return fmt.Errorf("unable to decode message#12947545: field is_pinned: %w", err) } m.IsPinned = value case "can_be_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_edited: %w", err) } m.CanBeEdited = value case "can_be_forwarded": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_forwarded: %w", err) } m.CanBeForwarded = value case "can_be_saved": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_saved: %w", err) } m.CanBeSaved = value case "can_be_deleted_only_for_self": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_deleted_only_for_self: %w", err) } m.CanBeDeletedOnlyForSelf = value case "can_be_deleted_for_all_users": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_be_deleted_for_all_users: %w", err) } m.CanBeDeletedForAllUsers = value case "can_get_added_reactions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_added_reactions: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_added_reactions: %w", err) } m.CanGetAddedReactions = value case "can_get_statistics": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_statistics: %w", err) } m.CanGetStatistics = value case "can_get_message_thread": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_message_thread: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_message_thread: %w", err) } m.CanGetMessageThread = value case "can_get_viewers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_viewers: %w", err) } m.CanGetViewers = value case "can_get_media_timestamp_links": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_get_media_timestamp_links: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_get_media_timestamp_links: %w", err) } m.CanGetMediaTimestampLinks = value case "can_report_reactions": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field can_report_reactions: %w", err) + return fmt.Errorf("unable to decode message#12947545: field can_report_reactions: %w", err) } m.CanReportReactions = value case "has_timestamped_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field has_timestamped_media: %w", err) + return fmt.Errorf("unable to decode message#12947545: field has_timestamped_media: %w", err) } m.HasTimestampedMedia = value case "is_channel_post": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field is_channel_post: %w", err) + return fmt.Errorf("unable to decode message#12947545: field is_channel_post: %w", err) } m.IsChannelPost = value case "is_topic_message": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field is_topic_message: %w", err) + return fmt.Errorf("unable to decode message#12947545: field is_topic_message: %w", err) } m.IsTopicMessage = value case "contains_unread_mention": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field contains_unread_mention: %w", err) + return fmt.Errorf("unable to decode message#12947545: field contains_unread_mention: %w", err) } m.ContainsUnreadMention = value case "date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field date: %w", err) + return fmt.Errorf("unable to decode message#12947545: field date: %w", err) } m.Date = value case "edit_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#12947545: field edit_date: %w", err) } m.EditDate = value case "forward_info": if err := m.ForwardInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field forward_info: %w", err) + return fmt.Errorf("unable to decode message#12947545: field forward_info: %w", err) + } + case "import_info": + if err := m.ImportInfo.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode message#12947545: field import_info: %w", err) } case "interaction_info": if err := m.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field interaction_info: %w", err) + return fmt.Errorf("unable to decode message#12947545: field interaction_info: %w", err) } case "unread_reactions": if err := b.Arr(func(b tdjson.Decoder) error { var value UnreadReaction if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode message#12947545: field unread_reactions: %w", err) } m.UnreadReactions = append(m.UnreadReactions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode message#12947545: field unread_reactions: %w", err) } case "reply_to": value, err := DecodeTDLibJSONMessageReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field reply_to: %w", err) + return fmt.Errorf("unable to decode message#12947545: field reply_to: %w", err) } m.ReplyTo = value case "message_thread_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field message_thread_id: %w", err) } m.MessageThreadID = value case "self_destruct_type": value, err := DecodeTDLibJSONMessageSelfDestructType(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field self_destruct_type: %w", err) + return fmt.Errorf("unable to decode message#12947545: field self_destruct_type: %w", err) } m.SelfDestructType = value case "self_destruct_in": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field self_destruct_in: %w", err) + return fmt.Errorf("unable to decode message#12947545: field self_destruct_in: %w", err) } m.SelfDestructIn = value case "auto_delete_in": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field auto_delete_in: %w", err) + return fmt.Errorf("unable to decode message#12947545: field auto_delete_in: %w", err) } m.AutoDeleteIn = value case "via_bot_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field via_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field via_bot_user_id: %w", err) } m.ViaBotUserID = value case "author_signature": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field author_signature: %w", err) + return fmt.Errorf("unable to decode message#12947545: field author_signature: %w", err) } m.AuthorSignature = value case "media_album_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field media_album_id: %w", err) + return fmt.Errorf("unable to decode message#12947545: field media_album_id: %w", err) } m.MediaAlbumID = value case "restriction_reason": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#12947545: field restriction_reason: %w", err) } m.RestrictionReason = value case "content": value, err := DecodeTDLibJSONMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field content: %w", err) + return fmt.Errorf("unable to decode message#12947545: field content: %w", err) } m.Content = value case "reply_markup": value, err := DecodeTDLibJSONReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#a516cc02: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#12947545: field reply_markup: %w", err) } m.ReplyMarkup = value default: @@ -1459,6 +1486,14 @@ func (m *Message) GetForwardInfo() (value MessageForwardInfo) { return m.ForwardInfo } +// GetImportInfo returns value of ImportInfo field. +func (m *Message) GetImportInfo() (value MessageImportInfo) { + if m == nil { + return + } + return m.ImportInfo +} + // GetInteractionInfo returns value of InteractionInfo field. func (m *Message) GetInteractionInfo() (value MessageInteractionInfo) { if m == nil { diff --git a/tdapi/tl_message_import_info_gen.go b/tdapi/tl_message_import_info_gen.go new file mode 100644 index 0000000000..250c877843 --- /dev/null +++ b/tdapi/tl_message_import_info_gen.go @@ -0,0 +1,227 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessageImportInfo represents TL type `messageImportInfo#e6dfabcf`. +type MessageImportInfo struct { + // Name of the original sender + SenderName string + // Point in time (Unix timestamp) when the message was originally sent + Date int32 +} + +// MessageImportInfoTypeID is TL type id of MessageImportInfo. +const MessageImportInfoTypeID = 0xe6dfabcf + +// Ensuring interfaces in compile-time for MessageImportInfo. +var ( + _ bin.Encoder = &MessageImportInfo{} + _ bin.Decoder = &MessageImportInfo{} + _ bin.BareEncoder = &MessageImportInfo{} + _ bin.BareDecoder = &MessageImportInfo{} +) + +func (m *MessageImportInfo) Zero() bool { + if m == nil { + return true + } + if !(m.SenderName == "") { + return false + } + if !(m.Date == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageImportInfo) String() string { + if m == nil { + return "MessageImportInfo(nil)" + } + type Alias MessageImportInfo + return fmt.Sprintf("MessageImportInfo%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageImportInfo) TypeID() uint32 { + return MessageImportInfoTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageImportInfo) TypeName() string { + return "messageImportInfo" +} + +// TypeInfo returns info about TL type. +func (m *MessageImportInfo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageImportInfo", + ID: MessageImportInfoTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "SenderName", + SchemaName: "sender_name", + }, + { + Name: "Date", + SchemaName: "date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageImportInfo) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageImportInfo#e6dfabcf as nil") + } + b.PutID(MessageImportInfoTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageImportInfo) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageImportInfo#e6dfabcf as nil") + } + b.PutString(m.SenderName) + b.PutInt32(m.Date) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageImportInfo) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageImportInfo#e6dfabcf to nil") + } + if err := b.ConsumeID(MessageImportInfoTypeID); err != nil { + return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageImportInfo) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageImportInfo#e6dfabcf to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: field sender_name: %w", err) + } + m.SenderName = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: field date: %w", err) + } + m.Date = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageImportInfo) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageImportInfo#e6dfabcf as nil") + } + b.ObjStart() + b.PutID("messageImportInfo") + b.Comma() + b.FieldStart("sender_name") + b.PutString(m.SenderName) + b.Comma() + b.FieldStart("date") + b.PutInt32(m.Date) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageImportInfo) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageImportInfo#e6dfabcf to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageImportInfo"); err != nil { + return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: %w", err) + } + case "sender_name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: field sender_name: %w", err) + } + m.SenderName = value + case "date": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: field date: %w", err) + } + m.Date = value + default: + return b.Skip() + } + return nil + }) +} + +// GetSenderName returns value of SenderName field. +func (m *MessageImportInfo) GetSenderName() (value string) { + if m == nil { + return + } + return m.SenderName +} + +// GetDate returns value of Date field. +func (m *MessageImportInfo) GetDate() (value int32) { + if m == nil { + return + } + return m.Date +} diff --git a/tdapi/tl_message_reaction_gen.go b/tdapi/tl_message_reaction_gen.go index c09983348d..251d712ed0 100644 --- a/tdapi/tl_message_reaction_gen.go +++ b/tdapi/tl_message_reaction_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessageReaction represents TL type `messageReaction#2bb15e3a`. +// MessageReaction represents TL type `messageReaction#7d9e9864`. type MessageReaction struct { // Type of the reaction Type ReactionTypeClass @@ -39,13 +39,16 @@ type MessageReaction struct { TotalCount int32 // True, if the reaction is chosen by the current user IsChosen bool + // Identifier of the message sender used by the current user to add the reaction; null if + // unknown or the reaction isn't chosen + UsedSenderID MessageSenderClass // Identifiers of at most 3 recent message senders, added the reaction; available in // private, basic group and supergroup chats RecentSenderIDs []MessageSenderClass } // MessageReactionTypeID is TL type id of MessageReaction. -const MessageReactionTypeID = 0x2bb15e3a +const MessageReactionTypeID = 0x7d9e9864 // Ensuring interfaces in compile-time for MessageReaction. var ( @@ -68,6 +71,9 @@ func (m *MessageReaction) Zero() bool { if !(m.IsChosen == false) { return false } + if !(m.UsedSenderID == nil) { + return false + } if !(m.RecentSenderIDs == nil) { return false } @@ -119,6 +125,10 @@ func (m *MessageReaction) TypeInfo() tdp.Type { Name: "IsChosen", SchemaName: "is_chosen", }, + { + Name: "UsedSenderID", + SchemaName: "used_sender_id", + }, { Name: "RecentSenderIDs", SchemaName: "recent_sender_ids", @@ -130,7 +140,7 @@ func (m *MessageReaction) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageReaction) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReaction#2bb15e3a as nil") + return fmt.Errorf("can't encode messageReaction#7d9e9864 as nil") } b.PutID(MessageReactionTypeID) return m.EncodeBare(b) @@ -139,23 +149,29 @@ func (m *MessageReaction) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageReaction) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReaction#2bb15e3a as nil") + return fmt.Errorf("can't encode messageReaction#7d9e9864 as nil") } if m.Type == nil { - return fmt.Errorf("unable to encode messageReaction#2bb15e3a: field type is nil") + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field type is nil") } if err := m.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReaction#2bb15e3a: field type: %w", err) + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field type: %w", err) } b.PutInt32(m.TotalCount) b.PutBool(m.IsChosen) + if m.UsedSenderID == nil { + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field used_sender_id is nil") + } + if err := m.UsedSenderID.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field used_sender_id: %w", err) + } b.PutInt(len(m.RecentSenderIDs)) for idx, v := range m.RecentSenderIDs { if v == nil { - return fmt.Errorf("unable to encode messageReaction#2bb15e3a: field recent_sender_ids element with index %d is nil", idx) + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field recent_sender_ids element with index %d is nil", idx) } if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageReaction#2bb15e3a: field recent_sender_ids element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare messageReaction#7d9e9864: field recent_sender_ids element with index %d: %w", idx, err) } } return nil @@ -164,10 +180,10 @@ func (m *MessageReaction) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageReaction) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReaction#2bb15e3a to nil") + return fmt.Errorf("can't decode messageReaction#7d9e9864 to nil") } if err := b.ConsumeID(MessageReactionTypeID); err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: %w", err) } return m.DecodeBare(b) } @@ -175,33 +191,40 @@ func (m *MessageReaction) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageReaction) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReaction#2bb15e3a to nil") + return fmt.Errorf("can't decode messageReaction#7d9e9864 to nil") } { value, err := DecodeReactionType(b) if err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field type: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field type: %w", err) } m.Type = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field total_count: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field total_count: %w", err) } m.TotalCount = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field is_chosen: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field is_chosen: %w", err) } m.IsChosen = value } + { + value, err := DecodeMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field used_sender_id: %w", err) + } + m.UsedSenderID = value + } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field recent_sender_ids: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field recent_sender_ids: %w", err) } if headerLen > 0 { @@ -210,7 +233,7 @@ func (m *MessageReaction) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field recent_sender_ids: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field recent_sender_ids: %w", err) } m.RecentSenderIDs = append(m.RecentSenderIDs, value) } @@ -221,17 +244,17 @@ func (m *MessageReaction) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageReaction) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageReaction#2bb15e3a as nil") + return fmt.Errorf("can't encode messageReaction#7d9e9864 as nil") } b.ObjStart() b.PutID("messageReaction") b.Comma() b.FieldStart("type") if m.Type == nil { - return fmt.Errorf("unable to encode messageReaction#2bb15e3a: field type is nil") + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field type is nil") } if err := m.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReaction#2bb15e3a: field type: %w", err) + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field type: %w", err) } b.Comma() b.FieldStart("total_count") @@ -240,14 +263,22 @@ func (m *MessageReaction) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_chosen") b.PutBool(m.IsChosen) b.Comma() + b.FieldStart("used_sender_id") + if m.UsedSenderID == nil { + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field used_sender_id is nil") + } + if err := m.UsedSenderID.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field used_sender_id: %w", err) + } + b.Comma() b.FieldStart("recent_sender_ids") b.ArrStart() for idx, v := range m.RecentSenderIDs { if v == nil { - return fmt.Errorf("unable to encode messageReaction#2bb15e3a: field recent_sender_ids element with index %d is nil", idx) + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field recent_sender_ids element with index %d is nil", idx) } if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReaction#2bb15e3a: field recent_sender_ids element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messageReaction#7d9e9864: field recent_sender_ids element with index %d: %w", idx, err) } b.Comma() } @@ -262,43 +293,49 @@ func (m *MessageReaction) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageReaction) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageReaction#2bb15e3a to nil") + return fmt.Errorf("can't decode messageReaction#7d9e9864 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageReaction"); err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: %w", err) } case "type": value, err := DecodeTDLibJSONReactionType(b) if err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field type: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field type: %w", err) } m.Type = value case "total_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field total_count: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field total_count: %w", err) } m.TotalCount = value case "is_chosen": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field is_chosen: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field is_chosen: %w", err) } m.IsChosen = value + case "used_sender_id": + value, err := DecodeTDLibJSONMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field used_sender_id: %w", err) + } + m.UsedSenderID = value case "recent_sender_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field recent_sender_ids: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field recent_sender_ids: %w", err) } m.RecentSenderIDs = append(m.RecentSenderIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode messageReaction#2bb15e3a: field recent_sender_ids: %w", err) + return fmt.Errorf("unable to decode messageReaction#7d9e9864: field recent_sender_ids: %w", err) } default: return b.Skip() @@ -331,6 +368,14 @@ func (m *MessageReaction) GetIsChosen() (value bool) { return m.IsChosen } +// GetUsedSenderID returns value of UsedSenderID field. +func (m *MessageReaction) GetUsedSenderID() (value MessageSenderClass) { + if m == nil { + return + } + return m.UsedSenderID +} + // GetRecentSenderIDs returns value of RecentSenderIDs field. func (m *MessageReaction) GetRecentSenderIDs() (value []MessageSenderClass) { if m == nil { diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index 6017f69c70..35549b1723 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -219,19 +219,19 @@ func TypesMap() map[uint32]string { MessageForwardOriginChatTypeID: "messageForwardOriginChat#5af51364", MessageForwardOriginHiddenUserTypeID: "messageForwardOriginHiddenUser#efd4eee3", MessageForwardOriginChannelTypeID: "messageForwardOriginChannel#58dabee3", - MessageForwardOriginMessageImportTypeID: "messageForwardOriginMessageImport#d3eb2e21", ReactionTypeEmojiTypeID: "reactionTypeEmoji#8c3e22c8", ReactionTypeCustomEmojiTypeID: "reactionTypeCustomEmoji#c50b42f3", MessageForwardInfoTypeID: "messageForwardInfo#ec7dcac8", + MessageImportInfoTypeID: "messageImportInfo#e6dfabcf", MessageReplyInfoTypeID: "messageReplyInfo#69240cb9", - MessageReactionTypeID: "messageReaction#2bb15e3a", + MessageReactionTypeID: "messageReaction#7d9e9864", MessageInteractionInfoTypeID: "messageInteractionInfo#4af275ac", UnreadReactionTypeID: "unreadReaction#8c5b3b82", MessageSendingStatePendingTypeID: "messageSendingStatePending#f32b63b4", MessageSendingStateFailedTypeID: "messageSendingStateFailed#fb75b2af", MessageReplyToMessageTypeID: "messageReplyToMessage#deb02f02", MessageReplyToStoryTypeID: "messageReplyToStory#708ca939", - MessageTypeID: "message#a516cc02", + MessageTypeID: "message#12947545", MessagesTypeID: "messages#b34c8c60", FoundMessagesTypeID: "foundMessages#2515f708", FoundChatMessagesTypeID: "foundChatMessages#4a25270c", @@ -547,8 +547,7 @@ func TypesMap() map[uint32]string { MessageContactRegisteredTypeID: "messageContactRegistered#a678fcff", MessageUserSharedTypeID: "messageUserShared#d4dcb77c", MessageChatSharedTypeID: "messageChatShared#22db7091", - MessageWebsiteConnectedTypeID: "messageWebsiteConnected#bff3a408", - MessageBotWriteAccessAllowedTypeID: "messageBotWriteAccessAllowed#322dfdaa", + MessageBotWriteAccessAllowedTypeID: "messageBotWriteAccessAllowed#9a8ab7b4", MessageWebAppDataSentTypeID: "messageWebAppDataSent#fb033912", MessageWebAppDataReceivedTypeID: "messageWebAppDataReceived#ff7d1a15", MessagePassportDataSentTypeID: "messagePassportDataSent#26c5ed6b", @@ -675,7 +674,7 @@ func TypesMap() map[uint32]string { StoriesTypeID: "stories#5a860711", StoryInfoTypeID: "storyInfo#8997c352", ChatActiveStoriesTypeID: "chatActiveStories#d923d773", - ChatBoostStatusTypeID: "chatBoostStatus#cd6a3f87", + ChatBoostStatusTypeID: "chatBoostStatus#dc02a4b2", ChatBoostTypeID: "chatBoost#8d029d82", FoundChatBoostsTypeID: "foundChatBoosts#dc80d52e", CallDiscardReasonEmptyTypeID: "callDiscardReasonEmpty#b4f66fc3", @@ -719,7 +718,7 @@ func TypesMap() map[uint32]string { FirebaseAuthenticationSettingsAndroidTypeID: "firebaseAuthenticationSettingsAndroid#966ef61c", FirebaseAuthenticationSettingsIosTypeID: "firebaseAuthenticationSettingsIos#d49a4c4", PhoneNumberAuthenticationSettingsTypeID: "phoneNumberAuthenticationSettings#c6e19fa1", - AddedReactionTypeID: "addedReaction#63514a16", + AddedReactionTypeID: "addedReaction#4b04819d", AddedReactionsTypeID: "addedReactions#77bf7590", AvailableReactionTypeID: "availableReaction#f9024387", AvailableReactionsTypeID: "availableReactions#d5568da9", @@ -734,6 +733,10 @@ func TypesMap() map[uint32]string { AttachmentMenuBotColorTypeID: "attachmentMenuBotColor#64235ebc", AttachmentMenuBotTypeID: "attachmentMenuBot#2176d831", SentWebAppMessageTypeID: "sentWebAppMessage#4a24eec0", + BotWriteAccessAllowReasonConnectedWebsiteTypeID: "botWriteAccessAllowReasonConnectedWebsite#782eafe3", + BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID: "botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d", + BotWriteAccessAllowReasonLaunchedWebAppTypeID: "botWriteAccessAllowReasonLaunchedWebApp#f1a504d7", + BotWriteAccessAllowReasonAcceptedRequestTypeID: "botWriteAccessAllowReasonAcceptedRequest#89c63bfc", HTTPURLTypeID: "httpUrl#87b775a6", UserLinkTypeID: "userLink#1db0fef8", InputInlineQueryResultAnimationTypeID: "inputInlineQueryResultAnimation#a7335216", @@ -2166,10 +2169,10 @@ func NamesMap() map[string]uint32 { "messageForwardOriginChat": MessageForwardOriginChatTypeID, "messageForwardOriginHiddenUser": MessageForwardOriginHiddenUserTypeID, "messageForwardOriginChannel": MessageForwardOriginChannelTypeID, - "messageForwardOriginMessageImport": MessageForwardOriginMessageImportTypeID, "reactionTypeEmoji": ReactionTypeEmojiTypeID, "reactionTypeCustomEmoji": ReactionTypeCustomEmojiTypeID, "messageForwardInfo": MessageForwardInfoTypeID, + "messageImportInfo": MessageImportInfoTypeID, "messageReplyInfo": MessageReplyInfoTypeID, "messageReaction": MessageReactionTypeID, "messageInteractionInfo": MessageInteractionInfoTypeID, @@ -2494,7 +2497,6 @@ func NamesMap() map[string]uint32 { "messageContactRegistered": MessageContactRegisteredTypeID, "messageUserShared": MessageUserSharedTypeID, "messageChatShared": MessageChatSharedTypeID, - "messageWebsiteConnected": MessageWebsiteConnectedTypeID, "messageBotWriteAccessAllowed": MessageBotWriteAccessAllowedTypeID, "messageWebAppDataSent": MessageWebAppDataSentTypeID, "messageWebAppDataReceived": MessageWebAppDataReceivedTypeID, @@ -2681,6 +2683,10 @@ func NamesMap() map[string]uint32 { "attachmentMenuBotColor": AttachmentMenuBotColorTypeID, "attachmentMenuBot": AttachmentMenuBotTypeID, "sentWebAppMessage": SentWebAppMessageTypeID, + "botWriteAccessAllowReasonConnectedWebsite": BotWriteAccessAllowReasonConnectedWebsiteTypeID, + "botWriteAccessAllowReasonAddedToAttachmentMenu": BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID, + "botWriteAccessAllowReasonLaunchedWebApp": BotWriteAccessAllowReasonLaunchedWebAppTypeID, + "botWriteAccessAllowReasonAcceptedRequest": BotWriteAccessAllowReasonAcceptedRequestTypeID, "httpUrl": HTTPURLTypeID, "userLink": UserLinkTypeID, "inputInlineQueryResultAnimation": InputInlineQueryResultAnimationTypeID, @@ -4113,10 +4119,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageForwardOriginChatTypeID: func() bin.Object { return &MessageForwardOriginChat{} }, MessageForwardOriginHiddenUserTypeID: func() bin.Object { return &MessageForwardOriginHiddenUser{} }, MessageForwardOriginChannelTypeID: func() bin.Object { return &MessageForwardOriginChannel{} }, - MessageForwardOriginMessageImportTypeID: func() bin.Object { return &MessageForwardOriginMessageImport{} }, ReactionTypeEmojiTypeID: func() bin.Object { return &ReactionTypeEmoji{} }, ReactionTypeCustomEmojiTypeID: func() bin.Object { return &ReactionTypeCustomEmoji{} }, MessageForwardInfoTypeID: func() bin.Object { return &MessageForwardInfo{} }, + MessageImportInfoTypeID: func() bin.Object { return &MessageImportInfo{} }, MessageReplyInfoTypeID: func() bin.Object { return &MessageReplyInfo{} }, MessageReactionTypeID: func() bin.Object { return &MessageReaction{} }, MessageInteractionInfoTypeID: func() bin.Object { return &MessageInteractionInfo{} }, @@ -4441,7 +4447,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageContactRegisteredTypeID: func() bin.Object { return &MessageContactRegistered{} }, MessageUserSharedTypeID: func() bin.Object { return &MessageUserShared{} }, MessageChatSharedTypeID: func() bin.Object { return &MessageChatShared{} }, - MessageWebsiteConnectedTypeID: func() bin.Object { return &MessageWebsiteConnected{} }, MessageBotWriteAccessAllowedTypeID: func() bin.Object { return &MessageBotWriteAccessAllowed{} }, MessageWebAppDataSentTypeID: func() bin.Object { return &MessageWebAppDataSent{} }, MessageWebAppDataReceivedTypeID: func() bin.Object { return &MessageWebAppDataReceived{} }, @@ -4628,6 +4633,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AttachmentMenuBotColorTypeID: func() bin.Object { return &AttachmentMenuBotColor{} }, AttachmentMenuBotTypeID: func() bin.Object { return &AttachmentMenuBot{} }, SentWebAppMessageTypeID: func() bin.Object { return &SentWebAppMessage{} }, + BotWriteAccessAllowReasonConnectedWebsiteTypeID: func() bin.Object { return &BotWriteAccessAllowReasonConnectedWebsite{} }, + BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID: func() bin.Object { return &BotWriteAccessAllowReasonAddedToAttachmentMenu{} }, + BotWriteAccessAllowReasonLaunchedWebAppTypeID: func() bin.Object { return &BotWriteAccessAllowReasonLaunchedWebApp{} }, + BotWriteAccessAllowReasonAcceptedRequestTypeID: func() bin.Object { return &BotWriteAccessAllowReasonAcceptedRequest{} }, HTTPURLTypeID: func() bin.Object { return &HTTPURL{} }, UserLinkTypeID: func() bin.Object { return &UserLink{} }, InputInlineQueryResultAnimationTypeID: func() bin.Object { return &InputInlineQueryResultAnimation{} }, @@ -5932,6 +5941,12 @@ func ClassConstructorsMap() map[string][]uint32 { BotCommandScopeChatAdministratorsTypeID, BotCommandScopeChatMemberTypeID, }, + BotWriteAccessAllowReasonClassName: { + BotWriteAccessAllowReasonConnectedWebsiteTypeID, + BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID, + BotWriteAccessAllowReasonLaunchedWebAppTypeID, + BotWriteAccessAllowReasonAcceptedRequestTypeID, + }, CallDiscardReasonClassName: { CallDiscardReasonEmptyTypeID, CallDiscardReasonMissedTypeID, @@ -6453,7 +6468,6 @@ func ClassConstructorsMap() map[string][]uint32 { MessageContactRegisteredTypeID, MessageUserSharedTypeID, MessageChatSharedTypeID, - MessageWebsiteConnectedTypeID, MessageBotWriteAccessAllowedTypeID, MessageWebAppDataSentTypeID, MessageWebAppDataReceivedTypeID, @@ -6478,7 +6492,6 @@ func ClassConstructorsMap() map[string][]uint32 { MessageForwardOriginChatTypeID, MessageForwardOriginHiddenUserTypeID, MessageForwardOriginChannelTypeID, - MessageForwardOriginMessageImportTypeID, }, MessageReplyToClassName: { MessageReplyToMessageTypeID,