From b609a337f24ae0db5ff7d33e46e3a72e3c2cb5a2 Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 1 Feb 2022 05:03:26 +0000 Subject: [PATCH] feat(schema): update TDLib to the latest layer --- _schema/tdapi.tl | 330 +- tdapi/tl_add_sticker_to_set_gen.go | 58 +- tdapi/tl_added_reaction_gen.go | 237 ++ tdapi/tl_added_reactions_gen.go | 289 ++ tdapi/tl_available_reactions_gen.go | 217 + tdapi/tl_chat_event_action_gen.go | 3621 +++++++++-------- tdapi/tl_chat_gen.go | 290 +- tdapi/tl_create_new_sticker_set_gen.go | 110 +- tdapi/tl_delete_commands_gen.go | 2 +- tdapi/tl_get_chat_message_calendar_gen.go | 4 +- ...l_get_chat_sparse_message_positions_gen.go | 4 +- tdapi/tl_get_commands_gen.go | 2 +- tdapi/tl_get_message_added_reactions_gen.go | 342 ++ .../tl_get_message_available_reactions_gen.go | 237 ++ tdapi/tl_get_message_public_forwards_gen.go | 2 +- tdapi/tl_get_phone_number_info_sync_gen.go | 2 +- tdapi/tl_input_inline_query_result_gen.go | 2 +- tdapi/tl_input_sticker_gen.go | 507 +-- tdapi/tl_message_gen.go | 306 +- tdapi/tl_message_interaction_info_gen.go | 98 +- tdapi/tl_message_reaction_gen.go | 330 ++ tdapi/tl_reaction_gen.go | 499 +++ tdapi/tl_read_all_chat_reactions_gen.go | 206 + tdapi/tl_registry_gen.go | 233 +- tdapi/tl_search_messages_filter_gen.go | 146 + tdapi/tl_search_messages_gen.go | 4 +- tdapi/tl_search_secret_messages_gen.go | 2 +- tdapi/tl_set_chat_available_reactions_gen.go | 262 ++ tdapi/tl_set_commands_gen.go | 2 +- tdapi/tl_set_message_reaction_gen.go | 306 ++ tdapi/tl_set_sticker_set_thumbnail_gen.go | 4 +- tdapi/tl_sticker_gen.go | 174 +- tdapi/tl_sticker_set_gen.go | 176 +- tdapi/tl_sticker_set_info_gen.go | 167 +- tdapi/tl_sticker_type_gen.go | 757 ++++ tdapi/tl_supergroup_full_info_gen.go | 2 +- tdapi/tl_thumbnail_format_gen.go | 528 ++- tdapi/tl_translate_text_gen.go | 273 ++ tdapi/tl_unread_reaction_gen.go | 271 ++ tdapi/tl_update_gen.go | 1220 +++++- tdapi/tl_upload_sticker_file_gen.go | 54 +- 41 files changed, 8981 insertions(+), 3295 deletions(-) create mode 100644 tdapi/tl_added_reaction_gen.go create mode 100644 tdapi/tl_added_reactions_gen.go create mode 100644 tdapi/tl_available_reactions_gen.go create mode 100644 tdapi/tl_get_message_added_reactions_gen.go create mode 100644 tdapi/tl_get_message_available_reactions_gen.go create mode 100644 tdapi/tl_message_reaction_gen.go create mode 100644 tdapi/tl_reaction_gen.go create mode 100644 tdapi/tl_read_all_chat_reactions_gen.go create mode 100644 tdapi/tl_set_chat_available_reactions_gen.go create mode 100644 tdapi/tl_set_message_reaction_gen.go create mode 100644 tdapi/tl_sticker_type_gen.go create mode 100644 tdapi/tl_translate_text_gen.go create mode 100644 tdapi/tl_unread_reaction_gen.go diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index 0670d25bb9..7861f9f476 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: 7b657ebd2abcabe433966470e028e8b0845479c43bbe21802def0de7ef9c0de0 +// SHA256: 1f6e2f2cbf4be894027a2a886a5e452a3547eae12ab417a965a4c6857f2689c6 double#2210c154 ? = Double; @@ -222,26 +222,29 @@ photoSize#18e56d39 type:string photo:file width:int32 height:int32 progressive_s //@data The thumbnail in JPEG format minithumbnail#ec6addaa width:int32 height:int32 data:bytes = Minithumbnail; -//@class ThumbnailFormat @description Describes format of the thumbnail +//@class ThumbnailFormat @description Describes format of a thumbnail //@description The thumbnail is in JPEG format thumbnailFormatJpeg#d90c5488 = ThumbnailFormat; -//@description The thumbnail is in PNG format. It will be used only for background patterns -thumbnailFormatPng#5e0697f5 = ThumbnailFormat; - -//@description The thumbnail is in WEBP format. It will be used only for some stickers -thumbnailFormatWebp#fcce4c12 = ThumbnailFormat; - //@description The thumbnail is in static GIF format. It will be used only for some bot inline results thumbnailFormatGif#4aa3258a = ThumbnailFormat; -//@description The thumbnail is in TGS format. It will be used only for animated sticker sets -thumbnailFormatTgs#4e694852 = ThumbnailFormat; - //@description The thumbnail is in MPEG4 format. It will be used only for some animations and videos thumbnailFormatMpeg4#109b57fe = ThumbnailFormat; +//@description The thumbnail is in PNG format. It will be used only for background patterns +thumbnailFormatPng#5e0697f5 = ThumbnailFormat; + +//@description The thumbnail is in TGS format. It will be used only for TGS sticker sets +thumbnailFormatTgs#4e694852 = ThumbnailFormat; + +//@description The thumbnail is in WEBM format. It will be used only for WEBM sticker sets +thumbnailFormatWebm#d8a7e727 = ThumbnailFormat; + +//@description The thumbnail is in WEBP format. It will be used only for some stickers +thumbnailFormatWebp#fcce4c12 = ThumbnailFormat; + //@description Represents a thumbnail //@format Thumbnail format //@width Thumbnail width @@ -270,6 +273,21 @@ maskPointChin#1fe36187 = MaskPoint; //@scale Mask scaling coefficient. (For example, 2.0 means a doubled size) maskPosition#82fbb63e point:MaskPoint x_shift:double y_shift:double scale:double = MaskPosition; +//@class StickerType @description Describes type of a sticker + +//@description The sticker is an image in WEBP format +stickerTypeStatic#6b8e3cd1 = StickerType; + +//@description The sticker is an animation in TGS format +stickerTypeAnimated#691926ad = StickerType; + +//@description The sticker is a video in WEBM format +stickerTypeVideo#1f22af74 = StickerType; + +//@description The sticker is a mask in WEBP format to be placed on photos or videos +//@mask_position Position where the mask is placed; may be null +stickerTypeMask#cdf254e3 mask_position:maskPosition = StickerType; + //@description Represents a closed vector path. The path begins at the end point of the last command //@commands List of vector path commands closedVectorPath#2f9276b9 commands:vector = ClosedVectorPath; @@ -335,13 +353,11 @@ photo#105a0689 has_stickers:Bool minithumbnail:minithumbnail sizes:vector thumbnail:thumbnail sticker:file = Sticker; +sticker#f2a43be4 set_id:int64 width:int32 height:int32 emoji:string type:StickerType outline:vector thumbnail:thumbnail sticker:file = Sticker; //@description Describes a video file //@duration Duration of the video, in seconds; as defined by the sender @@ -798,7 +814,7 @@ supergroup#d4f3e735 id:int53 username:string date:int32 status:ChatMemberStatus //@is_all_history_available True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators //@sticker_set_id Identifier of the supergroup sticker set; 0 if none //@location Location to which the supergroup is connected; may be null -//@invite_link Primary invite link for this chat; may be null. For chat administrators with can_invite_users right only +//@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only //@bot_commands List of commands of bots in the group //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none @@ -880,11 +896,25 @@ messageForwardInfo#ec7dcac8 origin:MessageForwardOrigin date:int32 public_servic //@last_message_id Identifier of the last reply to the message messageReplyInfo#69240cb9 reply_count:int32 recent_replier_ids:vector last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 last_message_id:int53 = MessageReplyInfo; +//@description Contains information about a reaction to a message +//@reaction Text representation of the reaction +//@total_count Number of times the reaction was added +//@is_chosen True, if the reaction is chosen by the current user +//@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private chats, basic groups and supergroups +messageReaction#7c4179cb reaction:string total_count:int32 is_chosen:Bool recent_sender_ids:vector = MessageReaction; + //@description Contains information about interactions with a message //@view_count Number of times the message was viewed //@forward_count Number of times the message was forwarded //@reply_info Information about direct or indirect replies to the message; may be null. Currently, available only in channels with a discussion supergroup and discussion supergroups for messages, which are not replies itself -messageInteractionInfo#db00a42a view_count:int32 forward_count:int32 reply_info:messageReplyInfo = MessageInteractionInfo; +//@reactions The list of reactions added to the message +messageInteractionInfo#4af275ac view_count:int32 forward_count:int32 reply_info:messageReplyInfo reactions:vector = MessageInteractionInfo; + +//@description Contains information about an unread reaction to a message +//@reaction Text representation of the reaction +//@sender_id Identifier of the sender, added the reaction +//@is_big True, if the reaction was added with a big animation +unreadReaction#54afb43 reaction:string sender_id:MessageSender is_big:Bool = UnreadReaction; //@class MessageSendingState @description Contains information about the sending state of the message @@ -912,10 +942,11 @@ messageSendingStateFailed#982ce904 error_code:int32 error_message:string can_ret //@can_be_saved True, if content of the message can be saved locally or copied //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it //@can_be_deleted_for_all_users True, if the message can be deleted for all users -//@can_get_statistics True, if the message statistics are available -//@can_get_message_thread True, if the message thread info is available +//@can_get_added_reactions True, if the list of added reactions is available through getMessageAddedReactions +//@can_get_statistics True, if the message statistics are available through getMessageStatistics +//@can_get_message_thread True, if the message thread info is available through getMessageThread //@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers -//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or web page description +//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or web page description through getMessageLink //@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts //@contains_unread_mention True, if the message contains an unread mention for the current user @@ -923,6 +954,7 @@ messageSendingStateFailed#982ce904 error_code:int32 error_message:string can_ret //@edit_date Point in time (Unix timestamp) when the message was last edited //@forward_info Information about the initial message sender; may be null //@interaction_info Information about interactions with the message; may be null +//@unread_reactions Information about unread reactions added to the message //@reply_in_chat_id If non-zero, the identifier of the chat to which the replied message belongs; Currently, only messages in the Replies chat can have different reply_in_chat_id and chat_id //@reply_to_message_id If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs @@ -934,7 +966,7 @@ messageSendingStateFailed#982ce904 error_code:int32 error_message:string can_ret //@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 -message#c6b405b7 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_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool has_timestamped_media:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo reply_in_chat_id:int53 reply_to_message_id:int53 message_thread_id:int53 ttl:int32 ttl_expires_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message#ef20f556 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 has_timestamped_media:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_in_chat_id:int53 reply_to_message_id:int53 message_thread_id:int53 ttl:int32 ttl_expires_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 count of messages found @@ -1125,7 +1157,9 @@ videoChat#ae158d28 group_call_id:int32 has_participants:Bool default_participant //@last_read_inbox_message_id Identifier of the last read incoming message //@last_read_outbox_message_id Identifier of the last read outgoing message //@unread_mention_count Number of unread messages with a mention/reply in the chat -//@notification_settings Notification settings for this chat +//@unread_reaction_count Number of messages with unread reactions in the chat +//@notification_settings Notification settings for the chat +//@available_reactions List of reactions, available in the chat //@message_ttl Current message Time To Live setting (self-destruct timer) for the chat; 0 if not defined. TTL is counted from the time message or its content is viewed in secret chats and from the send date in other chats //@theme_name If non-empty, name of a theme, set for the chat //@action_bar Information about actions which must be possible to do through the chat action bar; may be null @@ -1134,7 +1168,7 @@ videoChat#ae158d28 group_call_id:int32 has_participants:Bool default_participant //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null //@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used -chat#69d332bd id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender has_protected_content:Bool is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings message_ttl:int32 theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat#548eca01 id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender has_protected_content:Bool is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:vector message_ttl:int32 theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats //@total_count Approximate total count of chats found @@ -2598,6 +2632,9 @@ searchMessagesFilterMention#7748c89c = SearchMessagesFilter; //@description Returns only messages with unread mentions of the current user, or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query, a message thread or by the sending user searchMessagesFilterUnreadMention#fa4aadc3 = SearchMessagesFilter; +//@description Returns only messages with unread reactions for the current user. When using this filter the results can't be additionally filtered by a query, a message thread or by the sending user +searchMessagesFilterUnreadReaction#adc43100 = SearchMessagesFilter; + //@description Returns only failed to send messages. This filter can be used only if the message database is used searchMessagesFilterFailedToSend#dc74d6fc = SearchMessagesFilter; @@ -2691,33 +2728,31 @@ emojis#77274a16 emojis:vector = Emojis; //@id Identifier of the sticker set //@title Title of the sticker set //@name Name of the sticker set -//@thumbnail Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed +//@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed //@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner //@is_installed True, if the sticker set has been installed by the current user //@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously //@is_official True, if the sticker set is official -//@is_animated True, is the stickers in the set are animated -//@is_masks True, if the stickers in the set are masks +//@sticker_type Type of the stickers in the set //@is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set //@emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet#5ccde520 id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; +stickerSet#69307c1a id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set //@id Identifier of the sticker set //@title Title of the sticker set //@name Name of the sticker set -//@thumbnail Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null +//@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null //@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner //@is_installed True, if the sticker set has been installed by the current user //@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously //@is_official True, if the sticker set is official -//@is_animated True, is the stickers in the set are animated -//@is_masks True, if the stickers in the set are masks +//@sticker_type Type of the stickers in the set //@is_viewed True for already viewed trending sticker sets //@size Total number of stickers in the set //@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested -stickerSetInfo#aba733ac id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +stickerSetInfo#1f54c66b id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets //@total_count Approximate total number of sticker sets found @@ -2925,6 +2960,34 @@ call#36db9764 id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallSt //@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions phoneNumberAuthenticationSettings#88e1611f allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool authentication_tokens:vector = PhoneNumberAuthenticationSettings; +//@description Represents a reaction applied to a message +//@reaction Text representation of the reaction +//@sender_id Identifier of the chat member, applied the reaction +addedReaction#1b17c6bc reaction:string sender_id:MessageSender = AddedReaction; + +//@description Represents a list of reactions added to a message +//@total_count The total count of found reactions +//@reactions The list of added reactions +//@next_offset The offset for the next request. If empty, there are no more results +addedReactions#77bf7590 total_count:int32 reactions:vector next_offset:string = AddedReactions; + +//@description Represents a list of available reactions +//@reactions List of reactions +availableReactions#b83dc5b2 reactions:vector = AvailableReactions; + +//@description Contains stickers which must be used for reaction animation rendering +//@reaction Text representation of the reaction +//@title Reaction title +//@is_active True, if the reaction can be added to new messages and enabled in chats +//@static_icon Static icon for the reaction +//@appear_animation Appear animation for the reaction +//@select_animation Select animation for the reaction +//@activate_animation Activate animation for the reaction +//@effect_animation Effect animation for the reaction +//@around_animation Around animation for the reaction; may be null +//@center_animation Center animation for the reaction; may be null +reaction#ff6c56f1 reaction:string title:string is_active:Bool static_icon:sticker appear_animation:sticker select_animation:sticker activate_animation:sticker effect_animation:sticker around_animation:sticker center_animation:sticker = Reaction; + //@description Represents a list of animations //@animations List of animations animations#2ce4157c animations:vector = Animations; @@ -3044,10 +3107,10 @@ inputInlineQueryResultLocation#8f7cbe56 id:string location:location live_period: //@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessagePhoto, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact inputInlineQueryResultPhoto#bd0b361f id:string title:string description:string thumbnail_url:string photo_url:string photo_width:int32 photo_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; -//@description Represents a link to a WEBP or TGS sticker +//@description Represents a link to a WEBP, TGS, or WEBM sticker //@id Unique identifier of the query result //@thumbnail_url URL of the sticker thumbnail, if it exists -//@sticker_url The URL of the WEBP or TGS sticker (sticker file size must not exceed 5MB) +//@sticker_url The URL of the WEBP, TGS, or WEBM sticker (sticker file size must not exceed 5MB) //@sticker_width Width of the sticker //@sticker_height Height of the sticker //@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null @@ -3219,10 +3282,6 @@ chatEventMessageEdited#e64ff5f8 old_message:message new_message:message = ChatEv //@message Deleted message chatEventMessageDeleted#cac649f7 message:message = ChatEventAction; -//@description A poll in a message was stopped -//@message The message with the poll -chatEventPollStopped#77cc8be5 message:message = ChatEventAction; - //@description A message was pinned //@message Pinned message chatEventMessagePinned#1a26ad1a message:message = ChatEventAction; @@ -3231,6 +3290,10 @@ chatEventMessagePinned#1a26ad1a message:message = ChatEventAction; //@message Unpinned message chatEventMessageUnpinned#e9943b17 message:message = ChatEventAction; +//@description A poll in a message was stopped +//@message The message with the poll +chatEventPollStopped#77cc8be5 message:message = ChatEventAction; + //@description A new member joined the chat chatEventMemberJoined#f1f70924 = ChatEventAction; @@ -3243,14 +3306,14 @@ chatEventMemberJoinedByInviteLink#f0e6d5bd invite_link:chatInviteLink = ChatEven //@invite_link Invite link used to join the chat; may be null chatEventMemberJoinedByRequest#9dc87e3f approver_user_id:int53 invite_link:chatInviteLink = ChatEventAction; -//@description A member left the chat -chatEventMemberLeft#c778400f = ChatEventAction; - //@description A new chat member was invited //@user_id New member user identifier //@status New member status chatEventMemberInvited#38d7bfc9 user_id:int53 status:ChatMemberStatus = ChatEventAction; +//@description A member left the chat +chatEventMemberLeft#c778400f = ChatEventAction; + //@description A chat member has gained/lost administrator status, or the list of their administrator privileges has changed //@user_id Affected chat member user identifier //@old_status Previous status of the chat member @@ -3263,72 +3326,77 @@ chatEventMemberPromoted#1f4f6861 user_id:int53 old_status:ChatMemberStatus new_s //@new_status New status of the chat member chatEventMemberRestricted#5f951e05 member_id:MessageSender old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; -//@description The chat title was changed -//@old_title Previous chat title -//@new_title New chat title -chatEventTitleChanged#43990ad2 old_title:string new_title:string = ChatEventAction; - -//@description The chat permissions was changed -//@old_permissions Previous chat permissions -//@new_permissions New chat permissions -chatEventPermissionsChanged#b1d337a8 old_permissions:chatPermissions new_permissions:chatPermissions = ChatEventAction; +//@description The chat available reactions were changed +//@old_available_reactions Previous chat available reactions +//@new_available_reactions New chat available reactions +chatEventAvailableReactionsChanged#9ac93274 old_available_reactions:vector new_available_reactions:vector = ChatEventAction; //@description The chat description was changed //@old_description Previous chat description //@new_description New chat description chatEventDescriptionChanged#254cf1e old_description:string new_description:string = ChatEventAction; -//@description The chat username was changed -//@old_username Previous chat username -//@new_username New chat username -chatEventUsernameChanged#6707b56b old_username:string new_username:string = ChatEventAction; - -//@description The chat photo was changed -//@old_photo Previous chat photo value; may be null -//@new_photo New chat photo value; may be null -chatEventPhotoChanged#cfa062c3 old_photo:chatPhoto new_photo:chatPhoto = ChatEventAction; - -//@description The can_invite_users permission of a supergroup chat was toggled -//@can_invite_users New value of can_invite_users permission -chatEventInvitesToggled#fc45966b can_invite_users:Bool = ChatEventAction; - //@description The linked chat of a supergroup was changed //@old_linked_chat_id Previous supergroup linked chat identifier //@new_linked_chat_id New supergroup linked chat identifier chatEventLinkedChatChanged#6b2271af old_linked_chat_id:int53 new_linked_chat_id:int53 = ChatEventAction; -//@description The slow_mode_delay setting of a supergroup was changed -//@old_slow_mode_delay Previous value of slow_mode_delay, in seconds -//@new_slow_mode_delay New value of slow_mode_delay, in seconds -chatEventSlowModeDelayChanged#9d763c0b old_slow_mode_delay:int32 new_slow_mode_delay:int32 = ChatEventAction; +//@description The supergroup location was changed +//@old_location Previous location; may be null +//@new_location New location; may be null +chatEventLocationChanged#e7cdfd4e old_location:chatLocation new_location:chatLocation = ChatEventAction; //@description The message TTL was changed //@old_message_ttl Previous value of message_ttl //@new_message_ttl New value of message_ttl chatEventMessageTtlChanged#2e46b9b3 old_message_ttl:int32 new_message_ttl:int32 = ChatEventAction; -//@description The sign_messages setting of a channel was toggled -//@sign_messages New value of sign_messages -chatEventSignMessagesToggled#b1b9281e sign_messages:Bool = ChatEventAction; +//@description The chat permissions was changed +//@old_permissions Previous chat permissions +//@new_permissions New chat permissions +chatEventPermissionsChanged#b1d337a8 old_permissions:chatPermissions new_permissions:chatPermissions = ChatEventAction; -//@description The has_protected_content setting of a channel was toggled -//@has_protected_content New value of has_protected_content -chatEventHasProtectedContentToggled#f5044201 has_protected_content:Bool = ChatEventAction; +//@description The chat photo was changed +//@old_photo Previous chat photo value; may be null +//@new_photo New chat photo value; may be null +chatEventPhotoChanged#cfa062c3 old_photo:chatPhoto new_photo:chatPhoto = ChatEventAction; + +//@description The slow_mode_delay setting of a supergroup was changed +//@old_slow_mode_delay Previous value of slow_mode_delay, in seconds +//@new_slow_mode_delay New value of slow_mode_delay, in seconds +chatEventSlowModeDelayChanged#9d763c0b old_slow_mode_delay:int32 new_slow_mode_delay:int32 = ChatEventAction; //@description The supergroup sticker set was changed //@old_sticker_set_id Previous identifier of the chat sticker set; 0 if none //@new_sticker_set_id New identifier of the chat sticker set; 0 if none chatEventStickerSetChanged#b5e7558f old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction; -//@description The supergroup location was changed -//@old_location Previous location; may be null -//@new_location New location; may be null -chatEventLocationChanged#e7cdfd4e old_location:chatLocation new_location:chatLocation = ChatEventAction; +//@description The chat title was changed +//@old_title Previous chat title +//@new_title New chat title +chatEventTitleChanged#43990ad2 old_title:string new_title:string = ChatEventAction; + +//@description The chat username was changed +//@old_username Previous chat username +//@new_username New chat username +chatEventUsernameChanged#6707b56b old_username:string new_username:string = ChatEventAction; + +//@description The has_protected_content setting of a channel was toggled +//@has_protected_content New value of has_protected_content +chatEventHasProtectedContentToggled#f5044201 has_protected_content:Bool = ChatEventAction; + +//@description The can_invite_users permission of a supergroup chat was toggled +//@can_invite_users New value of can_invite_users permission +chatEventInvitesToggled#fc45966b can_invite_users:Bool = ChatEventAction; //@description The is_all_history_available setting of a supergroup was toggled //@is_all_history_available New value of is_all_history_available chatEventIsAllHistoryAvailableToggled#a0b03c15 is_all_history_available:Bool = ChatEventAction; +//@description The sign_messages setting of a channel was toggled +//@sign_messages New value of sign_messages +chatEventSignMessagesToggled#b1b9281e sign_messages:Bool = ChatEventAction; + //@description A chat invite link was edited //@old_invite_link Previous information about the invite link //@new_invite_link New information about the invite link @@ -3350,6 +3418,10 @@ chatEventVideoChatCreated#6ca68a7b group_call_id:int32 = ChatEventAction; //@group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall chatEventVideoChatEnded#61286c48 group_call_id:int32 = ChatEventAction; +//@description The mute_new_participants setting of a video chat was toggled +//@mute_new_participants New value of the mute_new_participants setting +chatEventVideoChatMuteNewParticipantsToggled#f87507fe mute_new_participants:Bool = ChatEventAction; + //@description A video chat participant was muted or unmuted //@participant_id Identifier of the affected group call participant //@is_muted New value of is_muted @@ -3360,10 +3432,6 @@ chatEventVideoChatParticipantIsMutedToggled#1f1058f7 participant_id:MessageSende //@volume_level New value of volume_level; 1-20000 in hundreds of percents chatEventVideoChatParticipantVolumeLevelChanged#436f92be participant_id:MessageSender volume_level:int32 = ChatEventAction; -//@description The mute_new_participants setting of a video chat was toggled -//@mute_new_participants New value of the mute_new_participants setting -chatEventVideoChatMuteNewParticipantsToggled#f87507fe mute_new_participants:Bool = ChatEventAction; - //@description Represents a chat event //@id Chat event identifier //@date Point in time (Unix timestamp) when the event happened @@ -4408,18 +4476,11 @@ proxy#baf7b73 id:int32 server:string port:int32 last_used_date:int32 is_enabled: //@proxies List of proxy servers proxies#5ee27a86 proxies:vector = Proxies; -//@class InputSticker @description Describes a sticker that needs to be added to a sticker set - -//@description A static sticker in PNG format, which will be converted to WEBP server-side -//@sticker PNG image with the sticker; must be up to 512 KB in size and fit in a 512x512 square +//@description A sticker to be added to a sticker set +//@sticker File with the sticker; must fit in a 512x512 square. For WEBP stickers and masks the file must be in PNG format, which will be converted to WEBP server-side. Otherwise, the file must be local or uploaded within a week. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements //@emojis Emojis corresponding to the sticker -//@mask_position For masks, position where the mask is placed; pass null if unspecified -inputStickerStatic#540604db sticker:InputFile emojis:string mask_position:maskPosition = InputSticker; - -//@description An animated sticker in TGS format -//@sticker File with the animated sticker. Only local or uploaded within a week files are supported. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements -//@emojis Emojis corresponding to the sticker -inputStickerAnimated#bccf4960 sticker:InputFile emojis:string = InputSticker; +//@type Sticker type +inputSticker#345af62e sticker:InputFile emojis:string type:StickerType = InputSticker; //@description Represents a date range //@start_date Point in time (Unix timestamp) at which the date range begins @@ -4621,6 +4682,13 @@ updateMessageContentOpened#a55ea885 chat_id:int53 message_id:int53 = Update; //@unread_mention_count The new number of unread mention messages left in the chat updateMessageMentionRead#f0f74d46 chat_id:int53 message_id:int53 unread_mention_count:int32 = Update; +//@description The list of unread reactions added to a message was changed +//@chat_id Chat identifier +//@message_id Message identifier +//@unread_reactions The new list of unread reactions +//@unread_reaction_count The new number of messages with unread reactions left in the chat +updateMessageUnreadReactions#12a7220a chat_id:int53 message_id:int53 unread_reactions:vector unread_reaction_count:int32 = Update; + //@description A message with a live location was viewed. When the update is received, the application is supposed to update the live location //@chat_id Identifier of the chat with the live location message //@message_id Identifier of the message with live location @@ -4672,6 +4740,11 @@ updateChatReadOutbox#2a385285 chat_id:int53 last_read_outbox_message_id:int53 = //@action_bar The new value of the action bar; may be null updateChatActionBar#d9a258c2 chat_id:int53 action_bar:ChatActionBar = Update; +//@description The chat available reactions were changed +//@chat_id Chat identifier +//@available_reactions The new list of reactions, available in the chat +updateChatAvailableReactions#852fb10d chat_id:int53 available_reactions:vector = Update; + //@description A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update mustn't be applied //@chat_id Chat identifier //@draft_message The new draft message; may be null @@ -4713,6 +4786,11 @@ updateChatTheme#31f3d465 chat_id:int53 theme_name:string = Update; //@unread_mention_count The number of unread mention messages left in the chat updateChatUnreadMentionCount#80f47b1c chat_id:int53 unread_mention_count:int32 = Update; +//@description The chat unread_reaction_count has changed +//@chat_id Chat identifier +//@unread_reaction_count The number of messages with unread reactions left in the chat +updateChatUnreadReactionCount#81603cdd chat_id:int53 unread_reaction_count:int32 = Update; + //@description A chat video chat state has changed //@chat_id Chat identifier //@video_chat New value of video_chat @@ -4949,6 +5027,10 @@ updateTermsOfService#b23cc55e terms_of_service_id:string terms_of_service:termsO //@users_nearby The new list of users nearby updateUsersNearby#97c8ab5 users_nearby:vector = Update; +//@description The list of supported reactions has changed +//@reactions The new list of supported reactions +updateReactions#e769e4e7 reactions:vector = Update; + //@description The list of supported dice emojis has changed //@emojis The new list of supported dice emojis updateDiceEmojis#9d0f91df emojis:vector = Update; @@ -5446,7 +5528,7 @@ searchChatMessages#f655b620 chat_id:int53 query:string sender_id:MessageSender f //@offset_chat_id The chat identifier of the last found message, or 0 for the first request //@offset_message_id The message identifier of the last found message, or 0 for the first request //@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -//@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterFailedToSend and searchMessagesFilterPinned are unsupported in this function +//@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function //@min_date If not 0, the minimum date of the messages to return //@max_date If not 0, the maximum date of the messages to return searchMessages#f2938192 chat_list:ChatList query:string offset_date:int32 offset_chat_id:int53 offset_message_id:int53 limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = Messages; @@ -5454,7 +5536,7 @@ searchMessages#f2938192 chat_list:ChatList query:string offset_date:int32 offset //@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance, the number of returned messages is chosen by TDLib //@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats //@query Query to search for. If empty, searchChatMessages must be used instead -//@offset Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit //@filter Additional filter for messages to search; pass null to search for all messages searchSecretMessages#cd2a4c9c chat_id:int53 query:string offset:string limit:int32 filter:SearchMessagesFilter = FoundMessages; @@ -5484,14 +5566,14 @@ getChatMessageByDate#3f557136 chat_id:int53 date:int32 = Message; //@description Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). //@chat_id Identifier of the chat in which to return information about message positions -//@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention and searchMessagesFilterUnreadMention are unsupported in this function +//@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about message positions //@limit The expected number of message positions to be returned; 50-2000. A smaller number of positions can be returned, if there are not enough appropriate messages getChatSparseMessagePositions#e472f784 chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 limit:int32 = MessagePositions; //@description Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" //@chat_id Identifier of the chat in which to return information about messages -//@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention and searchMessagesFilterUnreadMention are unsupported in this function +//@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function //@from_message_id The message identifier from which to return information about messages; use 0 to get results from the last message getChatMessageCalendar#ec8f2114 chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 = MessageCalendar; @@ -5508,7 +5590,7 @@ getChatScheduledMessages#df3d2ffb chat_id:int53 = Messages; //@description Returns forwarded copies of a channel message to different public channels. For optimal performance, the number of returned messages is chosen by TDLib //@chat_id Chat identifier of the message //@message_id Message identifier -//@offset Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit getMessagePublicForwards#6006a949 chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; @@ -5544,6 +5626,12 @@ getMessageEmbeddingCode#62a4cd09 chat_id:int53 message_id:int53 for_album:Bool = //@url The message link getMessageLinkInfo#d63eb458 url:string = MessageLinkInfo; +//@description Translates a text to the given language. Returns a 404 error if the translation can't be performed +//@text Text to translate +//@from_language_code A two-letter ISO 639-1 language code of the language from which the message is translated. If empty, the language will be detected automatically +//@to_language_code A two-letter ISO 639-1 language code of the language to which the message is translated +translateText#9f758a6d text:string from_language_code:string to_language_code:string = Text; + //@description Returns list of message sender identifiers, which can be used to send messages in a chat //@chat_id Chat identifier getChatAvailableMessageSenders#a41d7c58 chat_id:int53 = MessageSenders; @@ -5704,6 +5792,26 @@ editInlineMessageReplyMarkup#fbf906de inline_message_id:string reply_markup:Repl //@scheduling_state The new message scheduling state; pass null to send the message immediately editMessageSchedulingState#ae2a0bc0 chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; +//@description Returns reactions, which can be added to a message. The list can change after updateReactions, updateChatAvailableReactions for the chat, or updateMessageInteractionInfo for the message +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +getMessageAvailableReactions#c3fa54f chat_id:int53 message_id:int53 = AvailableReactions; + +//@description Changes chosen reaction for a message +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +//@reaction Text representation of the new chosen reaction. Can be an empty string or the currently chosen reaction to remove the reaction +//@is_big True, if the reaction is added with a big animation +setMessageReaction#874fab38 chat_id:int53 message_id:int53 reaction:string is_big:Bool = Ok; + +//@description Returns reactions added for a message, along with their sender +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +//@reaction If non-empty, only added reactions with the specified text representation will be returned +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of reactions to be returned; must be positive and can't be greater than 100 +getMessageAddedReactions#aac3b631 chat_id:int53 message_id:int53 reaction:string offset:string limit:int32 = AddedReactions; + //@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. Can be called synchronously //@text The text in which to look for entites getTextEntities#eba543fb text:string = TextEntities; @@ -5909,6 +6017,10 @@ getExternalLink#5e92f0eb link:string allow_write_access:Bool = HttpUrl; //@chat_id Chat identifier readAllChatMentions#50eab2b5 chat_id:int53 = Ok; +//@description Marks all reactions in a chat as read +//@chat_id Chat identifier +readAllChatReactions#54c1976d chat_id:int53 = Ok; + //@description Returns an existing chat corresponding to a given user //@user_id User identifier //@force If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect @@ -6037,6 +6149,11 @@ toggleChatIsMarkedAsUnread#c538dadf chat_id:int53 is_marked_as_unread:Bool = Ok; //@default_disable_notification New value of default_disable_notification toggleChatDefaultDisableNotification#12c36012 chat_id:int53 default_disable_notification:Bool = Ok; +//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right +//@chat_id Identifier of the chat +//@available_reactions New list of reactions, available in the chat. All reactions must be active and order of the reactions must be the same as in updateReactions +setChatAvailableReactions#2e5c0f2e chat_id:int53 available_reactions:vector = Ok; + //@description Changes application-specific data associated with a chat //@chat_id Chat identifier //@client_data New value of client_data @@ -6746,18 +6863,18 @@ checkChangePhoneNumberCode#9976a263 code:string = Ok; //@description Sets the list of commands supported by the bot for the given user scope and language; for bots only //@scope The scope to which the commands are relevant; pass null to change commands in the default bot command scope -//@language_code A two-letter ISO 639-1 country code. If empty, the commands will be applied to all users from the given scope, for which language there are no dedicated commands +//@language_code A two-letter ISO 639-1 language code. If empty, the commands will be applied to all users from the given scope, for which language there are no dedicated commands //@commands List of the bot's commands setCommands#b0e0217a scope:BotCommandScope language_code:string commands:vector = Ok; //@description Deletes commands supported by the bot for the given user scope and language; for bots only //@scope The scope to which the commands are relevant; pass null to delete commands in the default bot command scope -//@language_code A two-letter ISO 639-1 country code or an empty string +//@language_code A two-letter ISO 639-1 language code or an empty string deleteCommands#3bc47c2a scope:BotCommandScope language_code:string = Ok; //@description Returns the list of commands supported by the bot for the given user scope and language; for bots only //@scope The scope to which the commands are relevant; pass null to get commands in the default bot command scope -//@language_code A two-letter ISO 639-1 country code or an empty string +//@language_code A two-letter ISO 639-1 language code or an empty string getCommands#58ba8ff7 scope:BotCommandScope language_code:string = BotCommands; //@description Returns all active sessions of the current user @@ -7165,7 +7282,7 @@ setBotUpdatesStatus#bb293991 pending_update_count:int32 error_message:string = O //@description Uploads a file with a sticker; returns the uploaded file //@user_id Sticker file owner; ignored for regular users //@sticker Sticker file to upload -uploadStickerFile#23a0f58e user_id:int53 sticker:InputSticker = File; +uploadStickerFile#524839a user_id:int53 sticker:inputSticker = File; //@description Returns a suggested name for a new sticker set with a given title //@title Sticker set title; 1-64 characters @@ -7179,21 +7296,20 @@ checkStickerSetName#955808fe name:string = CheckStickerSetNameResult; //@user_id Sticker set owner; ignored for regular users //@title Sticker set title; 1-64 characters //@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 1-64 characters -//@is_masks True, if stickers are masks. Animated stickers can't be masks -//@stickers List of stickers to be added to the set; must be non-empty. All stickers must be of the same type. For animated stickers, uploadStickerFile must be used before the sticker is shown +//@stickers List of stickers to be added to the set; must be non-empty. All stickers must have the same format. For TGS stickers, uploadStickerFile must be used before the sticker is shown //@source Source of the sticker set; may be empty if unknown -createNewStickerSet#982c0b07 user_id:int53 title:string name:string is_masks:Bool stickers:vector source:string = StickerSet; +createNewStickerSet#aa878026 user_id:int53 title:string name:string stickers:vector source:string = StickerSet; //@description Adds a new sticker to a set; for bots only. Returns the sticker set //@user_id Sticker set owner //@name Sticker set name //@sticker Sticker to add to the set -addStickerToSet#3b0b81 user_id:int53 name:string sticker:InputSticker = StickerSet; +addStickerToSet#b015455d user_id:int53 name:string sticker:inputSticker = StickerSet; //@description Sets a sticker set thumbnail; for bots only. Returns the sticker set //@user_id Sticker set owner //@name Sticker set name -//@thumbnail Thumbnail to set in PNG or TGS format; pass null to remove the sticker set thumbnail. Animated thumbnail must be set for animated sticker sets and only for them +//@thumbnail Thumbnail to set in PNG, TGS, or WEBM format; pass null to remove the sticker set thumbnail. Thumbnail format must match the format of stickers in the set setStickerSetThumbnail#4952fa88 user_id:int53 name:string thumbnail:InputFile = StickerSet; //@description Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot @@ -7243,7 +7359,7 @@ getCountryCode#5bd398f2 = Text; getPhoneNumberInfo#a0229bf9 phone_number_prefix:string = PhoneNumberInfo; //@description Returns information about a phone number by its prefix synchronously. getCountries must be called at least once after changing localization to the specified language if properly localized country information is expected. Can be called synchronously -//@language_code A two-letter ISO 639-1 country code for country information localization +//@language_code A two-letter ISO 639-1 language code for country information localization //@phone_number_prefix The phone number prefix getPhoneNumberInfoSync#209b7d38 language_code:string phone_number_prefix:string = PhoneNumberInfo; diff --git a/tdapi/tl_add_sticker_to_set_gen.go b/tdapi/tl_add_sticker_to_set_gen.go index bf80f5ce9a..ce40762ef4 100644 --- a/tdapi/tl_add_sticker_to_set_gen.go +++ b/tdapi/tl_add_sticker_to_set_gen.go @@ -31,18 +31,18 @@ var ( _ = tdjson.Encoder{} ) -// AddStickerToSetRequest represents TL type `addStickerToSet#3b0b81`. +// AddStickerToSetRequest represents TL type `addStickerToSet#b015455d`. type AddStickerToSetRequest struct { // Sticker set owner UserID int64 // Sticker set name Name string // Sticker to add to the set - Sticker InputStickerClass + Sticker InputSticker } // AddStickerToSetRequestTypeID is TL type id of AddStickerToSetRequest. -const AddStickerToSetRequestTypeID = 0x3b0b81 +const AddStickerToSetRequestTypeID = 0xb015455d // Ensuring interfaces in compile-time for AddStickerToSetRequest. var ( @@ -62,7 +62,7 @@ func (a *AddStickerToSetRequest) Zero() bool { if !(a.Name == "") { return false } - if !(a.Sticker == nil) { + if !(a.Sticker.Zero()) { return false } @@ -120,7 +120,7 @@ func (a *AddStickerToSetRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (a *AddStickerToSetRequest) Encode(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't encode addStickerToSet#3b0b81 as nil") + return fmt.Errorf("can't encode addStickerToSet#b015455d as nil") } b.PutID(AddStickerToSetRequestTypeID) return a.EncodeBare(b) @@ -129,15 +129,12 @@ func (a *AddStickerToSetRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (a *AddStickerToSetRequest) EncodeBare(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't encode addStickerToSet#3b0b81 as nil") + return fmt.Errorf("can't encode addStickerToSet#b015455d as nil") } b.PutInt53(a.UserID) b.PutString(a.Name) - if a.Sticker == nil { - return fmt.Errorf("unable to encode addStickerToSet#3b0b81: field sticker is nil") - } if err := a.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode addStickerToSet#3b0b81: field sticker: %w", err) + return fmt.Errorf("unable to encode addStickerToSet#b015455d: field sticker: %w", err) } return nil } @@ -145,10 +142,10 @@ func (a *AddStickerToSetRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (a *AddStickerToSetRequest) Decode(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't decode addStickerToSet#3b0b81 to nil") + return fmt.Errorf("can't decode addStickerToSet#b015455d to nil") } if err := b.ConsumeID(AddStickerToSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addStickerToSet#3b0b81: %w", err) + return fmt.Errorf("unable to decode addStickerToSet#b015455d: %w", err) } return a.DecodeBare(b) } @@ -156,28 +153,26 @@ func (a *AddStickerToSetRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (a *AddStickerToSetRequest) DecodeBare(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't decode addStickerToSet#3b0b81 to nil") + return fmt.Errorf("can't decode addStickerToSet#b015455d to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#3b0b81: field user_id: %w", err) + return fmt.Errorf("unable to decode addStickerToSet#b015455d: field user_id: %w", err) } a.UserID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#3b0b81: field name: %w", err) + return fmt.Errorf("unable to decode addStickerToSet#b015455d: field name: %w", err) } a.Name = value } { - value, err := DecodeInputSticker(b) - if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#3b0b81: field sticker: %w", err) + if err := a.Sticker.Decode(b); err != nil { + return fmt.Errorf("unable to decode addStickerToSet#b015455d: field sticker: %w", err) } - a.Sticker = value } return nil } @@ -185,7 +180,7 @@ func (a *AddStickerToSetRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (a *AddStickerToSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if a == nil { - return fmt.Errorf("can't encode addStickerToSet#3b0b81 as nil") + return fmt.Errorf("can't encode addStickerToSet#b015455d as nil") } b.ObjStart() b.PutID("addStickerToSet") @@ -197,11 +192,8 @@ func (a *AddStickerToSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.PutString(a.Name) b.Comma() b.FieldStart("sticker") - if a.Sticker == nil { - return fmt.Errorf("unable to encode addStickerToSet#3b0b81: field sticker is nil") - } if err := a.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addStickerToSet#3b0b81: field sticker: %w", err) + return fmt.Errorf("unable to encode addStickerToSet#b015455d: field sticker: %w", err) } b.Comma() b.StripComma() @@ -212,33 +204,31 @@ func (a *AddStickerToSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (a *AddStickerToSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if a == nil { - return fmt.Errorf("can't decode addStickerToSet#3b0b81 to nil") + return fmt.Errorf("can't decode addStickerToSet#b015455d to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("addStickerToSet"); err != nil { - return fmt.Errorf("unable to decode addStickerToSet#3b0b81: %w", err) + return fmt.Errorf("unable to decode addStickerToSet#b015455d: %w", err) } case "user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#3b0b81: field user_id: %w", err) + return fmt.Errorf("unable to decode addStickerToSet#b015455d: field user_id: %w", err) } a.UserID = value case "name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#3b0b81: field name: %w", err) + return fmt.Errorf("unable to decode addStickerToSet#b015455d: field name: %w", err) } a.Name = value case "sticker": - value, err := DecodeTDLibJSONInputSticker(b) - if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#3b0b81: field sticker: %w", err) + if err := a.Sticker.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode addStickerToSet#b015455d: field sticker: %w", err) } - a.Sticker = value default: return b.Skip() } @@ -263,14 +253,14 @@ func (a *AddStickerToSetRequest) GetName() (value string) { } // GetSticker returns value of Sticker field. -func (a *AddStickerToSetRequest) GetSticker() (value InputStickerClass) { +func (a *AddStickerToSetRequest) GetSticker() (value InputSticker) { if a == nil { return } return a.Sticker } -// AddStickerToSet invokes method addStickerToSet#3b0b81 returning error if any. +// AddStickerToSet invokes method addStickerToSet#b015455d returning error if any. func (c *Client) AddStickerToSet(ctx context.Context, request *AddStickerToSetRequest) (*StickerSet, error) { var result StickerSet diff --git a/tdapi/tl_added_reaction_gen.go b/tdapi/tl_added_reaction_gen.go new file mode 100644 index 0000000000..d96c917e9a --- /dev/null +++ b/tdapi/tl_added_reaction_gen.go @@ -0,0 +1,237 @@ +// 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{} +) + +// AddedReaction represents TL type `addedReaction#1b17c6bc`. +type AddedReaction struct { + // Text representation of the reaction + Reaction string + // Identifier of the chat member, applied the reaction + SenderID MessageSenderClass +} + +// AddedReactionTypeID is TL type id of AddedReaction. +const AddedReactionTypeID = 0x1b17c6bc + +// Ensuring interfaces in compile-time for AddedReaction. +var ( + _ bin.Encoder = &AddedReaction{} + _ bin.Decoder = &AddedReaction{} + _ bin.BareEncoder = &AddedReaction{} + _ bin.BareDecoder = &AddedReaction{} +) + +func (a *AddedReaction) Zero() bool { + if a == nil { + return true + } + if !(a.Reaction == "") { + return false + } + if !(a.SenderID == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AddedReaction) String() string { + if a == nil { + return "AddedReaction(nil)" + } + type Alias AddedReaction + return fmt.Sprintf("AddedReaction%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AddedReaction) TypeID() uint32 { + return AddedReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*AddedReaction) TypeName() string { + return "addedReaction" +} + +// TypeInfo returns info about TL type. +func (a *AddedReaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "addedReaction", + ID: AddedReactionTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Reaction", + SchemaName: "reaction", + }, + { + Name: "SenderID", + SchemaName: "sender_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AddedReaction) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addedReaction#1b17c6bc as nil") + } + b.PutID(AddedReactionTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AddedReaction) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addedReaction#1b17c6bc as nil") + } + b.PutString(a.Reaction) + if a.SenderID == nil { + return fmt.Errorf("unable to encode addedReaction#1b17c6bc: field sender_id is nil") + } + if err := a.SenderID.Encode(b); err != nil { + return fmt.Errorf("unable to encode addedReaction#1b17c6bc: field sender_id: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (a *AddedReaction) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addedReaction#1b17c6bc to nil") + } + if err := b.ConsumeID(AddedReactionTypeID); err != nil { + return fmt.Errorf("unable to decode addedReaction#1b17c6bc: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AddedReaction) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addedReaction#1b17c6bc to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode addedReaction#1b17c6bc: field reaction: %w", err) + } + a.Reaction = value + } + { + value, err := DecodeMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode addedReaction#1b17c6bc: field sender_id: %w", err) + } + a.SenderID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AddedReaction) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode addedReaction#1b17c6bc as nil") + } + b.ObjStart() + b.PutID("addedReaction") + b.Comma() + b.FieldStart("reaction") + b.PutString(a.Reaction) + b.Comma() + b.FieldStart("sender_id") + if a.SenderID == nil { + return fmt.Errorf("unable to encode addedReaction#1b17c6bc: field sender_id is nil") + } + if err := a.SenderID.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode addedReaction#1b17c6bc: field sender_id: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AddedReaction) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode addedReaction#1b17c6bc 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#1b17c6bc: %w", err) + } + case "reaction": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode addedReaction#1b17c6bc: field reaction: %w", err) + } + a.Reaction = value + case "sender_id": + value, err := DecodeTDLibJSONMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode addedReaction#1b17c6bc: field sender_id: %w", err) + } + a.SenderID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetReaction returns value of Reaction field. +func (a *AddedReaction) GetReaction() (value string) { + if a == nil { + return + } + return a.Reaction +} + +// GetSenderID returns value of SenderID field. +func (a *AddedReaction) GetSenderID() (value MessageSenderClass) { + if a == nil { + return + } + return a.SenderID +} diff --git a/tdapi/tl_added_reactions_gen.go b/tdapi/tl_added_reactions_gen.go new file mode 100644 index 0000000000..b7c16859b6 --- /dev/null +++ b/tdapi/tl_added_reactions_gen.go @@ -0,0 +1,289 @@ +// 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{} +) + +// AddedReactions represents TL type `addedReactions#77bf7590`. +type AddedReactions struct { + // The total count of found reactions + TotalCount int32 + // The list of added reactions + Reactions []AddedReaction + // The offset for the next request. If empty, there are no more results + NextOffset string +} + +// AddedReactionsTypeID is TL type id of AddedReactions. +const AddedReactionsTypeID = 0x77bf7590 + +// Ensuring interfaces in compile-time for AddedReactions. +var ( + _ bin.Encoder = &AddedReactions{} + _ bin.Decoder = &AddedReactions{} + _ bin.BareEncoder = &AddedReactions{} + _ bin.BareDecoder = &AddedReactions{} +) + +func (a *AddedReactions) Zero() bool { + if a == nil { + return true + } + if !(a.TotalCount == 0) { + return false + } + if !(a.Reactions == nil) { + return false + } + if !(a.NextOffset == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AddedReactions) String() string { + if a == nil { + return "AddedReactions(nil)" + } + type Alias AddedReactions + return fmt.Sprintf("AddedReactions%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AddedReactions) TypeID() uint32 { + return AddedReactionsTypeID +} + +// TypeName returns name of type in TL schema. +func (*AddedReactions) TypeName() string { + return "addedReactions" +} + +// TypeInfo returns info about TL type. +func (a *AddedReactions) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "addedReactions", + ID: AddedReactionsTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "TotalCount", + SchemaName: "total_count", + }, + { + Name: "Reactions", + SchemaName: "reactions", + }, + { + Name: "NextOffset", + SchemaName: "next_offset", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AddedReactions) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addedReactions#77bf7590 as nil") + } + b.PutID(AddedReactionsTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AddedReactions) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addedReactions#77bf7590 as nil") + } + b.PutInt32(a.TotalCount) + b.PutInt(len(a.Reactions)) + for idx, v := range a.Reactions { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare addedReactions#77bf7590: field reactions element with index %d: %w", idx, err) + } + } + b.PutString(a.NextOffset) + return nil +} + +// Decode implements bin.Decoder. +func (a *AddedReactions) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addedReactions#77bf7590 to nil") + } + if err := b.ConsumeID(AddedReactionsTypeID); err != nil { + return fmt.Errorf("unable to decode addedReactions#77bf7590: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AddedReactions) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addedReactions#77bf7590 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode addedReactions#77bf7590: field total_count: %w", err) + } + a.TotalCount = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode addedReactions#77bf7590: field reactions: %w", err) + } + + if headerLen > 0 { + a.Reactions = make([]AddedReaction, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value AddedReaction + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare addedReactions#77bf7590: field reactions: %w", err) + } + a.Reactions = append(a.Reactions, value) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode addedReactions#77bf7590: field next_offset: %w", err) + } + a.NextOffset = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AddedReactions) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode addedReactions#77bf7590 as nil") + } + b.ObjStart() + b.PutID("addedReactions") + b.Comma() + b.FieldStart("total_count") + b.PutInt32(a.TotalCount) + b.Comma() + b.FieldStart("reactions") + b.ArrStart() + for idx, v := range a.Reactions { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode addedReactions#77bf7590: field reactions element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("next_offset") + b.PutString(a.NextOffset) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AddedReactions) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode addedReactions#77bf7590 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("addedReactions"); err != nil { + return fmt.Errorf("unable to decode addedReactions#77bf7590: %w", err) + } + case "total_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode addedReactions#77bf7590: field total_count: %w", err) + } + a.TotalCount = value + case "reactions": + if err := b.Arr(func(b tdjson.Decoder) error { + var value AddedReaction + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode addedReactions#77bf7590: field reactions: %w", err) + } + a.Reactions = append(a.Reactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode addedReactions#77bf7590: field reactions: %w", err) + } + case "next_offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode addedReactions#77bf7590: field next_offset: %w", err) + } + a.NextOffset = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTotalCount returns value of TotalCount field. +func (a *AddedReactions) GetTotalCount() (value int32) { + if a == nil { + return + } + return a.TotalCount +} + +// GetReactions returns value of Reactions field. +func (a *AddedReactions) GetReactions() (value []AddedReaction) { + if a == nil { + return + } + return a.Reactions +} + +// GetNextOffset returns value of NextOffset field. +func (a *AddedReactions) GetNextOffset() (value string) { + if a == nil { + return + } + return a.NextOffset +} diff --git a/tdapi/tl_available_reactions_gen.go b/tdapi/tl_available_reactions_gen.go new file mode 100644 index 0000000000..6cecb3e4f8 --- /dev/null +++ b/tdapi/tl_available_reactions_gen.go @@ -0,0 +1,217 @@ +// 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{} +) + +// AvailableReactions represents TL type `availableReactions#b83dc5b2`. +type AvailableReactions struct { + // List of reactions + Reactions []string +} + +// AvailableReactionsTypeID is TL type id of AvailableReactions. +const AvailableReactionsTypeID = 0xb83dc5b2 + +// Ensuring interfaces in compile-time for AvailableReactions. +var ( + _ bin.Encoder = &AvailableReactions{} + _ bin.Decoder = &AvailableReactions{} + _ bin.BareEncoder = &AvailableReactions{} + _ bin.BareDecoder = &AvailableReactions{} +) + +func (a *AvailableReactions) Zero() bool { + if a == nil { + return true + } + if !(a.Reactions == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AvailableReactions) String() string { + if a == nil { + return "AvailableReactions(nil)" + } + type Alias AvailableReactions + return fmt.Sprintf("AvailableReactions%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AvailableReactions) TypeID() uint32 { + return AvailableReactionsTypeID +} + +// TypeName returns name of type in TL schema. +func (*AvailableReactions) TypeName() string { + return "availableReactions" +} + +// TypeInfo returns info about TL type. +func (a *AvailableReactions) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "availableReactions", + ID: AvailableReactionsTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Reactions", + SchemaName: "reactions", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AvailableReactions) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode availableReactions#b83dc5b2 as nil") + } + b.PutID(AvailableReactionsTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AvailableReactions) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode availableReactions#b83dc5b2 as nil") + } + b.PutInt(len(a.Reactions)) + for _, v := range a.Reactions { + b.PutString(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (a *AvailableReactions) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode availableReactions#b83dc5b2 to nil") + } + if err := b.ConsumeID(AvailableReactionsTypeID); err != nil { + return fmt.Errorf("unable to decode availableReactions#b83dc5b2: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AvailableReactions) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode availableReactions#b83dc5b2 to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode availableReactions#b83dc5b2: field reactions: %w", err) + } + + if headerLen > 0 { + a.Reactions = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode availableReactions#b83dc5b2: field reactions: %w", err) + } + a.Reactions = append(a.Reactions, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AvailableReactions) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode availableReactions#b83dc5b2 as nil") + } + b.ObjStart() + b.PutID("availableReactions") + b.Comma() + b.FieldStart("reactions") + b.ArrStart() + for _, v := range a.Reactions { + b.PutString(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AvailableReactions) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode availableReactions#b83dc5b2 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("availableReactions"); err != nil { + return fmt.Errorf("unable to decode availableReactions#b83dc5b2: %w", err) + } + case "reactions": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode availableReactions#b83dc5b2: field reactions: %w", err) + } + a.Reactions = append(a.Reactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode availableReactions#b83dc5b2: field reactions: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetReactions returns value of Reactions field. +func (a *AvailableReactions) GetReactions() (value []string) { + if a == nil { + return + } + return a.Reactions +} diff --git a/tdapi/tl_chat_event_action_gen.go b/tdapi/tl_chat_event_action_gen.go index ce4fdfda60..cd7835ef80 100644 --- a/tdapi/tl_chat_event_action_gen.go +++ b/tdapi/tl_chat_event_action_gen.go @@ -397,172 +397,6 @@ func (c *ChatEventMessageDeleted) GetMessage() (value Message) { return c.Message } -// ChatEventPollStopped represents TL type `chatEventPollStopped#77cc8be5`. -type ChatEventPollStopped struct { - // The message with the poll - Message Message -} - -// ChatEventPollStoppedTypeID is TL type id of ChatEventPollStopped. -const ChatEventPollStoppedTypeID = 0x77cc8be5 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventPollStopped) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventPollStopped. -var ( - _ bin.Encoder = &ChatEventPollStopped{} - _ bin.Decoder = &ChatEventPollStopped{} - _ bin.BareEncoder = &ChatEventPollStopped{} - _ bin.BareDecoder = &ChatEventPollStopped{} - - _ ChatEventActionClass = &ChatEventPollStopped{} -) - -func (c *ChatEventPollStopped) Zero() bool { - if c == nil { - return true - } - if !(c.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventPollStopped) String() string { - if c == nil { - return "ChatEventPollStopped(nil)" - } - type Alias ChatEventPollStopped - return fmt.Sprintf("ChatEventPollStopped%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventPollStopped) TypeID() uint32 { - return ChatEventPollStoppedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventPollStopped) TypeName() string { - return "chatEventPollStopped" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventPollStopped) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventPollStopped", - ID: ChatEventPollStoppedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventPollStopped) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil") - } - b.PutID(ChatEventPollStoppedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventPollStopped) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil") - } - if err := c.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPollStopped#77cc8be5: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventPollStopped) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil") - } - if err := b.ConsumeID(ChatEventPollStoppedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventPollStopped) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil") - } - { - if err := c.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventPollStopped) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil") - } - b.ObjStart() - b.PutID("chatEventPollStopped") - b.Comma() - b.FieldStart("message") - if err := c.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPollStopped#77cc8be5: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventPollStopped) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventPollStopped"); err != nil { - return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: %w", err) - } - case "message": - if err := c.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (c *ChatEventPollStopped) GetMessage() (value Message) { - if c == nil { - return - } - return c.Message -} - // ChatEventMessagePinned represents TL type `chatEventMessagePinned#1a26ad1a`. type ChatEventMessagePinned struct { // Pinned message @@ -895,107 +729,273 @@ func (c *ChatEventMessageUnpinned) GetMessage() (value Message) { return c.Message } -// ChatEventMemberJoined represents TL type `chatEventMemberJoined#f1f70924`. -type ChatEventMemberJoined struct { +// ChatEventPollStopped represents TL type `chatEventPollStopped#77cc8be5`. +type ChatEventPollStopped struct { + // The message with the poll + Message Message } -// ChatEventMemberJoinedTypeID is TL type id of ChatEventMemberJoined. -const ChatEventMemberJoinedTypeID = 0xf1f70924 +// ChatEventPollStoppedTypeID is TL type id of ChatEventPollStopped. +const ChatEventPollStoppedTypeID = 0x77cc8be5 // construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberJoined) construct() ChatEventActionClass { return &c } +func (c ChatEventPollStopped) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventMemberJoined. +// Ensuring interfaces in compile-time for ChatEventPollStopped. var ( - _ bin.Encoder = &ChatEventMemberJoined{} - _ bin.Decoder = &ChatEventMemberJoined{} - _ bin.BareEncoder = &ChatEventMemberJoined{} - _ bin.BareDecoder = &ChatEventMemberJoined{} + _ bin.Encoder = &ChatEventPollStopped{} + _ bin.Decoder = &ChatEventPollStopped{} + _ bin.BareEncoder = &ChatEventPollStopped{} + _ bin.BareDecoder = &ChatEventPollStopped{} - _ ChatEventActionClass = &ChatEventMemberJoined{} + _ ChatEventActionClass = &ChatEventPollStopped{} ) -func (c *ChatEventMemberJoined) Zero() bool { +func (c *ChatEventPollStopped) Zero() bool { if c == nil { return true } + if !(c.Message.Zero()) { + return false + } return true } // String implements fmt.Stringer. -func (c *ChatEventMemberJoined) String() string { +func (c *ChatEventPollStopped) String() string { if c == nil { - return "ChatEventMemberJoined(nil)" + return "ChatEventPollStopped(nil)" } - type Alias ChatEventMemberJoined - return fmt.Sprintf("ChatEventMemberJoined%+v", Alias(*c)) + type Alias ChatEventPollStopped + return fmt.Sprintf("ChatEventPollStopped%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberJoined) TypeID() uint32 { - return ChatEventMemberJoinedTypeID +func (*ChatEventPollStopped) TypeID() uint32 { + return ChatEventPollStoppedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventMemberJoined) TypeName() string { - return "chatEventMemberJoined" +func (*ChatEventPollStopped) TypeName() string { + return "chatEventPollStopped" } // TypeInfo returns info about TL type. -func (c *ChatEventMemberJoined) TypeInfo() tdp.Type { +func (c *ChatEventPollStopped) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventMemberJoined", - ID: ChatEventMemberJoinedTypeID, + Name: "chatEventPollStopped", + ID: ChatEventPollStoppedTypeID, } if c == nil { typ.Null = true return typ } - typ.Fields = []tdp.Field{} + typ.Fields = []tdp.Field{ + { + Name: "Message", + SchemaName: "message", + }, + } return typ } // Encode implements bin.Encoder. -func (c *ChatEventMemberJoined) Encode(b *bin.Buffer) error { +func (c *ChatEventPollStopped) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil") + return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil") } - b.PutID(ChatEventMemberJoinedTypeID) + b.PutID(ChatEventPollStoppedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberJoined) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventPollStopped) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil") + return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil") + } + if err := c.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventPollStopped#77cc8be5: field message: %w", err) } return nil } // Decode implements bin.Decoder. -func (c *ChatEventMemberJoined) Decode(b *bin.Buffer) error { +func (c *ChatEventPollStopped) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil") + return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil") } - if err := b.ConsumeID(ChatEventMemberJoinedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoined#f1f70924: %w", err) + if err := b.ConsumeID(ChatEventPollStoppedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberJoined) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventPollStopped) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil") + return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil") + } + { + if err := c.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: field message: %w", err) + } } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberJoined) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventPollStopped) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil") + } + b.ObjStart() + b.PutID("chatEventPollStopped") + b.Comma() + b.FieldStart("message") + if err := c.Message.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventPollStopped#77cc8be5: field message: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatEventPollStopped) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatEventPollStopped"); err != nil { + return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: %w", err) + } + case "message": + if err := c.Message.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: field message: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetMessage returns value of Message field. +func (c *ChatEventPollStopped) GetMessage() (value Message) { + if c == nil { + return + } + return c.Message +} + +// ChatEventMemberJoined represents TL type `chatEventMemberJoined#f1f70924`. +type ChatEventMemberJoined struct { +} + +// ChatEventMemberJoinedTypeID is TL type id of ChatEventMemberJoined. +const ChatEventMemberJoinedTypeID = 0xf1f70924 + +// construct implements constructor of ChatEventActionClass. +func (c ChatEventMemberJoined) construct() ChatEventActionClass { return &c } + +// Ensuring interfaces in compile-time for ChatEventMemberJoined. +var ( + _ bin.Encoder = &ChatEventMemberJoined{} + _ bin.Decoder = &ChatEventMemberJoined{} + _ bin.BareEncoder = &ChatEventMemberJoined{} + _ bin.BareDecoder = &ChatEventMemberJoined{} + + _ ChatEventActionClass = &ChatEventMemberJoined{} +) + +func (c *ChatEventMemberJoined) Zero() bool { + if c == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatEventMemberJoined) String() string { + if c == nil { + return "ChatEventMemberJoined(nil)" + } + type Alias ChatEventMemberJoined + return fmt.Sprintf("ChatEventMemberJoined%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatEventMemberJoined) TypeID() uint32 { + return ChatEventMemberJoinedTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatEventMemberJoined) TypeName() string { + return "chatEventMemberJoined" +} + +// TypeInfo returns info about TL type. +func (c *ChatEventMemberJoined) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatEventMemberJoined", + ID: ChatEventMemberJoinedTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatEventMemberJoined) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil") + } + b.PutID(ChatEventMemberJoinedTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatEventMemberJoined) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatEventMemberJoined) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil") + } + if err := b.ConsumeID(ChatEventMemberJoinedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventMemberJoined#f1f70924: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatEventMemberJoined) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatEventMemberJoined) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil") } @@ -1392,130 +1392,193 @@ func (c *ChatEventMemberJoinedByRequest) GetInviteLink() (value ChatInviteLink) return c.InviteLink } -// ChatEventMemberLeft represents TL type `chatEventMemberLeft#c778400f`. -type ChatEventMemberLeft struct { +// ChatEventMemberInvited represents TL type `chatEventMemberInvited#38d7bfc9`. +type ChatEventMemberInvited struct { + // New member user identifier + UserID int64 + // New member status + Status ChatMemberStatusClass } -// ChatEventMemberLeftTypeID is TL type id of ChatEventMemberLeft. -const ChatEventMemberLeftTypeID = 0xc778400f +// ChatEventMemberInvitedTypeID is TL type id of ChatEventMemberInvited. +const ChatEventMemberInvitedTypeID = 0x38d7bfc9 // construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberLeft) construct() ChatEventActionClass { return &c } +func (c ChatEventMemberInvited) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventMemberLeft. +// Ensuring interfaces in compile-time for ChatEventMemberInvited. var ( - _ bin.Encoder = &ChatEventMemberLeft{} - _ bin.Decoder = &ChatEventMemberLeft{} - _ bin.BareEncoder = &ChatEventMemberLeft{} - _ bin.BareDecoder = &ChatEventMemberLeft{} + _ bin.Encoder = &ChatEventMemberInvited{} + _ bin.Decoder = &ChatEventMemberInvited{} + _ bin.BareEncoder = &ChatEventMemberInvited{} + _ bin.BareDecoder = &ChatEventMemberInvited{} - _ ChatEventActionClass = &ChatEventMemberLeft{} + _ ChatEventActionClass = &ChatEventMemberInvited{} ) -func (c *ChatEventMemberLeft) Zero() bool { +func (c *ChatEventMemberInvited) Zero() bool { if c == nil { return true } + if !(c.UserID == 0) { + return false + } + if !(c.Status == nil) { + return false + } return true } // String implements fmt.Stringer. -func (c *ChatEventMemberLeft) String() string { +func (c *ChatEventMemberInvited) String() string { if c == nil { - return "ChatEventMemberLeft(nil)" + return "ChatEventMemberInvited(nil)" } - type Alias ChatEventMemberLeft - return fmt.Sprintf("ChatEventMemberLeft%+v", Alias(*c)) + type Alias ChatEventMemberInvited + return fmt.Sprintf("ChatEventMemberInvited%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberLeft) TypeID() uint32 { - return ChatEventMemberLeftTypeID +func (*ChatEventMemberInvited) TypeID() uint32 { + return ChatEventMemberInvitedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventMemberLeft) TypeName() string { - return "chatEventMemberLeft" +func (*ChatEventMemberInvited) TypeName() string { + return "chatEventMemberInvited" } // TypeInfo returns info about TL type. -func (c *ChatEventMemberLeft) TypeInfo() tdp.Type { +func (c *ChatEventMemberInvited) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventMemberLeft", - ID: ChatEventMemberLeftTypeID, + Name: "chatEventMemberInvited", + ID: ChatEventMemberInvitedTypeID, } if c == nil { typ.Null = true return typ } - typ.Fields = []tdp.Field{} + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Status", + SchemaName: "status", + }, + } return typ } // Encode implements bin.Encoder. -func (c *ChatEventMemberLeft) Encode(b *bin.Buffer) error { +func (c *ChatEventMemberInvited) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil") + return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil") } - b.PutID(ChatEventMemberLeftTypeID) + b.PutID(ChatEventMemberInvitedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberLeft) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventMemberInvited) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil") + return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil") + } + b.PutInt53(c.UserID) + if c.Status == nil { + return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status is nil") + } + if err := c.Status.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status: %w", err) } return nil } // Decode implements bin.Decoder. -func (c *ChatEventMemberLeft) Decode(b *bin.Buffer) error { +func (c *ChatEventMemberInvited) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil") + return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil") } - if err := b.ConsumeID(ChatEventMemberLeftTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberLeft#c778400f: %w", err) + if err := b.ConsumeID(ChatEventMemberInvitedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberLeft) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberLeft) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventMemberInvited) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil") + return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil") } - b.ObjStart() - b.PutID("chatEventMemberLeft") - b.Comma() - b.StripComma() + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field user_id: %w", err) + } + c.UserID = value + } + { + value, err := DecodeChatMemberStatus(b) + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field status: %w", err) + } + c.Status = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatEventMemberInvited) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil") + } + b.ObjStart() + b.PutID("chatEventMemberInvited") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(c.UserID) + b.Comma() + b.FieldStart("status") + if c.Status == nil { + return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status is nil") + } + if err := c.Status.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status: %w", err) + } + b.Comma() + b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberLeft) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventMemberInvited) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil") + return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberLeft"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberLeft#c778400f: %w", err) + if err := b.ConsumeID("chatEventMemberInvited"); err != nil { + return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field user_id: %w", err) + } + c.UserID = value + case "status": + value, err := DecodeTDLibJSONChatMemberStatus(b) + if err != nil { + return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field status: %w", err) } + c.Status = value default: return b.Skip() } @@ -1523,163 +1586,128 @@ func (c *ChatEventMemberLeft) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// ChatEventMemberInvited represents TL type `chatEventMemberInvited#38d7bfc9`. -type ChatEventMemberInvited struct { - // New member user identifier - UserID int64 - // New member status - Status ChatMemberStatusClass +// GetUserID returns value of UserID field. +func (c *ChatEventMemberInvited) GetUserID() (value int64) { + if c == nil { + return + } + return c.UserID } -// ChatEventMemberInvitedTypeID is TL type id of ChatEventMemberInvited. -const ChatEventMemberInvitedTypeID = 0x38d7bfc9 +// GetStatus returns value of Status field. +func (c *ChatEventMemberInvited) GetStatus() (value ChatMemberStatusClass) { + if c == nil { + return + } + return c.Status +} + +// ChatEventMemberLeft represents TL type `chatEventMemberLeft#c778400f`. +type ChatEventMemberLeft struct { +} + +// ChatEventMemberLeftTypeID is TL type id of ChatEventMemberLeft. +const ChatEventMemberLeftTypeID = 0xc778400f // construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberInvited) construct() ChatEventActionClass { return &c } +func (c ChatEventMemberLeft) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventMemberInvited. +// Ensuring interfaces in compile-time for ChatEventMemberLeft. var ( - _ bin.Encoder = &ChatEventMemberInvited{} - _ bin.Decoder = &ChatEventMemberInvited{} - _ bin.BareEncoder = &ChatEventMemberInvited{} - _ bin.BareDecoder = &ChatEventMemberInvited{} + _ bin.Encoder = &ChatEventMemberLeft{} + _ bin.Decoder = &ChatEventMemberLeft{} + _ bin.BareEncoder = &ChatEventMemberLeft{} + _ bin.BareDecoder = &ChatEventMemberLeft{} - _ ChatEventActionClass = &ChatEventMemberInvited{} + _ ChatEventActionClass = &ChatEventMemberLeft{} ) -func (c *ChatEventMemberInvited) Zero() bool { +func (c *ChatEventMemberLeft) Zero() bool { if c == nil { return true } - if !(c.UserID == 0) { - return false - } - if !(c.Status == nil) { - return false - } return true } // String implements fmt.Stringer. -func (c *ChatEventMemberInvited) String() string { +func (c *ChatEventMemberLeft) String() string { if c == nil { - return "ChatEventMemberInvited(nil)" + return "ChatEventMemberLeft(nil)" } - type Alias ChatEventMemberInvited - return fmt.Sprintf("ChatEventMemberInvited%+v", Alias(*c)) + type Alias ChatEventMemberLeft + return fmt.Sprintf("ChatEventMemberLeft%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberInvited) TypeID() uint32 { - return ChatEventMemberInvitedTypeID +func (*ChatEventMemberLeft) TypeID() uint32 { + return ChatEventMemberLeftTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventMemberInvited) TypeName() string { - return "chatEventMemberInvited" +func (*ChatEventMemberLeft) TypeName() string { + return "chatEventMemberLeft" } // TypeInfo returns info about TL type. -func (c *ChatEventMemberInvited) TypeInfo() tdp.Type { +func (c *ChatEventMemberLeft) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventMemberInvited", - ID: ChatEventMemberInvitedTypeID, + Name: "chatEventMemberLeft", + ID: ChatEventMemberLeftTypeID, } if c == nil { typ.Null = true return typ } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Status", - SchemaName: "status", - }, - } + typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. -func (c *ChatEventMemberInvited) Encode(b *bin.Buffer) error { +func (c *ChatEventMemberLeft) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil") + return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil") } - b.PutID(ChatEventMemberInvitedTypeID) + b.PutID(ChatEventMemberLeftTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberInvited) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventMemberLeft) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil") - } - b.PutInt53(c.UserID) - if c.Status == nil { - return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status is nil") - } - if err := c.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status: %w", err) + return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil") } return nil } // Decode implements bin.Decoder. -func (c *ChatEventMemberInvited) Decode(b *bin.Buffer) error { +func (c *ChatEventMemberLeft) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil") + return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil") } - if err := b.ConsumeID(ChatEventMemberInvitedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: %w", err) + if err := b.ConsumeID(ChatEventMemberLeftTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventMemberLeft#c778400f: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberInvited) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventMemberLeft) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field status: %w", err) - } - c.Status = value + return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberInvited) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventMemberLeft) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil") + return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil") } b.ObjStart() - b.PutID("chatEventMemberInvited") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("status") - if c.Status == nil { - return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status is nil") - } - if err := c.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status: %w", err) - } + b.PutID("chatEventMemberLeft") b.Comma() b.StripComma() b.ObjEnd() @@ -1687,29 +1715,17 @@ func (c *ChatEventMemberInvited) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberInvited) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventMemberLeft) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil") + return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberInvited"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field user_id: %w", err) - } - c.UserID = value - case "status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field status: %w", err) + if err := b.ConsumeID("chatEventMemberLeft"); err != nil { + return fmt.Errorf("unable to decode chatEventMemberLeft#c778400f: %w", err) } - c.Status = value default: return b.Skip() } @@ -1717,22 +1733,6 @@ func (c *ChatEventMemberInvited) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetUserID returns value of UserID field. -func (c *ChatEventMemberInvited) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetStatus returns value of Status field. -func (c *ChatEventMemberInvited) GetStatus() (value ChatMemberStatusClass) { - if c == nil { - return - } - return c.Status -} - // ChatEventMemberPromoted represents TL type `chatEventMemberPromoted#1f4f6861`. type ChatEventMemberPromoted struct { // Affected chat member user identifier @@ -2251,38 +2251,38 @@ func (c *ChatEventMemberRestricted) GetNewStatus() (value ChatMemberStatusClass) return c.NewStatus } -// ChatEventTitleChanged represents TL type `chatEventTitleChanged#43990ad2`. -type ChatEventTitleChanged struct { - // Previous chat title - OldTitle string - // New chat title - NewTitle string +// ChatEventAvailableReactionsChanged represents TL type `chatEventAvailableReactionsChanged#9ac93274`. +type ChatEventAvailableReactionsChanged struct { + // Previous chat available reactions + OldAvailableReactions []string + // New chat available reactions + NewAvailableReactions []string } -// ChatEventTitleChangedTypeID is TL type id of ChatEventTitleChanged. -const ChatEventTitleChangedTypeID = 0x43990ad2 +// ChatEventAvailableReactionsChangedTypeID is TL type id of ChatEventAvailableReactionsChanged. +const ChatEventAvailableReactionsChangedTypeID = 0x9ac93274 // construct implements constructor of ChatEventActionClass. -func (c ChatEventTitleChanged) construct() ChatEventActionClass { return &c } +func (c ChatEventAvailableReactionsChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventTitleChanged. +// Ensuring interfaces in compile-time for ChatEventAvailableReactionsChanged. var ( - _ bin.Encoder = &ChatEventTitleChanged{} - _ bin.Decoder = &ChatEventTitleChanged{} - _ bin.BareEncoder = &ChatEventTitleChanged{} - _ bin.BareDecoder = &ChatEventTitleChanged{} + _ bin.Encoder = &ChatEventAvailableReactionsChanged{} + _ bin.Decoder = &ChatEventAvailableReactionsChanged{} + _ bin.BareEncoder = &ChatEventAvailableReactionsChanged{} + _ bin.BareDecoder = &ChatEventAvailableReactionsChanged{} - _ ChatEventActionClass = &ChatEventTitleChanged{} + _ ChatEventActionClass = &ChatEventAvailableReactionsChanged{} ) -func (c *ChatEventTitleChanged) Zero() bool { +func (c *ChatEventAvailableReactionsChanged) Zero() bool { if c == nil { return true } - if !(c.OldTitle == "") { + if !(c.OldAvailableReactions == nil) { return false } - if !(c.NewTitle == "") { + if !(c.NewAvailableReactions == nil) { return false } @@ -2290,31 +2290,31 @@ func (c *ChatEventTitleChanged) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventTitleChanged) String() string { +func (c *ChatEventAvailableReactionsChanged) String() string { if c == nil { - return "ChatEventTitleChanged(nil)" + return "ChatEventAvailableReactionsChanged(nil)" } - type Alias ChatEventTitleChanged - return fmt.Sprintf("ChatEventTitleChanged%+v", Alias(*c)) + type Alias ChatEventAvailableReactionsChanged + return fmt.Sprintf("ChatEventAvailableReactionsChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventTitleChanged) TypeID() uint32 { - return ChatEventTitleChangedTypeID +func (*ChatEventAvailableReactionsChanged) TypeID() uint32 { + return ChatEventAvailableReactionsChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventTitleChanged) TypeName() string { - return "chatEventTitleChanged" +func (*ChatEventAvailableReactionsChanged) TypeName() string { + return "chatEventAvailableReactionsChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventTitleChanged) TypeInfo() tdp.Type { +func (c *ChatEventAvailableReactionsChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventTitleChanged", - ID: ChatEventTitleChangedTypeID, + Name: "chatEventAvailableReactionsChanged", + ID: ChatEventAvailableReactionsChangedTypeID, } if c == nil { typ.Null = true @@ -2322,82 +2322,120 @@ func (c *ChatEventTitleChanged) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "OldTitle", - SchemaName: "old_title", + Name: "OldAvailableReactions", + SchemaName: "old_available_reactions", }, { - Name: "NewTitle", - SchemaName: "new_title", + Name: "NewAvailableReactions", + SchemaName: "new_available_reactions", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventTitleChanged) Encode(b *bin.Buffer) error { +func (c *ChatEventAvailableReactionsChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil") + return fmt.Errorf("can't encode chatEventAvailableReactionsChanged#9ac93274 as nil") } - b.PutID(ChatEventTitleChangedTypeID) + b.PutID(ChatEventAvailableReactionsChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventTitleChanged) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventAvailableReactionsChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil") + return fmt.Errorf("can't encode chatEventAvailableReactionsChanged#9ac93274 as nil") + } + b.PutInt(len(c.OldAvailableReactions)) + for _, v := range c.OldAvailableReactions { + b.PutString(v) + } + b.PutInt(len(c.NewAvailableReactions)) + for _, v := range c.NewAvailableReactions { + b.PutString(v) } - b.PutString(c.OldTitle) - b.PutString(c.NewTitle) return nil } // Decode implements bin.Decoder. -func (c *ChatEventTitleChanged) Decode(b *bin.Buffer) error { +func (c *ChatEventAvailableReactionsChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil") + return fmt.Errorf("can't decode chatEventAvailableReactionsChanged#9ac93274 to nil") } - if err := b.ConsumeID(ChatEventTitleChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: %w", err) + if err := b.ConsumeID(ChatEventAvailableReactionsChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventTitleChanged) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventAvailableReactionsChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil") + return fmt.Errorf("can't decode chatEventAvailableReactionsChanged#9ac93274 to nil") } { - value, err := b.String() + headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field old_title: %w", err) + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: field old_available_reactions: %w", err) + } + + if headerLen > 0 { + c.OldAvailableReactions = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: field old_available_reactions: %w", err) + } + c.OldAvailableReactions = append(c.OldAvailableReactions, value) } - c.OldTitle = value } { - value, err := b.String() + headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field new_title: %w", err) + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: field new_available_reactions: %w", err) + } + + if headerLen > 0 { + c.NewAvailableReactions = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: field new_available_reactions: %w", err) + } + c.NewAvailableReactions = append(c.NewAvailableReactions, value) } - c.NewTitle = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventTitleChanged) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventAvailableReactionsChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil") + return fmt.Errorf("can't encode chatEventAvailableReactionsChanged#9ac93274 as nil") } b.ObjStart() - b.PutID("chatEventTitleChanged") + b.PutID("chatEventAvailableReactionsChanged") b.Comma() - b.FieldStart("old_title") - b.PutString(c.OldTitle) + b.FieldStart("old_available_reactions") + b.ArrStart() + for _, v := range c.OldAvailableReactions { + b.PutString(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() b.Comma() - b.FieldStart("new_title") - b.PutString(c.NewTitle) + b.FieldStart("new_available_reactions") + b.ArrStart() + for _, v := range c.NewAvailableReactions { + b.PutString(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() b.Comma() b.StripComma() b.ObjEnd() @@ -2405,29 +2443,39 @@ func (c *ChatEventTitleChanged) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventTitleChanged) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventAvailableReactionsChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil") + return fmt.Errorf("can't decode chatEventAvailableReactionsChanged#9ac93274 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventTitleChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: %w", err) + if err := b.ConsumeID("chatEventAvailableReactionsChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: %w", err) } - case "old_title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field old_title: %w", err) + case "old_available_reactions": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: field old_available_reactions: %w", err) + } + c.OldAvailableReactions = append(c.OldAvailableReactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: field old_available_reactions: %w", err) } - c.OldTitle = value - case "new_title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field new_title: %w", err) + case "new_available_reactions": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: field new_available_reactions: %w", err) + } + c.NewAvailableReactions = append(c.NewAvailableReactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#9ac93274: field new_available_reactions: %w", err) } - c.NewTitle = value default: return b.Skip() } @@ -2435,54 +2483,54 @@ func (c *ChatEventTitleChanged) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetOldTitle returns value of OldTitle field. -func (c *ChatEventTitleChanged) GetOldTitle() (value string) { +// GetOldAvailableReactions returns value of OldAvailableReactions field. +func (c *ChatEventAvailableReactionsChanged) GetOldAvailableReactions() (value []string) { if c == nil { return } - return c.OldTitle + return c.OldAvailableReactions } -// GetNewTitle returns value of NewTitle field. -func (c *ChatEventTitleChanged) GetNewTitle() (value string) { +// GetNewAvailableReactions returns value of NewAvailableReactions field. +func (c *ChatEventAvailableReactionsChanged) GetNewAvailableReactions() (value []string) { if c == nil { return } - return c.NewTitle + return c.NewAvailableReactions } -// ChatEventPermissionsChanged represents TL type `chatEventPermissionsChanged#b1d337a8`. -type ChatEventPermissionsChanged struct { - // Previous chat permissions - OldPermissions ChatPermissions - // New chat permissions - NewPermissions ChatPermissions +// ChatEventDescriptionChanged represents TL type `chatEventDescriptionChanged#254cf1e`. +type ChatEventDescriptionChanged struct { + // Previous chat description + OldDescription string + // New chat description + NewDescription string } -// ChatEventPermissionsChangedTypeID is TL type id of ChatEventPermissionsChanged. -const ChatEventPermissionsChangedTypeID = 0xb1d337a8 +// ChatEventDescriptionChangedTypeID is TL type id of ChatEventDescriptionChanged. +const ChatEventDescriptionChangedTypeID = 0x254cf1e // construct implements constructor of ChatEventActionClass. -func (c ChatEventPermissionsChanged) construct() ChatEventActionClass { return &c } +func (c ChatEventDescriptionChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventPermissionsChanged. +// Ensuring interfaces in compile-time for ChatEventDescriptionChanged. var ( - _ bin.Encoder = &ChatEventPermissionsChanged{} - _ bin.Decoder = &ChatEventPermissionsChanged{} - _ bin.BareEncoder = &ChatEventPermissionsChanged{} - _ bin.BareDecoder = &ChatEventPermissionsChanged{} + _ bin.Encoder = &ChatEventDescriptionChanged{} + _ bin.Decoder = &ChatEventDescriptionChanged{} + _ bin.BareEncoder = &ChatEventDescriptionChanged{} + _ bin.BareDecoder = &ChatEventDescriptionChanged{} - _ ChatEventActionClass = &ChatEventPermissionsChanged{} + _ ChatEventActionClass = &ChatEventDescriptionChanged{} ) -func (c *ChatEventPermissionsChanged) Zero() bool { +func (c *ChatEventDescriptionChanged) Zero() bool { if c == nil { return true } - if !(c.OldPermissions.Zero()) { + if !(c.OldDescription == "") { return false } - if !(c.NewPermissions.Zero()) { + if !(c.NewDescription == "") { return false } @@ -2490,31 +2538,31 @@ func (c *ChatEventPermissionsChanged) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventPermissionsChanged) String() string { +func (c *ChatEventDescriptionChanged) String() string { if c == nil { - return "ChatEventPermissionsChanged(nil)" + return "ChatEventDescriptionChanged(nil)" } - type Alias ChatEventPermissionsChanged - return fmt.Sprintf("ChatEventPermissionsChanged%+v", Alias(*c)) + type Alias ChatEventDescriptionChanged + return fmt.Sprintf("ChatEventDescriptionChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventPermissionsChanged) TypeID() uint32 { - return ChatEventPermissionsChangedTypeID +func (*ChatEventDescriptionChanged) TypeID() uint32 { + return ChatEventDescriptionChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventPermissionsChanged) TypeName() string { - return "chatEventPermissionsChanged" +func (*ChatEventDescriptionChanged) TypeName() string { + return "chatEventDescriptionChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventPermissionsChanged) TypeInfo() tdp.Type { +func (c *ChatEventDescriptionChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventPermissionsChanged", - ID: ChatEventPermissionsChangedTypeID, + Name: "chatEventDescriptionChanged", + ID: ChatEventDescriptionChangedTypeID, } if c == nil { typ.Null = true @@ -2522,86 +2570,82 @@ func (c *ChatEventPermissionsChanged) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "OldPermissions", - SchemaName: "old_permissions", + Name: "OldDescription", + SchemaName: "old_description", }, { - Name: "NewPermissions", - SchemaName: "new_permissions", + Name: "NewDescription", + SchemaName: "new_description", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventPermissionsChanged) Encode(b *bin.Buffer) error { +func (c *ChatEventDescriptionChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil") + return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil") } - b.PutID(ChatEventPermissionsChangedTypeID) + b.PutID(ChatEventDescriptionChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventPermissionsChanged) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventDescriptionChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil") - } - if err := c.OldPermissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) - } - if err := c.NewPermissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) + return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil") } + b.PutString(c.OldDescription) + b.PutString(c.NewDescription) return nil } // Decode implements bin.Decoder. -func (c *ChatEventPermissionsChanged) Decode(b *bin.Buffer) error { +func (c *ChatEventDescriptionChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil") + return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil") } - if err := b.ConsumeID(ChatEventPermissionsChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: %w", err) + if err := b.ConsumeID(ChatEventDescriptionChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventPermissionsChanged) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventDescriptionChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil") + return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil") } { - if err := c.OldPermissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field old_description: %w", err) } + c.OldDescription = value } { - if err := c.NewPermissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field new_description: %w", err) } + c.NewDescription = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventPermissionsChanged) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventDescriptionChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil") + return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil") } b.ObjStart() - b.PutID("chatEventPermissionsChanged") + b.PutID("chatEventDescriptionChanged") b.Comma() - b.FieldStart("old_permissions") - if err := c.OldPermissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) - } + b.FieldStart("old_description") + b.PutString(c.OldDescription) b.Comma() - b.FieldStart("new_permissions") - if err := c.NewPermissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) - } + b.FieldStart("new_description") + b.PutString(c.NewDescription) b.Comma() b.StripComma() b.ObjEnd() @@ -2609,25 +2653,29 @@ func (c *ChatEventPermissionsChanged) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventPermissionsChanged) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventDescriptionChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil") + return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventPermissionsChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: %w", err) + if err := b.ConsumeID("chatEventDescriptionChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: %w", err) } - case "old_permissions": - if err := c.OldPermissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) + case "old_description": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field old_description: %w", err) } - case "new_permissions": - if err := c.NewPermissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) + c.OldDescription = value + case "new_description": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field new_description: %w", err) } + c.NewDescription = value default: return b.Skip() } @@ -2635,54 +2683,54 @@ func (c *ChatEventPermissionsChanged) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetOldPermissions returns value of OldPermissions field. -func (c *ChatEventPermissionsChanged) GetOldPermissions() (value ChatPermissions) { +// GetOldDescription returns value of OldDescription field. +func (c *ChatEventDescriptionChanged) GetOldDescription() (value string) { if c == nil { return } - return c.OldPermissions + return c.OldDescription } -// GetNewPermissions returns value of NewPermissions field. -func (c *ChatEventPermissionsChanged) GetNewPermissions() (value ChatPermissions) { +// GetNewDescription returns value of NewDescription field. +func (c *ChatEventDescriptionChanged) GetNewDescription() (value string) { if c == nil { return } - return c.NewPermissions + return c.NewDescription } -// ChatEventDescriptionChanged represents TL type `chatEventDescriptionChanged#254cf1e`. -type ChatEventDescriptionChanged struct { - // Previous chat description - OldDescription string - // New chat description - NewDescription string +// ChatEventLinkedChatChanged represents TL type `chatEventLinkedChatChanged#6b2271af`. +type ChatEventLinkedChatChanged struct { + // Previous supergroup linked chat identifier + OldLinkedChatID int64 + // New supergroup linked chat identifier + NewLinkedChatID int64 } -// ChatEventDescriptionChangedTypeID is TL type id of ChatEventDescriptionChanged. -const ChatEventDescriptionChangedTypeID = 0x254cf1e +// ChatEventLinkedChatChangedTypeID is TL type id of ChatEventLinkedChatChanged. +const ChatEventLinkedChatChangedTypeID = 0x6b2271af // construct implements constructor of ChatEventActionClass. -func (c ChatEventDescriptionChanged) construct() ChatEventActionClass { return &c } +func (c ChatEventLinkedChatChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventDescriptionChanged. +// Ensuring interfaces in compile-time for ChatEventLinkedChatChanged. var ( - _ bin.Encoder = &ChatEventDescriptionChanged{} - _ bin.Decoder = &ChatEventDescriptionChanged{} - _ bin.BareEncoder = &ChatEventDescriptionChanged{} - _ bin.BareDecoder = &ChatEventDescriptionChanged{} + _ bin.Encoder = &ChatEventLinkedChatChanged{} + _ bin.Decoder = &ChatEventLinkedChatChanged{} + _ bin.BareEncoder = &ChatEventLinkedChatChanged{} + _ bin.BareDecoder = &ChatEventLinkedChatChanged{} - _ ChatEventActionClass = &ChatEventDescriptionChanged{} + _ ChatEventActionClass = &ChatEventLinkedChatChanged{} ) -func (c *ChatEventDescriptionChanged) Zero() bool { +func (c *ChatEventLinkedChatChanged) Zero() bool { if c == nil { return true } - if !(c.OldDescription == "") { + if !(c.OldLinkedChatID == 0) { return false } - if !(c.NewDescription == "") { + if !(c.NewLinkedChatID == 0) { return false } @@ -2690,31 +2738,31 @@ func (c *ChatEventDescriptionChanged) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventDescriptionChanged) String() string { +func (c *ChatEventLinkedChatChanged) String() string { if c == nil { - return "ChatEventDescriptionChanged(nil)" + return "ChatEventLinkedChatChanged(nil)" } - type Alias ChatEventDescriptionChanged - return fmt.Sprintf("ChatEventDescriptionChanged%+v", Alias(*c)) + type Alias ChatEventLinkedChatChanged + return fmt.Sprintf("ChatEventLinkedChatChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventDescriptionChanged) TypeID() uint32 { - return ChatEventDescriptionChangedTypeID +func (*ChatEventLinkedChatChanged) TypeID() uint32 { + return ChatEventLinkedChatChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventDescriptionChanged) TypeName() string { - return "chatEventDescriptionChanged" +func (*ChatEventLinkedChatChanged) TypeName() string { + return "chatEventLinkedChatChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventDescriptionChanged) TypeInfo() tdp.Type { +func (c *ChatEventLinkedChatChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventDescriptionChanged", - ID: ChatEventDescriptionChangedTypeID, + Name: "chatEventLinkedChatChanged", + ID: ChatEventLinkedChatChangedTypeID, } if c == nil { typ.Null = true @@ -2722,82 +2770,82 @@ func (c *ChatEventDescriptionChanged) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "OldDescription", - SchemaName: "old_description", + Name: "OldLinkedChatID", + SchemaName: "old_linked_chat_id", }, { - Name: "NewDescription", - SchemaName: "new_description", + Name: "NewLinkedChatID", + SchemaName: "new_linked_chat_id", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventDescriptionChanged) Encode(b *bin.Buffer) error { +func (c *ChatEventLinkedChatChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil") + return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil") } - b.PutID(ChatEventDescriptionChangedTypeID) + b.PutID(ChatEventLinkedChatChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventDescriptionChanged) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventLinkedChatChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil") + return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil") } - b.PutString(c.OldDescription) - b.PutString(c.NewDescription) + b.PutInt53(c.OldLinkedChatID) + b.PutInt53(c.NewLinkedChatID) return nil } // Decode implements bin.Decoder. -func (c *ChatEventDescriptionChanged) Decode(b *bin.Buffer) error { +func (c *ChatEventLinkedChatChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil") + return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil") } - if err := b.ConsumeID(ChatEventDescriptionChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: %w", err) + if err := b.ConsumeID(ChatEventLinkedChatChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventDescriptionChanged) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventLinkedChatChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil") + return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil") } { - value, err := b.String() + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field old_description: %w", err) + return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field old_linked_chat_id: %w", err) } - c.OldDescription = value + c.OldLinkedChatID = value } { - value, err := b.String() + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field new_description: %w", err) + return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field new_linked_chat_id: %w", err) } - c.NewDescription = value + c.NewLinkedChatID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventDescriptionChanged) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventLinkedChatChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil") + return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil") } b.ObjStart() - b.PutID("chatEventDescriptionChanged") + b.PutID("chatEventLinkedChatChanged") b.Comma() - b.FieldStart("old_description") - b.PutString(c.OldDescription) + b.FieldStart("old_linked_chat_id") + b.PutInt53(c.OldLinkedChatID) b.Comma() - b.FieldStart("new_description") - b.PutString(c.NewDescription) + b.FieldStart("new_linked_chat_id") + b.PutInt53(c.NewLinkedChatID) b.Comma() b.StripComma() b.ObjEnd() @@ -2805,29 +2853,29 @@ func (c *ChatEventDescriptionChanged) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventDescriptionChanged) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventLinkedChatChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil") + return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventDescriptionChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: %w", err) + if err := b.ConsumeID("chatEventLinkedChatChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: %w", err) } - case "old_description": - value, err := b.String() + case "old_linked_chat_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field old_description: %w", err) + return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field old_linked_chat_id: %w", err) } - c.OldDescription = value - case "new_description": - value, err := b.String() + c.OldLinkedChatID = value + case "new_linked_chat_id": + value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field new_description: %w", err) + return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field new_linked_chat_id: %w", err) } - c.NewDescription = value + c.NewLinkedChatID = value default: return b.Skip() } @@ -2835,54 +2883,54 @@ func (c *ChatEventDescriptionChanged) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetOldDescription returns value of OldDescription field. -func (c *ChatEventDescriptionChanged) GetOldDescription() (value string) { +// GetOldLinkedChatID returns value of OldLinkedChatID field. +func (c *ChatEventLinkedChatChanged) GetOldLinkedChatID() (value int64) { if c == nil { return } - return c.OldDescription + return c.OldLinkedChatID } -// GetNewDescription returns value of NewDescription field. -func (c *ChatEventDescriptionChanged) GetNewDescription() (value string) { +// GetNewLinkedChatID returns value of NewLinkedChatID field. +func (c *ChatEventLinkedChatChanged) GetNewLinkedChatID() (value int64) { if c == nil { return } - return c.NewDescription + return c.NewLinkedChatID } -// ChatEventUsernameChanged represents TL type `chatEventUsernameChanged#6707b56b`. -type ChatEventUsernameChanged struct { - // Previous chat username - OldUsername string - // New chat username - NewUsername string +// ChatEventLocationChanged represents TL type `chatEventLocationChanged#e7cdfd4e`. +type ChatEventLocationChanged struct { + // Previous location; may be null + OldLocation ChatLocation + // New location; may be null + NewLocation ChatLocation } -// ChatEventUsernameChangedTypeID is TL type id of ChatEventUsernameChanged. -const ChatEventUsernameChangedTypeID = 0x6707b56b +// ChatEventLocationChangedTypeID is TL type id of ChatEventLocationChanged. +const ChatEventLocationChangedTypeID = 0xe7cdfd4e // construct implements constructor of ChatEventActionClass. -func (c ChatEventUsernameChanged) construct() ChatEventActionClass { return &c } +func (c ChatEventLocationChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventUsernameChanged. +// Ensuring interfaces in compile-time for ChatEventLocationChanged. var ( - _ bin.Encoder = &ChatEventUsernameChanged{} - _ bin.Decoder = &ChatEventUsernameChanged{} - _ bin.BareEncoder = &ChatEventUsernameChanged{} - _ bin.BareDecoder = &ChatEventUsernameChanged{} + _ bin.Encoder = &ChatEventLocationChanged{} + _ bin.Decoder = &ChatEventLocationChanged{} + _ bin.BareEncoder = &ChatEventLocationChanged{} + _ bin.BareDecoder = &ChatEventLocationChanged{} - _ ChatEventActionClass = &ChatEventUsernameChanged{} + _ ChatEventActionClass = &ChatEventLocationChanged{} ) -func (c *ChatEventUsernameChanged) Zero() bool { +func (c *ChatEventLocationChanged) Zero() bool { if c == nil { return true } - if !(c.OldUsername == "") { + if !(c.OldLocation.Zero()) { return false } - if !(c.NewUsername == "") { + if !(c.NewLocation.Zero()) { return false } @@ -2890,31 +2938,31 @@ func (c *ChatEventUsernameChanged) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventUsernameChanged) String() string { +func (c *ChatEventLocationChanged) String() string { if c == nil { - return "ChatEventUsernameChanged(nil)" + return "ChatEventLocationChanged(nil)" } - type Alias ChatEventUsernameChanged - return fmt.Sprintf("ChatEventUsernameChanged%+v", Alias(*c)) + type Alias ChatEventLocationChanged + return fmt.Sprintf("ChatEventLocationChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventUsernameChanged) TypeID() uint32 { - return ChatEventUsernameChangedTypeID +func (*ChatEventLocationChanged) TypeID() uint32 { + return ChatEventLocationChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventUsernameChanged) TypeName() string { - return "chatEventUsernameChanged" +func (*ChatEventLocationChanged) TypeName() string { + return "chatEventLocationChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventUsernameChanged) TypeInfo() tdp.Type { +func (c *ChatEventLocationChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventUsernameChanged", - ID: ChatEventUsernameChangedTypeID, + Name: "chatEventLocationChanged", + ID: ChatEventLocationChangedTypeID, } if c == nil { typ.Null = true @@ -2922,82 +2970,86 @@ func (c *ChatEventUsernameChanged) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "OldUsername", - SchemaName: "old_username", + Name: "OldLocation", + SchemaName: "old_location", }, { - Name: "NewUsername", - SchemaName: "new_username", + Name: "NewLocation", + SchemaName: "new_location", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventUsernameChanged) Encode(b *bin.Buffer) error { +func (c *ChatEventLocationChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil") + return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil") } - b.PutID(ChatEventUsernameChangedTypeID) + b.PutID(ChatEventLocationChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventUsernameChanged) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventLocationChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil") + return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil") + } + if err := c.OldLocation.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) + } + if err := c.NewLocation.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) } - b.PutString(c.OldUsername) - b.PutString(c.NewUsername) return nil } // Decode implements bin.Decoder. -func (c *ChatEventUsernameChanged) Decode(b *bin.Buffer) error { +func (c *ChatEventLocationChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil") + return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil") } - if err := b.ConsumeID(ChatEventUsernameChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: %w", err) + if err := b.ConsumeID(ChatEventLocationChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventUsernameChanged) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventLocationChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil") + return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil") } { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field old_username: %w", err) + if err := c.OldLocation.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) } - c.OldUsername = value } { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field new_username: %w", err) + if err := c.NewLocation.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) } - c.NewUsername = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventUsernameChanged) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventLocationChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil") + return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil") } b.ObjStart() - b.PutID("chatEventUsernameChanged") - b.Comma() - b.FieldStart("old_username") - b.PutString(c.OldUsername) + b.PutID("chatEventLocationChanged") b.Comma() - b.FieldStart("new_username") - b.PutString(c.NewUsername) + b.FieldStart("old_location") + if err := c.OldLocation.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) + } + b.Comma() + b.FieldStart("new_location") + if err := c.NewLocation.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -3005,29 +3057,25 @@ func (c *ChatEventUsernameChanged) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventUsernameChanged) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventLocationChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil") + return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventUsernameChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: %w", err) + if err := b.ConsumeID("chatEventLocationChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: %w", err) } - case "old_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field old_username: %w", err) + case "old_location": + if err := c.OldLocation.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) } - c.OldUsername = value - case "new_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field new_username: %w", err) + case "new_location": + if err := c.NewLocation.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) } - c.NewUsername = value default: return b.Skip() } @@ -3035,54 +3083,54 @@ func (c *ChatEventUsernameChanged) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetOldUsername returns value of OldUsername field. -func (c *ChatEventUsernameChanged) GetOldUsername() (value string) { +// GetOldLocation returns value of OldLocation field. +func (c *ChatEventLocationChanged) GetOldLocation() (value ChatLocation) { if c == nil { return } - return c.OldUsername + return c.OldLocation } -// GetNewUsername returns value of NewUsername field. -func (c *ChatEventUsernameChanged) GetNewUsername() (value string) { +// GetNewLocation returns value of NewLocation field. +func (c *ChatEventLocationChanged) GetNewLocation() (value ChatLocation) { if c == nil { return } - return c.NewUsername + return c.NewLocation } -// ChatEventPhotoChanged represents TL type `chatEventPhotoChanged#cfa062c3`. -type ChatEventPhotoChanged struct { - // Previous chat photo value; may be null - OldPhoto ChatPhoto - // New chat photo value; may be null - NewPhoto ChatPhoto +// ChatEventMessageTTLChanged represents TL type `chatEventMessageTtlChanged#2e46b9b3`. +type ChatEventMessageTTLChanged struct { + // Previous value of message_ttl + OldMessageTTL int32 + // New value of message_ttl + NewMessageTTL int32 } -// ChatEventPhotoChangedTypeID is TL type id of ChatEventPhotoChanged. -const ChatEventPhotoChangedTypeID = 0xcfa062c3 +// ChatEventMessageTTLChangedTypeID is TL type id of ChatEventMessageTTLChanged. +const ChatEventMessageTTLChangedTypeID = 0x2e46b9b3 // construct implements constructor of ChatEventActionClass. -func (c ChatEventPhotoChanged) construct() ChatEventActionClass { return &c } +func (c ChatEventMessageTTLChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventPhotoChanged. +// Ensuring interfaces in compile-time for ChatEventMessageTTLChanged. var ( - _ bin.Encoder = &ChatEventPhotoChanged{} - _ bin.Decoder = &ChatEventPhotoChanged{} - _ bin.BareEncoder = &ChatEventPhotoChanged{} - _ bin.BareDecoder = &ChatEventPhotoChanged{} + _ bin.Encoder = &ChatEventMessageTTLChanged{} + _ bin.Decoder = &ChatEventMessageTTLChanged{} + _ bin.BareEncoder = &ChatEventMessageTTLChanged{} + _ bin.BareDecoder = &ChatEventMessageTTLChanged{} - _ ChatEventActionClass = &ChatEventPhotoChanged{} + _ ChatEventActionClass = &ChatEventMessageTTLChanged{} ) -func (c *ChatEventPhotoChanged) Zero() bool { +func (c *ChatEventMessageTTLChanged) Zero() bool { if c == nil { return true } - if !(c.OldPhoto.Zero()) { + if !(c.OldMessageTTL == 0) { return false } - if !(c.NewPhoto.Zero()) { + if !(c.NewMessageTTL == 0) { return false } @@ -3090,31 +3138,31 @@ func (c *ChatEventPhotoChanged) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventPhotoChanged) String() string { +func (c *ChatEventMessageTTLChanged) String() string { if c == nil { - return "ChatEventPhotoChanged(nil)" + return "ChatEventMessageTTLChanged(nil)" } - type Alias ChatEventPhotoChanged - return fmt.Sprintf("ChatEventPhotoChanged%+v", Alias(*c)) + type Alias ChatEventMessageTTLChanged + return fmt.Sprintf("ChatEventMessageTTLChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventPhotoChanged) TypeID() uint32 { - return ChatEventPhotoChangedTypeID +func (*ChatEventMessageTTLChanged) TypeID() uint32 { + return ChatEventMessageTTLChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventPhotoChanged) TypeName() string { - return "chatEventPhotoChanged" +func (*ChatEventMessageTTLChanged) TypeName() string { + return "chatEventMessageTtlChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventPhotoChanged) TypeInfo() tdp.Type { +func (c *ChatEventMessageTTLChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventPhotoChanged", - ID: ChatEventPhotoChangedTypeID, + Name: "chatEventMessageTtlChanged", + ID: ChatEventMessageTTLChangedTypeID, } if c == nil { typ.Null = true @@ -3122,86 +3170,82 @@ func (c *ChatEventPhotoChanged) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "OldPhoto", - SchemaName: "old_photo", + Name: "OldMessageTTL", + SchemaName: "old_message_ttl", }, { - Name: "NewPhoto", - SchemaName: "new_photo", + Name: "NewMessageTTL", + SchemaName: "new_message_ttl", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventPhotoChanged) Encode(b *bin.Buffer) error { +func (c *ChatEventMessageTTLChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil") + return fmt.Errorf("can't encode chatEventMessageTtlChanged#2e46b9b3 as nil") } - b.PutID(ChatEventPhotoChangedTypeID) + b.PutID(ChatEventMessageTTLChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventPhotoChanged) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventMessageTTLChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil") - } - if err := c.OldPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) - } - if err := c.NewPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) + return fmt.Errorf("can't encode chatEventMessageTtlChanged#2e46b9b3 as nil") } + b.PutInt32(c.OldMessageTTL) + b.PutInt32(c.NewMessageTTL) return nil } // Decode implements bin.Decoder. -func (c *ChatEventPhotoChanged) Decode(b *bin.Buffer) error { +func (c *ChatEventMessageTTLChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil") + return fmt.Errorf("can't decode chatEventMessageTtlChanged#2e46b9b3 to nil") } - if err := b.ConsumeID(ChatEventPhotoChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: %w", err) + if err := b.ConsumeID(ChatEventMessageTTLChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventPhotoChanged) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventMessageTTLChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil") + return fmt.Errorf("can't decode chatEventMessageTtlChanged#2e46b9b3 to nil") } { - if err := c.OldPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: field old_message_ttl: %w", err) } + c.OldMessageTTL = value } { - if err := c.NewPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: field new_message_ttl: %w", err) } + c.NewMessageTTL = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventPhotoChanged) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventMessageTTLChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil") + return fmt.Errorf("can't encode chatEventMessageTtlChanged#2e46b9b3 as nil") } b.ObjStart() - b.PutID("chatEventPhotoChanged") + b.PutID("chatEventMessageTtlChanged") b.Comma() - b.FieldStart("old_photo") - if err := c.OldPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) - } + b.FieldStart("old_message_ttl") + b.PutInt32(c.OldMessageTTL) b.Comma() - b.FieldStart("new_photo") - if err := c.NewPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) - } + b.FieldStart("new_message_ttl") + b.PutInt32(c.NewMessageTTL) b.Comma() b.StripComma() b.ObjEnd() @@ -3209,25 +3253,29 @@ func (c *ChatEventPhotoChanged) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventPhotoChanged) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventMessageTTLChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil") + return fmt.Errorf("can't decode chatEventMessageTtlChanged#2e46b9b3 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventPhotoChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: %w", err) + if err := b.ConsumeID("chatEventMessageTtlChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: %w", err) } - case "old_photo": - if err := c.OldPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) + case "old_message_ttl": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: field old_message_ttl: %w", err) } - case "new_photo": - if err := c.NewPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) + c.OldMessageTTL = value + case "new_message_ttl": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: field new_message_ttl: %w", err) } + c.NewMessageTTL = value default: return b.Skip() } @@ -3235,49 +3283,54 @@ func (c *ChatEventPhotoChanged) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetOldPhoto returns value of OldPhoto field. -func (c *ChatEventPhotoChanged) GetOldPhoto() (value ChatPhoto) { +// GetOldMessageTTL returns value of OldMessageTTL field. +func (c *ChatEventMessageTTLChanged) GetOldMessageTTL() (value int32) { if c == nil { return } - return c.OldPhoto + return c.OldMessageTTL } -// GetNewPhoto returns value of NewPhoto field. -func (c *ChatEventPhotoChanged) GetNewPhoto() (value ChatPhoto) { +// GetNewMessageTTL returns value of NewMessageTTL field. +func (c *ChatEventMessageTTLChanged) GetNewMessageTTL() (value int32) { if c == nil { return } - return c.NewPhoto + return c.NewMessageTTL } -// ChatEventInvitesToggled represents TL type `chatEventInvitesToggled#fc45966b`. -type ChatEventInvitesToggled struct { - // New value of can_invite_users permission - CanInviteUsers bool +// ChatEventPermissionsChanged represents TL type `chatEventPermissionsChanged#b1d337a8`. +type ChatEventPermissionsChanged struct { + // Previous chat permissions + OldPermissions ChatPermissions + // New chat permissions + NewPermissions ChatPermissions } -// ChatEventInvitesToggledTypeID is TL type id of ChatEventInvitesToggled. -const ChatEventInvitesToggledTypeID = 0xfc45966b +// ChatEventPermissionsChangedTypeID is TL type id of ChatEventPermissionsChanged. +const ChatEventPermissionsChangedTypeID = 0xb1d337a8 // construct implements constructor of ChatEventActionClass. -func (c ChatEventInvitesToggled) construct() ChatEventActionClass { return &c } +func (c ChatEventPermissionsChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventInvitesToggled. +// Ensuring interfaces in compile-time for ChatEventPermissionsChanged. var ( - _ bin.Encoder = &ChatEventInvitesToggled{} - _ bin.Decoder = &ChatEventInvitesToggled{} - _ bin.BareEncoder = &ChatEventInvitesToggled{} - _ bin.BareDecoder = &ChatEventInvitesToggled{} + _ bin.Encoder = &ChatEventPermissionsChanged{} + _ bin.Decoder = &ChatEventPermissionsChanged{} + _ bin.BareEncoder = &ChatEventPermissionsChanged{} + _ bin.BareDecoder = &ChatEventPermissionsChanged{} - _ ChatEventActionClass = &ChatEventInvitesToggled{} + _ ChatEventActionClass = &ChatEventPermissionsChanged{} ) -func (c *ChatEventInvitesToggled) Zero() bool { +func (c *ChatEventPermissionsChanged) Zero() bool { if c == nil { return true } - if !(c.CanInviteUsers == false) { + if !(c.OldPermissions.Zero()) { + return false + } + if !(c.NewPermissions.Zero()) { return false } @@ -3285,31 +3338,31 @@ func (c *ChatEventInvitesToggled) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventInvitesToggled) String() string { +func (c *ChatEventPermissionsChanged) String() string { if c == nil { - return "ChatEventInvitesToggled(nil)" + return "ChatEventPermissionsChanged(nil)" } - type Alias ChatEventInvitesToggled - return fmt.Sprintf("ChatEventInvitesToggled%+v", Alias(*c)) + type Alias ChatEventPermissionsChanged + return fmt.Sprintf("ChatEventPermissionsChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventInvitesToggled) TypeID() uint32 { - return ChatEventInvitesToggledTypeID +func (*ChatEventPermissionsChanged) TypeID() uint32 { + return ChatEventPermissionsChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventInvitesToggled) TypeName() string { - return "chatEventInvitesToggled" +func (*ChatEventPermissionsChanged) TypeName() string { + return "chatEventPermissionsChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventInvitesToggled) TypeInfo() tdp.Type { +func (c *ChatEventPermissionsChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventInvitesToggled", - ID: ChatEventInvitesToggledTypeID, + Name: "chatEventPermissionsChanged", + ID: ChatEventPermissionsChangedTypeID, } if c == nil { typ.Null = true @@ -3317,67 +3370,86 @@ func (c *ChatEventInvitesToggled) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "CanInviteUsers", - SchemaName: "can_invite_users", + Name: "OldPermissions", + SchemaName: "old_permissions", + }, + { + Name: "NewPermissions", + SchemaName: "new_permissions", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventInvitesToggled) Encode(b *bin.Buffer) error { +func (c *ChatEventPermissionsChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil") + return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil") } - b.PutID(ChatEventInvitesToggledTypeID) + b.PutID(ChatEventPermissionsChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventInvitesToggled) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventPermissionsChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil") + return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil") + } + if err := c.OldPermissions.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) + } + if err := c.NewPermissions.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) } - b.PutBool(c.CanInviteUsers) return nil } // Decode implements bin.Decoder. -func (c *ChatEventInvitesToggled) Decode(b *bin.Buffer) error { +func (c *ChatEventPermissionsChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil") + return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil") } - if err := b.ConsumeID(ChatEventInvitesToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: %w", err) + if err := b.ConsumeID(ChatEventPermissionsChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventInvitesToggled) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventPermissionsChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil") + return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil") } { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: field can_invite_users: %w", err) + if err := c.OldPermissions.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) + } + } + { + if err := c.NewPermissions.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) } - c.CanInviteUsers = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventInvitesToggled) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventPermissionsChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil") + return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil") } b.ObjStart() - b.PutID("chatEventInvitesToggled") + b.PutID("chatEventPermissionsChanged") b.Comma() - b.FieldStart("can_invite_users") - b.PutBool(c.CanInviteUsers) + b.FieldStart("old_permissions") + if err := c.OldPermissions.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) + } + b.Comma() + b.FieldStart("new_permissions") + if err := c.NewPermissions.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -3385,23 +3457,25 @@ func (c *ChatEventInvitesToggled) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventInvitesToggled) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventPermissionsChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil") + return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventInvitesToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: %w", err) + if err := b.ConsumeID("chatEventPermissionsChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: %w", err) } - case "can_invite_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: field can_invite_users: %w", err) + case "old_permissions": + if err := c.OldPermissions.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) + } + case "new_permissions": + if err := c.NewPermissions.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) } - c.CanInviteUsers = value default: return b.Skip() } @@ -3409,46 +3483,54 @@ func (c *ChatEventInvitesToggled) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetCanInviteUsers returns value of CanInviteUsers field. -func (c *ChatEventInvitesToggled) GetCanInviteUsers() (value bool) { +// GetOldPermissions returns value of OldPermissions field. +func (c *ChatEventPermissionsChanged) GetOldPermissions() (value ChatPermissions) { if c == nil { return } - return c.CanInviteUsers + return c.OldPermissions } -// ChatEventLinkedChatChanged represents TL type `chatEventLinkedChatChanged#6b2271af`. -type ChatEventLinkedChatChanged struct { - // Previous supergroup linked chat identifier - OldLinkedChatID int64 - // New supergroup linked chat identifier - NewLinkedChatID int64 +// GetNewPermissions returns value of NewPermissions field. +func (c *ChatEventPermissionsChanged) GetNewPermissions() (value ChatPermissions) { + if c == nil { + return + } + return c.NewPermissions } -// ChatEventLinkedChatChangedTypeID is TL type id of ChatEventLinkedChatChanged. -const ChatEventLinkedChatChangedTypeID = 0x6b2271af +// ChatEventPhotoChanged represents TL type `chatEventPhotoChanged#cfa062c3`. +type ChatEventPhotoChanged struct { + // Previous chat photo value; may be null + OldPhoto ChatPhoto + // New chat photo value; may be null + NewPhoto ChatPhoto +} + +// ChatEventPhotoChangedTypeID is TL type id of ChatEventPhotoChanged. +const ChatEventPhotoChangedTypeID = 0xcfa062c3 // construct implements constructor of ChatEventActionClass. -func (c ChatEventLinkedChatChanged) construct() ChatEventActionClass { return &c } +func (c ChatEventPhotoChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventLinkedChatChanged. +// Ensuring interfaces in compile-time for ChatEventPhotoChanged. var ( - _ bin.Encoder = &ChatEventLinkedChatChanged{} - _ bin.Decoder = &ChatEventLinkedChatChanged{} - _ bin.BareEncoder = &ChatEventLinkedChatChanged{} - _ bin.BareDecoder = &ChatEventLinkedChatChanged{} + _ bin.Encoder = &ChatEventPhotoChanged{} + _ bin.Decoder = &ChatEventPhotoChanged{} + _ bin.BareEncoder = &ChatEventPhotoChanged{} + _ bin.BareDecoder = &ChatEventPhotoChanged{} - _ ChatEventActionClass = &ChatEventLinkedChatChanged{} + _ ChatEventActionClass = &ChatEventPhotoChanged{} ) -func (c *ChatEventLinkedChatChanged) Zero() bool { +func (c *ChatEventPhotoChanged) Zero() bool { if c == nil { return true } - if !(c.OldLinkedChatID == 0) { + if !(c.OldPhoto.Zero()) { return false } - if !(c.NewLinkedChatID == 0) { + if !(c.NewPhoto.Zero()) { return false } @@ -3456,31 +3538,31 @@ func (c *ChatEventLinkedChatChanged) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventLinkedChatChanged) String() string { +func (c *ChatEventPhotoChanged) String() string { if c == nil { - return "ChatEventLinkedChatChanged(nil)" + return "ChatEventPhotoChanged(nil)" } - type Alias ChatEventLinkedChatChanged - return fmt.Sprintf("ChatEventLinkedChatChanged%+v", Alias(*c)) + type Alias ChatEventPhotoChanged + return fmt.Sprintf("ChatEventPhotoChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventLinkedChatChanged) TypeID() uint32 { - return ChatEventLinkedChatChangedTypeID +func (*ChatEventPhotoChanged) TypeID() uint32 { + return ChatEventPhotoChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventLinkedChatChanged) TypeName() string { - return "chatEventLinkedChatChanged" +func (*ChatEventPhotoChanged) TypeName() string { + return "chatEventPhotoChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventLinkedChatChanged) TypeInfo() tdp.Type { +func (c *ChatEventPhotoChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventLinkedChatChanged", - ID: ChatEventLinkedChatChangedTypeID, + Name: "chatEventPhotoChanged", + ID: ChatEventPhotoChangedTypeID, } if c == nil { typ.Null = true @@ -3488,82 +3570,86 @@ func (c *ChatEventLinkedChatChanged) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "OldLinkedChatID", - SchemaName: "old_linked_chat_id", + Name: "OldPhoto", + SchemaName: "old_photo", }, { - Name: "NewLinkedChatID", - SchemaName: "new_linked_chat_id", + Name: "NewPhoto", + SchemaName: "new_photo", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventLinkedChatChanged) Encode(b *bin.Buffer) error { +func (c *ChatEventPhotoChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil") + return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil") } - b.PutID(ChatEventLinkedChatChangedTypeID) + b.PutID(ChatEventPhotoChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventLinkedChatChanged) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventPhotoChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil") + return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil") + } + if err := c.OldPhoto.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) + } + if err := c.NewPhoto.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) } - b.PutInt53(c.OldLinkedChatID) - b.PutInt53(c.NewLinkedChatID) return nil } // Decode implements bin.Decoder. -func (c *ChatEventLinkedChatChanged) Decode(b *bin.Buffer) error { +func (c *ChatEventPhotoChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil") + return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil") } - if err := b.ConsumeID(ChatEventLinkedChatChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: %w", err) + if err := b.ConsumeID(ChatEventPhotoChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventLinkedChatChanged) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventPhotoChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil") + return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil") } { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field old_linked_chat_id: %w", err) + if err := c.OldPhoto.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) } - c.OldLinkedChatID = value } { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field new_linked_chat_id: %w", err) + if err := c.NewPhoto.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) } - c.NewLinkedChatID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventLinkedChatChanged) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventPhotoChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil") + return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil") } b.ObjStart() - b.PutID("chatEventLinkedChatChanged") + b.PutID("chatEventPhotoChanged") b.Comma() - b.FieldStart("old_linked_chat_id") - b.PutInt53(c.OldLinkedChatID) + b.FieldStart("old_photo") + if err := c.OldPhoto.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) + } b.Comma() - b.FieldStart("new_linked_chat_id") - b.PutInt53(c.NewLinkedChatID) + b.FieldStart("new_photo") + if err := c.NewPhoto.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) + } b.Comma() b.StripComma() b.ObjEnd() @@ -3571,29 +3657,25 @@ func (c *ChatEventLinkedChatChanged) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventLinkedChatChanged) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventPhotoChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil") + return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventLinkedChatChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: %w", err) + if err := b.ConsumeID("chatEventPhotoChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: %w", err) } - case "old_linked_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field old_linked_chat_id: %w", err) + case "old_photo": + if err := c.OldPhoto.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) } - c.OldLinkedChatID = value - case "new_linked_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field new_linked_chat_id: %w", err) + case "new_photo": + if err := c.NewPhoto.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) } - c.NewLinkedChatID = value default: return b.Skip() } @@ -3601,20 +3683,20 @@ func (c *ChatEventLinkedChatChanged) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetOldLinkedChatID returns value of OldLinkedChatID field. -func (c *ChatEventLinkedChatChanged) GetOldLinkedChatID() (value int64) { +// GetOldPhoto returns value of OldPhoto field. +func (c *ChatEventPhotoChanged) GetOldPhoto() (value ChatPhoto) { if c == nil { return } - return c.OldLinkedChatID + return c.OldPhoto } -// GetNewLinkedChatID returns value of NewLinkedChatID field. -func (c *ChatEventLinkedChatChanged) GetNewLinkedChatID() (value int64) { +// GetNewPhoto returns value of NewPhoto field. +func (c *ChatEventPhotoChanged) GetNewPhoto() (value ChatPhoto) { if c == nil { return } - return c.NewLinkedChatID + return c.NewPhoto } // ChatEventSlowModeDelayChanged represents TL type `chatEventSlowModeDelayChanged#9d763c0b`. @@ -3817,38 +3899,38 @@ func (c *ChatEventSlowModeDelayChanged) GetNewSlowModeDelay() (value int32) { return c.NewSlowModeDelay } -// ChatEventMessageTTLChanged represents TL type `chatEventMessageTtlChanged#2e46b9b3`. -type ChatEventMessageTTLChanged struct { - // Previous value of message_ttl - OldMessageTTL int32 - // New value of message_ttl - NewMessageTTL int32 +// ChatEventStickerSetChanged represents TL type `chatEventStickerSetChanged#b5e7558f`. +type ChatEventStickerSetChanged struct { + // Previous identifier of the chat sticker set; 0 if none + OldStickerSetID int64 + // New identifier of the chat sticker set; 0 if none + NewStickerSetID int64 } -// ChatEventMessageTTLChangedTypeID is TL type id of ChatEventMessageTTLChanged. -const ChatEventMessageTTLChangedTypeID = 0x2e46b9b3 +// ChatEventStickerSetChangedTypeID is TL type id of ChatEventStickerSetChanged. +const ChatEventStickerSetChangedTypeID = 0xb5e7558f // construct implements constructor of ChatEventActionClass. -func (c ChatEventMessageTTLChanged) construct() ChatEventActionClass { return &c } +func (c ChatEventStickerSetChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventMessageTTLChanged. +// Ensuring interfaces in compile-time for ChatEventStickerSetChanged. var ( - _ bin.Encoder = &ChatEventMessageTTLChanged{} - _ bin.Decoder = &ChatEventMessageTTLChanged{} - _ bin.BareEncoder = &ChatEventMessageTTLChanged{} - _ bin.BareDecoder = &ChatEventMessageTTLChanged{} + _ bin.Encoder = &ChatEventStickerSetChanged{} + _ bin.Decoder = &ChatEventStickerSetChanged{} + _ bin.BareEncoder = &ChatEventStickerSetChanged{} + _ bin.BareDecoder = &ChatEventStickerSetChanged{} - _ ChatEventActionClass = &ChatEventMessageTTLChanged{} + _ ChatEventActionClass = &ChatEventStickerSetChanged{} ) -func (c *ChatEventMessageTTLChanged) Zero() bool { +func (c *ChatEventStickerSetChanged) Zero() bool { if c == nil { return true } - if !(c.OldMessageTTL == 0) { + if !(c.OldStickerSetID == 0) { return false } - if !(c.NewMessageTTL == 0) { + if !(c.NewStickerSetID == 0) { return false } @@ -3856,31 +3938,31 @@ func (c *ChatEventMessageTTLChanged) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventMessageTTLChanged) String() string { +func (c *ChatEventStickerSetChanged) String() string { if c == nil { - return "ChatEventMessageTTLChanged(nil)" + return "ChatEventStickerSetChanged(nil)" } - type Alias ChatEventMessageTTLChanged - return fmt.Sprintf("ChatEventMessageTTLChanged%+v", Alias(*c)) + type Alias ChatEventStickerSetChanged + return fmt.Sprintf("ChatEventStickerSetChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMessageTTLChanged) TypeID() uint32 { - return ChatEventMessageTTLChangedTypeID +func (*ChatEventStickerSetChanged) TypeID() uint32 { + return ChatEventStickerSetChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventMessageTTLChanged) TypeName() string { - return "chatEventMessageTtlChanged" +func (*ChatEventStickerSetChanged) TypeName() string { + return "chatEventStickerSetChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventMessageTTLChanged) TypeInfo() tdp.Type { +func (c *ChatEventStickerSetChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventMessageTtlChanged", - ID: ChatEventMessageTTLChangedTypeID, + Name: "chatEventStickerSetChanged", + ID: ChatEventStickerSetChangedTypeID, } if c == nil { typ.Null = true @@ -3888,82 +3970,82 @@ func (c *ChatEventMessageTTLChanged) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "OldMessageTTL", - SchemaName: "old_message_ttl", + Name: "OldStickerSetID", + SchemaName: "old_sticker_set_id", }, { - Name: "NewMessageTTL", - SchemaName: "new_message_ttl", + Name: "NewStickerSetID", + SchemaName: "new_sticker_set_id", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventMessageTTLChanged) Encode(b *bin.Buffer) error { +func (c *ChatEventStickerSetChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMessageTtlChanged#2e46b9b3 as nil") + return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil") } - b.PutID(ChatEventMessageTTLChangedTypeID) + b.PutID(ChatEventStickerSetChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventMessageTTLChanged) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventStickerSetChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventMessageTtlChanged#2e46b9b3 as nil") + return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil") } - b.PutInt32(c.OldMessageTTL) - b.PutInt32(c.NewMessageTTL) + b.PutLong(c.OldStickerSetID) + b.PutLong(c.NewStickerSetID) return nil } // Decode implements bin.Decoder. -func (c *ChatEventMessageTTLChanged) Decode(b *bin.Buffer) error { +func (c *ChatEventStickerSetChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventMessageTtlChanged#2e46b9b3 to nil") + return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil") } - if err := b.ConsumeID(ChatEventMessageTTLChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: %w", err) + if err := b.ConsumeID(ChatEventStickerSetChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventMessageTTLChanged) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventStickerSetChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventMessageTtlChanged#2e46b9b3 to nil") + return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil") } { - value, err := b.Int32() + value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: field old_message_ttl: %w", err) + return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field old_sticker_set_id: %w", err) } - c.OldMessageTTL = value + c.OldStickerSetID = value } { - value, err := b.Int32() + value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: field new_message_ttl: %w", err) + return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field new_sticker_set_id: %w", err) } - c.NewMessageTTL = value + c.NewStickerSetID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMessageTTLChanged) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventStickerSetChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventMessageTtlChanged#2e46b9b3 as nil") + return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil") } b.ObjStart() - b.PutID("chatEventMessageTtlChanged") + b.PutID("chatEventStickerSetChanged") b.Comma() - b.FieldStart("old_message_ttl") - b.PutInt32(c.OldMessageTTL) + b.FieldStart("old_sticker_set_id") + b.PutLong(c.OldStickerSetID) b.Comma() - b.FieldStart("new_message_ttl") - b.PutInt32(c.NewMessageTTL) + b.FieldStart("new_sticker_set_id") + b.PutLong(c.NewStickerSetID) b.Comma() b.StripComma() b.ObjEnd() @@ -3971,29 +4053,29 @@ func (c *ChatEventMessageTTLChanged) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMessageTTLChanged) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventStickerSetChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventMessageTtlChanged#2e46b9b3 to nil") + return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventMessageTtlChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: %w", err) + if err := b.ConsumeID("chatEventStickerSetChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: %w", err) } - case "old_message_ttl": - value, err := b.Int32() + case "old_sticker_set_id": + value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: field old_message_ttl: %w", err) + return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field old_sticker_set_id: %w", err) } - c.OldMessageTTL = value - case "new_message_ttl": - value, err := b.Int32() + c.OldStickerSetID = value + case "new_sticker_set_id": + value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatEventMessageTtlChanged#2e46b9b3: field new_message_ttl: %w", err) + return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field new_sticker_set_id: %w", err) } - c.NewMessageTTL = value + c.NewStickerSetID = value default: return b.Skip() } @@ -4001,49 +4083,54 @@ func (c *ChatEventMessageTTLChanged) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetOldMessageTTL returns value of OldMessageTTL field. -func (c *ChatEventMessageTTLChanged) GetOldMessageTTL() (value int32) { +// GetOldStickerSetID returns value of OldStickerSetID field. +func (c *ChatEventStickerSetChanged) GetOldStickerSetID() (value int64) { if c == nil { return } - return c.OldMessageTTL + return c.OldStickerSetID } -// GetNewMessageTTL returns value of NewMessageTTL field. -func (c *ChatEventMessageTTLChanged) GetNewMessageTTL() (value int32) { +// GetNewStickerSetID returns value of NewStickerSetID field. +func (c *ChatEventStickerSetChanged) GetNewStickerSetID() (value int64) { if c == nil { return } - return c.NewMessageTTL + return c.NewStickerSetID } -// ChatEventSignMessagesToggled represents TL type `chatEventSignMessagesToggled#b1b9281e`. -type ChatEventSignMessagesToggled struct { - // New value of sign_messages - SignMessages bool +// ChatEventTitleChanged represents TL type `chatEventTitleChanged#43990ad2`. +type ChatEventTitleChanged struct { + // Previous chat title + OldTitle string + // New chat title + NewTitle string } -// ChatEventSignMessagesToggledTypeID is TL type id of ChatEventSignMessagesToggled. -const ChatEventSignMessagesToggledTypeID = 0xb1b9281e +// ChatEventTitleChangedTypeID is TL type id of ChatEventTitleChanged. +const ChatEventTitleChangedTypeID = 0x43990ad2 // construct implements constructor of ChatEventActionClass. -func (c ChatEventSignMessagesToggled) construct() ChatEventActionClass { return &c } +func (c ChatEventTitleChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventSignMessagesToggled. +// Ensuring interfaces in compile-time for ChatEventTitleChanged. var ( - _ bin.Encoder = &ChatEventSignMessagesToggled{} - _ bin.Decoder = &ChatEventSignMessagesToggled{} - _ bin.BareEncoder = &ChatEventSignMessagesToggled{} - _ bin.BareDecoder = &ChatEventSignMessagesToggled{} + _ bin.Encoder = &ChatEventTitleChanged{} + _ bin.Decoder = &ChatEventTitleChanged{} + _ bin.BareEncoder = &ChatEventTitleChanged{} + _ bin.BareDecoder = &ChatEventTitleChanged{} - _ ChatEventActionClass = &ChatEventSignMessagesToggled{} + _ ChatEventActionClass = &ChatEventTitleChanged{} ) -func (c *ChatEventSignMessagesToggled) Zero() bool { +func (c *ChatEventTitleChanged) Zero() bool { if c == nil { return true } - if !(c.SignMessages == false) { + if !(c.OldTitle == "") { + return false + } + if !(c.NewTitle == "") { return false } @@ -4051,31 +4138,31 @@ func (c *ChatEventSignMessagesToggled) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventSignMessagesToggled) String() string { +func (c *ChatEventTitleChanged) String() string { if c == nil { - return "ChatEventSignMessagesToggled(nil)" + return "ChatEventTitleChanged(nil)" } - type Alias ChatEventSignMessagesToggled - return fmt.Sprintf("ChatEventSignMessagesToggled%+v", Alias(*c)) + type Alias ChatEventTitleChanged + return fmt.Sprintf("ChatEventTitleChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventSignMessagesToggled) TypeID() uint32 { - return ChatEventSignMessagesToggledTypeID +func (*ChatEventTitleChanged) TypeID() uint32 { + return ChatEventTitleChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventSignMessagesToggled) TypeName() string { - return "chatEventSignMessagesToggled" +func (*ChatEventTitleChanged) TypeName() string { + return "chatEventTitleChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventSignMessagesToggled) TypeInfo() tdp.Type { +func (c *ChatEventTitleChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventSignMessagesToggled", - ID: ChatEventSignMessagesToggledTypeID, + Name: "chatEventTitleChanged", + ID: ChatEventTitleChangedTypeID, } if c == nil { typ.Null = true @@ -4083,67 +4170,82 @@ func (c *ChatEventSignMessagesToggled) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "SignMessages", - SchemaName: "sign_messages", + Name: "OldTitle", + SchemaName: "old_title", + }, + { + Name: "NewTitle", + SchemaName: "new_title", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventSignMessagesToggled) Encode(b *bin.Buffer) error { +func (c *ChatEventTitleChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil") + return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil") } - b.PutID(ChatEventSignMessagesToggledTypeID) + b.PutID(ChatEventTitleChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventSignMessagesToggled) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventTitleChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil") + return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil") } - b.PutBool(c.SignMessages) + b.PutString(c.OldTitle) + b.PutString(c.NewTitle) return nil } // Decode implements bin.Decoder. -func (c *ChatEventSignMessagesToggled) Decode(b *bin.Buffer) error { +func (c *ChatEventTitleChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil") + return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil") } - if err := b.ConsumeID(ChatEventSignMessagesToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: %w", err) + if err := b.ConsumeID(ChatEventTitleChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventSignMessagesToggled) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventTitleChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil") + return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil") } { - value, err := b.Bool() + value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: field sign_messages: %w", err) + return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field old_title: %w", err) } - c.SignMessages = value + c.OldTitle = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field new_title: %w", err) + } + c.NewTitle = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventSignMessagesToggled) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventTitleChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil") + return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil") } b.ObjStart() - b.PutID("chatEventSignMessagesToggled") + b.PutID("chatEventTitleChanged") b.Comma() - b.FieldStart("sign_messages") - b.PutBool(c.SignMessages) + b.FieldStart("old_title") + b.PutString(c.OldTitle) + b.Comma() + b.FieldStart("new_title") + b.PutString(c.NewTitle) b.Comma() b.StripComma() b.ObjEnd() @@ -4151,23 +4253,29 @@ func (c *ChatEventSignMessagesToggled) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventSignMessagesToggled) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventTitleChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil") + return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventSignMessagesToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: %w", err) + if err := b.ConsumeID("chatEventTitleChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: %w", err) } - case "sign_messages": - value, err := b.Bool() + case "old_title": + value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: field sign_messages: %w", err) + return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field old_title: %w", err) } - c.SignMessages = value + c.OldTitle = value + case "new_title": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field new_title: %w", err) + } + c.NewTitle = value default: return b.Skip() } @@ -4175,41 +4283,54 @@ func (c *ChatEventSignMessagesToggled) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetSignMessages returns value of SignMessages field. -func (c *ChatEventSignMessagesToggled) GetSignMessages() (value bool) { +// GetOldTitle returns value of OldTitle field. +func (c *ChatEventTitleChanged) GetOldTitle() (value string) { if c == nil { return } - return c.SignMessages + return c.OldTitle } -// ChatEventHasProtectedContentToggled represents TL type `chatEventHasProtectedContentToggled#f5044201`. -type ChatEventHasProtectedContentToggled struct { - // New value of has_protected_content - HasProtectedContent bool +// GetNewTitle returns value of NewTitle field. +func (c *ChatEventTitleChanged) GetNewTitle() (value string) { + if c == nil { + return + } + return c.NewTitle } -// ChatEventHasProtectedContentToggledTypeID is TL type id of ChatEventHasProtectedContentToggled. -const ChatEventHasProtectedContentToggledTypeID = 0xf5044201 +// ChatEventUsernameChanged represents TL type `chatEventUsernameChanged#6707b56b`. +type ChatEventUsernameChanged struct { + // Previous chat username + OldUsername string + // New chat username + NewUsername string +} + +// ChatEventUsernameChangedTypeID is TL type id of ChatEventUsernameChanged. +const ChatEventUsernameChangedTypeID = 0x6707b56b // construct implements constructor of ChatEventActionClass. -func (c ChatEventHasProtectedContentToggled) construct() ChatEventActionClass { return &c } +func (c ChatEventUsernameChanged) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventHasProtectedContentToggled. +// Ensuring interfaces in compile-time for ChatEventUsernameChanged. var ( - _ bin.Encoder = &ChatEventHasProtectedContentToggled{} - _ bin.Decoder = &ChatEventHasProtectedContentToggled{} - _ bin.BareEncoder = &ChatEventHasProtectedContentToggled{} - _ bin.BareDecoder = &ChatEventHasProtectedContentToggled{} + _ bin.Encoder = &ChatEventUsernameChanged{} + _ bin.Decoder = &ChatEventUsernameChanged{} + _ bin.BareEncoder = &ChatEventUsernameChanged{} + _ bin.BareDecoder = &ChatEventUsernameChanged{} - _ ChatEventActionClass = &ChatEventHasProtectedContentToggled{} + _ ChatEventActionClass = &ChatEventUsernameChanged{} ) -func (c *ChatEventHasProtectedContentToggled) Zero() bool { +func (c *ChatEventUsernameChanged) Zero() bool { if c == nil { return true } - if !(c.HasProtectedContent == false) { + if !(c.OldUsername == "") { + return false + } + if !(c.NewUsername == "") { return false } @@ -4217,31 +4338,31 @@ func (c *ChatEventHasProtectedContentToggled) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventHasProtectedContentToggled) String() string { +func (c *ChatEventUsernameChanged) String() string { if c == nil { - return "ChatEventHasProtectedContentToggled(nil)" + return "ChatEventUsernameChanged(nil)" } - type Alias ChatEventHasProtectedContentToggled - return fmt.Sprintf("ChatEventHasProtectedContentToggled%+v", Alias(*c)) + type Alias ChatEventUsernameChanged + return fmt.Sprintf("ChatEventUsernameChanged%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventHasProtectedContentToggled) TypeID() uint32 { - return ChatEventHasProtectedContentToggledTypeID +func (*ChatEventUsernameChanged) TypeID() uint32 { + return ChatEventUsernameChangedTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventHasProtectedContentToggled) TypeName() string { - return "chatEventHasProtectedContentToggled" +func (*ChatEventUsernameChanged) TypeName() string { + return "chatEventUsernameChanged" } // TypeInfo returns info about TL type. -func (c *ChatEventHasProtectedContentToggled) TypeInfo() tdp.Type { +func (c *ChatEventUsernameChanged) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventHasProtectedContentToggled", - ID: ChatEventHasProtectedContentToggledTypeID, + Name: "chatEventUsernameChanged", + ID: ChatEventUsernameChangedTypeID, } if c == nil { typ.Null = true @@ -4249,67 +4370,82 @@ func (c *ChatEventHasProtectedContentToggled) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "HasProtectedContent", - SchemaName: "has_protected_content", + Name: "OldUsername", + SchemaName: "old_username", + }, + { + Name: "NewUsername", + SchemaName: "new_username", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventHasProtectedContentToggled) Encode(b *bin.Buffer) error { +func (c *ChatEventUsernameChanged) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil") + return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil") } - b.PutID(ChatEventHasProtectedContentToggledTypeID) + b.PutID(ChatEventUsernameChangedTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventHasProtectedContentToggled) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventUsernameChanged) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil") + return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil") } - b.PutBool(c.HasProtectedContent) + b.PutString(c.OldUsername) + b.PutString(c.NewUsername) return nil } // Decode implements bin.Decoder. -func (c *ChatEventHasProtectedContentToggled) Decode(b *bin.Buffer) error { +func (c *ChatEventUsernameChanged) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil") + return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil") } - if err := b.ConsumeID(ChatEventHasProtectedContentToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: %w", err) + if err := b.ConsumeID(ChatEventUsernameChangedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventHasProtectedContentToggled) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventUsernameChanged) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil") + return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil") } { - value, err := b.Bool() + value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: field has_protected_content: %w", err) + return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field old_username: %w", err) } - c.HasProtectedContent = value + c.OldUsername = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field new_username: %w", err) + } + c.NewUsername = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventHasProtectedContentToggled) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventUsernameChanged) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil") + return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil") } b.ObjStart() - b.PutID("chatEventHasProtectedContentToggled") + b.PutID("chatEventUsernameChanged") b.Comma() - b.FieldStart("has_protected_content") - b.PutBool(c.HasProtectedContent) + b.FieldStart("old_username") + b.PutString(c.OldUsername) + b.Comma() + b.FieldStart("new_username") + b.PutString(c.NewUsername) b.Comma() b.StripComma() b.ObjEnd() @@ -4317,23 +4453,29 @@ func (c *ChatEventHasProtectedContentToggled) EncodeTDLibJSON(b tdjson.Encoder) } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventHasProtectedContentToggled) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventUsernameChanged) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil") + return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventHasProtectedContentToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: %w", err) + if err := b.ConsumeID("chatEventUsernameChanged"); err != nil { + return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: %w", err) } - case "has_protected_content": - value, err := b.Bool() + case "old_username": + value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: field has_protected_content: %w", err) + return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field old_username: %w", err) } - c.HasProtectedContent = value + c.OldUsername = value + case "new_username": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field new_username: %w", err) + } + c.NewUsername = value default: return b.Skip() } @@ -4341,46 +4483,49 @@ func (c *ChatEventHasProtectedContentToggled) DecodeTDLibJSON(b tdjson.Decoder) }) } -// GetHasProtectedContent returns value of HasProtectedContent field. -func (c *ChatEventHasProtectedContentToggled) GetHasProtectedContent() (value bool) { +// GetOldUsername returns value of OldUsername field. +func (c *ChatEventUsernameChanged) GetOldUsername() (value string) { if c == nil { return } - return c.HasProtectedContent + return c.OldUsername } -// ChatEventStickerSetChanged represents TL type `chatEventStickerSetChanged#b5e7558f`. -type ChatEventStickerSetChanged struct { - // Previous identifier of the chat sticker set; 0 if none - OldStickerSetID int64 - // New identifier of the chat sticker set; 0 if none - NewStickerSetID int64 +// GetNewUsername returns value of NewUsername field. +func (c *ChatEventUsernameChanged) GetNewUsername() (value string) { + if c == nil { + return + } + return c.NewUsername } -// ChatEventStickerSetChangedTypeID is TL type id of ChatEventStickerSetChanged. -const ChatEventStickerSetChangedTypeID = 0xb5e7558f +// ChatEventHasProtectedContentToggled represents TL type `chatEventHasProtectedContentToggled#f5044201`. +type ChatEventHasProtectedContentToggled struct { + // New value of has_protected_content + HasProtectedContent bool +} + +// ChatEventHasProtectedContentToggledTypeID is TL type id of ChatEventHasProtectedContentToggled. +const ChatEventHasProtectedContentToggledTypeID = 0xf5044201 // construct implements constructor of ChatEventActionClass. -func (c ChatEventStickerSetChanged) construct() ChatEventActionClass { return &c } +func (c ChatEventHasProtectedContentToggled) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventStickerSetChanged. +// Ensuring interfaces in compile-time for ChatEventHasProtectedContentToggled. var ( - _ bin.Encoder = &ChatEventStickerSetChanged{} - _ bin.Decoder = &ChatEventStickerSetChanged{} - _ bin.BareEncoder = &ChatEventStickerSetChanged{} - _ bin.BareDecoder = &ChatEventStickerSetChanged{} + _ bin.Encoder = &ChatEventHasProtectedContentToggled{} + _ bin.Decoder = &ChatEventHasProtectedContentToggled{} + _ bin.BareEncoder = &ChatEventHasProtectedContentToggled{} + _ bin.BareDecoder = &ChatEventHasProtectedContentToggled{} - _ ChatEventActionClass = &ChatEventStickerSetChanged{} + _ ChatEventActionClass = &ChatEventHasProtectedContentToggled{} ) -func (c *ChatEventStickerSetChanged) Zero() bool { +func (c *ChatEventHasProtectedContentToggled) Zero() bool { if c == nil { return true } - if !(c.OldStickerSetID == 0) { - return false - } - if !(c.NewStickerSetID == 0) { + if !(c.HasProtectedContent == false) { return false } @@ -4388,31 +4533,31 @@ func (c *ChatEventStickerSetChanged) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventStickerSetChanged) String() string { +func (c *ChatEventHasProtectedContentToggled) String() string { if c == nil { - return "ChatEventStickerSetChanged(nil)" + return "ChatEventHasProtectedContentToggled(nil)" } - type Alias ChatEventStickerSetChanged - return fmt.Sprintf("ChatEventStickerSetChanged%+v", Alias(*c)) + type Alias ChatEventHasProtectedContentToggled + return fmt.Sprintf("ChatEventHasProtectedContentToggled%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventStickerSetChanged) TypeID() uint32 { - return ChatEventStickerSetChangedTypeID +func (*ChatEventHasProtectedContentToggled) TypeID() uint32 { + return ChatEventHasProtectedContentToggledTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventStickerSetChanged) TypeName() string { - return "chatEventStickerSetChanged" +func (*ChatEventHasProtectedContentToggled) TypeName() string { + return "chatEventHasProtectedContentToggled" } // TypeInfo returns info about TL type. -func (c *ChatEventStickerSetChanged) TypeInfo() tdp.Type { +func (c *ChatEventHasProtectedContentToggled) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventStickerSetChanged", - ID: ChatEventStickerSetChangedTypeID, + Name: "chatEventHasProtectedContentToggled", + ID: ChatEventHasProtectedContentToggledTypeID, } if c == nil { typ.Null = true @@ -4420,82 +4565,67 @@ func (c *ChatEventStickerSetChanged) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "OldStickerSetID", - SchemaName: "old_sticker_set_id", - }, - { - Name: "NewStickerSetID", - SchemaName: "new_sticker_set_id", + Name: "HasProtectedContent", + SchemaName: "has_protected_content", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventStickerSetChanged) Encode(b *bin.Buffer) error { +func (c *ChatEventHasProtectedContentToggled) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil") + return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil") } - b.PutID(ChatEventStickerSetChangedTypeID) + b.PutID(ChatEventHasProtectedContentToggledTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventStickerSetChanged) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventHasProtectedContentToggled) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil") + return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil") } - b.PutLong(c.OldStickerSetID) - b.PutLong(c.NewStickerSetID) + b.PutBool(c.HasProtectedContent) return nil } // Decode implements bin.Decoder. -func (c *ChatEventStickerSetChanged) Decode(b *bin.Buffer) error { +func (c *ChatEventHasProtectedContentToggled) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil") + return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil") } - if err := b.ConsumeID(ChatEventStickerSetChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: %w", err) + if err := b.ConsumeID(ChatEventHasProtectedContentToggledTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventStickerSetChanged) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventHasProtectedContentToggled) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field old_sticker_set_id: %w", err) - } - c.OldStickerSetID = value + return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil") } { - value, err := b.Long() + value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field new_sticker_set_id: %w", err) + return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: field has_protected_content: %w", err) } - c.NewStickerSetID = value + c.HasProtectedContent = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventStickerSetChanged) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventHasProtectedContentToggled) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil") + return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil") } b.ObjStart() - b.PutID("chatEventStickerSetChanged") - b.Comma() - b.FieldStart("old_sticker_set_id") - b.PutLong(c.OldStickerSetID) + b.PutID("chatEventHasProtectedContentToggled") b.Comma() - b.FieldStart("new_sticker_set_id") - b.PutLong(c.NewStickerSetID) + b.FieldStart("has_protected_content") + b.PutBool(c.HasProtectedContent) b.Comma() b.StripComma() b.ObjEnd() @@ -4503,29 +4633,23 @@ func (c *ChatEventStickerSetChanged) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventStickerSetChanged) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventHasProtectedContentToggled) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil") + return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventStickerSetChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: %w", err) - } - case "old_sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field old_sticker_set_id: %w", err) + if err := b.ConsumeID("chatEventHasProtectedContentToggled"); err != nil { + return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: %w", err) } - c.OldStickerSetID = value - case "new_sticker_set_id": - value, err := b.Long() + case "has_protected_content": + value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field new_sticker_set_id: %w", err) + return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: field has_protected_content: %w", err) } - c.NewStickerSetID = value + c.HasProtectedContent = value default: return b.Skip() } @@ -4533,54 +4657,41 @@ func (c *ChatEventStickerSetChanged) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetOldStickerSetID returns value of OldStickerSetID field. -func (c *ChatEventStickerSetChanged) GetOldStickerSetID() (value int64) { - if c == nil { - return - } - return c.OldStickerSetID -} - -// GetNewStickerSetID returns value of NewStickerSetID field. -func (c *ChatEventStickerSetChanged) GetNewStickerSetID() (value int64) { +// GetHasProtectedContent returns value of HasProtectedContent field. +func (c *ChatEventHasProtectedContentToggled) GetHasProtectedContent() (value bool) { if c == nil { return } - return c.NewStickerSetID + return c.HasProtectedContent } -// ChatEventLocationChanged represents TL type `chatEventLocationChanged#e7cdfd4e`. -type ChatEventLocationChanged struct { - // Previous location; may be null - OldLocation ChatLocation - // New location; may be null - NewLocation ChatLocation +// ChatEventInvitesToggled represents TL type `chatEventInvitesToggled#fc45966b`. +type ChatEventInvitesToggled struct { + // New value of can_invite_users permission + CanInviteUsers bool } -// ChatEventLocationChangedTypeID is TL type id of ChatEventLocationChanged. -const ChatEventLocationChangedTypeID = 0xe7cdfd4e +// ChatEventInvitesToggledTypeID is TL type id of ChatEventInvitesToggled. +const ChatEventInvitesToggledTypeID = 0xfc45966b // construct implements constructor of ChatEventActionClass. -func (c ChatEventLocationChanged) construct() ChatEventActionClass { return &c } +func (c ChatEventInvitesToggled) construct() ChatEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChatEventLocationChanged. +// Ensuring interfaces in compile-time for ChatEventInvitesToggled. var ( - _ bin.Encoder = &ChatEventLocationChanged{} - _ bin.Decoder = &ChatEventLocationChanged{} - _ bin.BareEncoder = &ChatEventLocationChanged{} - _ bin.BareDecoder = &ChatEventLocationChanged{} + _ bin.Encoder = &ChatEventInvitesToggled{} + _ bin.Decoder = &ChatEventInvitesToggled{} + _ bin.BareEncoder = &ChatEventInvitesToggled{} + _ bin.BareDecoder = &ChatEventInvitesToggled{} - _ ChatEventActionClass = &ChatEventLocationChanged{} + _ ChatEventActionClass = &ChatEventInvitesToggled{} ) -func (c *ChatEventLocationChanged) Zero() bool { +func (c *ChatEventInvitesToggled) Zero() bool { if c == nil { return true } - if !(c.OldLocation.Zero()) { - return false - } - if !(c.NewLocation.Zero()) { + if !(c.CanInviteUsers == false) { return false } @@ -4588,31 +4699,31 @@ func (c *ChatEventLocationChanged) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventLocationChanged) String() string { +func (c *ChatEventInvitesToggled) String() string { if c == nil { - return "ChatEventLocationChanged(nil)" + return "ChatEventInvitesToggled(nil)" } - type Alias ChatEventLocationChanged - return fmt.Sprintf("ChatEventLocationChanged%+v", Alias(*c)) + type Alias ChatEventInvitesToggled + return fmt.Sprintf("ChatEventInvitesToggled%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventLocationChanged) TypeID() uint32 { - return ChatEventLocationChangedTypeID +func (*ChatEventInvitesToggled) TypeID() uint32 { + return ChatEventInvitesToggledTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventLocationChanged) TypeName() string { - return "chatEventLocationChanged" +func (*ChatEventInvitesToggled) TypeName() string { + return "chatEventInvitesToggled" } // TypeInfo returns info about TL type. -func (c *ChatEventLocationChanged) TypeInfo() tdp.Type { +func (c *ChatEventInvitesToggled) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventLocationChanged", - ID: ChatEventLocationChangedTypeID, + Name: "chatEventInvitesToggled", + ID: ChatEventInvitesToggledTypeID, } if c == nil { typ.Null = true @@ -4620,86 +4731,67 @@ func (c *ChatEventLocationChanged) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "OldLocation", - SchemaName: "old_location", - }, - { - Name: "NewLocation", - SchemaName: "new_location", + Name: "CanInviteUsers", + SchemaName: "can_invite_users", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventLocationChanged) Encode(b *bin.Buffer) error { +func (c *ChatEventInvitesToggled) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil") + return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil") } - b.PutID(ChatEventLocationChangedTypeID) + b.PutID(ChatEventInvitesToggledTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventLocationChanged) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventInvitesToggled) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil") - } - if err := c.OldLocation.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) - } - if err := c.NewLocation.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) + return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil") } + b.PutBool(c.CanInviteUsers) return nil } // Decode implements bin.Decoder. -func (c *ChatEventLocationChanged) Decode(b *bin.Buffer) error { +func (c *ChatEventInvitesToggled) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil") + return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil") } - if err := b.ConsumeID(ChatEventLocationChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: %w", err) + if err := b.ConsumeID(ChatEventInvitesToggledTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventLocationChanged) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventInvitesToggled) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil") - } - { - if err := c.OldLocation.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) - } + return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil") } { - if err := c.NewLocation.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: field can_invite_users: %w", err) } + c.CanInviteUsers = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventLocationChanged) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventInvitesToggled) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil") + return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil") } b.ObjStart() - b.PutID("chatEventLocationChanged") - b.Comma() - b.FieldStart("old_location") - if err := c.OldLocation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) - } + b.PutID("chatEventInvitesToggled") b.Comma() - b.FieldStart("new_location") - if err := c.NewLocation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) - } + b.FieldStart("can_invite_users") + b.PutBool(c.CanInviteUsers) b.Comma() b.StripComma() b.ObjEnd() @@ -4707,25 +4799,23 @@ func (c *ChatEventLocationChanged) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventLocationChanged) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventInvitesToggled) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil") + return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventLocationChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: %w", err) - } - case "old_location": - if err := c.OldLocation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) + if err := b.ConsumeID("chatEventInvitesToggled"); err != nil { + return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: %w", err) } - case "new_location": - if err := c.NewLocation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) + case "can_invite_users": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: field can_invite_users: %w", err) } + c.CanInviteUsers = value default: return b.Skip() } @@ -4733,20 +4823,12 @@ func (c *ChatEventLocationChanged) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetOldLocation returns value of OldLocation field. -func (c *ChatEventLocationChanged) GetOldLocation() (value ChatLocation) { - if c == nil { - return - } - return c.OldLocation -} - -// GetNewLocation returns value of NewLocation field. -func (c *ChatEventLocationChanged) GetNewLocation() (value ChatLocation) { +// GetCanInviteUsers returns value of CanInviteUsers field. +func (c *ChatEventInvitesToggled) GetCanInviteUsers() (value bool) { if c == nil { return } - return c.NewLocation + return c.CanInviteUsers } // ChatEventIsAllHistoryAvailableToggled represents TL type `chatEventIsAllHistoryAvailableToggled#a0b03c15`. @@ -4768,14 +4850,180 @@ var ( _ bin.BareEncoder = &ChatEventIsAllHistoryAvailableToggled{} _ bin.BareDecoder = &ChatEventIsAllHistoryAvailableToggled{} - _ ChatEventActionClass = &ChatEventIsAllHistoryAvailableToggled{} + _ ChatEventActionClass = &ChatEventIsAllHistoryAvailableToggled{} +) + +func (c *ChatEventIsAllHistoryAvailableToggled) Zero() bool { + if c == nil { + return true + } + if !(c.IsAllHistoryAvailable == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatEventIsAllHistoryAvailableToggled) String() string { + if c == nil { + return "ChatEventIsAllHistoryAvailableToggled(nil)" + } + type Alias ChatEventIsAllHistoryAvailableToggled + return fmt.Sprintf("ChatEventIsAllHistoryAvailableToggled%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatEventIsAllHistoryAvailableToggled) TypeID() uint32 { + return ChatEventIsAllHistoryAvailableToggledTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatEventIsAllHistoryAvailableToggled) TypeName() string { + return "chatEventIsAllHistoryAvailableToggled" +} + +// TypeInfo returns info about TL type. +func (c *ChatEventIsAllHistoryAvailableToggled) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatEventIsAllHistoryAvailableToggled", + ID: ChatEventIsAllHistoryAvailableToggledTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "IsAllHistoryAvailable", + SchemaName: "is_all_history_available", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatEventIsAllHistoryAvailableToggled) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil") + } + b.PutID(ChatEventIsAllHistoryAvailableToggledTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatEventIsAllHistoryAvailableToggled) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil") + } + b.PutBool(c.IsAllHistoryAvailable) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatEventIsAllHistoryAvailableToggled) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil") + } + if err := b.ConsumeID(ChatEventIsAllHistoryAvailableToggledTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatEventIsAllHistoryAvailableToggled) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: field is_all_history_available: %w", err) + } + c.IsAllHistoryAvailable = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatEventIsAllHistoryAvailableToggled) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil") + } + b.ObjStart() + b.PutID("chatEventIsAllHistoryAvailableToggled") + b.Comma() + b.FieldStart("is_all_history_available") + b.PutBool(c.IsAllHistoryAvailable) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatEventIsAllHistoryAvailableToggled) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatEventIsAllHistoryAvailableToggled"); err != nil { + return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: %w", err) + } + case "is_all_history_available": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: field is_all_history_available: %w", err) + } + c.IsAllHistoryAvailable = value + default: + return b.Skip() + } + return nil + }) +} + +// GetIsAllHistoryAvailable returns value of IsAllHistoryAvailable field. +func (c *ChatEventIsAllHistoryAvailableToggled) GetIsAllHistoryAvailable() (value bool) { + if c == nil { + return + } + return c.IsAllHistoryAvailable +} + +// ChatEventSignMessagesToggled represents TL type `chatEventSignMessagesToggled#b1b9281e`. +type ChatEventSignMessagesToggled struct { + // New value of sign_messages + SignMessages bool +} + +// ChatEventSignMessagesToggledTypeID is TL type id of ChatEventSignMessagesToggled. +const ChatEventSignMessagesToggledTypeID = 0xb1b9281e + +// construct implements constructor of ChatEventActionClass. +func (c ChatEventSignMessagesToggled) construct() ChatEventActionClass { return &c } + +// Ensuring interfaces in compile-time for ChatEventSignMessagesToggled. +var ( + _ bin.Encoder = &ChatEventSignMessagesToggled{} + _ bin.Decoder = &ChatEventSignMessagesToggled{} + _ bin.BareEncoder = &ChatEventSignMessagesToggled{} + _ bin.BareDecoder = &ChatEventSignMessagesToggled{} + + _ ChatEventActionClass = &ChatEventSignMessagesToggled{} ) -func (c *ChatEventIsAllHistoryAvailableToggled) Zero() bool { +func (c *ChatEventSignMessagesToggled) Zero() bool { if c == nil { return true } - if !(c.IsAllHistoryAvailable == false) { + if !(c.SignMessages == false) { return false } @@ -4783,31 +5031,31 @@ func (c *ChatEventIsAllHistoryAvailableToggled) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventIsAllHistoryAvailableToggled) String() string { +func (c *ChatEventSignMessagesToggled) String() string { if c == nil { - return "ChatEventIsAllHistoryAvailableToggled(nil)" + return "ChatEventSignMessagesToggled(nil)" } - type Alias ChatEventIsAllHistoryAvailableToggled - return fmt.Sprintf("ChatEventIsAllHistoryAvailableToggled%+v", Alias(*c)) + type Alias ChatEventSignMessagesToggled + return fmt.Sprintf("ChatEventSignMessagesToggled%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventIsAllHistoryAvailableToggled) TypeID() uint32 { - return ChatEventIsAllHistoryAvailableToggledTypeID +func (*ChatEventSignMessagesToggled) TypeID() uint32 { + return ChatEventSignMessagesToggledTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventIsAllHistoryAvailableToggled) TypeName() string { - return "chatEventIsAllHistoryAvailableToggled" +func (*ChatEventSignMessagesToggled) TypeName() string { + return "chatEventSignMessagesToggled" } // TypeInfo returns info about TL type. -func (c *ChatEventIsAllHistoryAvailableToggled) TypeInfo() tdp.Type { +func (c *ChatEventSignMessagesToggled) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventIsAllHistoryAvailableToggled", - ID: ChatEventIsAllHistoryAvailableToggledTypeID, + Name: "chatEventSignMessagesToggled", + ID: ChatEventSignMessagesToggledTypeID, } if c == nil { typ.Null = true @@ -4815,67 +5063,67 @@ func (c *ChatEventIsAllHistoryAvailableToggled) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "IsAllHistoryAvailable", - SchemaName: "is_all_history_available", + Name: "SignMessages", + SchemaName: "sign_messages", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventIsAllHistoryAvailableToggled) Encode(b *bin.Buffer) error { +func (c *ChatEventSignMessagesToggled) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil") + return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil") } - b.PutID(ChatEventIsAllHistoryAvailableToggledTypeID) + b.PutID(ChatEventSignMessagesToggledTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventIsAllHistoryAvailableToggled) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventSignMessagesToggled) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil") + return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil") } - b.PutBool(c.IsAllHistoryAvailable) + b.PutBool(c.SignMessages) return nil } // Decode implements bin.Decoder. -func (c *ChatEventIsAllHistoryAvailableToggled) Decode(b *bin.Buffer) error { +func (c *ChatEventSignMessagesToggled) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil") + return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil") } - if err := b.ConsumeID(ChatEventIsAllHistoryAvailableToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: %w", err) + if err := b.ConsumeID(ChatEventSignMessagesToggledTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventIsAllHistoryAvailableToggled) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventSignMessagesToggled) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil") + return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil") } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: field sign_messages: %w", err) } - c.IsAllHistoryAvailable = value + c.SignMessages = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventIsAllHistoryAvailableToggled) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventSignMessagesToggled) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil") + return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil") } b.ObjStart() - b.PutID("chatEventIsAllHistoryAvailableToggled") + b.PutID("chatEventSignMessagesToggled") b.Comma() - b.FieldStart("is_all_history_available") - b.PutBool(c.IsAllHistoryAvailable) + b.FieldStart("sign_messages") + b.PutBool(c.SignMessages) b.Comma() b.StripComma() b.ObjEnd() @@ -4883,23 +5131,23 @@ func (c *ChatEventIsAllHistoryAvailableToggled) EncodeTDLibJSON(b tdjson.Encoder } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventIsAllHistoryAvailableToggled) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventSignMessagesToggled) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil") + return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventIsAllHistoryAvailableToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: %w", err) + if err := b.ConsumeID("chatEventSignMessagesToggled"); err != nil { + return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: %w", err) } - case "is_all_history_available": + case "sign_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: field is_all_history_available: %w", err) + return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: field sign_messages: %w", err) } - c.IsAllHistoryAvailable = value + c.SignMessages = value default: return b.Skip() } @@ -4907,12 +5155,12 @@ func (c *ChatEventIsAllHistoryAvailableToggled) DecodeTDLibJSON(b tdjson.Decoder }) } -// GetIsAllHistoryAvailable returns value of IsAllHistoryAvailable field. -func (c *ChatEventIsAllHistoryAvailableToggled) GetIsAllHistoryAvailable() (value bool) { +// GetSignMessages returns value of SignMessages field. +func (c *ChatEventSignMessagesToggled) GetSignMessages() (value bool) { if c == nil { return } - return c.IsAllHistoryAvailable + return c.SignMessages } // ChatEventInviteLinkEdited represents TL type `chatEventInviteLinkEdited#e4920d62`. @@ -5641,7 +5889,173 @@ func (c *ChatEventVideoChatEnded) Zero() bool { if c == nil { return true } - if !(c.GroupCallID == 0) { + if !(c.GroupCallID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChatEventVideoChatEnded) String() string { + if c == nil { + return "ChatEventVideoChatEnded(nil)" + } + type Alias ChatEventVideoChatEnded + return fmt.Sprintf("ChatEventVideoChatEnded%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChatEventVideoChatEnded) TypeID() uint32 { + return ChatEventVideoChatEndedTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChatEventVideoChatEnded) TypeName() string { + return "chatEventVideoChatEnded" +} + +// TypeInfo returns info about TL type. +func (c *ChatEventVideoChatEnded) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "chatEventVideoChatEnded", + ID: ChatEventVideoChatEndedTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GroupCallID", + SchemaName: "group_call_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChatEventVideoChatEnded) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil") + } + b.PutID(ChatEventVideoChatEndedTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChatEventVideoChatEnded) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil") + } + b.PutInt32(c.GroupCallID) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChatEventVideoChatEnded) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil") + } + if err := b.ConsumeID(ChatEventVideoChatEndedTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChatEventVideoChatEnded) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil") + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: field group_call_id: %w", err) + } + c.GroupCallID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *ChatEventVideoChatEnded) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil") + } + b.ObjStart() + b.PutID("chatEventVideoChatEnded") + b.Comma() + b.FieldStart("group_call_id") + b.PutInt32(c.GroupCallID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *ChatEventVideoChatEnded) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("chatEventVideoChatEnded"); err != nil { + return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: %w", err) + } + case "group_call_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: field group_call_id: %w", err) + } + c.GroupCallID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetGroupCallID returns value of GroupCallID field. +func (c *ChatEventVideoChatEnded) GetGroupCallID() (value int32) { + if c == nil { + return + } + return c.GroupCallID +} + +// ChatEventVideoChatMuteNewParticipantsToggled represents TL type `chatEventVideoChatMuteNewParticipantsToggled#f87507fe`. +type ChatEventVideoChatMuteNewParticipantsToggled struct { + // New value of the mute_new_participants setting + MuteNewParticipants bool +} + +// ChatEventVideoChatMuteNewParticipantsToggledTypeID is TL type id of ChatEventVideoChatMuteNewParticipantsToggled. +const ChatEventVideoChatMuteNewParticipantsToggledTypeID = 0xf87507fe + +// construct implements constructor of ChatEventActionClass. +func (c ChatEventVideoChatMuteNewParticipantsToggled) construct() ChatEventActionClass { return &c } + +// Ensuring interfaces in compile-time for ChatEventVideoChatMuteNewParticipantsToggled. +var ( + _ bin.Encoder = &ChatEventVideoChatMuteNewParticipantsToggled{} + _ bin.Decoder = &ChatEventVideoChatMuteNewParticipantsToggled{} + _ bin.BareEncoder = &ChatEventVideoChatMuteNewParticipantsToggled{} + _ bin.BareDecoder = &ChatEventVideoChatMuteNewParticipantsToggled{} + + _ ChatEventActionClass = &ChatEventVideoChatMuteNewParticipantsToggled{} +) + +func (c *ChatEventVideoChatMuteNewParticipantsToggled) Zero() bool { + if c == nil { + return true + } + if !(c.MuteNewParticipants == false) { return false } @@ -5649,31 +6063,31 @@ func (c *ChatEventVideoChatEnded) Zero() bool { } // String implements fmt.Stringer. -func (c *ChatEventVideoChatEnded) String() string { +func (c *ChatEventVideoChatMuteNewParticipantsToggled) String() string { if c == nil { - return "ChatEventVideoChatEnded(nil)" + return "ChatEventVideoChatMuteNewParticipantsToggled(nil)" } - type Alias ChatEventVideoChatEnded - return fmt.Sprintf("ChatEventVideoChatEnded%+v", Alias(*c)) + type Alias ChatEventVideoChatMuteNewParticipantsToggled + return fmt.Sprintf("ChatEventVideoChatMuteNewParticipantsToggled%+v", Alias(*c)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventVideoChatEnded) TypeID() uint32 { - return ChatEventVideoChatEndedTypeID +func (*ChatEventVideoChatMuteNewParticipantsToggled) TypeID() uint32 { + return ChatEventVideoChatMuteNewParticipantsToggledTypeID } // TypeName returns name of type in TL schema. -func (*ChatEventVideoChatEnded) TypeName() string { - return "chatEventVideoChatEnded" +func (*ChatEventVideoChatMuteNewParticipantsToggled) TypeName() string { + return "chatEventVideoChatMuteNewParticipantsToggled" } // TypeInfo returns info about TL type. -func (c *ChatEventVideoChatEnded) TypeInfo() tdp.Type { +func (c *ChatEventVideoChatMuteNewParticipantsToggled) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "chatEventVideoChatEnded", - ID: ChatEventVideoChatEndedTypeID, + Name: "chatEventVideoChatMuteNewParticipantsToggled", + ID: ChatEventVideoChatMuteNewParticipantsToggledTypeID, } if c == nil { typ.Null = true @@ -5681,67 +6095,67 @@ func (c *ChatEventVideoChatEnded) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "GroupCallID", - SchemaName: "group_call_id", + Name: "MuteNewParticipants", + SchemaName: "mute_new_participants", }, } return typ } // Encode implements bin.Encoder. -func (c *ChatEventVideoChatEnded) Encode(b *bin.Buffer) error { +func (c *ChatEventVideoChatMuteNewParticipantsToggled) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil") + return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil") } - b.PutID(ChatEventVideoChatEndedTypeID) + b.PutID(ChatEventVideoChatMuteNewParticipantsToggledTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChatEventVideoChatEnded) EncodeBare(b *bin.Buffer) error { +func (c *ChatEventVideoChatMuteNewParticipantsToggled) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil") + return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil") } - b.PutInt32(c.GroupCallID) + b.PutBool(c.MuteNewParticipants) return nil } // Decode implements bin.Decoder. -func (c *ChatEventVideoChatEnded) Decode(b *bin.Buffer) error { +func (c *ChatEventVideoChatMuteNewParticipantsToggled) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil") + return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil") } - if err := b.ConsumeID(ChatEventVideoChatEndedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: %w", err) + if err := b.ConsumeID(ChatEventVideoChatMuteNewParticipantsToggledTypeID); err != nil { + return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChatEventVideoChatEnded) DecodeBare(b *bin.Buffer) error { +func (c *ChatEventVideoChatMuteNewParticipantsToggled) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil") + return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil") } { - value, err := b.Int32() + value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: field group_call_id: %w", err) + return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: field mute_new_participants: %w", err) } - c.GroupCallID = value + c.MuteNewParticipants = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventVideoChatEnded) EncodeTDLibJSON(b tdjson.Encoder) error { +func (c *ChatEventVideoChatMuteNewParticipantsToggled) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil") + return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil") } b.ObjStart() - b.PutID("chatEventVideoChatEnded") + b.PutID("chatEventVideoChatMuteNewParticipantsToggled") b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(c.GroupCallID) + b.FieldStart("mute_new_participants") + b.PutBool(c.MuteNewParticipants) b.Comma() b.StripComma() b.ObjEnd() @@ -5749,23 +6163,23 @@ func (c *ChatEventVideoChatEnded) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventVideoChatEnded) DecodeTDLibJSON(b tdjson.Decoder) error { +func (c *ChatEventVideoChatMuteNewParticipantsToggled) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil") + return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("chatEventVideoChatEnded"); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: %w", err) + if err := b.ConsumeID("chatEventVideoChatMuteNewParticipantsToggled"); err != nil { + return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: %w", err) } - case "group_call_id": - value, err := b.Int32() + case "mute_new_participants": + value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: field group_call_id: %w", err) + return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: field mute_new_participants: %w", err) } - c.GroupCallID = value + c.MuteNewParticipants = value default: return b.Skip() } @@ -5773,12 +6187,12 @@ func (c *ChatEventVideoChatEnded) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetGroupCallID returns value of GroupCallID field. -func (c *ChatEventVideoChatEnded) GetGroupCallID() (value int32) { +// GetMuteNewParticipants returns value of MuteNewParticipants field. +func (c *ChatEventVideoChatMuteNewParticipantsToggled) GetMuteNewParticipants() (value bool) { if c == nil { return } - return c.GroupCallID + return c.MuteNewParticipants } // ChatEventVideoChatParticipantIsMutedToggled represents TL type `chatEventVideoChatParticipantIsMutedToggled#1f1058f7`. @@ -6201,172 +6615,6 @@ func (c *ChatEventVideoChatParticipantVolumeLevelChanged) GetVolumeLevel() (valu return c.VolumeLevel } -// ChatEventVideoChatMuteNewParticipantsToggled represents TL type `chatEventVideoChatMuteNewParticipantsToggled#f87507fe`. -type ChatEventVideoChatMuteNewParticipantsToggled struct { - // New value of the mute_new_participants setting - MuteNewParticipants bool -} - -// ChatEventVideoChatMuteNewParticipantsToggledTypeID is TL type id of ChatEventVideoChatMuteNewParticipantsToggled. -const ChatEventVideoChatMuteNewParticipantsToggledTypeID = 0xf87507fe - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventVideoChatMuteNewParticipantsToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventVideoChatMuteNewParticipantsToggled. -var ( - _ bin.Encoder = &ChatEventVideoChatMuteNewParticipantsToggled{} - _ bin.Decoder = &ChatEventVideoChatMuteNewParticipantsToggled{} - _ bin.BareEncoder = &ChatEventVideoChatMuteNewParticipantsToggled{} - _ bin.BareDecoder = &ChatEventVideoChatMuteNewParticipantsToggled{} - - _ ChatEventActionClass = &ChatEventVideoChatMuteNewParticipantsToggled{} -) - -func (c *ChatEventVideoChatMuteNewParticipantsToggled) Zero() bool { - if c == nil { - return true - } - if !(c.MuteNewParticipants == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) String() string { - if c == nil { - return "ChatEventVideoChatMuteNewParticipantsToggled(nil)" - } - type Alias ChatEventVideoChatMuteNewParticipantsToggled - return fmt.Sprintf("ChatEventVideoChatMuteNewParticipantsToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventVideoChatMuteNewParticipantsToggled) TypeID() uint32 { - return ChatEventVideoChatMuteNewParticipantsToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventVideoChatMuteNewParticipantsToggled) TypeName() string { - return "chatEventVideoChatMuteNewParticipantsToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventVideoChatMuteNewParticipantsToggled", - ID: ChatEventVideoChatMuteNewParticipantsToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MuteNewParticipants", - SchemaName: "mute_new_participants", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil") - } - b.PutID(ChatEventVideoChatMuteNewParticipantsToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil") - } - b.PutBool(c.MuteNewParticipants) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil") - } - if err := b.ConsumeID(ChatEventVideoChatMuteNewParticipantsToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: field mute_new_participants: %w", err) - } - c.MuteNewParticipants = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil") - } - b.ObjStart() - b.PutID("chatEventVideoChatMuteNewParticipantsToggled") - b.Comma() - b.FieldStart("mute_new_participants") - b.PutBool(c.MuteNewParticipants) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventVideoChatMuteNewParticipantsToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: %w", err) - } - case "mute_new_participants": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: field mute_new_participants: %w", err) - } - c.MuteNewParticipants = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMuteNewParticipants returns value of MuteNewParticipants field. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) GetMuteNewParticipants() (value bool) { - if c == nil { - return - } - return c.MuteNewParticipants -} - // ChatEventActionClassName is schema name of ChatEventActionClass. const ChatEventActionClassName = "ChatEventAction" @@ -6380,38 +6628,39 @@ const ChatEventActionClassName = "ChatEventAction" // switch v := g.(type) { // case *tdapi.ChatEventMessageEdited: // chatEventMessageEdited#e64ff5f8 // case *tdapi.ChatEventMessageDeleted: // chatEventMessageDeleted#cac649f7 -// case *tdapi.ChatEventPollStopped: // chatEventPollStopped#77cc8be5 // case *tdapi.ChatEventMessagePinned: // chatEventMessagePinned#1a26ad1a // case *tdapi.ChatEventMessageUnpinned: // chatEventMessageUnpinned#e9943b17 +// case *tdapi.ChatEventPollStopped: // chatEventPollStopped#77cc8be5 // case *tdapi.ChatEventMemberJoined: // chatEventMemberJoined#f1f70924 // case *tdapi.ChatEventMemberJoinedByInviteLink: // chatEventMemberJoinedByInviteLink#f0e6d5bd // case *tdapi.ChatEventMemberJoinedByRequest: // chatEventMemberJoinedByRequest#9dc87e3f -// case *tdapi.ChatEventMemberLeft: // chatEventMemberLeft#c778400f // case *tdapi.ChatEventMemberInvited: // chatEventMemberInvited#38d7bfc9 +// case *tdapi.ChatEventMemberLeft: // chatEventMemberLeft#c778400f // case *tdapi.ChatEventMemberPromoted: // chatEventMemberPromoted#1f4f6861 // case *tdapi.ChatEventMemberRestricted: // chatEventMemberRestricted#5f951e05 -// case *tdapi.ChatEventTitleChanged: // chatEventTitleChanged#43990ad2 -// case *tdapi.ChatEventPermissionsChanged: // chatEventPermissionsChanged#b1d337a8 +// case *tdapi.ChatEventAvailableReactionsChanged: // chatEventAvailableReactionsChanged#9ac93274 // case *tdapi.ChatEventDescriptionChanged: // chatEventDescriptionChanged#254cf1e -// case *tdapi.ChatEventUsernameChanged: // chatEventUsernameChanged#6707b56b -// case *tdapi.ChatEventPhotoChanged: // chatEventPhotoChanged#cfa062c3 -// case *tdapi.ChatEventInvitesToggled: // chatEventInvitesToggled#fc45966b // case *tdapi.ChatEventLinkedChatChanged: // chatEventLinkedChatChanged#6b2271af -// case *tdapi.ChatEventSlowModeDelayChanged: // chatEventSlowModeDelayChanged#9d763c0b +// case *tdapi.ChatEventLocationChanged: // chatEventLocationChanged#e7cdfd4e // case *tdapi.ChatEventMessageTTLChanged: // chatEventMessageTtlChanged#2e46b9b3 -// case *tdapi.ChatEventSignMessagesToggled: // chatEventSignMessagesToggled#b1b9281e -// case *tdapi.ChatEventHasProtectedContentToggled: // chatEventHasProtectedContentToggled#f5044201 +// case *tdapi.ChatEventPermissionsChanged: // chatEventPermissionsChanged#b1d337a8 +// case *tdapi.ChatEventPhotoChanged: // chatEventPhotoChanged#cfa062c3 +// case *tdapi.ChatEventSlowModeDelayChanged: // chatEventSlowModeDelayChanged#9d763c0b // case *tdapi.ChatEventStickerSetChanged: // chatEventStickerSetChanged#b5e7558f -// case *tdapi.ChatEventLocationChanged: // chatEventLocationChanged#e7cdfd4e +// case *tdapi.ChatEventTitleChanged: // chatEventTitleChanged#43990ad2 +// case *tdapi.ChatEventUsernameChanged: // chatEventUsernameChanged#6707b56b +// case *tdapi.ChatEventHasProtectedContentToggled: // chatEventHasProtectedContentToggled#f5044201 +// case *tdapi.ChatEventInvitesToggled: // chatEventInvitesToggled#fc45966b // case *tdapi.ChatEventIsAllHistoryAvailableToggled: // chatEventIsAllHistoryAvailableToggled#a0b03c15 +// case *tdapi.ChatEventSignMessagesToggled: // chatEventSignMessagesToggled#b1b9281e // case *tdapi.ChatEventInviteLinkEdited: // chatEventInviteLinkEdited#e4920d62 // case *tdapi.ChatEventInviteLinkRevoked: // chatEventInviteLinkRevoked#a1dbffe3 // case *tdapi.ChatEventInviteLinkDeleted: // chatEventInviteLinkDeleted#acda6167 // case *tdapi.ChatEventVideoChatCreated: // chatEventVideoChatCreated#6ca68a7b // case *tdapi.ChatEventVideoChatEnded: // chatEventVideoChatEnded#61286c48 +// case *tdapi.ChatEventVideoChatMuteNewParticipantsToggled: // chatEventVideoChatMuteNewParticipantsToggled#f87507fe // case *tdapi.ChatEventVideoChatParticipantIsMutedToggled: // chatEventVideoChatParticipantIsMutedToggled#1f1058f7 // case *tdapi.ChatEventVideoChatParticipantVolumeLevelChanged: // chatEventVideoChatParticipantVolumeLevelChanged#436f92be -// case *tdapi.ChatEventVideoChatMuteNewParticipantsToggled: // chatEventVideoChatMuteNewParticipantsToggled#f87507fe // default: panic(v) // } type ChatEventActionClass interface { @@ -6457,13 +6706,6 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventPollStoppedTypeID: - // Decoding chatEventPollStopped#77cc8be5. - v := ChatEventPollStopped{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil case ChatEventMessagePinnedTypeID: // Decoding chatEventMessagePinned#1a26ad1a. v := ChatEventMessagePinned{} @@ -6478,6 +6720,13 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case ChatEventPollStoppedTypeID: + // Decoding chatEventPollStopped#77cc8be5. + v := ChatEventPollStopped{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case ChatEventMemberJoinedTypeID: // Decoding chatEventMemberJoined#f1f70924. v := ChatEventMemberJoined{} @@ -6499,16 +6748,16 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventMemberLeftTypeID: - // Decoding chatEventMemberLeft#c778400f. - v := ChatEventMemberLeft{} + case ChatEventMemberInvitedTypeID: + // Decoding chatEventMemberInvited#38d7bfc9. + v := ChatEventMemberInvited{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventMemberInvitedTypeID: - // Decoding chatEventMemberInvited#38d7bfc9. - v := ChatEventMemberInvited{} + case ChatEventMemberLeftTypeID: + // Decoding chatEventMemberLeft#c778400f. + v := ChatEventMemberLeft{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } @@ -6527,51 +6776,51 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventTitleChangedTypeID: - // Decoding chatEventTitleChanged#43990ad2. - v := ChatEventTitleChanged{} + case ChatEventAvailableReactionsChangedTypeID: + // Decoding chatEventAvailableReactionsChanged#9ac93274. + v := ChatEventAvailableReactionsChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventPermissionsChangedTypeID: - // Decoding chatEventPermissionsChanged#b1d337a8. - v := ChatEventPermissionsChanged{} + case ChatEventDescriptionChangedTypeID: + // Decoding chatEventDescriptionChanged#254cf1e. + v := ChatEventDescriptionChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventDescriptionChangedTypeID: - // Decoding chatEventDescriptionChanged#254cf1e. - v := ChatEventDescriptionChanged{} + case ChatEventLinkedChatChangedTypeID: + // Decoding chatEventLinkedChatChanged#6b2271af. + v := ChatEventLinkedChatChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventUsernameChangedTypeID: - // Decoding chatEventUsernameChanged#6707b56b. - v := ChatEventUsernameChanged{} + case ChatEventLocationChangedTypeID: + // Decoding chatEventLocationChanged#e7cdfd4e. + v := ChatEventLocationChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventPhotoChangedTypeID: - // Decoding chatEventPhotoChanged#cfa062c3. - v := ChatEventPhotoChanged{} + case ChatEventMessageTTLChangedTypeID: + // Decoding chatEventMessageTtlChanged#2e46b9b3. + v := ChatEventMessageTTLChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventInvitesToggledTypeID: - // Decoding chatEventInvitesToggled#fc45966b. - v := ChatEventInvitesToggled{} + case ChatEventPermissionsChangedTypeID: + // Decoding chatEventPermissionsChanged#b1d337a8. + v := ChatEventPermissionsChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventLinkedChatChangedTypeID: - // Decoding chatEventLinkedChatChanged#6b2271af. - v := ChatEventLinkedChatChanged{} + case ChatEventPhotoChangedTypeID: + // Decoding chatEventPhotoChanged#cfa062c3. + v := ChatEventPhotoChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } @@ -6583,37 +6832,37 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventMessageTTLChangedTypeID: - // Decoding chatEventMessageTtlChanged#2e46b9b3. - v := ChatEventMessageTTLChanged{} + case ChatEventStickerSetChangedTypeID: + // Decoding chatEventStickerSetChanged#b5e7558f. + v := ChatEventStickerSetChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventSignMessagesToggledTypeID: - // Decoding chatEventSignMessagesToggled#b1b9281e. - v := ChatEventSignMessagesToggled{} + case ChatEventTitleChangedTypeID: + // Decoding chatEventTitleChanged#43990ad2. + v := ChatEventTitleChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventHasProtectedContentToggledTypeID: - // Decoding chatEventHasProtectedContentToggled#f5044201. - v := ChatEventHasProtectedContentToggled{} + case ChatEventUsernameChangedTypeID: + // Decoding chatEventUsernameChanged#6707b56b. + v := ChatEventUsernameChanged{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventStickerSetChangedTypeID: - // Decoding chatEventStickerSetChanged#b5e7558f. - v := ChatEventStickerSetChanged{} + case ChatEventHasProtectedContentToggledTypeID: + // Decoding chatEventHasProtectedContentToggled#f5044201. + v := ChatEventHasProtectedContentToggled{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventLocationChangedTypeID: - // Decoding chatEventLocationChanged#e7cdfd4e. - v := ChatEventLocationChanged{} + case ChatEventInvitesToggledTypeID: + // Decoding chatEventInvitesToggled#fc45966b. + v := ChatEventInvitesToggled{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } @@ -6625,6 +6874,13 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case ChatEventSignMessagesToggledTypeID: + // Decoding chatEventSignMessagesToggled#b1b9281e. + v := ChatEventSignMessagesToggled{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case ChatEventInviteLinkEditedTypeID: // Decoding chatEventInviteLinkEdited#e4920d62. v := ChatEventInviteLinkEdited{} @@ -6660,6 +6916,13 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case ChatEventVideoChatMuteNewParticipantsToggledTypeID: + // Decoding chatEventVideoChatMuteNewParticipantsToggled#f87507fe. + v := ChatEventVideoChatMuteNewParticipantsToggled{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case ChatEventVideoChatParticipantIsMutedToggledTypeID: // Decoding chatEventVideoChatParticipantIsMutedToggled#1f1058f7. v := ChatEventVideoChatParticipantIsMutedToggled{} @@ -6674,13 +6937,6 @@ func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case ChatEventVideoChatMuteNewParticipantsToggledTypeID: - // Decoding chatEventVideoChatMuteNewParticipantsToggled#f87507fe. - v := ChatEventVideoChatMuteNewParticipantsToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil default: return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", bin.NewUnexpectedID(id)) } @@ -6707,13 +6963,6 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventPollStopped": - // Decoding chatEventPollStopped#77cc8be5. - v := ChatEventPollStopped{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil case "chatEventMessagePinned": // Decoding chatEventMessagePinned#1a26ad1a. v := ChatEventMessagePinned{} @@ -6728,6 +6977,13 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case "chatEventPollStopped": + // Decoding chatEventPollStopped#77cc8be5. + v := ChatEventPollStopped{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case "chatEventMemberJoined": // Decoding chatEventMemberJoined#f1f70924. v := ChatEventMemberJoined{} @@ -6749,16 +7005,16 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventMemberLeft": - // Decoding chatEventMemberLeft#c778400f. - v := ChatEventMemberLeft{} + case "chatEventMemberInvited": + // Decoding chatEventMemberInvited#38d7bfc9. + v := ChatEventMemberInvited{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventMemberInvited": - // Decoding chatEventMemberInvited#38d7bfc9. - v := ChatEventMemberInvited{} + case "chatEventMemberLeft": + // Decoding chatEventMemberLeft#c778400f. + v := ChatEventMemberLeft{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } @@ -6777,51 +7033,51 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventTitleChanged": - // Decoding chatEventTitleChanged#43990ad2. - v := ChatEventTitleChanged{} + case "chatEventAvailableReactionsChanged": + // Decoding chatEventAvailableReactionsChanged#9ac93274. + v := ChatEventAvailableReactionsChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventPermissionsChanged": - // Decoding chatEventPermissionsChanged#b1d337a8. - v := ChatEventPermissionsChanged{} + case "chatEventDescriptionChanged": + // Decoding chatEventDescriptionChanged#254cf1e. + v := ChatEventDescriptionChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventDescriptionChanged": - // Decoding chatEventDescriptionChanged#254cf1e. - v := ChatEventDescriptionChanged{} + case "chatEventLinkedChatChanged": + // Decoding chatEventLinkedChatChanged#6b2271af. + v := ChatEventLinkedChatChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventUsernameChanged": - // Decoding chatEventUsernameChanged#6707b56b. - v := ChatEventUsernameChanged{} + case "chatEventLocationChanged": + // Decoding chatEventLocationChanged#e7cdfd4e. + v := ChatEventLocationChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventPhotoChanged": - // Decoding chatEventPhotoChanged#cfa062c3. - v := ChatEventPhotoChanged{} + case "chatEventMessageTtlChanged": + // Decoding chatEventMessageTtlChanged#2e46b9b3. + v := ChatEventMessageTTLChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventInvitesToggled": - // Decoding chatEventInvitesToggled#fc45966b. - v := ChatEventInvitesToggled{} + case "chatEventPermissionsChanged": + // Decoding chatEventPermissionsChanged#b1d337a8. + v := ChatEventPermissionsChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventLinkedChatChanged": - // Decoding chatEventLinkedChatChanged#6b2271af. - v := ChatEventLinkedChatChanged{} + case "chatEventPhotoChanged": + // Decoding chatEventPhotoChanged#cfa062c3. + v := ChatEventPhotoChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } @@ -6833,37 +7089,37 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventMessageTtlChanged": - // Decoding chatEventMessageTtlChanged#2e46b9b3. - v := ChatEventMessageTTLChanged{} + case "chatEventStickerSetChanged": + // Decoding chatEventStickerSetChanged#b5e7558f. + v := ChatEventStickerSetChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventSignMessagesToggled": - // Decoding chatEventSignMessagesToggled#b1b9281e. - v := ChatEventSignMessagesToggled{} + case "chatEventTitleChanged": + // Decoding chatEventTitleChanged#43990ad2. + v := ChatEventTitleChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventHasProtectedContentToggled": - // Decoding chatEventHasProtectedContentToggled#f5044201. - v := ChatEventHasProtectedContentToggled{} + case "chatEventUsernameChanged": + // Decoding chatEventUsernameChanged#6707b56b. + v := ChatEventUsernameChanged{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventStickerSetChanged": - // Decoding chatEventStickerSetChanged#b5e7558f. - v := ChatEventStickerSetChanged{} + case "chatEventHasProtectedContentToggled": + // Decoding chatEventHasProtectedContentToggled#f5044201. + v := ChatEventHasProtectedContentToggled{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventLocationChanged": - // Decoding chatEventLocationChanged#e7cdfd4e. - v := ChatEventLocationChanged{} + case "chatEventInvitesToggled": + // Decoding chatEventInvitesToggled#fc45966b. + v := ChatEventInvitesToggled{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } @@ -6875,6 +7131,13 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case "chatEventSignMessagesToggled": + // Decoding chatEventSignMessagesToggled#b1b9281e. + v := ChatEventSignMessagesToggled{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case "chatEventInviteLinkEdited": // Decoding chatEventInviteLinkEdited#e4920d62. v := ChatEventInviteLinkEdited{} @@ -6910,6 +7173,13 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil + case "chatEventVideoChatMuteNewParticipantsToggled": + // Decoding chatEventVideoChatMuteNewParticipantsToggled#f87507fe. + v := ChatEventVideoChatMuteNewParticipantsToggled{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) + } + return &v, nil case "chatEventVideoChatParticipantIsMutedToggled": // Decoding chatEventVideoChatParticipantIsMutedToggled#1f1058f7. v := ChatEventVideoChatParticipantIsMutedToggled{} @@ -6924,13 +7194,6 @@ func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, e return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) } return &v, nil - case "chatEventVideoChatMuteNewParticipantsToggled": - // Decoding chatEventVideoChatMuteNewParticipantsToggled#f87507fe. - v := ChatEventVideoChatMuteNewParticipantsToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil default: return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_chat_gen.go b/tdapi/tl_chat_gen.go index aa5d926f85..aff01ea3ad 100644 --- a/tdapi/tl_chat_gen.go +++ b/tdapi/tl_chat_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Chat represents TL type `chat#69d332bd`. +// Chat represents TL type `chat#548eca01`. type Chat struct { // Chat unique identifier ID int64 @@ -78,8 +78,12 @@ type Chat struct { LastReadOutboxMessageID int64 // Number of unread messages with a mention/reply in the chat UnreadMentionCount int32 - // Notification settings for this chat + // Number of messages with unread reactions in the chat + UnreadReactionCount int32 + // Notification settings for the chat NotificationSettings ChatNotificationSettings + // List of reactions, available in the chat + AvailableReactions []string // Current message Time To Live setting (self-destruct timer) for the chat; 0 if not // defined. TTL is counted from the time message or its content is viewed in secret chats // and from the send date in other chats @@ -105,7 +109,7 @@ type Chat struct { } // ChatTypeID is TL type id of Chat. -const ChatTypeID = 0x69d332bd +const ChatTypeID = 0x548eca01 // Ensuring interfaces in compile-time for Chat. var ( @@ -179,9 +183,15 @@ func (c *Chat) Zero() bool { if !(c.UnreadMentionCount == 0) { return false } + if !(c.UnreadReactionCount == 0) { + return false + } if !(c.NotificationSettings.Zero()) { return false } + if !(c.AvailableReactions == nil) { + return false + } if !(c.MessageTTL == 0) { return false } @@ -322,10 +332,18 @@ func (c *Chat) TypeInfo() tdp.Type { Name: "UnreadMentionCount", SchemaName: "unread_mention_count", }, + { + Name: "UnreadReactionCount", + SchemaName: "unread_reaction_count", + }, { Name: "NotificationSettings", SchemaName: "notification_settings", }, + { + Name: "AvailableReactions", + SchemaName: "available_reactions", + }, { Name: "MessageTTL", SchemaName: "message_ttl", @@ -365,7 +383,7 @@ func (c *Chat) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *Chat) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chat#69d332bd as nil") + return fmt.Errorf("can't encode chat#548eca01 as nil") } b.PutID(ChatTypeID) return c.EncodeBare(b) @@ -374,36 +392,36 @@ func (c *Chat) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *Chat) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chat#69d332bd as nil") + return fmt.Errorf("can't encode chat#548eca01 as nil") } b.PutInt53(c.ID) if c.Type == nil { - return fmt.Errorf("unable to encode chat#69d332bd: field type is nil") + return fmt.Errorf("unable to encode chat#548eca01: field type is nil") } if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field type: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field type: %w", err) } b.PutString(c.Title) if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field photo: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field photo: %w", err) } if err := c.Permissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field permissions: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field permissions: %w", err) } if err := c.LastMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field last_message: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field last_message: %w", err) } b.PutInt(len(c.Positions)) for idx, v := range c.Positions { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chat#69d332bd: field positions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare chat#548eca01: field positions element with index %d: %w", idx, err) } } if c.MessageSenderID == nil { - return fmt.Errorf("unable to encode chat#69d332bd: field message_sender_id is nil") + return fmt.Errorf("unable to encode chat#548eca01: field message_sender_id is nil") } if err := c.MessageSenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field message_sender_id: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field message_sender_id: %w", err) } b.PutBool(c.HasProtectedContent) b.PutBool(c.IsMarkedAsUnread) @@ -417,26 +435,31 @@ func (c *Chat) EncodeBare(b *bin.Buffer) error { b.PutInt53(c.LastReadInboxMessageID) b.PutInt53(c.LastReadOutboxMessageID) b.PutInt32(c.UnreadMentionCount) + b.PutInt32(c.UnreadReactionCount) if err := c.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field notification_settings: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field notification_settings: %w", err) + } + b.PutInt(len(c.AvailableReactions)) + for _, v := range c.AvailableReactions { + b.PutString(v) } b.PutInt32(c.MessageTTL) b.PutString(c.ThemeName) if c.ActionBar == nil { - return fmt.Errorf("unable to encode chat#69d332bd: field action_bar is nil") + return fmt.Errorf("unable to encode chat#548eca01: field action_bar is nil") } if err := c.ActionBar.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field action_bar: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field action_bar: %w", err) } if err := c.VideoChat.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field video_chat: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field video_chat: %w", err) } if err := c.PendingJoinRequests.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field pending_join_requests: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field pending_join_requests: %w", err) } b.PutInt53(c.ReplyMarkupMessageID) if err := c.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field draft_message: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field draft_message: %w", err) } b.PutString(c.ClientData) return nil @@ -445,10 +468,10 @@ func (c *Chat) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *Chat) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chat#69d332bd to nil") + return fmt.Errorf("can't decode chat#548eca01 to nil") } if err := b.ConsumeID(ChatTypeID); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: %w", err) } return c.DecodeBare(b) } @@ -456,48 +479,48 @@ func (c *Chat) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *Chat) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chat#69d332bd to nil") + return fmt.Errorf("can't decode chat#548eca01 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field id: %w", err) } c.ID = value } { value, err := DecodeChatType(b) if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field type: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field type: %w", err) } c.Type = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field title: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field title: %w", err) } c.Title = value } { if err := c.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field photo: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field photo: %w", err) } } { if err := c.Permissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field permissions: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field permissions: %w", err) } } { if err := c.LastMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field last_message: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field last_message: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field positions: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field positions: %w", err) } if headerLen > 0 { @@ -506,7 +529,7 @@ func (c *Chat) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value ChatPosition if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chat#69d332bd: field positions: %w", err) + return fmt.Errorf("unable to decode bare chat#548eca01: field positions: %w", err) } c.Positions = append(c.Positions, value) } @@ -514,146 +537,170 @@ func (c *Chat) DecodeBare(b *bin.Buffer) error { { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field message_sender_id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field message_sender_id: %w", err) } c.MessageSenderID = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field has_protected_content: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field has_protected_content: %w", err) } c.HasProtectedContent = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field is_marked_as_unread: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field is_marked_as_unread: %w", err) } c.IsMarkedAsUnread = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field is_blocked: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field is_blocked: %w", err) } c.IsBlocked = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field has_scheduled_messages: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field has_scheduled_messages: %w", err) } c.HasScheduledMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field can_be_deleted_only_for_self: %w", err) } c.CanBeDeletedOnlyForSelf = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field can_be_deleted_for_all_users: %w", err) } c.CanBeDeletedForAllUsers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field can_be_reported: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field can_be_reported: %w", err) } c.CanBeReported = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field default_disable_notification: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field default_disable_notification: %w", err) } c.DefaultDisableNotification = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field unread_count: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field unread_count: %w", err) } c.UnreadCount = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field last_read_inbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field last_read_inbox_message_id: %w", err) } c.LastReadInboxMessageID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field last_read_outbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field last_read_outbox_message_id: %w", err) } c.LastReadOutboxMessageID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field unread_mention_count: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field unread_mention_count: %w", err) } c.UnreadMentionCount = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chat#548eca01: field unread_reaction_count: %w", err) + } + c.UnreadReactionCount = value + } { if err := c.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field notification_settings: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field notification_settings: %w", err) + } + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode chat#548eca01: field available_reactions: %w", err) + } + + if headerLen > 0 { + c.AvailableReactions = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chat#548eca01: field available_reactions: %w", err) + } + c.AvailableReactions = append(c.AvailableReactions, value) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field message_ttl: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field message_ttl: %w", err) } c.MessageTTL = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field theme_name: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field theme_name: %w", err) } c.ThemeName = value } { value, err := DecodeChatActionBar(b) if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field action_bar: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field action_bar: %w", err) } c.ActionBar = value } { if err := c.VideoChat.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field video_chat: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field video_chat: %w", err) } } { if err := c.PendingJoinRequests.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field pending_join_requests: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field pending_join_requests: %w", err) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field reply_markup_message_id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field reply_markup_message_id: %w", err) } c.ReplyMarkupMessageID = value } { if err := c.DraftMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field draft_message: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field draft_message: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field client_data: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field client_data: %w", err) } c.ClientData = value } @@ -663,7 +710,7 @@ func (c *Chat) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode chat#69d332bd as nil") + return fmt.Errorf("can't encode chat#548eca01 as nil") } b.ObjStart() b.PutID("chat") @@ -673,10 +720,10 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("type") if c.Type == nil { - return fmt.Errorf("unable to encode chat#69d332bd: field type is nil") + return fmt.Errorf("unable to encode chat#548eca01: field type is nil") } if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field type: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field type: %w", err) } b.Comma() b.FieldStart("title") @@ -684,24 +731,24 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("photo") if err := c.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field photo: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field photo: %w", err) } b.Comma() b.FieldStart("permissions") if err := c.Permissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field permissions: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field permissions: %w", err) } b.Comma() b.FieldStart("last_message") if err := c.LastMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field last_message: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field last_message: %w", err) } b.Comma() b.FieldStart("positions") b.ArrStart() for idx, v := range c.Positions { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field positions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode chat#548eca01: field positions element with index %d: %w", idx, err) } b.Comma() } @@ -710,10 +757,10 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("message_sender_id") if c.MessageSenderID == nil { - return fmt.Errorf("unable to encode chat#69d332bd: field message_sender_id is nil") + return fmt.Errorf("unable to encode chat#548eca01: field message_sender_id is nil") } if err := c.MessageSenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field message_sender_id: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field message_sender_id: %w", err) } b.Comma() b.FieldStart("has_protected_content") @@ -752,11 +799,23 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("unread_mention_count") b.PutInt32(c.UnreadMentionCount) b.Comma() + b.FieldStart("unread_reaction_count") + b.PutInt32(c.UnreadReactionCount) + b.Comma() b.FieldStart("notification_settings") if err := c.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field notification_settings: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field notification_settings: %w", err) } b.Comma() + b.FieldStart("available_reactions") + b.ArrStart() + for _, v := range c.AvailableReactions { + b.PutString(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() b.FieldStart("message_ttl") b.PutInt32(c.MessageTTL) b.Comma() @@ -765,20 +824,20 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("action_bar") if c.ActionBar == nil { - return fmt.Errorf("unable to encode chat#69d332bd: field action_bar is nil") + return fmt.Errorf("unable to encode chat#548eca01: field action_bar is nil") } if err := c.ActionBar.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field action_bar: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field action_bar: %w", err) } b.Comma() b.FieldStart("video_chat") if err := c.VideoChat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field video_chat: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field video_chat: %w", err) } b.Comma() b.FieldStart("pending_join_requests") if err := c.PendingJoinRequests.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field pending_join_requests: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field pending_join_requests: %w", err) } b.Comma() b.FieldStart("reply_markup_message_id") @@ -786,7 +845,7 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("draft_message") if err := c.DraftMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#69d332bd: field draft_message: %w", err) + return fmt.Errorf("unable to encode chat#548eca01: field draft_message: %w", err) } b.Comma() b.FieldStart("client_data") @@ -800,178 +859,195 @@ func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *Chat) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode chat#69d332bd to nil") + return fmt.Errorf("can't decode chat#548eca01 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("chat"); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field id: %w", err) } c.ID = value case "type": value, err := DecodeTDLibJSONChatType(b) if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field type: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field type: %w", err) } c.Type = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field title: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field title: %w", err) } c.Title = value case "photo": if err := c.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field photo: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field photo: %w", err) } case "permissions": if err := c.Permissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field permissions: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field permissions: %w", err) } case "last_message": if err := c.LastMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field last_message: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field last_message: %w", err) } case "positions": if err := b.Arr(func(b tdjson.Decoder) error { var value ChatPosition if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field positions: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field positions: %w", err) } c.Positions = append(c.Positions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field positions: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field positions: %w", err) } case "message_sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field message_sender_id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field message_sender_id: %w", err) } c.MessageSenderID = value case "has_protected_content": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field has_protected_content: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field has_protected_content: %w", err) } c.HasProtectedContent = value case "is_marked_as_unread": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field is_marked_as_unread: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field is_marked_as_unread: %w", err) } c.IsMarkedAsUnread = value case "is_blocked": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field is_blocked: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field is_blocked: %w", err) } c.IsBlocked = value case "has_scheduled_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field has_scheduled_messages: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field has_scheduled_messages: %w", err) } c.HasScheduledMessages = value case "can_be_deleted_only_for_self": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field can_be_deleted_only_for_self: %w", err) } c.CanBeDeletedOnlyForSelf = value case "can_be_deleted_for_all_users": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field can_be_deleted_for_all_users: %w", err) } c.CanBeDeletedForAllUsers = value case "can_be_reported": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field can_be_reported: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field can_be_reported: %w", err) } c.CanBeReported = value case "default_disable_notification": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field default_disable_notification: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field default_disable_notification: %w", err) } c.DefaultDisableNotification = value case "unread_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field unread_count: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field unread_count: %w", err) } c.UnreadCount = value case "last_read_inbox_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field last_read_inbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field last_read_inbox_message_id: %w", err) } c.LastReadInboxMessageID = value case "last_read_outbox_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field last_read_outbox_message_id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field last_read_outbox_message_id: %w", err) } c.LastReadOutboxMessageID = value case "unread_mention_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field unread_mention_count: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field unread_mention_count: %w", err) } c.UnreadMentionCount = value + case "unread_reaction_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode chat#548eca01: field unread_reaction_count: %w", err) + } + c.UnreadReactionCount = value case "notification_settings": if err := c.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field notification_settings: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field notification_settings: %w", err) + } + case "available_reactions": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chat#548eca01: field available_reactions: %w", err) + } + c.AvailableReactions = append(c.AvailableReactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode chat#548eca01: field available_reactions: %w", err) } case "message_ttl": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field message_ttl: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field message_ttl: %w", err) } c.MessageTTL = value case "theme_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field theme_name: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field theme_name: %w", err) } c.ThemeName = value case "action_bar": value, err := DecodeTDLibJSONChatActionBar(b) if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field action_bar: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field action_bar: %w", err) } c.ActionBar = value case "video_chat": if err := c.VideoChat.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field video_chat: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field video_chat: %w", err) } case "pending_join_requests": if err := c.PendingJoinRequests.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field pending_join_requests: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field pending_join_requests: %w", err) } case "reply_markup_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field reply_markup_message_id: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field reply_markup_message_id: %w", err) } c.ReplyMarkupMessageID = value case "draft_message": if err := c.DraftMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field draft_message: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field draft_message: %w", err) } case "client_data": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode chat#69d332bd: field client_data: %w", err) + return fmt.Errorf("unable to decode chat#548eca01: field client_data: %w", err) } c.ClientData = value default: @@ -1141,6 +1217,14 @@ func (c *Chat) GetUnreadMentionCount() (value int32) { return c.UnreadMentionCount } +// GetUnreadReactionCount returns value of UnreadReactionCount field. +func (c *Chat) GetUnreadReactionCount() (value int32) { + if c == nil { + return + } + return c.UnreadReactionCount +} + // GetNotificationSettings returns value of NotificationSettings field. func (c *Chat) GetNotificationSettings() (value ChatNotificationSettings) { if c == nil { @@ -1149,6 +1233,14 @@ func (c *Chat) GetNotificationSettings() (value ChatNotificationSettings) { return c.NotificationSettings } +// GetAvailableReactions returns value of AvailableReactions field. +func (c *Chat) GetAvailableReactions() (value []string) { + if c == nil { + return + } + return c.AvailableReactions +} + // GetMessageTTL returns value of MessageTTL field. func (c *Chat) GetMessageTTL() (value int32) { if c == nil { diff --git a/tdapi/tl_create_new_sticker_set_gen.go b/tdapi/tl_create_new_sticker_set_gen.go index b0aa37aab2..4551992426 100644 --- a/tdapi/tl_create_new_sticker_set_gen.go +++ b/tdapi/tl_create_new_sticker_set_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// CreateNewStickerSetRequest represents TL type `createNewStickerSet#982c0b07`. +// CreateNewStickerSetRequest represents TL type `createNewStickerSet#aa878026`. type CreateNewStickerSetRequest struct { // Sticker set owner; ignored for regular users UserID int64 @@ -41,18 +41,16 @@ type CreateNewStickerSetRequest struct { // with *"_by_"* (** is case insensitive) for bots; 1-64 // characters Name string - // True, if stickers are masks. Animated stickers can't be masks - IsMasks bool - // List of stickers to be added to the set; must be non-empty. All stickers must be of - // the same type. For animated stickers, uploadStickerFile must be used before the - // sticker is shown - Stickers []InputStickerClass + // List of stickers to be added to the set; must be non-empty. All stickers must have the + // same format. For TGS stickers, uploadStickerFile must be used before the sticker is + // shown + Stickers []InputSticker // Source of the sticker set; may be empty if unknown Source string } // CreateNewStickerSetRequestTypeID is TL type id of CreateNewStickerSetRequest. -const CreateNewStickerSetRequestTypeID = 0x982c0b07 +const CreateNewStickerSetRequestTypeID = 0xaa878026 // Ensuring interfaces in compile-time for CreateNewStickerSetRequest. var ( @@ -75,9 +73,6 @@ func (c *CreateNewStickerSetRequest) Zero() bool { if !(c.Name == "") { return false } - if !(c.IsMasks == false) { - return false - } if !(c.Stickers == nil) { return false } @@ -132,10 +127,6 @@ func (c *CreateNewStickerSetRequest) TypeInfo() tdp.Type { Name: "Name", SchemaName: "name", }, - { - Name: "IsMasks", - SchemaName: "is_masks", - }, { Name: "Stickers", SchemaName: "stickers", @@ -151,7 +142,7 @@ func (c *CreateNewStickerSetRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (c *CreateNewStickerSetRequest) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode createNewStickerSet#982c0b07 as nil") + return fmt.Errorf("can't encode createNewStickerSet#aa878026 as nil") } b.PutID(CreateNewStickerSetRequestTypeID) return c.EncodeBare(b) @@ -160,19 +151,15 @@ func (c *CreateNewStickerSetRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *CreateNewStickerSetRequest) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode createNewStickerSet#982c0b07 as nil") + return fmt.Errorf("can't encode createNewStickerSet#aa878026 as nil") } b.PutInt53(c.UserID) b.PutString(c.Title) b.PutString(c.Name) - b.PutBool(c.IsMasks) b.PutInt(len(c.Stickers)) for idx, v := range c.Stickers { - if v == nil { - return fmt.Errorf("unable to encode createNewStickerSet#982c0b07: field stickers element with index %d is nil", idx) - } if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare createNewStickerSet#982c0b07: field stickers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare createNewStickerSet#aa878026: field stickers element with index %d: %w", idx, err) } } b.PutString(c.Source) @@ -182,10 +169,10 @@ func (c *CreateNewStickerSetRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *CreateNewStickerSetRequest) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode createNewStickerSet#982c0b07 to nil") + return fmt.Errorf("can't decode createNewStickerSet#aa878026 to nil") } if err := b.ConsumeID(CreateNewStickerSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: %w", err) } return c.DecodeBare(b) } @@ -193,49 +180,42 @@ func (c *CreateNewStickerSetRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *CreateNewStickerSetRequest) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode createNewStickerSet#982c0b07 to nil") + return fmt.Errorf("can't decode createNewStickerSet#aa878026 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field user_id: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field user_id: %w", err) } c.UserID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field title: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field title: %w", err) } c.Title = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field name: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field name: %w", err) } c.Name = value } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field is_masks: %w", err) - } - c.IsMasks = value - } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field stickers: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field stickers: %w", err) } if headerLen > 0 { - c.Stickers = make([]InputStickerClass, 0, headerLen%bin.PreallocateLimit) + c.Stickers = make([]InputSticker, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInputSticker(b) - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field stickers: %w", err) + var value InputSticker + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare createNewStickerSet#aa878026: field stickers: %w", err) } c.Stickers = append(c.Stickers, value) } @@ -243,7 +223,7 @@ func (c *CreateNewStickerSetRequest) DecodeBare(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field source: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field source: %w", err) } c.Source = value } @@ -253,7 +233,7 @@ func (c *CreateNewStickerSetRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (c *CreateNewStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if c == nil { - return fmt.Errorf("can't encode createNewStickerSet#982c0b07 as nil") + return fmt.Errorf("can't encode createNewStickerSet#aa878026 as nil") } b.ObjStart() b.PutID("createNewStickerSet") @@ -267,17 +247,11 @@ func (c *CreateNewStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("name") b.PutString(c.Name) b.Comma() - b.FieldStart("is_masks") - b.PutBool(c.IsMasks) - b.Comma() b.FieldStart("stickers") b.ArrStart() for idx, v := range c.Stickers { - if v == nil { - return fmt.Errorf("unable to encode createNewStickerSet#982c0b07: field stickers element with index %d is nil", idx) - } if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createNewStickerSet#982c0b07: field stickers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode createNewStickerSet#aa878026: field stickers element with index %d: %w", idx, err) } b.Comma() } @@ -295,54 +269,48 @@ func (c *CreateNewStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (c *CreateNewStickerSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if c == nil { - return fmt.Errorf("can't decode createNewStickerSet#982c0b07 to nil") + return fmt.Errorf("can't decode createNewStickerSet#aa878026 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("createNewStickerSet"); err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: %w", err) } case "user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field user_id: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field user_id: %w", err) } c.UserID = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field title: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field title: %w", err) } c.Title = value case "name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field name: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field name: %w", err) } c.Name = value - case "is_masks": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field is_masks: %w", err) - } - c.IsMasks = value case "stickers": if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInputSticker(b) - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field stickers: %w", err) + var value InputSticker + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field stickers: %w", err) } c.Stickers = append(c.Stickers, value) return nil }); err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field stickers: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field stickers: %w", err) } case "source": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#982c0b07: field source: %w", err) + return fmt.Errorf("unable to decode createNewStickerSet#aa878026: field source: %w", err) } c.Source = value default: @@ -376,16 +344,8 @@ func (c *CreateNewStickerSetRequest) GetName() (value string) { return c.Name } -// GetIsMasks returns value of IsMasks field. -func (c *CreateNewStickerSetRequest) GetIsMasks() (value bool) { - if c == nil { - return - } - return c.IsMasks -} - // GetStickers returns value of Stickers field. -func (c *CreateNewStickerSetRequest) GetStickers() (value []InputStickerClass) { +func (c *CreateNewStickerSetRequest) GetStickers() (value []InputSticker) { if c == nil { return } @@ -400,7 +360,7 @@ func (c *CreateNewStickerSetRequest) GetSource() (value string) { return c.Source } -// CreateNewStickerSet invokes method createNewStickerSet#982c0b07 returning error if any. +// CreateNewStickerSet invokes method createNewStickerSet#aa878026 returning error if any. func (c *Client) CreateNewStickerSet(ctx context.Context, request *CreateNewStickerSetRequest) (*StickerSet, error) { var result StickerSet diff --git a/tdapi/tl_delete_commands_gen.go b/tdapi/tl_delete_commands_gen.go index eed07f1969..d3b3b91fbb 100644 --- a/tdapi/tl_delete_commands_gen.go +++ b/tdapi/tl_delete_commands_gen.go @@ -36,7 +36,7 @@ type DeleteCommandsRequest struct { // The scope to which the commands are relevant; pass null to delete commands in the // default bot command scope Scope BotCommandScopeClass - // A two-letter ISO 639-1 country code or an empty string + // A two-letter ISO 639-1 language code or an empty string LanguageCode string } diff --git a/tdapi/tl_get_chat_message_calendar_gen.go b/tdapi/tl_get_chat_message_calendar_gen.go index 5105b4de96..adac4f831b 100644 --- a/tdapi/tl_get_chat_message_calendar_gen.go +++ b/tdapi/tl_get_chat_message_calendar_gen.go @@ -36,8 +36,8 @@ type GetChatMessageCalendarRequest struct { // Identifier of the chat in which to return information about messages ChatID int64 // Filter for message content. Filters searchMessagesFilterEmpty, - // searchMessagesFilterMention and searchMessagesFilterUnreadMention are unsupported in - // this function + // searchMessagesFilterMention, searchMessagesFilterUnreadMention, and + // searchMessagesFilterUnreadReaction are unsupported in this function Filter SearchMessagesFilterClass // The message identifier from which to return information about messages; use 0 to get // results from the last message diff --git a/tdapi/tl_get_chat_sparse_message_positions_gen.go b/tdapi/tl_get_chat_sparse_message_positions_gen.go index a3920ad1f7..8329723422 100644 --- a/tdapi/tl_get_chat_sparse_message_positions_gen.go +++ b/tdapi/tl_get_chat_sparse_message_positions_gen.go @@ -36,8 +36,8 @@ type GetChatSparseMessagePositionsRequest struct { // Identifier of the chat in which to return information about message positions ChatID int64 // Filter for message content. Filters searchMessagesFilterEmpty, - // searchMessagesFilterMention and searchMessagesFilterUnreadMention are unsupported in - // this function + // searchMessagesFilterMention, searchMessagesFilterUnreadMention, and + // searchMessagesFilterUnreadReaction are unsupported in this function Filter SearchMessagesFilterClass // The message identifier from which to return information about message positions FromMessageID int64 diff --git a/tdapi/tl_get_commands_gen.go b/tdapi/tl_get_commands_gen.go index fc38fc755a..d6ee34664e 100644 --- a/tdapi/tl_get_commands_gen.go +++ b/tdapi/tl_get_commands_gen.go @@ -36,7 +36,7 @@ type GetCommandsRequest struct { // The scope to which the commands are relevant; pass null to get commands in the default // bot command scope Scope BotCommandScopeClass - // A two-letter ISO 639-1 country code or an empty string + // A two-letter ISO 639-1 language code or an empty string LanguageCode string } diff --git a/tdapi/tl_get_message_added_reactions_gen.go b/tdapi/tl_get_message_added_reactions_gen.go new file mode 100644 index 0000000000..9ffeb4d708 --- /dev/null +++ b/tdapi/tl_get_message_added_reactions_gen.go @@ -0,0 +1,342 @@ +// 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{} +) + +// GetMessageAddedReactionsRequest represents TL type `getMessageAddedReactions#aac3b631`. +type GetMessageAddedReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatID int64 + // Identifier of the message + MessageID int64 + // If non-empty, only added reactions with the specified text representation will be + // returned + Reaction string + // Offset of the first entry to return as received from the previous request; use empty + // string to get the first chunk of results + Offset string + // The maximum number of reactions to be returned; must be positive and can't be greater + // than 100 + Limit int32 +} + +// GetMessageAddedReactionsRequestTypeID is TL type id of GetMessageAddedReactionsRequest. +const GetMessageAddedReactionsRequestTypeID = 0xaac3b631 + +// Ensuring interfaces in compile-time for GetMessageAddedReactionsRequest. +var ( + _ bin.Encoder = &GetMessageAddedReactionsRequest{} + _ bin.Decoder = &GetMessageAddedReactionsRequest{} + _ bin.BareEncoder = &GetMessageAddedReactionsRequest{} + _ bin.BareDecoder = &GetMessageAddedReactionsRequest{} +) + +func (g *GetMessageAddedReactionsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.MessageID == 0) { + return false + } + if !(g.Reaction == "") { + return false + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetMessageAddedReactionsRequest) String() string { + if g == nil { + return "GetMessageAddedReactionsRequest(nil)" + } + type Alias GetMessageAddedReactionsRequest + return fmt.Sprintf("GetMessageAddedReactionsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetMessageAddedReactionsRequest) TypeID() uint32 { + return GetMessageAddedReactionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetMessageAddedReactionsRequest) TypeName() string { + return "getMessageAddedReactions" +} + +// TypeInfo returns info about TL type. +func (g *GetMessageAddedReactionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getMessageAddedReactions", + ID: GetMessageAddedReactionsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + { + Name: "Reaction", + SchemaName: "reaction", + }, + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetMessageAddedReactionsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getMessageAddedReactions#aac3b631 as nil") + } + b.PutID(GetMessageAddedReactionsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetMessageAddedReactionsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getMessageAddedReactions#aac3b631 as nil") + } + b.PutInt53(g.ChatID) + b.PutInt53(g.MessageID) + b.PutString(g.Reaction) + b.PutString(g.Offset) + b.PutInt32(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetMessageAddedReactionsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getMessageAddedReactions#aac3b631 to nil") + } + if err := b.ConsumeID(GetMessageAddedReactionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetMessageAddedReactionsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getMessageAddedReactions#aac3b631 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field message_id: %w", err) + } + g.MessageID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field reaction: %w", err) + } + g.Reaction = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetMessageAddedReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getMessageAddedReactions#aac3b631 as nil") + } + b.ObjStart() + b.PutID("getMessageAddedReactions") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(g.MessageID) + b.Comma() + b.FieldStart("reaction") + b.PutString(g.Reaction) + b.Comma() + b.FieldStart("offset") + b.PutString(g.Offset) + b.Comma() + b.FieldStart("limit") + b.PutInt32(g.Limit) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetMessageAddedReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getMessageAddedReactions#aac3b631 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getMessageAddedReactions"); err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field chat_id: %w", err) + } + g.ChatID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field message_id: %w", err) + } + g.MessageID = value + case "reaction": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field reaction: %w", err) + } + g.Reaction = value + case "offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field offset: %w", err) + } + g.Offset = value + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getMessageAddedReactions#aac3b631: field limit: %w", err) + } + g.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetMessageAddedReactionsRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetMessageID returns value of MessageID field. +func (g *GetMessageAddedReactionsRequest) GetMessageID() (value int64) { + if g == nil { + return + } + return g.MessageID +} + +// GetReaction returns value of Reaction field. +func (g *GetMessageAddedReactionsRequest) GetReaction() (value string) { + if g == nil { + return + } + return g.Reaction +} + +// GetOffset returns value of Offset field. +func (g *GetMessageAddedReactionsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// GetLimit returns value of Limit field. +func (g *GetMessageAddedReactionsRequest) GetLimit() (value int32) { + if g == nil { + return + } + return g.Limit +} + +// GetMessageAddedReactions invokes method getMessageAddedReactions#aac3b631 returning error if any. +func (c *Client) GetMessageAddedReactions(ctx context.Context, request *GetMessageAddedReactionsRequest) (*AddedReactions, error) { + var result AddedReactions + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_message_available_reactions_gen.go b/tdapi/tl_get_message_available_reactions_gen.go new file mode 100644 index 0000000000..72686ca582 --- /dev/null +++ b/tdapi/tl_get_message_available_reactions_gen.go @@ -0,0 +1,237 @@ +// 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{} +) + +// GetMessageAvailableReactionsRequest represents TL type `getMessageAvailableReactions#c3fa54f`. +type GetMessageAvailableReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatID int64 + // Identifier of the message + MessageID int64 +} + +// GetMessageAvailableReactionsRequestTypeID is TL type id of GetMessageAvailableReactionsRequest. +const GetMessageAvailableReactionsRequestTypeID = 0xc3fa54f + +// Ensuring interfaces in compile-time for GetMessageAvailableReactionsRequest. +var ( + _ bin.Encoder = &GetMessageAvailableReactionsRequest{} + _ bin.Decoder = &GetMessageAvailableReactionsRequest{} + _ bin.BareEncoder = &GetMessageAvailableReactionsRequest{} + _ bin.BareDecoder = &GetMessageAvailableReactionsRequest{} +) + +func (g *GetMessageAvailableReactionsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.MessageID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetMessageAvailableReactionsRequest) String() string { + if g == nil { + return "GetMessageAvailableReactionsRequest(nil)" + } + type Alias GetMessageAvailableReactionsRequest + return fmt.Sprintf("GetMessageAvailableReactionsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetMessageAvailableReactionsRequest) TypeID() uint32 { + return GetMessageAvailableReactionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetMessageAvailableReactionsRequest) TypeName() string { + return "getMessageAvailableReactions" +} + +// TypeInfo returns info about TL type. +func (g *GetMessageAvailableReactionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getMessageAvailableReactions", + ID: GetMessageAvailableReactionsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetMessageAvailableReactionsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getMessageAvailableReactions#c3fa54f as nil") + } + b.PutID(GetMessageAvailableReactionsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetMessageAvailableReactionsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getMessageAvailableReactions#c3fa54f as nil") + } + b.PutInt53(g.ChatID) + b.PutInt53(g.MessageID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetMessageAvailableReactionsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getMessageAvailableReactions#c3fa54f to nil") + } + if err := b.ConsumeID(GetMessageAvailableReactionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getMessageAvailableReactions#c3fa54f: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetMessageAvailableReactionsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getMessageAvailableReactions#c3fa54f to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageAvailableReactions#c3fa54f: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageAvailableReactions#c3fa54f: field message_id: %w", err) + } + g.MessageID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetMessageAvailableReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getMessageAvailableReactions#c3fa54f as nil") + } + b.ObjStart() + b.PutID("getMessageAvailableReactions") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(g.MessageID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetMessageAvailableReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getMessageAvailableReactions#c3fa54f to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getMessageAvailableReactions"); err != nil { + return fmt.Errorf("unable to decode getMessageAvailableReactions#c3fa54f: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageAvailableReactions#c3fa54f: field chat_id: %w", err) + } + g.ChatID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageAvailableReactions#c3fa54f: field message_id: %w", err) + } + g.MessageID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetMessageAvailableReactionsRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetMessageID returns value of MessageID field. +func (g *GetMessageAvailableReactionsRequest) GetMessageID() (value int64) { + if g == nil { + return + } + return g.MessageID +} + +// GetMessageAvailableReactions invokes method getMessageAvailableReactions#c3fa54f returning error if any. +func (c *Client) GetMessageAvailableReactions(ctx context.Context, request *GetMessageAvailableReactionsRequest) (*AvailableReactions, error) { + var result AvailableReactions + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_message_public_forwards_gen.go b/tdapi/tl_get_message_public_forwards_gen.go index 97fc46904f..1e028c9ac5 100644 --- a/tdapi/tl_get_message_public_forwards_gen.go +++ b/tdapi/tl_get_message_public_forwards_gen.go @@ -38,7 +38,7 @@ type GetMessagePublicForwardsRequest struct { // Message identifier MessageID int64 // Offset of the first entry to return as received from the previous request; use empty - // string to get first chunk of results + // string to get the first chunk of results Offset string // The maximum number of messages to be returned; must be positive and can't be greater // than 100. For optimal performance, the number of returned messages is chosen by TDLib diff --git a/tdapi/tl_get_phone_number_info_sync_gen.go b/tdapi/tl_get_phone_number_info_sync_gen.go index a42e46fc11..08427f09b8 100644 --- a/tdapi/tl_get_phone_number_info_sync_gen.go +++ b/tdapi/tl_get_phone_number_info_sync_gen.go @@ -33,7 +33,7 @@ var ( // GetPhoneNumberInfoSyncRequest represents TL type `getPhoneNumberInfoSync#209b7d38`. type GetPhoneNumberInfoSyncRequest struct { - // A two-letter ISO 639-1 country code for country information localization + // A two-letter ISO 639-1 language code for country information localization LanguageCode string // The phone number prefix PhoneNumberPrefix string diff --git a/tdapi/tl_input_inline_query_result_gen.go b/tdapi/tl_input_inline_query_result_gen.go index 3aa855e437..71751baa8f 100644 --- a/tdapi/tl_input_inline_query_result_gen.go +++ b/tdapi/tl_input_inline_query_result_gen.go @@ -3512,7 +3512,7 @@ type InputInlineQueryResultSticker struct { ID string // URL of the sticker thumbnail, if it exists ThumbnailURL string - // The URL of the WEBP or TGS sticker (sticker file size must not exceed 5MB) + // The URL of the WEBP, TGS, or WEBM sticker (sticker file size must not exceed 5MB) StickerURL string // Width of the sticker StickerWidth int32 diff --git a/tdapi/tl_input_sticker_gen.go b/tdapi/tl_input_sticker_gen.go index a0b1e54532..204f8d529c 100644 --- a/tdapi/tl_input_sticker_gen.go +++ b/tdapi/tl_input_sticker_gen.go @@ -31,33 +31,31 @@ var ( _ = tdjson.Encoder{} ) -// InputStickerStatic represents TL type `inputStickerStatic#540604db`. -type InputStickerStatic struct { - // PNG image with the sticker; must be up to 512 KB in size and fit in a 512x512 square +// InputSticker represents TL type `inputSticker#345af62e`. +type InputSticker struct { + // File with the sticker; must fit in a 512x512 square. For WEBP stickers and masks the + // file must be in PNG format, which will be converted to WEBP server-side. Otherwise, + // the file must be local or uploaded within a week. See https://core.telegram + // org/animated_stickers#technical-requirements for technical requirements Sticker InputFileClass // Emojis corresponding to the sticker Emojis string - // For masks, position where the mask is placed; pass null if unspecified - MaskPosition MaskPosition + // Sticker type + Type StickerTypeClass } -// InputStickerStaticTypeID is TL type id of InputStickerStatic. -const InputStickerStaticTypeID = 0x540604db +// InputStickerTypeID is TL type id of InputSticker. +const InputStickerTypeID = 0x345af62e -// construct implements constructor of InputStickerClass. -func (i InputStickerStatic) construct() InputStickerClass { return &i } - -// Ensuring interfaces in compile-time for InputStickerStatic. +// Ensuring interfaces in compile-time for InputSticker. var ( - _ bin.Encoder = &InputStickerStatic{} - _ bin.Decoder = &InputStickerStatic{} - _ bin.BareEncoder = &InputStickerStatic{} - _ bin.BareDecoder = &InputStickerStatic{} - - _ InputStickerClass = &InputStickerStatic{} + _ bin.Encoder = &InputSticker{} + _ bin.Decoder = &InputSticker{} + _ bin.BareEncoder = &InputSticker{} + _ bin.BareDecoder = &InputSticker{} ) -func (i *InputStickerStatic) Zero() bool { +func (i *InputSticker) Zero() bool { if i == nil { return true } @@ -67,7 +65,7 @@ func (i *InputStickerStatic) Zero() bool { if !(i.Emojis == "") { return false } - if !(i.MaskPosition.Zero()) { + if !(i.Type == nil) { return false } @@ -75,31 +73,31 @@ func (i *InputStickerStatic) Zero() bool { } // String implements fmt.Stringer. -func (i *InputStickerStatic) String() string { +func (i *InputSticker) String() string { if i == nil { - return "InputStickerStatic(nil)" + return "InputSticker(nil)" } - type Alias InputStickerStatic - return fmt.Sprintf("InputStickerStatic%+v", Alias(*i)) + type Alias InputSticker + return fmt.Sprintf("InputSticker%+v", Alias(*i)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStickerStatic) TypeID() uint32 { - return InputStickerStaticTypeID +func (*InputSticker) TypeID() uint32 { + return InputStickerTypeID } // TypeName returns name of type in TL schema. -func (*InputStickerStatic) TypeName() string { - return "inputStickerStatic" +func (*InputSticker) TypeName() string { + return "inputSticker" } // TypeInfo returns info about TL type. -func (i *InputStickerStatic) TypeInfo() tdp.Type { +func (i *InputSticker) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "inputStickerStatic", - ID: InputStickerStaticTypeID, + Name: "inputSticker", + ID: InputStickerTypeID, } if i == nil { typ.Null = true @@ -115,100 +113,108 @@ func (i *InputStickerStatic) TypeInfo() tdp.Type { SchemaName: "emojis", }, { - Name: "MaskPosition", - SchemaName: "mask_position", + Name: "Type", + SchemaName: "type", }, } return typ } // Encode implements bin.Encoder. -func (i *InputStickerStatic) Encode(b *bin.Buffer) error { +func (i *InputSticker) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStickerStatic#540604db as nil") + return fmt.Errorf("can't encode inputSticker#345af62e as nil") } - b.PutID(InputStickerStaticTypeID) + b.PutID(InputStickerTypeID) return i.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (i *InputStickerStatic) EncodeBare(b *bin.Buffer) error { +func (i *InputSticker) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStickerStatic#540604db as nil") + return fmt.Errorf("can't encode inputSticker#345af62e as nil") } if i.Sticker == nil { - return fmt.Errorf("unable to encode inputStickerStatic#540604db: field sticker is nil") + return fmt.Errorf("unable to encode inputSticker#345af62e: field sticker is nil") } if err := i.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStickerStatic#540604db: field sticker: %w", err) + return fmt.Errorf("unable to encode inputSticker#345af62e: field sticker: %w", err) } b.PutString(i.Emojis) - if err := i.MaskPosition.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStickerStatic#540604db: field mask_position: %w", err) + if i.Type == nil { + return fmt.Errorf("unable to encode inputSticker#345af62e: field type is nil") + } + if err := i.Type.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputSticker#345af62e: field type: %w", err) } return nil } // Decode implements bin.Decoder. -func (i *InputStickerStatic) Decode(b *bin.Buffer) error { +func (i *InputSticker) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStickerStatic#540604db to nil") + return fmt.Errorf("can't decode inputSticker#345af62e to nil") } - if err := b.ConsumeID(InputStickerStaticTypeID); err != nil { - return fmt.Errorf("unable to decode inputStickerStatic#540604db: %w", err) + if err := b.ConsumeID(InputStickerTypeID); err != nil { + return fmt.Errorf("unable to decode inputSticker#345af62e: %w", err) } return i.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (i *InputStickerStatic) DecodeBare(b *bin.Buffer) error { +func (i *InputSticker) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStickerStatic#540604db to nil") + return fmt.Errorf("can't decode inputSticker#345af62e to nil") } { value, err := DecodeInputFile(b) if err != nil { - return fmt.Errorf("unable to decode inputStickerStatic#540604db: field sticker: %w", err) + return fmt.Errorf("unable to decode inputSticker#345af62e: field sticker: %w", err) } i.Sticker = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputStickerStatic#540604db: field emojis: %w", err) + return fmt.Errorf("unable to decode inputSticker#345af62e: field emojis: %w", err) } i.Emojis = value } { - if err := i.MaskPosition.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputStickerStatic#540604db: field mask_position: %w", err) + value, err := DecodeStickerType(b) + if err != nil { + return fmt.Errorf("unable to decode inputSticker#345af62e: field type: %w", err) } + i.Type = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStickerStatic) EncodeTDLibJSON(b tdjson.Encoder) error { +func (i *InputSticker) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode inputStickerStatic#540604db as nil") + return fmt.Errorf("can't encode inputSticker#345af62e as nil") } b.ObjStart() - b.PutID("inputStickerStatic") + b.PutID("inputSticker") b.Comma() b.FieldStart("sticker") if i.Sticker == nil { - return fmt.Errorf("unable to encode inputStickerStatic#540604db: field sticker is nil") + return fmt.Errorf("unable to encode inputSticker#345af62e: field sticker is nil") } if err := i.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStickerStatic#540604db: field sticker: %w", err) + return fmt.Errorf("unable to encode inputSticker#345af62e: field sticker: %w", err) } b.Comma() b.FieldStart("emojis") b.PutString(i.Emojis) b.Comma() - b.FieldStart("mask_position") - if err := i.MaskPosition.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStickerStatic#540604db: field mask_position: %w", err) + b.FieldStart("type") + if i.Type == nil { + return fmt.Errorf("unable to encode inputSticker#345af62e: field type is nil") + } + if err := i.Type.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode inputSticker#345af62e: field type: %w", err) } b.Comma() b.StripComma() @@ -217,33 +223,35 @@ func (i *InputStickerStatic) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStickerStatic) DecodeTDLibJSON(b tdjson.Decoder) error { +func (i *InputSticker) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode inputStickerStatic#540604db to nil") + return fmt.Errorf("can't decode inputSticker#345af62e to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("inputStickerStatic"); err != nil { - return fmt.Errorf("unable to decode inputStickerStatic#540604db: %w", err) + if err := b.ConsumeID("inputSticker"); err != nil { + return fmt.Errorf("unable to decode inputSticker#345af62e: %w", err) } case "sticker": value, err := DecodeTDLibJSONInputFile(b) if err != nil { - return fmt.Errorf("unable to decode inputStickerStatic#540604db: field sticker: %w", err) + return fmt.Errorf("unable to decode inputSticker#345af62e: field sticker: %w", err) } i.Sticker = value case "emojis": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputStickerStatic#540604db: field emojis: %w", err) + return fmt.Errorf("unable to decode inputSticker#345af62e: field emojis: %w", err) } i.Emojis = value - case "mask_position": - if err := i.MaskPosition.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputStickerStatic#540604db: field mask_position: %w", err) + case "type": + value, err := DecodeTDLibJSONStickerType(b) + if err != nil { + return fmt.Errorf("unable to decode inputSticker#345af62e: field type: %w", err) } + i.Type = value default: return b.Skip() } @@ -252,7 +260,7 @@ func (i *InputStickerStatic) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetSticker returns value of Sticker field. -func (i *InputStickerStatic) GetSticker() (value InputFileClass) { +func (i *InputSticker) GetSticker() (value InputFileClass) { if i == nil { return } @@ -260,370 +268,17 @@ func (i *InputStickerStatic) GetSticker() (value InputFileClass) { } // GetEmojis returns value of Emojis field. -func (i *InputStickerStatic) GetEmojis() (value string) { +func (i *InputSticker) GetEmojis() (value string) { if i == nil { return } return i.Emojis } -// GetMaskPosition returns value of MaskPosition field. -func (i *InputStickerStatic) GetMaskPosition() (value MaskPosition) { +// GetType returns value of Type field. +func (i *InputSticker) GetType() (value StickerTypeClass) { if i == nil { return } - return i.MaskPosition -} - -// InputStickerAnimated represents TL type `inputStickerAnimated#bccf4960`. -type InputStickerAnimated struct { - // File with the animated sticker. Only local or uploaded within a week files are - // supported. See https://core.telegram.org/animated_stickers#technical-requirements for - // technical requirements - Sticker InputFileClass - // Emojis corresponding to the sticker - Emojis string -} - -// InputStickerAnimatedTypeID is TL type id of InputStickerAnimated. -const InputStickerAnimatedTypeID = 0xbccf4960 - -// construct implements constructor of InputStickerClass. -func (i InputStickerAnimated) construct() InputStickerClass { return &i } - -// Ensuring interfaces in compile-time for InputStickerAnimated. -var ( - _ bin.Encoder = &InputStickerAnimated{} - _ bin.Decoder = &InputStickerAnimated{} - _ bin.BareEncoder = &InputStickerAnimated{} - _ bin.BareDecoder = &InputStickerAnimated{} - - _ InputStickerClass = &InputStickerAnimated{} -) - -func (i *InputStickerAnimated) Zero() bool { - if i == nil { - return true - } - if !(i.Sticker == nil) { - return false - } - if !(i.Emojis == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStickerAnimated) String() string { - if i == nil { - return "InputStickerAnimated(nil)" - } - type Alias InputStickerAnimated - return fmt.Sprintf("InputStickerAnimated%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStickerAnimated) TypeID() uint32 { - return InputStickerAnimatedTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStickerAnimated) TypeName() string { - return "inputStickerAnimated" -} - -// TypeInfo returns info about TL type. -func (i *InputStickerAnimated) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStickerAnimated", - ID: InputStickerAnimatedTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "Emojis", - SchemaName: "emojis", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStickerAnimated) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStickerAnimated#bccf4960 as nil") - } - b.PutID(InputStickerAnimatedTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStickerAnimated) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStickerAnimated#bccf4960 as nil") - } - if i.Sticker == nil { - return fmt.Errorf("unable to encode inputStickerAnimated#bccf4960: field sticker is nil") - } - if err := i.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStickerAnimated#bccf4960: field sticker: %w", err) - } - b.PutString(i.Emojis) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStickerAnimated) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStickerAnimated#bccf4960 to nil") - } - if err := b.ConsumeID(InputStickerAnimatedTypeID); err != nil { - return fmt.Errorf("unable to decode inputStickerAnimated#bccf4960: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStickerAnimated) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStickerAnimated#bccf4960 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputStickerAnimated#bccf4960: field sticker: %w", err) - } - i.Sticker = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStickerAnimated#bccf4960: field emojis: %w", err) - } - i.Emojis = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStickerAnimated) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStickerAnimated#bccf4960 as nil") - } - b.ObjStart() - b.PutID("inputStickerAnimated") - b.Comma() - b.FieldStart("sticker") - if i.Sticker == nil { - return fmt.Errorf("unable to encode inputStickerAnimated#bccf4960: field sticker is nil") - } - if err := i.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStickerAnimated#bccf4960: field sticker: %w", err) - } - b.Comma() - b.FieldStart("emojis") - b.PutString(i.Emojis) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStickerAnimated) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStickerAnimated#bccf4960 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStickerAnimated"); err != nil { - return fmt.Errorf("unable to decode inputStickerAnimated#bccf4960: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputStickerAnimated#bccf4960: field sticker: %w", err) - } - i.Sticker = value - case "emojis": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStickerAnimated#bccf4960: field emojis: %w", err) - } - i.Emojis = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (i *InputStickerAnimated) GetSticker() (value InputFileClass) { - if i == nil { - return - } - return i.Sticker -} - -// GetEmojis returns value of Emojis field. -func (i *InputStickerAnimated) GetEmojis() (value string) { - if i == nil { - return - } - return i.Emojis -} - -// InputStickerClassName is schema name of InputStickerClass. -const InputStickerClassName = "InputSticker" - -// InputStickerClass represents InputSticker generic type. -// -// Example: -// g, err := tdapi.DecodeInputSticker(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputStickerStatic: // inputStickerStatic#540604db -// case *tdapi.InputStickerAnimated: // inputStickerAnimated#bccf4960 -// default: panic(v) -// } -type InputStickerClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputStickerClass - - // 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 - - // PNG image with the sticker; must be up to 512 KB in size and fit in a 512x512 square - GetSticker() (value InputFileClass) - // Emojis corresponding to the sticker - GetEmojis() (value string) -} - -// DecodeInputSticker implements binary de-serialization for InputStickerClass. -func DecodeInputSticker(buf *bin.Buffer) (InputStickerClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputStickerStaticTypeID: - // Decoding inputStickerStatic#540604db. - v := InputStickerStatic{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStickerClass: %w", err) - } - return &v, nil - case InputStickerAnimatedTypeID: - // Decoding inputStickerAnimated#bccf4960. - v := InputStickerAnimated{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStickerClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputStickerClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputSticker implements binary de-serialization for InputStickerClass. -func DecodeTDLibJSONInputSticker(buf tdjson.Decoder) (InputStickerClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputStickerStatic": - // Decoding inputStickerStatic#540604db. - v := InputStickerStatic{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStickerClass: %w", err) - } - return &v, nil - case "inputStickerAnimated": - // Decoding inputStickerAnimated#bccf4960. - v := InputStickerAnimated{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStickerClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputStickerClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputSticker boxes the InputStickerClass providing a helper. -type InputStickerBox struct { - InputSticker InputStickerClass -} - -// Decode implements bin.Decoder for InputStickerBox. -func (b *InputStickerBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputStickerBox to nil") - } - v, err := DecodeInputSticker(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputSticker = v - return nil -} - -// Encode implements bin.Encode for InputStickerBox. -func (b *InputStickerBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputSticker == nil { - return fmt.Errorf("unable to encode InputStickerClass as nil") - } - return b.InputSticker.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputStickerBox. -func (b *InputStickerBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputStickerBox to nil") - } - v, err := DecodeTDLibJSONInputSticker(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputSticker = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputStickerBox. -func (b *InputStickerBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputSticker == nil { - return fmt.Errorf("unable to encode InputStickerClass as nil") - } - return b.InputSticker.EncodeTDLibJSON(buf) + return i.Type } diff --git a/tdapi/tl_message_gen.go b/tdapi/tl_message_gen.go index a29d482ff5..997f48b859 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#c6b405b7`. +// Message represents TL type `message#ef20f556`. type Message struct { // Message identifier; unique for the chat to which the message belongs ID int64 @@ -60,15 +60,17 @@ type Message struct { CanBeDeletedOnlyForSelf bool // True, if the message can be deleted for all users CanBeDeletedForAllUsers bool - // True, if the message statistics are available + // True, if the list of added reactions is available through getMessageAddedReactions + CanGetAddedReactions bool + // True, if the message statistics are available through getMessageStatistics CanGetStatistics bool - // True, if the message thread info is available + // True, if the message thread info is available through getMessageThread CanGetMessageThread bool // True, if chat members already viewed the message can be received through // getMessageViewers CanGetViewers bool // True, if media timestamp links can be generated for media timestamp entities in the - // message text, caption or web page description + // message text, caption or web page description through getMessageLink CanGetMediaTimestampLinks bool // True, if media timestamp entities refers to a media in this message as opposed to a // media in the replied message @@ -86,6 +88,8 @@ type Message struct { ForwardInfo MessageForwardInfo // Information about interactions with the message; may be null InteractionInfo MessageInteractionInfo + // Information about unread reactions added to the message + UnreadReactions []UnreadReaction // If non-zero, the identifier of the chat to which the replied message belongs; // Currently, only messages in the Replies chat can have different reply_in_chat_id and // chat_id @@ -119,7 +123,7 @@ type Message struct { } // MessageTypeID is TL type id of Message. -const MessageTypeID = 0xc6b405b7 +const MessageTypeID = 0xef20f556 // Ensuring interfaces in compile-time for Message. var ( @@ -169,6 +173,9 @@ func (m *Message) Zero() bool { if !(m.CanBeDeletedForAllUsers == false) { return false } + if !(m.CanGetAddedReactions == false) { + return false + } if !(m.CanGetStatistics == false) { return false } @@ -202,6 +209,9 @@ func (m *Message) Zero() bool { if !(m.InteractionInfo.Zero()) { return false } + if !(m.UnreadReactions == nil) { + return false + } if !(m.ReplyInChatID == 0) { return false } @@ -319,6 +329,10 @@ func (m *Message) TypeInfo() tdp.Type { Name: "CanBeDeletedForAllUsers", SchemaName: "can_be_deleted_for_all_users", }, + { + Name: "CanGetAddedReactions", + SchemaName: "can_get_added_reactions", + }, { Name: "CanGetStatistics", SchemaName: "can_get_statistics", @@ -363,6 +377,10 @@ func (m *Message) TypeInfo() tdp.Type { Name: "InteractionInfo", SchemaName: "interaction_info", }, + { + Name: "UnreadReactions", + SchemaName: "unread_reactions", + }, { Name: "ReplyInChatID", SchemaName: "reply_in_chat_id", @@ -414,7 +432,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#c6b405b7 as nil") + return fmt.Errorf("can't encode message#ef20f556 as nil") } b.PutID(MessageTypeID) return m.EncodeBare(b) @@ -423,27 +441,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#c6b405b7 as nil") + return fmt.Errorf("can't encode message#ef20f556 as nil") } b.PutInt53(m.ID) if m.SenderID == nil { - return fmt.Errorf("unable to encode message#c6b405b7: field sender_id is nil") + return fmt.Errorf("unable to encode message#ef20f556: field sender_id is nil") } if err := m.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field sender_id: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field sender_id: %w", err) } b.PutInt53(m.ChatID) if m.SendingState == nil { - return fmt.Errorf("unable to encode message#c6b405b7: field sending_state is nil") + return fmt.Errorf("unable to encode message#ef20f556: field sending_state is nil") } if err := m.SendingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field sending_state: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field sending_state: %w", err) } if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#c6b405b7: field scheduling_state is nil") + return fmt.Errorf("unable to encode message#ef20f556: field scheduling_state is nil") } if err := m.SchedulingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field scheduling_state: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field scheduling_state: %w", err) } b.PutBool(m.IsOutgoing) b.PutBool(m.IsPinned) @@ -452,6 +470,7 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { b.PutBool(m.CanBeSaved) b.PutBool(m.CanBeDeletedOnlyForSelf) b.PutBool(m.CanBeDeletedForAllUsers) + b.PutBool(m.CanGetAddedReactions) b.PutBool(m.CanGetStatistics) b.PutBool(m.CanGetMessageThread) b.PutBool(m.CanGetViewers) @@ -462,10 +481,16 @@ 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#c6b405b7: field forward_info: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field forward_info: %w", err) } if err := m.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field interaction_info: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: 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#ef20f556: field unread_reactions element with index %d: %w", idx, err) + } } b.PutInt53(m.ReplyInChatID) b.PutInt53(m.ReplyToMessageID) @@ -477,16 +502,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#c6b405b7: field content is nil") + return fmt.Errorf("unable to encode message#ef20f556: field content is nil") } if err := m.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field content: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field content: %w", err) } if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#c6b405b7: field reply_markup is nil") + return fmt.Errorf("unable to encode message#ef20f556: field reply_markup is nil") } if err := m.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field reply_markup: %w", err) } return nil } @@ -494,10 +519,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#c6b405b7 to nil") + return fmt.Errorf("can't decode message#ef20f556 to nil") } if err := b.ConsumeID(MessageTypeID); err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: %w", err) } return m.DecodeBare(b) } @@ -505,239 +530,263 @@ 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#c6b405b7 to nil") + return fmt.Errorf("can't decode message#ef20f556 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field id: %w", err) } m.ID = value } { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field sender_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field sender_id: %w", err) } m.SenderID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field chat_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field chat_id: %w", err) } m.ChatID = value } { value, err := DecodeMessageSendingState(b) if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field sending_state: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field sending_state: %w", err) } m.SendingState = value } { value, err := DecodeMessageSchedulingState(b) if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field scheduling_state: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field scheduling_state: %w", err) } m.SchedulingState = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field is_outgoing: %w", err) } m.IsOutgoing = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field is_pinned: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field is_pinned: %w", err) } m.IsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field can_be_edited: %w", err) } m.CanBeEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field can_be_forwarded: %w", err) } m.CanBeForwarded = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field can_be_saved: %w", err) } m.CanBeSaved = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field can_get_added_reactions: %w", err) + } + m.CanGetAddedReactions = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode message#ef20f556: field can_get_statistics: %w", err) } m.CanGetStatistics = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field can_get_message_thread: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field can_get_message_thread: %w", err) } m.CanGetMessageThread = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field can_get_viewers: %w", err) } m.CanGetViewers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field can_get_media_timestamp_links: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field has_timestamped_media: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field has_timestamped_media: %w", err) } m.HasTimestampedMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field is_channel_post: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field is_channel_post: %w", err) } m.IsChannelPost = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field contains_unread_mention: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field contains_unread_mention: %w", err) } m.ContainsUnreadMention = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field date: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field date: %w", err) } m.Date = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field edit_date: %w", err) } m.EditDate = value } { if err := m.ForwardInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field forward_info: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field forward_info: %w", err) } } { if err := m.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field interaction_info: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field interaction_info: %w", err) + } + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode message#ef20f556: field unread_reactions: %w", err) + } + + if headerLen > 0 { + m.UnreadReactions = make([]UnreadReaction, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value UnreadReaction + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare message#ef20f556: field unread_reactions: %w", err) + } + m.UnreadReactions = append(m.UnreadReactions, value) } } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field reply_in_chat_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field reply_in_chat_id: %w", err) } m.ReplyInChatID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field reply_to_message_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field reply_to_message_id: %w", err) } m.ReplyToMessageID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field message_thread_id: %w", err) } m.MessageThreadID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field ttl: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field ttl: %w", err) } m.TTL = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field ttl_expires_in: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field ttl_expires_in: %w", err) } m.TTLExpiresIn = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field via_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field via_bot_user_id: %w", err) } m.ViaBotUserID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field author_signature: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field author_signature: %w", err) } m.AuthorSignature = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field media_album_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field media_album_id: %w", err) } m.MediaAlbumID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field restriction_reason: %w", err) } m.RestrictionReason = value } { value, err := DecodeMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field content: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field content: %w", err) } m.Content = value } { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field reply_markup: %w", err) } m.ReplyMarkup = value } @@ -747,7 +796,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#c6b405b7 as nil") + return fmt.Errorf("can't encode message#ef20f556 as nil") } b.ObjStart() b.PutID("message") @@ -757,10 +806,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#c6b405b7: field sender_id is nil") + return fmt.Errorf("unable to encode message#ef20f556: field sender_id is nil") } if err := m.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field sender_id: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field sender_id: %w", err) } b.Comma() b.FieldStart("chat_id") @@ -768,18 +817,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#c6b405b7: field sending_state is nil") + return fmt.Errorf("unable to encode message#ef20f556: field sending_state is nil") } if err := m.SendingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field sending_state: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field sending_state: %w", err) } b.Comma() b.FieldStart("scheduling_state") if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#c6b405b7: field scheduling_state is nil") + return fmt.Errorf("unable to encode message#ef20f556: field scheduling_state is nil") } if err := m.SchedulingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field scheduling_state: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field scheduling_state: %w", err) } b.Comma() b.FieldStart("is_outgoing") @@ -803,6 +852,9 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("can_be_deleted_for_all_users") b.PutBool(m.CanBeDeletedForAllUsers) b.Comma() + b.FieldStart("can_get_added_reactions") + b.PutBool(m.CanGetAddedReactions) + b.Comma() b.FieldStart("can_get_statistics") b.PutBool(m.CanGetStatistics) b.Comma() @@ -832,14 +884,25 @@ 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#c6b405b7: field forward_info: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field forward_info: %w", err) } b.Comma() b.FieldStart("interaction_info") if err := m.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field interaction_info: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: 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#ef20f556: field unread_reactions element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() b.FieldStart("reply_in_chat_id") b.PutInt53(m.ReplyInChatID) b.Comma() @@ -869,18 +932,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#c6b405b7: field content is nil") + return fmt.Errorf("unable to encode message#ef20f556: field content is nil") } if err := m.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field content: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field content: %w", err) } b.Comma() b.FieldStart("reply_markup") if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#c6b405b7: field reply_markup is nil") + return fmt.Errorf("unable to encode message#ef20f556: field reply_markup is nil") } if err := m.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#c6b405b7: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#ef20f556: field reply_markup: %w", err) } b.Comma() b.StripComma() @@ -891,213 +954,230 @@ 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#c6b405b7 to nil") + return fmt.Errorf("can't decode message#ef20f556 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#c6b405b7: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field id: %w", err) } m.ID = value case "sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field sender_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field chat_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field sending_state: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field scheduling_state: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field is_pinned: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_be_forwarded: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_be_deleted_only_for_self: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_be_deleted_for_all_users: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#ef20f556: 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#c6b405b7: field can_get_statistics: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_get_message_thread: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_get_viewers: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field can_get_media_timestamp_links: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field can_get_media_timestamp_links: %w", err) } m.CanGetMediaTimestampLinks = value case "has_timestamped_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field has_timestamped_media: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field is_channel_post: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field is_channel_post: %w", err) } m.IsChannelPost = value case "contains_unread_mention": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field contains_unread_mention: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field date: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field date: %w", err) } m.Date = value case "edit_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field forward_info: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field forward_info: %w", err) } case "interaction_info": if err := m.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field interaction_info: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#ef20f556: field unread_reactions: %w", err) + } + m.UnreadReactions = append(m.UnreadReactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode message#ef20f556: field unread_reactions: %w", err) } case "reply_in_chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field reply_in_chat_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field reply_in_chat_id: %w", err) } m.ReplyInChatID = value case "reply_to_message_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field reply_to_message_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field reply_to_message_id: %w", err) } m.ReplyToMessageID = value case "message_thread_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field message_thread_id: %w", err) } m.MessageThreadID = value case "ttl": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field ttl: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field ttl: %w", err) } m.TTL = value case "ttl_expires_in": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field ttl_expires_in: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field ttl_expires_in: %w", err) } m.TTLExpiresIn = value case "via_bot_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field via_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field author_signature: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field media_album_id: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: 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#c6b405b7: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field restriction_reason: %w", err) } m.RestrictionReason = value case "content": value, err := DecodeTDLibJSONMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field content: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field content: %w", err) } m.Content = value case "reply_markup": value, err := DecodeTDLibJSONReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#c6b405b7: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#ef20f556: field reply_markup: %w", err) } m.ReplyMarkup = value default: @@ -1203,6 +1283,14 @@ func (m *Message) GetCanBeDeletedForAllUsers() (value bool) { return m.CanBeDeletedForAllUsers } +// GetCanGetAddedReactions returns value of CanGetAddedReactions field. +func (m *Message) GetCanGetAddedReactions() (value bool) { + if m == nil { + return + } + return m.CanGetAddedReactions +} + // GetCanGetStatistics returns value of CanGetStatistics field. func (m *Message) GetCanGetStatistics() (value bool) { if m == nil { @@ -1291,6 +1379,14 @@ func (m *Message) GetInteractionInfo() (value MessageInteractionInfo) { return m.InteractionInfo } +// GetUnreadReactions returns value of UnreadReactions field. +func (m *Message) GetUnreadReactions() (value []UnreadReaction) { + if m == nil { + return + } + return m.UnreadReactions +} + // GetReplyInChatID returns value of ReplyInChatID field. func (m *Message) GetReplyInChatID() (value int64) { if m == nil { diff --git a/tdapi/tl_message_interaction_info_gen.go b/tdapi/tl_message_interaction_info_gen.go index da0fa7102d..21fd4f5d66 100644 --- a/tdapi/tl_message_interaction_info_gen.go +++ b/tdapi/tl_message_interaction_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessageInteractionInfo represents TL type `messageInteractionInfo#db00a42a`. +// MessageInteractionInfo represents TL type `messageInteractionInfo#4af275ac`. type MessageInteractionInfo struct { // Number of times the message was viewed ViewCount int32 @@ -41,10 +41,12 @@ type MessageInteractionInfo struct { // available only in channels with a discussion supergroup and discussion supergroups for // messages, which are not replies itself ReplyInfo MessageReplyInfo + // The list of reactions added to the message + Reactions []MessageReaction } // MessageInteractionInfoTypeID is TL type id of MessageInteractionInfo. -const MessageInteractionInfoTypeID = 0xdb00a42a +const MessageInteractionInfoTypeID = 0x4af275ac // Ensuring interfaces in compile-time for MessageInteractionInfo. var ( @@ -67,6 +69,9 @@ func (m *MessageInteractionInfo) Zero() bool { if !(m.ReplyInfo.Zero()) { return false } + if !(m.Reactions == nil) { + return false + } return true } @@ -115,6 +120,10 @@ func (m *MessageInteractionInfo) TypeInfo() tdp.Type { Name: "ReplyInfo", SchemaName: "reply_info", }, + { + Name: "Reactions", + SchemaName: "reactions", + }, } return typ } @@ -122,7 +131,7 @@ func (m *MessageInteractionInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageInteractionInfo) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageInteractionInfo#db00a42a as nil") + return fmt.Errorf("can't encode messageInteractionInfo#4af275ac as nil") } b.PutID(MessageInteractionInfoTypeID) return m.EncodeBare(b) @@ -131,12 +140,18 @@ func (m *MessageInteractionInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageInteractionInfo) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageInteractionInfo#db00a42a as nil") + return fmt.Errorf("can't encode messageInteractionInfo#4af275ac as nil") } b.PutInt32(m.ViewCount) b.PutInt32(m.ForwardCount) if err := m.ReplyInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageInteractionInfo#db00a42a: field reply_info: %w", err) + return fmt.Errorf("unable to encode messageInteractionInfo#4af275ac: field reply_info: %w", err) + } + b.PutInt(len(m.Reactions)) + for idx, v := range m.Reactions { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare messageInteractionInfo#4af275ac: field reactions element with index %d: %w", idx, err) + } } return nil } @@ -144,10 +159,10 @@ func (m *MessageInteractionInfo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageInteractionInfo) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageInteractionInfo#db00a42a to nil") + return fmt.Errorf("can't decode messageInteractionInfo#4af275ac to nil") } if err := b.ConsumeID(MessageInteractionInfoTypeID); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#db00a42a: %w", err) + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: %w", err) } return m.DecodeBare(b) } @@ -155,25 +170,42 @@ func (m *MessageInteractionInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageInteractionInfo) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageInteractionInfo#db00a42a to nil") + return fmt.Errorf("can't decode messageInteractionInfo#4af275ac to nil") } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#db00a42a: field view_count: %w", err) + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: field view_count: %w", err) } m.ViewCount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#db00a42a: field forward_count: %w", err) + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: field forward_count: %w", err) } m.ForwardCount = value } { if err := m.ReplyInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#db00a42a: field reply_info: %w", err) + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: field reply_info: %w", err) + } + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: field reactions: %w", err) + } + + if headerLen > 0 { + m.Reactions = make([]MessageReaction, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value MessageReaction + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare messageInteractionInfo#4af275ac: field reactions: %w", err) + } + m.Reactions = append(m.Reactions, value) } } return nil @@ -182,7 +214,7 @@ func (m *MessageInteractionInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageInteractionInfo#db00a42a as nil") + return fmt.Errorf("can't encode messageInteractionInfo#4af275ac as nil") } b.ObjStart() b.PutID("messageInteractionInfo") @@ -195,8 +227,19 @@ func (m *MessageInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("reply_info") if err := m.ReplyInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageInteractionInfo#db00a42a: field reply_info: %w", err) + return fmt.Errorf("unable to encode messageInteractionInfo#4af275ac: field reply_info: %w", err) + } + b.Comma() + b.FieldStart("reactions") + b.ArrStart() + for idx, v := range m.Reactions { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageInteractionInfo#4af275ac: field reactions element with index %d: %w", idx, err) + } + b.Comma() } + b.StripComma() + b.ArrEnd() b.Comma() b.StripComma() b.ObjEnd() @@ -206,30 +249,41 @@ func (m *MessageInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageInteractionInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageInteractionInfo#db00a42a to nil") + return fmt.Errorf("can't decode messageInteractionInfo#4af275ac to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageInteractionInfo"); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#db00a42a: %w", err) + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: %w", err) } case "view_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#db00a42a: field view_count: %w", err) + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: field view_count: %w", err) } m.ViewCount = value case "forward_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#db00a42a: field forward_count: %w", err) + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: field forward_count: %w", err) } m.ForwardCount = value case "reply_info": if err := m.ReplyInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#db00a42a: field reply_info: %w", err) + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: field reply_info: %w", err) + } + case "reactions": + if err := b.Arr(func(b tdjson.Decoder) error { + var value MessageReaction + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: field reactions: %w", err) + } + m.Reactions = append(m.Reactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode messageInteractionInfo#4af275ac: field reactions: %w", err) } default: return b.Skip() @@ -261,3 +315,11 @@ func (m *MessageInteractionInfo) GetReplyInfo() (value MessageReplyInfo) { } return m.ReplyInfo } + +// GetReactions returns value of Reactions field. +func (m *MessageInteractionInfo) GetReactions() (value []MessageReaction) { + if m == nil { + return + } + return m.Reactions +} diff --git a/tdapi/tl_message_reaction_gen.go b/tdapi/tl_message_reaction_gen.go new file mode 100644 index 0000000000..e93a19b041 --- /dev/null +++ b/tdapi/tl_message_reaction_gen.go @@ -0,0 +1,330 @@ +// 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{} +) + +// MessageReaction represents TL type `messageReaction#7c4179cb`. +type MessageReaction struct { + // Text representation of the reaction + Reaction string + // Number of times the reaction was added + TotalCount int32 + // True, if the reaction is chosen by the current user + IsChosen bool + // Identifiers of at most 3 recent message senders, added the reaction; available in + // private chats, basic groups and supergroups + RecentSenderIDs []MessageSenderClass +} + +// MessageReactionTypeID is TL type id of MessageReaction. +const MessageReactionTypeID = 0x7c4179cb + +// Ensuring interfaces in compile-time for MessageReaction. +var ( + _ bin.Encoder = &MessageReaction{} + _ bin.Decoder = &MessageReaction{} + _ bin.BareEncoder = &MessageReaction{} + _ bin.BareDecoder = &MessageReaction{} +) + +func (m *MessageReaction) Zero() bool { + if m == nil { + return true + } + if !(m.Reaction == "") { + return false + } + if !(m.TotalCount == 0) { + return false + } + if !(m.IsChosen == false) { + return false + } + if !(m.RecentSenderIDs == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageReaction) String() string { + if m == nil { + return "MessageReaction(nil)" + } + type Alias MessageReaction + return fmt.Sprintf("MessageReaction%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageReaction) TypeID() uint32 { + return MessageReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageReaction) TypeName() string { + return "messageReaction" +} + +// TypeInfo returns info about TL type. +func (m *MessageReaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageReaction", + ID: MessageReactionTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Reaction", + SchemaName: "reaction", + }, + { + Name: "TotalCount", + SchemaName: "total_count", + }, + { + Name: "IsChosen", + SchemaName: "is_chosen", + }, + { + Name: "RecentSenderIDs", + SchemaName: "recent_sender_ids", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageReaction) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageReaction#7c4179cb as nil") + } + b.PutID(MessageReactionTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageReaction) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageReaction#7c4179cb as nil") + } + b.PutString(m.Reaction) + b.PutInt32(m.TotalCount) + b.PutBool(m.IsChosen) + b.PutInt(len(m.RecentSenderIDs)) + for idx, v := range m.RecentSenderIDs { + if v == nil { + return fmt.Errorf("unable to encode messageReaction#7c4179cb: 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#7c4179cb: field recent_sender_ids element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageReaction) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageReaction#7c4179cb to nil") + } + if err := b.ConsumeID(MessageReactionTypeID); err != nil { + return fmt.Errorf("unable to decode messageReaction#7c4179cb: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageReaction) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageReaction#7c4179cb to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageReaction#7c4179cb: field reaction: %w", err) + } + m.Reaction = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageReaction#7c4179cb: field total_count: %w", err) + } + m.TotalCount = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageReaction#7c4179cb: field is_chosen: %w", err) + } + m.IsChosen = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageReaction#7c4179cb: field recent_sender_ids: %w", err) + } + + if headerLen > 0 { + m.RecentSenderIDs = make([]MessageSenderClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode messageReaction#7c4179cb: field recent_sender_ids: %w", err) + } + m.RecentSenderIDs = append(m.RecentSenderIDs, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageReaction) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageReaction#7c4179cb as nil") + } + b.ObjStart() + b.PutID("messageReaction") + b.Comma() + b.FieldStart("reaction") + b.PutString(m.Reaction) + b.Comma() + b.FieldStart("total_count") + b.PutInt32(m.TotalCount) + b.Comma() + b.FieldStart("is_chosen") + b.PutBool(m.IsChosen) + 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#7c4179cb: 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#7c4179cb: field recent_sender_ids element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageReaction) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageReaction#7c4179cb 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#7c4179cb: %w", err) + } + case "reaction": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageReaction#7c4179cb: field reaction: %w", err) + } + m.Reaction = value + case "total_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode messageReaction#7c4179cb: 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#7c4179cb: field is_chosen: %w", err) + } + m.IsChosen = 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#7c4179cb: field recent_sender_ids: %w", err) + } + m.RecentSenderIDs = append(m.RecentSenderIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode messageReaction#7c4179cb: field recent_sender_ids: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetReaction returns value of Reaction field. +func (m *MessageReaction) GetReaction() (value string) { + if m == nil { + return + } + return m.Reaction +} + +// GetTotalCount returns value of TotalCount field. +func (m *MessageReaction) GetTotalCount() (value int32) { + if m == nil { + return + } + return m.TotalCount +} + +// GetIsChosen returns value of IsChosen field. +func (m *MessageReaction) GetIsChosen() (value bool) { + if m == nil { + return + } + return m.IsChosen +} + +// GetRecentSenderIDs returns value of RecentSenderIDs field. +func (m *MessageReaction) GetRecentSenderIDs() (value []MessageSenderClass) { + if m == nil { + return + } + return m.RecentSenderIDs +} diff --git a/tdapi/tl_reaction_gen.go b/tdapi/tl_reaction_gen.go new file mode 100644 index 0000000000..f9b3f9f797 --- /dev/null +++ b/tdapi/tl_reaction_gen.go @@ -0,0 +1,499 @@ +// 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{} +) + +// Reaction represents TL type `reaction#ff6c56f1`. +type Reaction struct { + // Text representation of the reaction + Reaction string + // Reaction title + Title string + // True, if the reaction can be added to new messages and enabled in chats + IsActive bool + // Static icon for the reaction + StaticIcon Sticker + // Appear animation for the reaction + AppearAnimation Sticker + // Select animation for the reaction + SelectAnimation Sticker + // Activate animation for the reaction + ActivateAnimation Sticker + // Effect animation for the reaction + EffectAnimation Sticker + // Around animation for the reaction; may be null + AroundAnimation Sticker + // Center animation for the reaction; may be null + CenterAnimation Sticker +} + +// ReactionTypeID is TL type id of Reaction. +const ReactionTypeID = 0xff6c56f1 + +// Ensuring interfaces in compile-time for Reaction. +var ( + _ bin.Encoder = &Reaction{} + _ bin.Decoder = &Reaction{} + _ bin.BareEncoder = &Reaction{} + _ bin.BareDecoder = &Reaction{} +) + +func (r *Reaction) Zero() bool { + if r == nil { + return true + } + if !(r.Reaction == "") { + return false + } + if !(r.Title == "") { + return false + } + if !(r.IsActive == false) { + return false + } + if !(r.StaticIcon.Zero()) { + return false + } + if !(r.AppearAnimation.Zero()) { + return false + } + if !(r.SelectAnimation.Zero()) { + return false + } + if !(r.ActivateAnimation.Zero()) { + return false + } + if !(r.EffectAnimation.Zero()) { + return false + } + if !(r.AroundAnimation.Zero()) { + return false + } + if !(r.CenterAnimation.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *Reaction) String() string { + if r == nil { + return "Reaction(nil)" + } + type Alias Reaction + return fmt.Sprintf("Reaction%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*Reaction) TypeID() uint32 { + return ReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*Reaction) TypeName() string { + return "reaction" +} + +// TypeInfo returns info about TL type. +func (r *Reaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reaction", + ID: ReactionTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Reaction", + SchemaName: "reaction", + }, + { + Name: "Title", + SchemaName: "title", + }, + { + Name: "IsActive", + SchemaName: "is_active", + }, + { + Name: "StaticIcon", + SchemaName: "static_icon", + }, + { + Name: "AppearAnimation", + SchemaName: "appear_animation", + }, + { + Name: "SelectAnimation", + SchemaName: "select_animation", + }, + { + Name: "ActivateAnimation", + SchemaName: "activate_animation", + }, + { + Name: "EffectAnimation", + SchemaName: "effect_animation", + }, + { + Name: "AroundAnimation", + SchemaName: "around_animation", + }, + { + Name: "CenterAnimation", + SchemaName: "center_animation", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *Reaction) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reaction#ff6c56f1 as nil") + } + b.PutID(ReactionTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *Reaction) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reaction#ff6c56f1 as nil") + } + b.PutString(r.Reaction) + b.PutString(r.Title) + b.PutBool(r.IsActive) + if err := r.StaticIcon.Encode(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field static_icon: %w", err) + } + if err := r.AppearAnimation.Encode(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field appear_animation: %w", err) + } + if err := r.SelectAnimation.Encode(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field select_animation: %w", err) + } + if err := r.ActivateAnimation.Encode(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field activate_animation: %w", err) + } + if err := r.EffectAnimation.Encode(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field effect_animation: %w", err) + } + if err := r.AroundAnimation.Encode(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field around_animation: %w", err) + } + if err := r.CenterAnimation.Encode(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field center_animation: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (r *Reaction) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reaction#ff6c56f1 to nil") + } + if err := b.ConsumeID(ReactionTypeID); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *Reaction) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reaction#ff6c56f1 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field reaction: %w", err) + } + r.Reaction = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field title: %w", err) + } + r.Title = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field is_active: %w", err) + } + r.IsActive = value + } + { + if err := r.StaticIcon.Decode(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field static_icon: %w", err) + } + } + { + if err := r.AppearAnimation.Decode(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field appear_animation: %w", err) + } + } + { + if err := r.SelectAnimation.Decode(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field select_animation: %w", err) + } + } + { + if err := r.ActivateAnimation.Decode(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field activate_animation: %w", err) + } + } + { + if err := r.EffectAnimation.Decode(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field effect_animation: %w", err) + } + } + { + if err := r.AroundAnimation.Decode(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field around_animation: %w", err) + } + } + { + if err := r.CenterAnimation.Decode(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field center_animation: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *Reaction) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reaction#ff6c56f1 as nil") + } + b.ObjStart() + b.PutID("reaction") + b.Comma() + b.FieldStart("reaction") + b.PutString(r.Reaction) + b.Comma() + b.FieldStart("title") + b.PutString(r.Title) + b.Comma() + b.FieldStart("is_active") + b.PutBool(r.IsActive) + b.Comma() + b.FieldStart("static_icon") + if err := r.StaticIcon.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field static_icon: %w", err) + } + b.Comma() + b.FieldStart("appear_animation") + if err := r.AppearAnimation.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field appear_animation: %w", err) + } + b.Comma() + b.FieldStart("select_animation") + if err := r.SelectAnimation.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field select_animation: %w", err) + } + b.Comma() + b.FieldStart("activate_animation") + if err := r.ActivateAnimation.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field activate_animation: %w", err) + } + b.Comma() + b.FieldStart("effect_animation") + if err := r.EffectAnimation.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field effect_animation: %w", err) + } + b.Comma() + b.FieldStart("around_animation") + if err := r.AroundAnimation.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field around_animation: %w", err) + } + b.Comma() + b.FieldStart("center_animation") + if err := r.CenterAnimation.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode reaction#ff6c56f1: field center_animation: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *Reaction) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reaction#ff6c56f1 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reaction"); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: %w", err) + } + case "reaction": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field reaction: %w", err) + } + r.Reaction = value + case "title": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field title: %w", err) + } + r.Title = value + case "is_active": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field is_active: %w", err) + } + r.IsActive = value + case "static_icon": + if err := r.StaticIcon.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field static_icon: %w", err) + } + case "appear_animation": + if err := r.AppearAnimation.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field appear_animation: %w", err) + } + case "select_animation": + if err := r.SelectAnimation.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field select_animation: %w", err) + } + case "activate_animation": + if err := r.ActivateAnimation.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field activate_animation: %w", err) + } + case "effect_animation": + if err := r.EffectAnimation.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field effect_animation: %w", err) + } + case "around_animation": + if err := r.AroundAnimation.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field around_animation: %w", err) + } + case "center_animation": + if err := r.CenterAnimation.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode reaction#ff6c56f1: field center_animation: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetReaction returns value of Reaction field. +func (r *Reaction) GetReaction() (value string) { + if r == nil { + return + } + return r.Reaction +} + +// GetTitle returns value of Title field. +func (r *Reaction) GetTitle() (value string) { + if r == nil { + return + } + return r.Title +} + +// GetIsActive returns value of IsActive field. +func (r *Reaction) GetIsActive() (value bool) { + if r == nil { + return + } + return r.IsActive +} + +// GetStaticIcon returns value of StaticIcon field. +func (r *Reaction) GetStaticIcon() (value Sticker) { + if r == nil { + return + } + return r.StaticIcon +} + +// GetAppearAnimation returns value of AppearAnimation field. +func (r *Reaction) GetAppearAnimation() (value Sticker) { + if r == nil { + return + } + return r.AppearAnimation +} + +// GetSelectAnimation returns value of SelectAnimation field. +func (r *Reaction) GetSelectAnimation() (value Sticker) { + if r == nil { + return + } + return r.SelectAnimation +} + +// GetActivateAnimation returns value of ActivateAnimation field. +func (r *Reaction) GetActivateAnimation() (value Sticker) { + if r == nil { + return + } + return r.ActivateAnimation +} + +// GetEffectAnimation returns value of EffectAnimation field. +func (r *Reaction) GetEffectAnimation() (value Sticker) { + if r == nil { + return + } + return r.EffectAnimation +} + +// GetAroundAnimation returns value of AroundAnimation field. +func (r *Reaction) GetAroundAnimation() (value Sticker) { + if r == nil { + return + } + return r.AroundAnimation +} + +// GetCenterAnimation returns value of CenterAnimation field. +func (r *Reaction) GetCenterAnimation() (value Sticker) { + if r == nil { + return + } + return r.CenterAnimation +} diff --git a/tdapi/tl_read_all_chat_reactions_gen.go b/tdapi/tl_read_all_chat_reactions_gen.go new file mode 100644 index 0000000000..acd16eb08a --- /dev/null +++ b/tdapi/tl_read_all_chat_reactions_gen.go @@ -0,0 +1,206 @@ +// 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{} +) + +// ReadAllChatReactionsRequest represents TL type `readAllChatReactions#54c1976d`. +type ReadAllChatReactionsRequest struct { + // Chat identifier + ChatID int64 +} + +// ReadAllChatReactionsRequestTypeID is TL type id of ReadAllChatReactionsRequest. +const ReadAllChatReactionsRequestTypeID = 0x54c1976d + +// Ensuring interfaces in compile-time for ReadAllChatReactionsRequest. +var ( + _ bin.Encoder = &ReadAllChatReactionsRequest{} + _ bin.Decoder = &ReadAllChatReactionsRequest{} + _ bin.BareEncoder = &ReadAllChatReactionsRequest{} + _ bin.BareDecoder = &ReadAllChatReactionsRequest{} +) + +func (r *ReadAllChatReactionsRequest) Zero() bool { + if r == nil { + return true + } + if !(r.ChatID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReadAllChatReactionsRequest) String() string { + if r == nil { + return "ReadAllChatReactionsRequest(nil)" + } + type Alias ReadAllChatReactionsRequest + return fmt.Sprintf("ReadAllChatReactionsRequest%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReadAllChatReactionsRequest) TypeID() uint32 { + return ReadAllChatReactionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReadAllChatReactionsRequest) TypeName() string { + return "readAllChatReactions" +} + +// TypeInfo returns info about TL type. +func (r *ReadAllChatReactionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "readAllChatReactions", + ID: ReadAllChatReactionsRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *ReadAllChatReactionsRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode readAllChatReactions#54c1976d as nil") + } + b.PutID(ReadAllChatReactionsRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReadAllChatReactionsRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode readAllChatReactions#54c1976d as nil") + } + b.PutInt53(r.ChatID) + return nil +} + +// Decode implements bin.Decoder. +func (r *ReadAllChatReactionsRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode readAllChatReactions#54c1976d to nil") + } + if err := b.ConsumeID(ReadAllChatReactionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode readAllChatReactions#54c1976d: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReadAllChatReactionsRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode readAllChatReactions#54c1976d to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode readAllChatReactions#54c1976d: field chat_id: %w", err) + } + r.ChatID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReadAllChatReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode readAllChatReactions#54c1976d as nil") + } + b.ObjStart() + b.PutID("readAllChatReactions") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(r.ChatID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReadAllChatReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode readAllChatReactions#54c1976d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("readAllChatReactions"); err != nil { + return fmt.Errorf("unable to decode readAllChatReactions#54c1976d: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode readAllChatReactions#54c1976d: field chat_id: %w", err) + } + r.ChatID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (r *ReadAllChatReactionsRequest) GetChatID() (value int64) { + if r == nil { + return + } + return r.ChatID +} + +// ReadAllChatReactions invokes method readAllChatReactions#54c1976d returning error if any. +func (c *Client) ReadAllChatReactions(ctx context.Context, chatid int64) error { + var ok Ok + + request := &ReadAllChatReactionsRequest{ + ChatID: chatid, + } + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index 7a4c75a241..60a540eae4 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -80,17 +80,22 @@ func TypesMap() map[uint32]string { PhotoSizeTypeID: "photoSize#18e56d39", MinithumbnailTypeID: "minithumbnail#ec6addaa", ThumbnailFormatJpegTypeID: "thumbnailFormatJpeg#d90c5488", - ThumbnailFormatPngTypeID: "thumbnailFormatPng#5e0697f5", - ThumbnailFormatWebpTypeID: "thumbnailFormatWebp#fcce4c12", ThumbnailFormatGifTypeID: "thumbnailFormatGif#4aa3258a", - ThumbnailFormatTgsTypeID: "thumbnailFormatTgs#4e694852", ThumbnailFormatMpeg4TypeID: "thumbnailFormatMpeg4#109b57fe", + ThumbnailFormatPngTypeID: "thumbnailFormatPng#5e0697f5", + ThumbnailFormatTgsTypeID: "thumbnailFormatTgs#4e694852", + ThumbnailFormatWebmTypeID: "thumbnailFormatWebm#d8a7e727", + ThumbnailFormatWebpTypeID: "thumbnailFormatWebp#fcce4c12", ThumbnailTypeID: "thumbnail#4a1ae06b", MaskPointForeheadTypeID: "maskPointForehead#3d3e96c5", MaskPointEyesTypeID: "maskPointEyes#68351b4d", MaskPointMouthTypeID: "maskPointMouth#188b29de", MaskPointChinTypeID: "maskPointChin#1fe36187", MaskPositionTypeID: "maskPosition#82fbb63e", + StickerTypeStaticTypeID: "stickerTypeStatic#6b8e3cd1", + StickerTypeAnimatedTypeID: "stickerTypeAnimated#691926ad", + StickerTypeVideoTypeID: "stickerTypeVideo#1f22af74", + StickerTypeMaskTypeID: "stickerTypeMask#cdf254e3", ClosedVectorPathTypeID: "closedVectorPath#2f9276b9", PollOptionTypeID: "pollOption#57d9d5a5", PollTypeRegularTypeID: "pollTypeRegular#2638f022", @@ -99,7 +104,7 @@ func TypesMap() map[uint32]string { AudioTypeID: "audio#b9b4c7de", DocumentTypeID: "document#af19afd8", PhotoTypeID: "photo#105a0689", - StickerTypeID: "sticker#a5687f28", + StickerTypeID: "sticker#f2a43be4", VideoTypeID: "video#31a460cc", VideoNoteTypeID: "videoNote#fbb96a3a", VoiceNoteTypeID: "voiceNote#84db2866", @@ -181,10 +186,12 @@ func TypesMap() map[uint32]string { MessageForwardOriginMessageImportTypeID: "messageForwardOriginMessageImport#d3eb2e21", MessageForwardInfoTypeID: "messageForwardInfo#ec7dcac8", MessageReplyInfoTypeID: "messageReplyInfo#69240cb9", - MessageInteractionInfoTypeID: "messageInteractionInfo#db00a42a", + MessageReactionTypeID: "messageReaction#7c4179cb", + MessageInteractionInfoTypeID: "messageInteractionInfo#4af275ac", + UnreadReactionTypeID: "unreadReaction#54afb43", MessageSendingStatePendingTypeID: "messageSendingStatePending#ada359c2", MessageSendingStateFailedTypeID: "messageSendingStateFailed#982ce904", - MessageTypeID: "message#c6b405b7", + MessageTypeID: "message#ef20f556", MessagesTypeID: "messages#b34c8c60", FoundMessagesTypeID: "foundMessages#2515f708", MessagePositionTypeID: "messagePosition#4d0540ef", @@ -214,7 +221,7 @@ func TypesMap() map[uint32]string { ChatSourcePublicServiceAnnouncementTypeID: "chatSourcePublicServiceAnnouncement#ec6a6694", ChatPositionTypeID: "chatPosition#dae48755", VideoChatTypeID: "videoChat#ae158d28", - ChatTypeID: "chat#69d332bd", + ChatTypeID: "chat#548eca01", ChatsTypeID: "chats#9b93e3eb", ChatNearbyTypeID: "chatNearby#2de4255", ChatsNearbyTypeID: "chatsNearby#cc744cff", @@ -504,6 +511,7 @@ func TypesMap() map[uint32]string { SearchMessagesFilterVoiceAndVideoNoteTypeID: "searchMessagesFilterVoiceAndVideoNote#279680e3", SearchMessagesFilterMentionTypeID: "searchMessagesFilterMention#7748c89c", SearchMessagesFilterUnreadMentionTypeID: "searchMessagesFilterUnreadMention#fa4aadc3", + SearchMessagesFilterUnreadReactionTypeID: "searchMessagesFilterUnreadReaction#adc43100", SearchMessagesFilterFailedToSendTypeID: "searchMessagesFilterFailedToSend#dc74d6fc", SearchMessagesFilterPinnedTypeID: "searchMessagesFilterPinned#16294d48", ChatActionTypingTypeID: "chatActionTyping#16a83437", @@ -529,8 +537,8 @@ func TypesMap() map[uint32]string { UserStatusLastMonthTypeID: "userStatusLastMonth#77ebc742", StickersTypeID: "stickers#83491d00", EmojisTypeID: "emojis#77274a16", - StickerSetTypeID: "stickerSet#5ccde520", - StickerSetInfoTypeID: "stickerSetInfo#aba733ac", + StickerSetTypeID: "stickerSet#69307c1a", + StickerSetInfoTypeID: "stickerSetInfo#1f54c66b", StickerSetsTypeID: "stickerSets#b8a6490d", CallDiscardReasonEmptyTypeID: "callDiscardReasonEmpty#b4f66fc3", CallDiscardReasonMissedTypeID: "callDiscardReasonMissed#64283a7c", @@ -568,6 +576,10 @@ func TypesMap() map[uint32]string { CallProblemPixelatedVideoTypeID: "callProblemPixelatedVideo#7e1526d3", CallTypeID: "call#36db9764", PhoneNumberAuthenticationSettingsTypeID: "phoneNumberAuthenticationSettings#88e1611f", + AddedReactionTypeID: "addedReaction#1b17c6bc", + AddedReactionsTypeID: "addedReactions#77bf7590", + AvailableReactionsTypeID: "availableReactions#b83dc5b2", + ReactionTypeID: "reaction#ff6c56f1", AnimationsTypeID: "animations#2ce4157c", DiceStickersRegularTypeID: "diceStickersRegular#d3dfecce", DiceStickersSlotMachineTypeID: "diceStickersSlotMachine#e9a28cac", @@ -607,38 +619,39 @@ func TypesMap() map[uint32]string { GameHighScoresTypeID: "gameHighScores#6d4cd30d", ChatEventMessageEditedTypeID: "chatEventMessageEdited#e64ff5f8", ChatEventMessageDeletedTypeID: "chatEventMessageDeleted#cac649f7", - ChatEventPollStoppedTypeID: "chatEventPollStopped#77cc8be5", ChatEventMessagePinnedTypeID: "chatEventMessagePinned#1a26ad1a", ChatEventMessageUnpinnedTypeID: "chatEventMessageUnpinned#e9943b17", + ChatEventPollStoppedTypeID: "chatEventPollStopped#77cc8be5", ChatEventMemberJoinedTypeID: "chatEventMemberJoined#f1f70924", ChatEventMemberJoinedByInviteLinkTypeID: "chatEventMemberJoinedByInviteLink#f0e6d5bd", ChatEventMemberJoinedByRequestTypeID: "chatEventMemberJoinedByRequest#9dc87e3f", - ChatEventMemberLeftTypeID: "chatEventMemberLeft#c778400f", ChatEventMemberInvitedTypeID: "chatEventMemberInvited#38d7bfc9", + ChatEventMemberLeftTypeID: "chatEventMemberLeft#c778400f", ChatEventMemberPromotedTypeID: "chatEventMemberPromoted#1f4f6861", ChatEventMemberRestrictedTypeID: "chatEventMemberRestricted#5f951e05", - ChatEventTitleChangedTypeID: "chatEventTitleChanged#43990ad2", - ChatEventPermissionsChangedTypeID: "chatEventPermissionsChanged#b1d337a8", + ChatEventAvailableReactionsChangedTypeID: "chatEventAvailableReactionsChanged#9ac93274", ChatEventDescriptionChangedTypeID: "chatEventDescriptionChanged#254cf1e", - ChatEventUsernameChangedTypeID: "chatEventUsernameChanged#6707b56b", - ChatEventPhotoChangedTypeID: "chatEventPhotoChanged#cfa062c3", - ChatEventInvitesToggledTypeID: "chatEventInvitesToggled#fc45966b", ChatEventLinkedChatChangedTypeID: "chatEventLinkedChatChanged#6b2271af", - ChatEventSlowModeDelayChangedTypeID: "chatEventSlowModeDelayChanged#9d763c0b", + ChatEventLocationChangedTypeID: "chatEventLocationChanged#e7cdfd4e", ChatEventMessageTTLChangedTypeID: "chatEventMessageTtlChanged#2e46b9b3", - ChatEventSignMessagesToggledTypeID: "chatEventSignMessagesToggled#b1b9281e", - ChatEventHasProtectedContentToggledTypeID: "chatEventHasProtectedContentToggled#f5044201", + ChatEventPermissionsChangedTypeID: "chatEventPermissionsChanged#b1d337a8", + ChatEventPhotoChangedTypeID: "chatEventPhotoChanged#cfa062c3", + ChatEventSlowModeDelayChangedTypeID: "chatEventSlowModeDelayChanged#9d763c0b", ChatEventStickerSetChangedTypeID: "chatEventStickerSetChanged#b5e7558f", - ChatEventLocationChangedTypeID: "chatEventLocationChanged#e7cdfd4e", + ChatEventTitleChangedTypeID: "chatEventTitleChanged#43990ad2", + ChatEventUsernameChangedTypeID: "chatEventUsernameChanged#6707b56b", + ChatEventHasProtectedContentToggledTypeID: "chatEventHasProtectedContentToggled#f5044201", + ChatEventInvitesToggledTypeID: "chatEventInvitesToggled#fc45966b", ChatEventIsAllHistoryAvailableToggledTypeID: "chatEventIsAllHistoryAvailableToggled#a0b03c15", + ChatEventSignMessagesToggledTypeID: "chatEventSignMessagesToggled#b1b9281e", ChatEventInviteLinkEditedTypeID: "chatEventInviteLinkEdited#e4920d62", ChatEventInviteLinkRevokedTypeID: "chatEventInviteLinkRevoked#a1dbffe3", ChatEventInviteLinkDeletedTypeID: "chatEventInviteLinkDeleted#acda6167", ChatEventVideoChatCreatedTypeID: "chatEventVideoChatCreated#6ca68a7b", ChatEventVideoChatEndedTypeID: "chatEventVideoChatEnded#61286c48", + ChatEventVideoChatMuteNewParticipantsToggledTypeID: "chatEventVideoChatMuteNewParticipantsToggled#f87507fe", ChatEventVideoChatParticipantIsMutedToggledTypeID: "chatEventVideoChatParticipantIsMutedToggled#1f1058f7", ChatEventVideoChatParticipantVolumeLevelChangedTypeID: "chatEventVideoChatParticipantVolumeLevelChanged#436f92be", - ChatEventVideoChatMuteNewParticipantsToggledTypeID: "chatEventVideoChatMuteNewParticipantsToggled#f87507fe", ChatEventTypeID: "chatEvent#d921b3d0", ChatEventsTypeID: "chatEvents#d73ecdc4", ChatEventLogFiltersTypeID: "chatEventLogFilters#4a93c173", @@ -864,8 +877,7 @@ func TypesMap() map[uint32]string { ProxyTypeMtprotoTypeID: "proxyTypeMtproto#8ae31ffd", ProxyTypeID: "proxy#baf7b73", ProxiesTypeID: "proxies#5ee27a86", - InputStickerStaticTypeID: "inputStickerStatic#540604db", - InputStickerAnimatedTypeID: "inputStickerAnimated#bccf4960", + InputStickerTypeID: "inputSticker#345af62e", DateRangeTypeID: "dateRange#51150c66", StatisticalValueTypeID: "statisticalValue#626d6a76", StatisticalGraphDataTypeID: "statisticalGraphData#89732e2c", @@ -899,6 +911,7 @@ func TypesMap() map[uint32]string { UpdateMessageInteractionInfoTypeID: "updateMessageInteractionInfo#ab803bfe", UpdateMessageContentOpenedTypeID: "updateMessageContentOpened#a55ea885", UpdateMessageMentionReadTypeID: "updateMessageMentionRead#f0f74d46", + UpdateMessageUnreadReactionsTypeID: "updateMessageUnreadReactions#12a7220a", UpdateMessageLiveLocationViewedTypeID: "updateMessageLiveLocationViewed#b2058595", UpdateNewChatTypeID: "updateNewChat#7bb98ccd", UpdateChatTitleTypeID: "updateChatTitle#f58b85a4", @@ -909,6 +922,7 @@ func TypesMap() map[uint32]string { UpdateChatReadInboxTypeID: "updateChatReadInbox#d07036e7", UpdateChatReadOutboxTypeID: "updateChatReadOutbox#2a385285", UpdateChatActionBarTypeID: "updateChatActionBar#d9a258c2", + UpdateChatAvailableReactionsTypeID: "updateChatAvailableReactions#852fb10d", UpdateChatDraftMessageTypeID: "updateChatDraftMessage#2bf257d4", UpdateChatMessageSenderTypeID: "updateChatMessageSender#77705241", UpdateChatMessageTTLTypeID: "updateChatMessageTtl#dde0a978", @@ -917,6 +931,7 @@ func TypesMap() map[uint32]string { UpdateChatReplyMarkupTypeID: "updateChatReplyMarkup#4e0ba5a0", UpdateChatThemeTypeID: "updateChatTheme#31f3d465", UpdateChatUnreadMentionCountTypeID: "updateChatUnreadMentionCount#80f47b1c", + UpdateChatUnreadReactionCountTypeID: "updateChatUnreadReactionCount#81603cdd", UpdateChatVideoChatTypeID: "updateChatVideoChat#25fb4ca6", UpdateChatDefaultDisableNotificationTypeID: "updateChatDefaultDisableNotification#1ba96a9b", UpdateChatHasProtectedContentTypeID: "updateChatHasProtectedContent#6b50071b", @@ -964,6 +979,7 @@ func TypesMap() map[uint32]string { UpdateConnectionStateTypeID: "updateConnectionState#57939e2e", UpdateTermsOfServiceTypeID: "updateTermsOfService#b23cc55e", UpdateUsersNearbyTypeID: "updateUsersNearby#97c8ab5", + UpdateReactionsTypeID: "updateReactions#e769e4e7", UpdateDiceEmojisTypeID: "updateDiceEmojis#9d0f91df", UpdateAnimatedEmojiMessageClickedTypeID: "updateAnimatedEmojiMessageClicked#a3167405", UpdateAnimationSearchParametersTypeID: "updateAnimationSearchParameters#6016ef01", @@ -1086,6 +1102,7 @@ func TypesMap() map[uint32]string { GetMessageLinkRequestTypeID: "getMessageLink#a0312f6f", GetMessageEmbeddingCodeRequestTypeID: "getMessageEmbeddingCode#62a4cd09", GetMessageLinkInfoRequestTypeID: "getMessageLinkInfo#d63eb458", + TranslateTextRequestTypeID: "translateText#9f758a6d", GetChatAvailableMessageSendersRequestTypeID: "getChatAvailableMessageSenders#a41d7c58", SetChatMessageSenderRequestTypeID: "setChatMessageSender#ab456b7e", SendMessageRequestTypeID: "sendMessage#393f599d", @@ -1110,6 +1127,9 @@ func TypesMap() map[uint32]string { EditInlineMessageCaptionRequestTypeID: "editInlineMessageCaption#d2a446b7", EditInlineMessageReplyMarkupRequestTypeID: "editInlineMessageReplyMarkup#fbf906de", EditMessageSchedulingStateRequestTypeID: "editMessageSchedulingState#ae2a0bc0", + GetMessageAvailableReactionsRequestTypeID: "getMessageAvailableReactions#c3fa54f", + SetMessageReactionRequestTypeID: "setMessageReaction#874fab38", + GetMessageAddedReactionsRequestTypeID: "getMessageAddedReactions#aac3b631", GetTextEntitiesRequestTypeID: "getTextEntities#eba543fb", ParseTextEntitiesRequestTypeID: "parseTextEntities#9a1fc29f", ParseMarkdownRequestTypeID: "parseMarkdown#2d153aef", @@ -1147,6 +1167,7 @@ func TypesMap() map[uint32]string { GetExternalLinkInfoRequestTypeID: "getExternalLinkInfo#460d7a3f", GetExternalLinkRequestTypeID: "getExternalLink#5e92f0eb", ReadAllChatMentionsRequestTypeID: "readAllChatMentions#50eab2b5", + ReadAllChatReactionsRequestTypeID: "readAllChatReactions#54c1976d", CreatePrivateChatRequestTypeID: "createPrivateChat#c7825b09", CreateBasicGroupChatRequestTypeID: "createBasicGroupChat#758ab4e4", CreateSupergroupChatRequestTypeID: "createSupergroupChat#46c770eb", @@ -1174,6 +1195,7 @@ func TypesMap() map[uint32]string { ToggleChatHasProtectedContentRequestTypeID: "toggleChatHasProtectedContent#3a20d94d", ToggleChatIsMarkedAsUnreadRequestTypeID: "toggleChatIsMarkedAsUnread#c538dadf", ToggleChatDefaultDisableNotificationRequestTypeID: "toggleChatDefaultDisableNotification#12c36012", + SetChatAvailableReactionsRequestTypeID: "setChatAvailableReactions#2e5c0f2e", SetChatClientDataRequestTypeID: "setChatClientData#ceb3273d", SetChatDescriptionRequestTypeID: "setChatDescription#74a8b45d", SetChatDiscussionGroupRequestTypeID: "setChatDiscussionGroup#c93c32b8", @@ -1407,11 +1429,11 @@ func TypesMap() map[uint32]string { ResendPhoneNumberConfirmationCodeRequestTypeID: "resendPhoneNumberConfirmationCode#7b537aea", CheckPhoneNumberConfirmationCodeRequestTypeID: "checkPhoneNumberConfirmationCode#afa638da", SetBotUpdatesStatusRequestTypeID: "setBotUpdatesStatus#bb293991", - UploadStickerFileRequestTypeID: "uploadStickerFile#23a0f58e", + UploadStickerFileRequestTypeID: "uploadStickerFile#524839a", GetSuggestedStickerSetNameRequestTypeID: "getSuggestedStickerSetName#b0120840", CheckStickerSetNameRequestTypeID: "checkStickerSetName#955808fe", - CreateNewStickerSetRequestTypeID: "createNewStickerSet#982c0b07", - AddStickerToSetRequestTypeID: "addStickerToSet#3b0b81", + CreateNewStickerSetRequestTypeID: "createNewStickerSet#aa878026", + AddStickerToSetRequestTypeID: "addStickerToSet#b015455d", SetStickerSetThumbnailRequestTypeID: "setStickerSetThumbnail#4952fa88", SetStickerPositionInSetRequestTypeID: "setStickerPositionInSet#7bb24721", RemoveStickerFromSetRequestTypeID: "removeStickerFromSet#61e1eea4", @@ -1509,17 +1531,22 @@ func NamesMap() map[string]uint32 { "photoSize": PhotoSizeTypeID, "minithumbnail": MinithumbnailTypeID, "thumbnailFormatJpeg": ThumbnailFormatJpegTypeID, - "thumbnailFormatPng": ThumbnailFormatPngTypeID, - "thumbnailFormatWebp": ThumbnailFormatWebpTypeID, "thumbnailFormatGif": ThumbnailFormatGifTypeID, - "thumbnailFormatTgs": ThumbnailFormatTgsTypeID, "thumbnailFormatMpeg4": ThumbnailFormatMpeg4TypeID, + "thumbnailFormatPng": ThumbnailFormatPngTypeID, + "thumbnailFormatTgs": ThumbnailFormatTgsTypeID, + "thumbnailFormatWebm": ThumbnailFormatWebmTypeID, + "thumbnailFormatWebp": ThumbnailFormatWebpTypeID, "thumbnail": ThumbnailTypeID, "maskPointForehead": MaskPointForeheadTypeID, "maskPointEyes": MaskPointEyesTypeID, "maskPointMouth": MaskPointMouthTypeID, "maskPointChin": MaskPointChinTypeID, "maskPosition": MaskPositionTypeID, + "stickerTypeStatic": StickerTypeStaticTypeID, + "stickerTypeAnimated": StickerTypeAnimatedTypeID, + "stickerTypeVideo": StickerTypeVideoTypeID, + "stickerTypeMask": StickerTypeMaskTypeID, "closedVectorPath": ClosedVectorPathTypeID, "pollOption": PollOptionTypeID, "pollTypeRegular": PollTypeRegularTypeID, @@ -1610,7 +1637,9 @@ func NamesMap() map[string]uint32 { "messageForwardOriginMessageImport": MessageForwardOriginMessageImportTypeID, "messageForwardInfo": MessageForwardInfoTypeID, "messageReplyInfo": MessageReplyInfoTypeID, + "messageReaction": MessageReactionTypeID, "messageInteractionInfo": MessageInteractionInfoTypeID, + "unreadReaction": UnreadReactionTypeID, "messageSendingStatePending": MessageSendingStatePendingTypeID, "messageSendingStateFailed": MessageSendingStateFailedTypeID, "message": MessageTypeID, @@ -1933,6 +1962,7 @@ func NamesMap() map[string]uint32 { "searchMessagesFilterVoiceAndVideoNote": SearchMessagesFilterVoiceAndVideoNoteTypeID, "searchMessagesFilterMention": SearchMessagesFilterMentionTypeID, "searchMessagesFilterUnreadMention": SearchMessagesFilterUnreadMentionTypeID, + "searchMessagesFilterUnreadReaction": SearchMessagesFilterUnreadReactionTypeID, "searchMessagesFilterFailedToSend": SearchMessagesFilterFailedToSendTypeID, "searchMessagesFilterPinned": SearchMessagesFilterPinnedTypeID, "chatActionTyping": ChatActionTypingTypeID, @@ -1997,6 +2027,10 @@ func NamesMap() map[string]uint32 { "callProblemPixelatedVideo": CallProblemPixelatedVideoTypeID, "call": CallTypeID, "phoneNumberAuthenticationSettings": PhoneNumberAuthenticationSettingsTypeID, + "addedReaction": AddedReactionTypeID, + "addedReactions": AddedReactionsTypeID, + "availableReactions": AvailableReactionsTypeID, + "reaction": ReactionTypeID, "animations": AnimationsTypeID, "diceStickersRegular": DiceStickersRegularTypeID, "diceStickersSlotMachine": DiceStickersSlotMachineTypeID, @@ -2036,38 +2070,39 @@ func NamesMap() map[string]uint32 { "gameHighScores": GameHighScoresTypeID, "chatEventMessageEdited": ChatEventMessageEditedTypeID, "chatEventMessageDeleted": ChatEventMessageDeletedTypeID, - "chatEventPollStopped": ChatEventPollStoppedTypeID, "chatEventMessagePinned": ChatEventMessagePinnedTypeID, "chatEventMessageUnpinned": ChatEventMessageUnpinnedTypeID, + "chatEventPollStopped": ChatEventPollStoppedTypeID, "chatEventMemberJoined": ChatEventMemberJoinedTypeID, "chatEventMemberJoinedByInviteLink": ChatEventMemberJoinedByInviteLinkTypeID, "chatEventMemberJoinedByRequest": ChatEventMemberJoinedByRequestTypeID, - "chatEventMemberLeft": ChatEventMemberLeftTypeID, "chatEventMemberInvited": ChatEventMemberInvitedTypeID, + "chatEventMemberLeft": ChatEventMemberLeftTypeID, "chatEventMemberPromoted": ChatEventMemberPromotedTypeID, "chatEventMemberRestricted": ChatEventMemberRestrictedTypeID, - "chatEventTitleChanged": ChatEventTitleChangedTypeID, - "chatEventPermissionsChanged": ChatEventPermissionsChangedTypeID, + "chatEventAvailableReactionsChanged": ChatEventAvailableReactionsChangedTypeID, "chatEventDescriptionChanged": ChatEventDescriptionChangedTypeID, - "chatEventUsernameChanged": ChatEventUsernameChangedTypeID, - "chatEventPhotoChanged": ChatEventPhotoChangedTypeID, - "chatEventInvitesToggled": ChatEventInvitesToggledTypeID, "chatEventLinkedChatChanged": ChatEventLinkedChatChangedTypeID, - "chatEventSlowModeDelayChanged": ChatEventSlowModeDelayChangedTypeID, + "chatEventLocationChanged": ChatEventLocationChangedTypeID, "chatEventMessageTtlChanged": ChatEventMessageTTLChangedTypeID, - "chatEventSignMessagesToggled": ChatEventSignMessagesToggledTypeID, - "chatEventHasProtectedContentToggled": ChatEventHasProtectedContentToggledTypeID, + "chatEventPermissionsChanged": ChatEventPermissionsChangedTypeID, + "chatEventPhotoChanged": ChatEventPhotoChangedTypeID, + "chatEventSlowModeDelayChanged": ChatEventSlowModeDelayChangedTypeID, "chatEventStickerSetChanged": ChatEventStickerSetChangedTypeID, - "chatEventLocationChanged": ChatEventLocationChangedTypeID, + "chatEventTitleChanged": ChatEventTitleChangedTypeID, + "chatEventUsernameChanged": ChatEventUsernameChangedTypeID, + "chatEventHasProtectedContentToggled": ChatEventHasProtectedContentToggledTypeID, + "chatEventInvitesToggled": ChatEventInvitesToggledTypeID, "chatEventIsAllHistoryAvailableToggled": ChatEventIsAllHistoryAvailableToggledTypeID, + "chatEventSignMessagesToggled": ChatEventSignMessagesToggledTypeID, "chatEventInviteLinkEdited": ChatEventInviteLinkEditedTypeID, "chatEventInviteLinkRevoked": ChatEventInviteLinkRevokedTypeID, "chatEventInviteLinkDeleted": ChatEventInviteLinkDeletedTypeID, "chatEventVideoChatCreated": ChatEventVideoChatCreatedTypeID, "chatEventVideoChatEnded": ChatEventVideoChatEndedTypeID, + "chatEventVideoChatMuteNewParticipantsToggled": ChatEventVideoChatMuteNewParticipantsToggledTypeID, "chatEventVideoChatParticipantIsMutedToggled": ChatEventVideoChatParticipantIsMutedToggledTypeID, "chatEventVideoChatParticipantVolumeLevelChanged": ChatEventVideoChatParticipantVolumeLevelChangedTypeID, - "chatEventVideoChatMuteNewParticipantsToggled": ChatEventVideoChatMuteNewParticipantsToggledTypeID, "chatEvent": ChatEventTypeID, "chatEvents": ChatEventsTypeID, "chatEventLogFilters": ChatEventLogFiltersTypeID, @@ -2293,8 +2328,7 @@ func NamesMap() map[string]uint32 { "proxyTypeMtproto": ProxyTypeMtprotoTypeID, "proxy": ProxyTypeID, "proxies": ProxiesTypeID, - "inputStickerStatic": InputStickerStaticTypeID, - "inputStickerAnimated": InputStickerAnimatedTypeID, + "inputSticker": InputStickerTypeID, "dateRange": DateRangeTypeID, "statisticalValue": StatisticalValueTypeID, "statisticalGraphData": StatisticalGraphDataTypeID, @@ -2328,6 +2362,7 @@ func NamesMap() map[string]uint32 { "updateMessageInteractionInfo": UpdateMessageInteractionInfoTypeID, "updateMessageContentOpened": UpdateMessageContentOpenedTypeID, "updateMessageMentionRead": UpdateMessageMentionReadTypeID, + "updateMessageUnreadReactions": UpdateMessageUnreadReactionsTypeID, "updateMessageLiveLocationViewed": UpdateMessageLiveLocationViewedTypeID, "updateNewChat": UpdateNewChatTypeID, "updateChatTitle": UpdateChatTitleTypeID, @@ -2338,6 +2373,7 @@ func NamesMap() map[string]uint32 { "updateChatReadInbox": UpdateChatReadInboxTypeID, "updateChatReadOutbox": UpdateChatReadOutboxTypeID, "updateChatActionBar": UpdateChatActionBarTypeID, + "updateChatAvailableReactions": UpdateChatAvailableReactionsTypeID, "updateChatDraftMessage": UpdateChatDraftMessageTypeID, "updateChatMessageSender": UpdateChatMessageSenderTypeID, "updateChatMessageTtl": UpdateChatMessageTTLTypeID, @@ -2346,6 +2382,7 @@ func NamesMap() map[string]uint32 { "updateChatReplyMarkup": UpdateChatReplyMarkupTypeID, "updateChatTheme": UpdateChatThemeTypeID, "updateChatUnreadMentionCount": UpdateChatUnreadMentionCountTypeID, + "updateChatUnreadReactionCount": UpdateChatUnreadReactionCountTypeID, "updateChatVideoChat": UpdateChatVideoChatTypeID, "updateChatDefaultDisableNotification": UpdateChatDefaultDisableNotificationTypeID, "updateChatHasProtectedContent": UpdateChatHasProtectedContentTypeID, @@ -2393,6 +2430,7 @@ func NamesMap() map[string]uint32 { "updateConnectionState": UpdateConnectionStateTypeID, "updateTermsOfService": UpdateTermsOfServiceTypeID, "updateUsersNearby": UpdateUsersNearbyTypeID, + "updateReactions": UpdateReactionsTypeID, "updateDiceEmojis": UpdateDiceEmojisTypeID, "updateAnimatedEmojiMessageClicked": UpdateAnimatedEmojiMessageClickedTypeID, "updateAnimationSearchParameters": UpdateAnimationSearchParametersTypeID, @@ -2515,6 +2553,7 @@ func NamesMap() map[string]uint32 { "getMessageLink": GetMessageLinkRequestTypeID, "getMessageEmbeddingCode": GetMessageEmbeddingCodeRequestTypeID, "getMessageLinkInfo": GetMessageLinkInfoRequestTypeID, + "translateText": TranslateTextRequestTypeID, "getChatAvailableMessageSenders": GetChatAvailableMessageSendersRequestTypeID, "setChatMessageSender": SetChatMessageSenderRequestTypeID, "sendMessage": SendMessageRequestTypeID, @@ -2539,6 +2578,9 @@ func NamesMap() map[string]uint32 { "editInlineMessageCaption": EditInlineMessageCaptionRequestTypeID, "editInlineMessageReplyMarkup": EditInlineMessageReplyMarkupRequestTypeID, "editMessageSchedulingState": EditMessageSchedulingStateRequestTypeID, + "getMessageAvailableReactions": GetMessageAvailableReactionsRequestTypeID, + "setMessageReaction": SetMessageReactionRequestTypeID, + "getMessageAddedReactions": GetMessageAddedReactionsRequestTypeID, "getTextEntities": GetTextEntitiesRequestTypeID, "parseTextEntities": ParseTextEntitiesRequestTypeID, "parseMarkdown": ParseMarkdownRequestTypeID, @@ -2576,6 +2618,7 @@ func NamesMap() map[string]uint32 { "getExternalLinkInfo": GetExternalLinkInfoRequestTypeID, "getExternalLink": GetExternalLinkRequestTypeID, "readAllChatMentions": ReadAllChatMentionsRequestTypeID, + "readAllChatReactions": ReadAllChatReactionsRequestTypeID, "createPrivateChat": CreatePrivateChatRequestTypeID, "createBasicGroupChat": CreateBasicGroupChatRequestTypeID, "createSupergroupChat": CreateSupergroupChatRequestTypeID, @@ -2603,6 +2646,7 @@ func NamesMap() map[string]uint32 { "toggleChatHasProtectedContent": ToggleChatHasProtectedContentRequestTypeID, "toggleChatIsMarkedAsUnread": ToggleChatIsMarkedAsUnreadRequestTypeID, "toggleChatDefaultDisableNotification": ToggleChatDefaultDisableNotificationRequestTypeID, + "setChatAvailableReactions": SetChatAvailableReactionsRequestTypeID, "setChatClientData": SetChatClientDataRequestTypeID, "setChatDescription": SetChatDescriptionRequestTypeID, "setChatDiscussionGroup": SetChatDiscussionGroupRequestTypeID, @@ -2938,17 +2982,22 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PhotoSizeTypeID: func() bin.Object { return &PhotoSize{} }, MinithumbnailTypeID: func() bin.Object { return &Minithumbnail{} }, ThumbnailFormatJpegTypeID: func() bin.Object { return &ThumbnailFormatJpeg{} }, - ThumbnailFormatPngTypeID: func() bin.Object { return &ThumbnailFormatPng{} }, - ThumbnailFormatWebpTypeID: func() bin.Object { return &ThumbnailFormatWebp{} }, ThumbnailFormatGifTypeID: func() bin.Object { return &ThumbnailFormatGif{} }, - ThumbnailFormatTgsTypeID: func() bin.Object { return &ThumbnailFormatTgs{} }, ThumbnailFormatMpeg4TypeID: func() bin.Object { return &ThumbnailFormatMpeg4{} }, + ThumbnailFormatPngTypeID: func() bin.Object { return &ThumbnailFormatPng{} }, + ThumbnailFormatTgsTypeID: func() bin.Object { return &ThumbnailFormatTgs{} }, + ThumbnailFormatWebmTypeID: func() bin.Object { return &ThumbnailFormatWebm{} }, + ThumbnailFormatWebpTypeID: func() bin.Object { return &ThumbnailFormatWebp{} }, ThumbnailTypeID: func() bin.Object { return &Thumbnail{} }, MaskPointForeheadTypeID: func() bin.Object { return &MaskPointForehead{} }, MaskPointEyesTypeID: func() bin.Object { return &MaskPointEyes{} }, MaskPointMouthTypeID: func() bin.Object { return &MaskPointMouth{} }, MaskPointChinTypeID: func() bin.Object { return &MaskPointChin{} }, MaskPositionTypeID: func() bin.Object { return &MaskPosition{} }, + StickerTypeStaticTypeID: func() bin.Object { return &StickerTypeStatic{} }, + StickerTypeAnimatedTypeID: func() bin.Object { return &StickerTypeAnimated{} }, + StickerTypeVideoTypeID: func() bin.Object { return &StickerTypeVideo{} }, + StickerTypeMaskTypeID: func() bin.Object { return &StickerTypeMask{} }, ClosedVectorPathTypeID: func() bin.Object { return &ClosedVectorPath{} }, PollOptionTypeID: func() bin.Object { return &PollOption{} }, PollTypeRegularTypeID: func() bin.Object { return &PollTypeRegular{} }, @@ -3039,7 +3088,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageForwardOriginMessageImportTypeID: func() bin.Object { return &MessageForwardOriginMessageImport{} }, MessageForwardInfoTypeID: func() bin.Object { return &MessageForwardInfo{} }, MessageReplyInfoTypeID: func() bin.Object { return &MessageReplyInfo{} }, + MessageReactionTypeID: func() bin.Object { return &MessageReaction{} }, MessageInteractionInfoTypeID: func() bin.Object { return &MessageInteractionInfo{} }, + UnreadReactionTypeID: func() bin.Object { return &UnreadReaction{} }, MessageSendingStatePendingTypeID: func() bin.Object { return &MessageSendingStatePending{} }, MessageSendingStateFailedTypeID: func() bin.Object { return &MessageSendingStateFailed{} }, MessageTypeID: func() bin.Object { return &Message{} }, @@ -3362,6 +3413,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { SearchMessagesFilterVoiceAndVideoNoteTypeID: func() bin.Object { return &SearchMessagesFilterVoiceAndVideoNote{} }, SearchMessagesFilterMentionTypeID: func() bin.Object { return &SearchMessagesFilterMention{} }, SearchMessagesFilterUnreadMentionTypeID: func() bin.Object { return &SearchMessagesFilterUnreadMention{} }, + SearchMessagesFilterUnreadReactionTypeID: func() bin.Object { return &SearchMessagesFilterUnreadReaction{} }, SearchMessagesFilterFailedToSendTypeID: func() bin.Object { return &SearchMessagesFilterFailedToSend{} }, SearchMessagesFilterPinnedTypeID: func() bin.Object { return &SearchMessagesFilterPinned{} }, ChatActionTypingTypeID: func() bin.Object { return &ChatActionTyping{} }, @@ -3426,6 +3478,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { CallProblemPixelatedVideoTypeID: func() bin.Object { return &CallProblemPixelatedVideo{} }, CallTypeID: func() bin.Object { return &Call{} }, PhoneNumberAuthenticationSettingsTypeID: func() bin.Object { return &PhoneNumberAuthenticationSettings{} }, + AddedReactionTypeID: func() bin.Object { return &AddedReaction{} }, + AddedReactionsTypeID: func() bin.Object { return &AddedReactions{} }, + AvailableReactionsTypeID: func() bin.Object { return &AvailableReactions{} }, + ReactionTypeID: func() bin.Object { return &Reaction{} }, AnimationsTypeID: func() bin.Object { return &Animations{} }, DiceStickersRegularTypeID: func() bin.Object { return &DiceStickersRegular{} }, DiceStickersSlotMachineTypeID: func() bin.Object { return &DiceStickersSlotMachine{} }, @@ -3465,38 +3521,39 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GameHighScoresTypeID: func() bin.Object { return &GameHighScores{} }, ChatEventMessageEditedTypeID: func() bin.Object { return &ChatEventMessageEdited{} }, ChatEventMessageDeletedTypeID: func() bin.Object { return &ChatEventMessageDeleted{} }, - ChatEventPollStoppedTypeID: func() bin.Object { return &ChatEventPollStopped{} }, ChatEventMessagePinnedTypeID: func() bin.Object { return &ChatEventMessagePinned{} }, ChatEventMessageUnpinnedTypeID: func() bin.Object { return &ChatEventMessageUnpinned{} }, + ChatEventPollStoppedTypeID: func() bin.Object { return &ChatEventPollStopped{} }, ChatEventMemberJoinedTypeID: func() bin.Object { return &ChatEventMemberJoined{} }, ChatEventMemberJoinedByInviteLinkTypeID: func() bin.Object { return &ChatEventMemberJoinedByInviteLink{} }, ChatEventMemberJoinedByRequestTypeID: func() bin.Object { return &ChatEventMemberJoinedByRequest{} }, - ChatEventMemberLeftTypeID: func() bin.Object { return &ChatEventMemberLeft{} }, ChatEventMemberInvitedTypeID: func() bin.Object { return &ChatEventMemberInvited{} }, + ChatEventMemberLeftTypeID: func() bin.Object { return &ChatEventMemberLeft{} }, ChatEventMemberPromotedTypeID: func() bin.Object { return &ChatEventMemberPromoted{} }, ChatEventMemberRestrictedTypeID: func() bin.Object { return &ChatEventMemberRestricted{} }, - ChatEventTitleChangedTypeID: func() bin.Object { return &ChatEventTitleChanged{} }, - ChatEventPermissionsChangedTypeID: func() bin.Object { return &ChatEventPermissionsChanged{} }, + ChatEventAvailableReactionsChangedTypeID: func() bin.Object { return &ChatEventAvailableReactionsChanged{} }, ChatEventDescriptionChangedTypeID: func() bin.Object { return &ChatEventDescriptionChanged{} }, - ChatEventUsernameChangedTypeID: func() bin.Object { return &ChatEventUsernameChanged{} }, - ChatEventPhotoChangedTypeID: func() bin.Object { return &ChatEventPhotoChanged{} }, - ChatEventInvitesToggledTypeID: func() bin.Object { return &ChatEventInvitesToggled{} }, ChatEventLinkedChatChangedTypeID: func() bin.Object { return &ChatEventLinkedChatChanged{} }, - ChatEventSlowModeDelayChangedTypeID: func() bin.Object { return &ChatEventSlowModeDelayChanged{} }, + ChatEventLocationChangedTypeID: func() bin.Object { return &ChatEventLocationChanged{} }, ChatEventMessageTTLChangedTypeID: func() bin.Object { return &ChatEventMessageTTLChanged{} }, - ChatEventSignMessagesToggledTypeID: func() bin.Object { return &ChatEventSignMessagesToggled{} }, - ChatEventHasProtectedContentToggledTypeID: func() bin.Object { return &ChatEventHasProtectedContentToggled{} }, + ChatEventPermissionsChangedTypeID: func() bin.Object { return &ChatEventPermissionsChanged{} }, + ChatEventPhotoChangedTypeID: func() bin.Object { return &ChatEventPhotoChanged{} }, + ChatEventSlowModeDelayChangedTypeID: func() bin.Object { return &ChatEventSlowModeDelayChanged{} }, ChatEventStickerSetChangedTypeID: func() bin.Object { return &ChatEventStickerSetChanged{} }, - ChatEventLocationChangedTypeID: func() bin.Object { return &ChatEventLocationChanged{} }, + ChatEventTitleChangedTypeID: func() bin.Object { return &ChatEventTitleChanged{} }, + ChatEventUsernameChangedTypeID: func() bin.Object { return &ChatEventUsernameChanged{} }, + ChatEventHasProtectedContentToggledTypeID: func() bin.Object { return &ChatEventHasProtectedContentToggled{} }, + ChatEventInvitesToggledTypeID: func() bin.Object { return &ChatEventInvitesToggled{} }, ChatEventIsAllHistoryAvailableToggledTypeID: func() bin.Object { return &ChatEventIsAllHistoryAvailableToggled{} }, + ChatEventSignMessagesToggledTypeID: func() bin.Object { return &ChatEventSignMessagesToggled{} }, ChatEventInviteLinkEditedTypeID: func() bin.Object { return &ChatEventInviteLinkEdited{} }, ChatEventInviteLinkRevokedTypeID: func() bin.Object { return &ChatEventInviteLinkRevoked{} }, ChatEventInviteLinkDeletedTypeID: func() bin.Object { return &ChatEventInviteLinkDeleted{} }, ChatEventVideoChatCreatedTypeID: func() bin.Object { return &ChatEventVideoChatCreated{} }, ChatEventVideoChatEndedTypeID: func() bin.Object { return &ChatEventVideoChatEnded{} }, + ChatEventVideoChatMuteNewParticipantsToggledTypeID: func() bin.Object { return &ChatEventVideoChatMuteNewParticipantsToggled{} }, ChatEventVideoChatParticipantIsMutedToggledTypeID: func() bin.Object { return &ChatEventVideoChatParticipantIsMutedToggled{} }, ChatEventVideoChatParticipantVolumeLevelChangedTypeID: func() bin.Object { return &ChatEventVideoChatParticipantVolumeLevelChanged{} }, - ChatEventVideoChatMuteNewParticipantsToggledTypeID: func() bin.Object { return &ChatEventVideoChatMuteNewParticipantsToggled{} }, ChatEventTypeID: func() bin.Object { return &ChatEvent{} }, ChatEventsTypeID: func() bin.Object { return &ChatEvents{} }, ChatEventLogFiltersTypeID: func() bin.Object { return &ChatEventLogFilters{} }, @@ -3722,8 +3779,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ProxyTypeMtprotoTypeID: func() bin.Object { return &ProxyTypeMtproto{} }, ProxyTypeID: func() bin.Object { return &Proxy{} }, ProxiesTypeID: func() bin.Object { return &Proxies{} }, - InputStickerStaticTypeID: func() bin.Object { return &InputStickerStatic{} }, - InputStickerAnimatedTypeID: func() bin.Object { return &InputStickerAnimated{} }, + InputStickerTypeID: func() bin.Object { return &InputSticker{} }, DateRangeTypeID: func() bin.Object { return &DateRange{} }, StatisticalValueTypeID: func() bin.Object { return &StatisticalValue{} }, StatisticalGraphDataTypeID: func() bin.Object { return &StatisticalGraphData{} }, @@ -3757,6 +3813,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateMessageInteractionInfoTypeID: func() bin.Object { return &UpdateMessageInteractionInfo{} }, UpdateMessageContentOpenedTypeID: func() bin.Object { return &UpdateMessageContentOpened{} }, UpdateMessageMentionReadTypeID: func() bin.Object { return &UpdateMessageMentionRead{} }, + UpdateMessageUnreadReactionsTypeID: func() bin.Object { return &UpdateMessageUnreadReactions{} }, UpdateMessageLiveLocationViewedTypeID: func() bin.Object { return &UpdateMessageLiveLocationViewed{} }, UpdateNewChatTypeID: func() bin.Object { return &UpdateNewChat{} }, UpdateChatTitleTypeID: func() bin.Object { return &UpdateChatTitle{} }, @@ -3767,6 +3824,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateChatReadInboxTypeID: func() bin.Object { return &UpdateChatReadInbox{} }, UpdateChatReadOutboxTypeID: func() bin.Object { return &UpdateChatReadOutbox{} }, UpdateChatActionBarTypeID: func() bin.Object { return &UpdateChatActionBar{} }, + UpdateChatAvailableReactionsTypeID: func() bin.Object { return &UpdateChatAvailableReactions{} }, UpdateChatDraftMessageTypeID: func() bin.Object { return &UpdateChatDraftMessage{} }, UpdateChatMessageSenderTypeID: func() bin.Object { return &UpdateChatMessageSender{} }, UpdateChatMessageTTLTypeID: func() bin.Object { return &UpdateChatMessageTTL{} }, @@ -3775,6 +3833,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateChatReplyMarkupTypeID: func() bin.Object { return &UpdateChatReplyMarkup{} }, UpdateChatThemeTypeID: func() bin.Object { return &UpdateChatTheme{} }, UpdateChatUnreadMentionCountTypeID: func() bin.Object { return &UpdateChatUnreadMentionCount{} }, + UpdateChatUnreadReactionCountTypeID: func() bin.Object { return &UpdateChatUnreadReactionCount{} }, UpdateChatVideoChatTypeID: func() bin.Object { return &UpdateChatVideoChat{} }, UpdateChatDefaultDisableNotificationTypeID: func() bin.Object { return &UpdateChatDefaultDisableNotification{} }, UpdateChatHasProtectedContentTypeID: func() bin.Object { return &UpdateChatHasProtectedContent{} }, @@ -3822,6 +3881,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateConnectionStateTypeID: func() bin.Object { return &UpdateConnectionState{} }, UpdateTermsOfServiceTypeID: func() bin.Object { return &UpdateTermsOfService{} }, UpdateUsersNearbyTypeID: func() bin.Object { return &UpdateUsersNearby{} }, + UpdateReactionsTypeID: func() bin.Object { return &UpdateReactions{} }, UpdateDiceEmojisTypeID: func() bin.Object { return &UpdateDiceEmojis{} }, UpdateAnimatedEmojiMessageClickedTypeID: func() bin.Object { return &UpdateAnimatedEmojiMessageClicked{} }, UpdateAnimationSearchParametersTypeID: func() bin.Object { return &UpdateAnimationSearchParameters{} }, @@ -3944,6 +4004,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetMessageLinkRequestTypeID: func() bin.Object { return &GetMessageLinkRequest{} }, GetMessageEmbeddingCodeRequestTypeID: func() bin.Object { return &GetMessageEmbeddingCodeRequest{} }, GetMessageLinkInfoRequestTypeID: func() bin.Object { return &GetMessageLinkInfoRequest{} }, + TranslateTextRequestTypeID: func() bin.Object { return &TranslateTextRequest{} }, GetChatAvailableMessageSendersRequestTypeID: func() bin.Object { return &GetChatAvailableMessageSendersRequest{} }, SetChatMessageSenderRequestTypeID: func() bin.Object { return &SetChatMessageSenderRequest{} }, SendMessageRequestTypeID: func() bin.Object { return &SendMessageRequest{} }, @@ -3968,6 +4029,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { EditInlineMessageCaptionRequestTypeID: func() bin.Object { return &EditInlineMessageCaptionRequest{} }, EditInlineMessageReplyMarkupRequestTypeID: func() bin.Object { return &EditInlineMessageReplyMarkupRequest{} }, EditMessageSchedulingStateRequestTypeID: func() bin.Object { return &EditMessageSchedulingStateRequest{} }, + GetMessageAvailableReactionsRequestTypeID: func() bin.Object { return &GetMessageAvailableReactionsRequest{} }, + SetMessageReactionRequestTypeID: func() bin.Object { return &SetMessageReactionRequest{} }, + GetMessageAddedReactionsRequestTypeID: func() bin.Object { return &GetMessageAddedReactionsRequest{} }, GetTextEntitiesRequestTypeID: func() bin.Object { return &GetTextEntitiesRequest{} }, ParseTextEntitiesRequestTypeID: func() bin.Object { return &ParseTextEntitiesRequest{} }, ParseMarkdownRequestTypeID: func() bin.Object { return &ParseMarkdownRequest{} }, @@ -4005,6 +4069,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetExternalLinkInfoRequestTypeID: func() bin.Object { return &GetExternalLinkInfoRequest{} }, GetExternalLinkRequestTypeID: func() bin.Object { return &GetExternalLinkRequest{} }, ReadAllChatMentionsRequestTypeID: func() bin.Object { return &ReadAllChatMentionsRequest{} }, + ReadAllChatReactionsRequestTypeID: func() bin.Object { return &ReadAllChatReactionsRequest{} }, CreatePrivateChatRequestTypeID: func() bin.Object { return &CreatePrivateChatRequest{} }, CreateBasicGroupChatRequestTypeID: func() bin.Object { return &CreateBasicGroupChatRequest{} }, CreateSupergroupChatRequestTypeID: func() bin.Object { return &CreateSupergroupChatRequest{} }, @@ -4032,6 +4097,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ToggleChatHasProtectedContentRequestTypeID: func() bin.Object { return &ToggleChatHasProtectedContentRequest{} }, ToggleChatIsMarkedAsUnreadRequestTypeID: func() bin.Object { return &ToggleChatIsMarkedAsUnreadRequest{} }, ToggleChatDefaultDisableNotificationRequestTypeID: func() bin.Object { return &ToggleChatDefaultDisableNotificationRequest{} }, + SetChatAvailableReactionsRequestTypeID: func() bin.Object { return &SetChatAvailableReactionsRequest{} }, SetChatClientDataRequestTypeID: func() bin.Object { return &SetChatClientDataRequest{} }, SetChatDescriptionRequestTypeID: func() bin.Object { return &SetChatDescriptionRequest{} }, SetChatDiscussionGroupRequestTypeID: func() bin.Object { return &SetChatDiscussionGroupRequest{} }, @@ -4434,38 +4500,39 @@ func ClassConstructorsMap() map[string][]uint32 { ChatEventActionClassName: { ChatEventMessageEditedTypeID, ChatEventMessageDeletedTypeID, - ChatEventPollStoppedTypeID, ChatEventMessagePinnedTypeID, ChatEventMessageUnpinnedTypeID, + ChatEventPollStoppedTypeID, ChatEventMemberJoinedTypeID, ChatEventMemberJoinedByInviteLinkTypeID, ChatEventMemberJoinedByRequestTypeID, - ChatEventMemberLeftTypeID, ChatEventMemberInvitedTypeID, + ChatEventMemberLeftTypeID, ChatEventMemberPromotedTypeID, ChatEventMemberRestrictedTypeID, - ChatEventTitleChangedTypeID, - ChatEventPermissionsChangedTypeID, + ChatEventAvailableReactionsChangedTypeID, ChatEventDescriptionChangedTypeID, - ChatEventUsernameChangedTypeID, - ChatEventPhotoChangedTypeID, - ChatEventInvitesToggledTypeID, ChatEventLinkedChatChangedTypeID, - ChatEventSlowModeDelayChangedTypeID, + ChatEventLocationChangedTypeID, ChatEventMessageTTLChangedTypeID, - ChatEventSignMessagesToggledTypeID, - ChatEventHasProtectedContentToggledTypeID, + ChatEventPermissionsChangedTypeID, + ChatEventPhotoChangedTypeID, + ChatEventSlowModeDelayChangedTypeID, ChatEventStickerSetChangedTypeID, - ChatEventLocationChangedTypeID, + ChatEventTitleChangedTypeID, + ChatEventUsernameChangedTypeID, + ChatEventHasProtectedContentToggledTypeID, + ChatEventInvitesToggledTypeID, ChatEventIsAllHistoryAvailableToggledTypeID, + ChatEventSignMessagesToggledTypeID, ChatEventInviteLinkEditedTypeID, ChatEventInviteLinkRevokedTypeID, ChatEventInviteLinkDeletedTypeID, ChatEventVideoChatCreatedTypeID, ChatEventVideoChatEndedTypeID, + ChatEventVideoChatMuteNewParticipantsToggledTypeID, ChatEventVideoChatParticipantIsMutedToggledTypeID, ChatEventVideoChatParticipantVolumeLevelChangedTypeID, - ChatEventVideoChatMuteNewParticipantsToggledTypeID, }, ChatListClassName: { ChatListMainTypeID, @@ -4676,10 +4743,6 @@ func ClassConstructorsMap() map[string][]uint32 { InputPassportElementErrorSourceFileTypeID, InputPassportElementErrorSourceFilesTypeID, }, - InputStickerClassName: { - InputStickerStaticTypeID, - InputStickerAnimatedTypeID, - }, InternalLinkTypeClassName: { InternalLinkTypeActiveSessionsTypeID, InternalLinkTypeAuthenticationCodeTypeID, @@ -5019,6 +5082,7 @@ func ClassConstructorsMap() map[string][]uint32 { SearchMessagesFilterVoiceAndVideoNoteTypeID, SearchMessagesFilterMentionTypeID, SearchMessagesFilterUnreadMentionTypeID, + SearchMessagesFilterUnreadReactionTypeID, SearchMessagesFilterFailedToSendTypeID, SearchMessagesFilterPinnedTypeID, }, @@ -5032,6 +5096,12 @@ func ClassConstructorsMap() map[string][]uint32 { StatisticalGraphAsyncTypeID, StatisticalGraphErrorTypeID, }, + StickerTypeClassName: { + StickerTypeStaticTypeID, + StickerTypeAnimatedTypeID, + StickerTypeVideoTypeID, + StickerTypeMaskTypeID, + }, SuggestedActionClassName: { SuggestedActionEnableArchiveAndMuteNewChatsTypeID, SuggestedActionCheckPasswordTypeID, @@ -5083,11 +5153,12 @@ func ClassConstructorsMap() map[string][]uint32 { }, ThumbnailFormatClassName: { ThumbnailFormatJpegTypeID, - ThumbnailFormatPngTypeID, - ThumbnailFormatWebpTypeID, ThumbnailFormatGifTypeID, - ThumbnailFormatTgsTypeID, ThumbnailFormatMpeg4TypeID, + ThumbnailFormatPngTypeID, + ThumbnailFormatTgsTypeID, + ThumbnailFormatWebmTypeID, + ThumbnailFormatWebpTypeID, }, TopChatCategoryClassName: { TopChatCategoryUsersTypeID, @@ -5110,6 +5181,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateMessageInteractionInfoTypeID, UpdateMessageContentOpenedTypeID, UpdateMessageMentionReadTypeID, + UpdateMessageUnreadReactionsTypeID, UpdateMessageLiveLocationViewedTypeID, UpdateNewChatTypeID, UpdateChatTitleTypeID, @@ -5120,6 +5192,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateChatReadInboxTypeID, UpdateChatReadOutboxTypeID, UpdateChatActionBarTypeID, + UpdateChatAvailableReactionsTypeID, UpdateChatDraftMessageTypeID, UpdateChatMessageSenderTypeID, UpdateChatMessageTTLTypeID, @@ -5128,6 +5201,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateChatReplyMarkupTypeID, UpdateChatThemeTypeID, UpdateChatUnreadMentionCountTypeID, + UpdateChatUnreadReactionCountTypeID, UpdateChatVideoChatTypeID, UpdateChatDefaultDisableNotificationTypeID, UpdateChatHasProtectedContentTypeID, @@ -5175,6 +5249,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateConnectionStateTypeID, UpdateTermsOfServiceTypeID, UpdateUsersNearbyTypeID, + UpdateReactionsTypeID, UpdateDiceEmojisTypeID, UpdateAnimatedEmojiMessageClickedTypeID, UpdateAnimationSearchParametersTypeID, diff --git a/tdapi/tl_search_messages_filter_gen.go b/tdapi/tl_search_messages_filter_gen.go index c86ab0d383..1004489ff5 100644 --- a/tdapi/tl_search_messages_filter_gen.go +++ b/tdapi/tl_search_messages_filter_gen.go @@ -1865,6 +1865,137 @@ func (s *SearchMessagesFilterUnreadMention) DecodeTDLibJSON(b tdjson.Decoder) er }) } +// SearchMessagesFilterUnreadReaction represents TL type `searchMessagesFilterUnreadReaction#adc43100`. +type SearchMessagesFilterUnreadReaction struct { +} + +// SearchMessagesFilterUnreadReactionTypeID is TL type id of SearchMessagesFilterUnreadReaction. +const SearchMessagesFilterUnreadReactionTypeID = 0xadc43100 + +// construct implements constructor of SearchMessagesFilterClass. +func (s SearchMessagesFilterUnreadReaction) construct() SearchMessagesFilterClass { return &s } + +// Ensuring interfaces in compile-time for SearchMessagesFilterUnreadReaction. +var ( + _ bin.Encoder = &SearchMessagesFilterUnreadReaction{} + _ bin.Decoder = &SearchMessagesFilterUnreadReaction{} + _ bin.BareEncoder = &SearchMessagesFilterUnreadReaction{} + _ bin.BareDecoder = &SearchMessagesFilterUnreadReaction{} + + _ SearchMessagesFilterClass = &SearchMessagesFilterUnreadReaction{} +) + +func (s *SearchMessagesFilterUnreadReaction) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *SearchMessagesFilterUnreadReaction) String() string { + if s == nil { + return "SearchMessagesFilterUnreadReaction(nil)" + } + type Alias SearchMessagesFilterUnreadReaction + return fmt.Sprintf("SearchMessagesFilterUnreadReaction%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SearchMessagesFilterUnreadReaction) TypeID() uint32 { + return SearchMessagesFilterUnreadReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*SearchMessagesFilterUnreadReaction) TypeName() string { + return "searchMessagesFilterUnreadReaction" +} + +// TypeInfo returns info about TL type. +func (s *SearchMessagesFilterUnreadReaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "searchMessagesFilterUnreadReaction", + ID: SearchMessagesFilterUnreadReactionTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *SearchMessagesFilterUnreadReaction) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesFilterUnreadReaction#adc43100 as nil") + } + b.PutID(SearchMessagesFilterUnreadReactionTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SearchMessagesFilterUnreadReaction) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesFilterUnreadReaction#adc43100 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SearchMessagesFilterUnreadReaction) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesFilterUnreadReaction#adc43100 to nil") + } + if err := b.ConsumeID(SearchMessagesFilterUnreadReactionTypeID); err != nil { + return fmt.Errorf("unable to decode searchMessagesFilterUnreadReaction#adc43100: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SearchMessagesFilterUnreadReaction) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesFilterUnreadReaction#adc43100 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SearchMessagesFilterUnreadReaction) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode searchMessagesFilterUnreadReaction#adc43100 as nil") + } + b.ObjStart() + b.PutID("searchMessagesFilterUnreadReaction") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SearchMessagesFilterUnreadReaction) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode searchMessagesFilterUnreadReaction#adc43100 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("searchMessagesFilterUnreadReaction"); err != nil { + return fmt.Errorf("unable to decode searchMessagesFilterUnreadReaction#adc43100: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // SearchMessagesFilterFailedToSend represents TL type `searchMessagesFilterFailedToSend#dc74d6fc`. type SearchMessagesFilterFailedToSend struct { } @@ -2152,6 +2283,7 @@ const SearchMessagesFilterClassName = "SearchMessagesFilter" // case *tdapi.SearchMessagesFilterVoiceAndVideoNote: // searchMessagesFilterVoiceAndVideoNote#279680e3 // case *tdapi.SearchMessagesFilterMention: // searchMessagesFilterMention#7748c89c // case *tdapi.SearchMessagesFilterUnreadMention: // searchMessagesFilterUnreadMention#fa4aadc3 +// case *tdapi.SearchMessagesFilterUnreadReaction: // searchMessagesFilterUnreadReaction#adc43100 // case *tdapi.SearchMessagesFilterFailedToSend: // searchMessagesFilterFailedToSend#dc74d6fc // case *tdapi.SearchMessagesFilterPinned: // searchMessagesFilterPinned#16294d48 // default: panic(v) @@ -2283,6 +2415,13 @@ func DecodeSearchMessagesFilter(buf *bin.Buffer) (SearchMessagesFilterClass, err return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) } return &v, nil + case SearchMessagesFilterUnreadReactionTypeID: + // Decoding searchMessagesFilterUnreadReaction#adc43100. + v := SearchMessagesFilterUnreadReaction{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) + } + return &v, nil case SearchMessagesFilterFailedToSendTypeID: // Decoding searchMessagesFilterFailedToSend#dc74d6fc. v := SearchMessagesFilterFailedToSend{} @@ -2407,6 +2546,13 @@ func DecodeTDLibJSONSearchMessagesFilter(buf tdjson.Decoder) (SearchMessagesFilt return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) } return &v, nil + case "searchMessagesFilterUnreadReaction": + // Decoding searchMessagesFilterUnreadReaction#adc43100. + v := SearchMessagesFilterUnreadReaction{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) + } + return &v, nil case "searchMessagesFilterFailedToSend": // Decoding searchMessagesFilterFailedToSend#dc74d6fc. v := SearchMessagesFilterFailedToSend{} diff --git a/tdapi/tl_search_messages_gen.go b/tdapi/tl_search_messages_gen.go index 5a47974229..bd6899973b 100644 --- a/tdapi/tl_search_messages_gen.go +++ b/tdapi/tl_search_messages_gen.go @@ -51,8 +51,8 @@ type SearchMessagesRequest struct { Limit int32 // Additional filter for messages to search; pass null to search for all messages. // Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, - // searchMessagesFilterFailedToSend and searchMessagesFilterPinned are unsupported in - // this function + // searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and + // searchMessagesFilterPinned are unsupported in this function Filter SearchMessagesFilterClass // If not 0, the minimum date of the messages to return MinDate int32 diff --git a/tdapi/tl_search_secret_messages_gen.go b/tdapi/tl_search_secret_messages_gen.go index 644017cf83..33a14a47d1 100644 --- a/tdapi/tl_search_secret_messages_gen.go +++ b/tdapi/tl_search_secret_messages_gen.go @@ -38,7 +38,7 @@ type SearchSecretMessagesRequest struct { // Query to search for. If empty, searchChatMessages must be used instead Query string // Offset of the first entry to return as received from the previous request; use empty - // string to get first chunk of results + // string to get the first chunk of results Offset string // The maximum number of messages to be returned; up to 100. For optimal performance, the // number of returned messages is chosen by TDLib and can be smaller than the specified diff --git a/tdapi/tl_set_chat_available_reactions_gen.go b/tdapi/tl_set_chat_available_reactions_gen.go new file mode 100644 index 0000000000..3ba3180408 --- /dev/null +++ b/tdapi/tl_set_chat_available_reactions_gen.go @@ -0,0 +1,262 @@ +// 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{} +) + +// SetChatAvailableReactionsRequest represents TL type `setChatAvailableReactions#2e5c0f2e`. +type SetChatAvailableReactionsRequest struct { + // Identifier of the chat + ChatID int64 + // New list of reactions, available in the chat. All reactions must be active and order + // of the reactions must be the same as in updateReactions + AvailableReactions []string +} + +// SetChatAvailableReactionsRequestTypeID is TL type id of SetChatAvailableReactionsRequest. +const SetChatAvailableReactionsRequestTypeID = 0x2e5c0f2e + +// Ensuring interfaces in compile-time for SetChatAvailableReactionsRequest. +var ( + _ bin.Encoder = &SetChatAvailableReactionsRequest{} + _ bin.Decoder = &SetChatAvailableReactionsRequest{} + _ bin.BareEncoder = &SetChatAvailableReactionsRequest{} + _ bin.BareDecoder = &SetChatAvailableReactionsRequest{} +) + +func (s *SetChatAvailableReactionsRequest) Zero() bool { + if s == nil { + return true + } + if !(s.ChatID == 0) { + return false + } + if !(s.AvailableReactions == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetChatAvailableReactionsRequest) String() string { + if s == nil { + return "SetChatAvailableReactionsRequest(nil)" + } + type Alias SetChatAvailableReactionsRequest + return fmt.Sprintf("SetChatAvailableReactionsRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetChatAvailableReactionsRequest) TypeID() uint32 { + return SetChatAvailableReactionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetChatAvailableReactionsRequest) TypeName() string { + return "setChatAvailableReactions" +} + +// TypeInfo returns info about TL type. +func (s *SetChatAvailableReactionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setChatAvailableReactions", + ID: SetChatAvailableReactionsRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "AvailableReactions", + SchemaName: "available_reactions", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetChatAvailableReactionsRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setChatAvailableReactions#2e5c0f2e as nil") + } + b.PutID(SetChatAvailableReactionsRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetChatAvailableReactionsRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setChatAvailableReactions#2e5c0f2e as nil") + } + b.PutInt53(s.ChatID) + b.PutInt(len(s.AvailableReactions)) + for _, v := range s.AvailableReactions { + b.PutString(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *SetChatAvailableReactionsRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setChatAvailableReactions#2e5c0f2e to nil") + } + if err := b.ConsumeID(SetChatAvailableReactionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setChatAvailableReactions#2e5c0f2e: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetChatAvailableReactionsRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setChatAvailableReactions#2e5c0f2e to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setChatAvailableReactions#2e5c0f2e: field chat_id: %w", err) + } + s.ChatID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode setChatAvailableReactions#2e5c0f2e: field available_reactions: %w", err) + } + + if headerLen > 0 { + s.AvailableReactions = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setChatAvailableReactions#2e5c0f2e: field available_reactions: %w", err) + } + s.AvailableReactions = append(s.AvailableReactions, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetChatAvailableReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setChatAvailableReactions#2e5c0f2e as nil") + } + b.ObjStart() + b.PutID("setChatAvailableReactions") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(s.ChatID) + b.Comma() + b.FieldStart("available_reactions") + b.ArrStart() + for _, v := range s.AvailableReactions { + b.PutString(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetChatAvailableReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setChatAvailableReactions#2e5c0f2e to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setChatAvailableReactions"); err != nil { + return fmt.Errorf("unable to decode setChatAvailableReactions#2e5c0f2e: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setChatAvailableReactions#2e5c0f2e: field chat_id: %w", err) + } + s.ChatID = value + case "available_reactions": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setChatAvailableReactions#2e5c0f2e: field available_reactions: %w", err) + } + s.AvailableReactions = append(s.AvailableReactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode setChatAvailableReactions#2e5c0f2e: field available_reactions: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (s *SetChatAvailableReactionsRequest) GetChatID() (value int64) { + if s == nil { + return + } + return s.ChatID +} + +// GetAvailableReactions returns value of AvailableReactions field. +func (s *SetChatAvailableReactionsRequest) GetAvailableReactions() (value []string) { + if s == nil { + return + } + return s.AvailableReactions +} + +// SetChatAvailableReactions invokes method setChatAvailableReactions#2e5c0f2e returning error if any. +func (c *Client) SetChatAvailableReactions(ctx context.Context, request *SetChatAvailableReactionsRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_commands_gen.go b/tdapi/tl_set_commands_gen.go index 29b511afe5..64fe6ac09a 100644 --- a/tdapi/tl_set_commands_gen.go +++ b/tdapi/tl_set_commands_gen.go @@ -36,7 +36,7 @@ type SetCommandsRequest struct { // The scope to which the commands are relevant; pass null to change commands in the // default bot command scope Scope BotCommandScopeClass - // A two-letter ISO 639-1 country code. If empty, the commands will be applied to all + // A two-letter ISO 639-1 language code. If empty, the commands will be applied to all // users from the given scope, for which language there are no dedicated commands LanguageCode string // List of the bot's commands diff --git a/tdapi/tl_set_message_reaction_gen.go b/tdapi/tl_set_message_reaction_gen.go new file mode 100644 index 0000000000..83c9173a5d --- /dev/null +++ b/tdapi/tl_set_message_reaction_gen.go @@ -0,0 +1,306 @@ +// 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{} +) + +// SetMessageReactionRequest represents TL type `setMessageReaction#874fab38`. +type SetMessageReactionRequest struct { + // Identifier of the chat to which the message belongs + ChatID int64 + // Identifier of the message + MessageID int64 + // Text representation of the new chosen reaction. Can be an empty string or the + // currently chosen reaction to remove the reaction + Reaction string + // True, if the reaction is added with a big animation + IsBig bool +} + +// SetMessageReactionRequestTypeID is TL type id of SetMessageReactionRequest. +const SetMessageReactionRequestTypeID = 0x874fab38 + +// Ensuring interfaces in compile-time for SetMessageReactionRequest. +var ( + _ bin.Encoder = &SetMessageReactionRequest{} + _ bin.Decoder = &SetMessageReactionRequest{} + _ bin.BareEncoder = &SetMessageReactionRequest{} + _ bin.BareDecoder = &SetMessageReactionRequest{} +) + +func (s *SetMessageReactionRequest) Zero() bool { + if s == nil { + return true + } + if !(s.ChatID == 0) { + return false + } + if !(s.MessageID == 0) { + return false + } + if !(s.Reaction == "") { + return false + } + if !(s.IsBig == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetMessageReactionRequest) String() string { + if s == nil { + return "SetMessageReactionRequest(nil)" + } + type Alias SetMessageReactionRequest + return fmt.Sprintf("SetMessageReactionRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetMessageReactionRequest) TypeID() uint32 { + return SetMessageReactionRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetMessageReactionRequest) TypeName() string { + return "setMessageReaction" +} + +// TypeInfo returns info about TL type. +func (s *SetMessageReactionRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setMessageReaction", + ID: SetMessageReactionRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + { + Name: "Reaction", + SchemaName: "reaction", + }, + { + Name: "IsBig", + SchemaName: "is_big", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetMessageReactionRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setMessageReaction#874fab38 as nil") + } + b.PutID(SetMessageReactionRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetMessageReactionRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setMessageReaction#874fab38 as nil") + } + b.PutInt53(s.ChatID) + b.PutInt53(s.MessageID) + b.PutString(s.Reaction) + b.PutBool(s.IsBig) + return nil +} + +// Decode implements bin.Decoder. +func (s *SetMessageReactionRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setMessageReaction#874fab38 to nil") + } + if err := b.ConsumeID(SetMessageReactionRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetMessageReactionRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setMessageReaction#874fab38 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: field chat_id: %w", err) + } + s.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: field message_id: %w", err) + } + s.MessageID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: field reaction: %w", err) + } + s.Reaction = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: field is_big: %w", err) + } + s.IsBig = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetMessageReactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setMessageReaction#874fab38 as nil") + } + b.ObjStart() + b.PutID("setMessageReaction") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(s.ChatID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(s.MessageID) + b.Comma() + b.FieldStart("reaction") + b.PutString(s.Reaction) + b.Comma() + b.FieldStart("is_big") + b.PutBool(s.IsBig) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetMessageReactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setMessageReaction#874fab38 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setMessageReaction"); err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: field chat_id: %w", err) + } + s.ChatID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: field message_id: %w", err) + } + s.MessageID = value + case "reaction": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: field reaction: %w", err) + } + s.Reaction = value + case "is_big": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode setMessageReaction#874fab38: field is_big: %w", err) + } + s.IsBig = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (s *SetMessageReactionRequest) GetChatID() (value int64) { + if s == nil { + return + } + return s.ChatID +} + +// GetMessageID returns value of MessageID field. +func (s *SetMessageReactionRequest) GetMessageID() (value int64) { + if s == nil { + return + } + return s.MessageID +} + +// GetReaction returns value of Reaction field. +func (s *SetMessageReactionRequest) GetReaction() (value string) { + if s == nil { + return + } + return s.Reaction +} + +// GetIsBig returns value of IsBig field. +func (s *SetMessageReactionRequest) GetIsBig() (value bool) { + if s == nil { + return + } + return s.IsBig +} + +// SetMessageReaction invokes method setMessageReaction#874fab38 returning error if any. +func (c *Client) SetMessageReaction(ctx context.Context, request *SetMessageReactionRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_sticker_set_thumbnail_gen.go b/tdapi/tl_set_sticker_set_thumbnail_gen.go index 5bf99652ec..3af3f41d1e 100644 --- a/tdapi/tl_set_sticker_set_thumbnail_gen.go +++ b/tdapi/tl_set_sticker_set_thumbnail_gen.go @@ -37,8 +37,8 @@ type SetStickerSetThumbnailRequest struct { UserID int64 // Sticker set name Name string - // Thumbnail to set in PNG or TGS format; pass null to remove the sticker set thumbnail. - // Animated thumbnail must be set for animated sticker sets and only for them + // Thumbnail to set in PNG, TGS, or WEBM format; pass null to remove the sticker set + // thumbnail. Thumbnail format must match the format of stickers in the set Thumbnail InputFileClass } diff --git a/tdapi/tl_sticker_gen.go b/tdapi/tl_sticker_gen.go index ba2fbdde70..efaa7c6160 100644 --- a/tdapi/tl_sticker_gen.go +++ b/tdapi/tl_sticker_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Sticker represents TL type `sticker#a5687f28`. +// Sticker represents TL type `sticker#f2a43be4`. type Sticker struct { // The identifier of the sticker set to which the sticker belongs; 0 if none SetID int64 @@ -41,12 +41,8 @@ type Sticker struct { Height int32 // Emoji corresponding to the sticker Emoji string - // True, if the sticker is an animated sticker in TGS format - IsAnimated bool - // True, if the sticker is a mask - IsMask bool - // Position where the mask is placed; may be null - MaskPosition MaskPosition + // Sticker type + Type StickerTypeClass // Sticker's outline represented as a list of closed vector paths; may be empty. The // coordinate system origin is in the upper-left corner Outline []ClosedVectorPath @@ -57,7 +53,7 @@ type Sticker struct { } // StickerTypeID is TL type id of Sticker. -const StickerTypeID = 0xa5687f28 +const StickerTypeID = 0xf2a43be4 // Ensuring interfaces in compile-time for Sticker. var ( @@ -83,13 +79,7 @@ func (s *Sticker) Zero() bool { if !(s.Emoji == "") { return false } - if !(s.IsAnimated == false) { - return false - } - if !(s.IsMask == false) { - return false - } - if !(s.MaskPosition.Zero()) { + if !(s.Type == nil) { return false } if !(s.Outline == nil) { @@ -154,16 +144,8 @@ func (s *Sticker) TypeInfo() tdp.Type { SchemaName: "emoji", }, { - Name: "IsAnimated", - SchemaName: "is_animated", - }, - { - Name: "IsMask", - SchemaName: "is_mask", - }, - { - Name: "MaskPosition", - SchemaName: "mask_position", + Name: "Type", + SchemaName: "type", }, { Name: "Outline", @@ -184,7 +166,7 @@ func (s *Sticker) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *Sticker) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sticker#a5687f28 as nil") + return fmt.Errorf("can't encode sticker#f2a43be4 as nil") } b.PutID(StickerTypeID) return s.EncodeBare(b) @@ -193,28 +175,29 @@ func (s *Sticker) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *Sticker) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sticker#a5687f28 as nil") + return fmt.Errorf("can't encode sticker#f2a43be4 as nil") } b.PutLong(s.SetID) b.PutInt32(s.Width) b.PutInt32(s.Height) b.PutString(s.Emoji) - b.PutBool(s.IsAnimated) - b.PutBool(s.IsMask) - if err := s.MaskPosition.Encode(b); err != nil { - return fmt.Errorf("unable to encode sticker#a5687f28: field mask_position: %w", err) + if s.Type == nil { + return fmt.Errorf("unable to encode sticker#f2a43be4: field type is nil") + } + if err := s.Type.Encode(b); err != nil { + return fmt.Errorf("unable to encode sticker#f2a43be4: field type: %w", err) } b.PutInt(len(s.Outline)) for idx, v := range s.Outline { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare sticker#a5687f28: field outline element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare sticker#f2a43be4: field outline element with index %d: %w", idx, err) } } if err := s.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode sticker#a5687f28: field thumbnail: %w", err) + return fmt.Errorf("unable to encode sticker#f2a43be4: field thumbnail: %w", err) } if err := s.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode sticker#a5687f28: field sticker: %w", err) + return fmt.Errorf("unable to encode sticker#f2a43be4: field sticker: %w", err) } return nil } @@ -222,10 +205,10 @@ func (s *Sticker) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *Sticker) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sticker#a5687f28 to nil") + return fmt.Errorf("can't decode sticker#f2a43be4 to nil") } if err := b.ConsumeID(StickerTypeID); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: %w", err) } return s.DecodeBare(b) } @@ -233,59 +216,47 @@ func (s *Sticker) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *Sticker) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sticker#a5687f28 to nil") + return fmt.Errorf("can't decode sticker#f2a43be4 to nil") } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field set_id: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field set_id: %w", err) } s.SetID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field width: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field width: %w", err) } s.Width = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field height: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field height: %w", err) } s.Height = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field emoji: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field emoji: %w", err) } s.Emoji = value } { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field is_animated: %w", err) - } - s.IsAnimated = value - } - { - value, err := b.Bool() + value, err := DecodeStickerType(b) if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field is_mask: %w", err) - } - s.IsMask = value - } - { - if err := s.MaskPosition.Decode(b); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field mask_position: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field type: %w", err) } + s.Type = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field outline: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field outline: %w", err) } if headerLen > 0 { @@ -294,19 +265,19 @@ func (s *Sticker) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value ClosedVectorPath if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare sticker#a5687f28: field outline: %w", err) + return fmt.Errorf("unable to decode bare sticker#f2a43be4: field outline: %w", err) } s.Outline = append(s.Outline, value) } } { if err := s.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field thumbnail: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field thumbnail: %w", err) } } { if err := s.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field sticker: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field sticker: %w", err) } } return nil @@ -315,7 +286,7 @@ func (s *Sticker) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *Sticker) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode sticker#a5687f28 as nil") + return fmt.Errorf("can't encode sticker#f2a43be4 as nil") } b.ObjStart() b.PutID("sticker") @@ -332,22 +303,19 @@ func (s *Sticker) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("emoji") b.PutString(s.Emoji) b.Comma() - b.FieldStart("is_animated") - b.PutBool(s.IsAnimated) - b.Comma() - b.FieldStart("is_mask") - b.PutBool(s.IsMask) - b.Comma() - b.FieldStart("mask_position") - if err := s.MaskPosition.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sticker#a5687f28: field mask_position: %w", err) + b.FieldStart("type") + if s.Type == nil { + return fmt.Errorf("unable to encode sticker#f2a43be4: field type is nil") + } + if err := s.Type.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode sticker#f2a43be4: field type: %w", err) } b.Comma() b.FieldStart("outline") b.ArrStart() for idx, v := range s.Outline { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sticker#a5687f28: field outline element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode sticker#f2a43be4: field outline element with index %d: %w", idx, err) } b.Comma() } @@ -356,12 +324,12 @@ func (s *Sticker) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("thumbnail") if err := s.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sticker#a5687f28: field thumbnail: %w", err) + return fmt.Errorf("unable to encode sticker#f2a43be4: field thumbnail: %w", err) } b.Comma() b.FieldStart("sticker") if err := s.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sticker#a5687f28: field sticker: %w", err) + return fmt.Errorf("unable to encode sticker#f2a43be4: field sticker: %w", err) } b.Comma() b.StripComma() @@ -372,73 +340,63 @@ func (s *Sticker) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *Sticker) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode sticker#a5687f28 to nil") + return fmt.Errorf("can't decode sticker#f2a43be4 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("sticker"); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: %w", err) } case "set_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field set_id: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field set_id: %w", err) } s.SetID = value case "width": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field width: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field width: %w", err) } s.Width = value case "height": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field height: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field height: %w", err) } s.Height = value case "emoji": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field emoji: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field emoji: %w", err) } s.Emoji = value - case "is_animated": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field is_animated: %w", err) - } - s.IsAnimated = value - case "is_mask": - value, err := b.Bool() + case "type": + value, err := DecodeTDLibJSONStickerType(b) if err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field is_mask: %w", err) - } - s.IsMask = value - case "mask_position": - if err := s.MaskPosition.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field mask_position: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field type: %w", err) } + s.Type = value case "outline": if err := b.Arr(func(b tdjson.Decoder) error { var value ClosedVectorPath if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field outline: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field outline: %w", err) } s.Outline = append(s.Outline, value) return nil }); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field outline: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field outline: %w", err) } case "thumbnail": if err := s.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field thumbnail: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field thumbnail: %w", err) } case "sticker": if err := s.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sticker#a5687f28: field sticker: %w", err) + return fmt.Errorf("unable to decode sticker#f2a43be4: field sticker: %w", err) } default: return b.Skip() @@ -479,28 +437,12 @@ func (s *Sticker) GetEmoji() (value string) { return s.Emoji } -// GetIsAnimated returns value of IsAnimated field. -func (s *Sticker) GetIsAnimated() (value bool) { - if s == nil { - return - } - return s.IsAnimated -} - -// GetIsMask returns value of IsMask field. -func (s *Sticker) GetIsMask() (value bool) { - if s == nil { - return - } - return s.IsMask -} - -// GetMaskPosition returns value of MaskPosition field. -func (s *Sticker) GetMaskPosition() (value MaskPosition) { +// GetType returns value of Type field. +func (s *Sticker) GetType() (value StickerTypeClass) { if s == nil { return } - return s.MaskPosition + return s.Type } // GetOutline returns value of Outline field. diff --git a/tdapi/tl_sticker_set_gen.go b/tdapi/tl_sticker_set_gen.go index 1a83bb3843..b847d4e7bf 100644 --- a/tdapi/tl_sticker_set_gen.go +++ b/tdapi/tl_sticker_set_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StickerSet represents TL type `stickerSet#5ccde520`. +// StickerSet represents TL type `stickerSet#69307c1a`. type StickerSet struct { // Identifier of the sticker set ID int64 @@ -39,8 +39,8 @@ type StickerSet struct { Title string // Name of the sticker set Name string - // Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null. - // The file can be downloaded only before the thumbnail is changed + // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be + // null. The file can be downloaded only before the thumbnail is changed Thumbnail Thumbnail // Sticker set thumbnail's outline represented as a list of closed vector paths; may be // empty. The coordinate system origin is in the upper-left corner @@ -52,10 +52,8 @@ type StickerSet struct { IsArchived bool // True, if the sticker set is official IsOfficial bool - // True, is the stickers in the set are animated - IsAnimated bool - // True, if the stickers in the set are masks - IsMasks bool + // Type of the stickers in the set + StickerType StickerTypeClass // True for already viewed trending sticker sets IsViewed bool // List of stickers in this set @@ -67,7 +65,7 @@ type StickerSet struct { } // StickerSetTypeID is TL type id of StickerSet. -const StickerSetTypeID = 0x5ccde520 +const StickerSetTypeID = 0x69307c1a // Ensuring interfaces in compile-time for StickerSet. var ( @@ -105,10 +103,7 @@ func (s *StickerSet) Zero() bool { if !(s.IsOfficial == false) { return false } - if !(s.IsAnimated == false) { - return false - } - if !(s.IsMasks == false) { + if !(s.StickerType == nil) { return false } if !(s.IsViewed == false) { @@ -189,12 +184,8 @@ func (s *StickerSet) TypeInfo() tdp.Type { SchemaName: "is_official", }, { - Name: "IsAnimated", - SchemaName: "is_animated", - }, - { - Name: "IsMasks", - SchemaName: "is_masks", + Name: "StickerType", + SchemaName: "sticker_type", }, { Name: "IsViewed", @@ -215,7 +206,7 @@ func (s *StickerSet) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *StickerSet) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stickerSet#5ccde520 as nil") + return fmt.Errorf("can't encode stickerSet#69307c1a as nil") } b.PutID(StickerSetTypeID) return s.EncodeBare(b) @@ -224,36 +215,40 @@ func (s *StickerSet) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StickerSet) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stickerSet#5ccde520 as nil") + return fmt.Errorf("can't encode stickerSet#69307c1a as nil") } b.PutLong(s.ID) b.PutString(s.Title) b.PutString(s.Name) if err := s.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#5ccde520: field thumbnail: %w", err) + return fmt.Errorf("unable to encode stickerSet#69307c1a: field thumbnail: %w", err) } b.PutInt(len(s.ThumbnailOutline)) for idx, v := range s.ThumbnailOutline { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickerSet#5ccde520: field thumbnail_outline element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare stickerSet#69307c1a: field thumbnail_outline element with index %d: %w", idx, err) } } b.PutBool(s.IsInstalled) b.PutBool(s.IsArchived) b.PutBool(s.IsOfficial) - b.PutBool(s.IsAnimated) - b.PutBool(s.IsMasks) + if s.StickerType == nil { + return fmt.Errorf("unable to encode stickerSet#69307c1a: field sticker_type is nil") + } + if err := s.StickerType.Encode(b); err != nil { + return fmt.Errorf("unable to encode stickerSet#69307c1a: field sticker_type: %w", err) + } b.PutBool(s.IsViewed) b.PutInt(len(s.Stickers)) for idx, v := range s.Stickers { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickerSet#5ccde520: field stickers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare stickerSet#69307c1a: field stickers element with index %d: %w", idx, err) } } b.PutInt(len(s.Emojis)) for idx, v := range s.Emojis { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickerSet#5ccde520: field emojis element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare stickerSet#69307c1a: field emojis element with index %d: %w", idx, err) } } return nil @@ -262,10 +257,10 @@ func (s *StickerSet) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *StickerSet) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stickerSet#5ccde520 to nil") + return fmt.Errorf("can't decode stickerSet#69307c1a to nil") } if err := b.ConsumeID(StickerSetTypeID); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: %w", err) } return s.DecodeBare(b) } @@ -273,38 +268,38 @@ func (s *StickerSet) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StickerSet) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stickerSet#5ccde520 to nil") + return fmt.Errorf("can't decode stickerSet#69307c1a to nil") } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field id: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field id: %w", err) } s.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field title: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field title: %w", err) } s.Title = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field name: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field name: %w", err) } s.Name = value } { if err := s.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field thumbnail: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field thumbnail: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field thumbnail_outline: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field thumbnail_outline: %w", err) } if headerLen > 0 { @@ -313,7 +308,7 @@ func (s *StickerSet) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value ClosedVectorPath if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickerSet#5ccde520: field thumbnail_outline: %w", err) + return fmt.Errorf("unable to decode bare stickerSet#69307c1a: field thumbnail_outline: %w", err) } s.ThumbnailOutline = append(s.ThumbnailOutline, value) } @@ -321,49 +316,42 @@ func (s *StickerSet) DecodeBare(b *bin.Buffer) error { { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_installed: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field is_installed: %w", err) } s.IsInstalled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_archived: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field is_archived: %w", err) } s.IsArchived = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_official: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field is_official: %w", err) } s.IsOfficial = value } { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_animated: %w", err) - } - s.IsAnimated = value - } - { - value, err := b.Bool() + value, err := DecodeStickerType(b) if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_masks: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field sticker_type: %w", err) } - s.IsMasks = value + s.StickerType = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_viewed: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field is_viewed: %w", err) } s.IsViewed = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field stickers: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field stickers: %w", err) } if headerLen > 0 { @@ -372,7 +360,7 @@ func (s *StickerSet) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value Sticker if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickerSet#5ccde520: field stickers: %w", err) + return fmt.Errorf("unable to decode bare stickerSet#69307c1a: field stickers: %w", err) } s.Stickers = append(s.Stickers, value) } @@ -380,7 +368,7 @@ func (s *StickerSet) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field emojis: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field emojis: %w", err) } if headerLen > 0 { @@ -389,7 +377,7 @@ func (s *StickerSet) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value Emojis if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickerSet#5ccde520: field emojis: %w", err) + return fmt.Errorf("unable to decode bare stickerSet#69307c1a: field emojis: %w", err) } s.Emojis = append(s.Emojis, value) } @@ -400,7 +388,7 @@ func (s *StickerSet) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *StickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode stickerSet#5ccde520 as nil") + return fmt.Errorf("can't encode stickerSet#69307c1a as nil") } b.ObjStart() b.PutID("stickerSet") @@ -416,14 +404,14 @@ func (s *StickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("thumbnail") if err := s.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#5ccde520: field thumbnail: %w", err) + return fmt.Errorf("unable to encode stickerSet#69307c1a: field thumbnail: %w", err) } b.Comma() b.FieldStart("thumbnail_outline") b.ArrStart() for idx, v := range s.ThumbnailOutline { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#5ccde520: field thumbnail_outline element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stickerSet#69307c1a: field thumbnail_outline element with index %d: %w", idx, err) } b.Comma() } @@ -439,11 +427,13 @@ func (s *StickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_official") b.PutBool(s.IsOfficial) b.Comma() - b.FieldStart("is_animated") - b.PutBool(s.IsAnimated) - b.Comma() - b.FieldStart("is_masks") - b.PutBool(s.IsMasks) + b.FieldStart("sticker_type") + if s.StickerType == nil { + return fmt.Errorf("unable to encode stickerSet#69307c1a: field sticker_type is nil") + } + if err := s.StickerType.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode stickerSet#69307c1a: field sticker_type: %w", err) + } b.Comma() b.FieldStart("is_viewed") b.PutBool(s.IsViewed) @@ -452,7 +442,7 @@ func (s *StickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range s.Stickers { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#5ccde520: field stickers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stickerSet#69307c1a: field stickers element with index %d: %w", idx, err) } b.Comma() } @@ -463,7 +453,7 @@ func (s *StickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range s.Emojis { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#5ccde520: field emojis element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stickerSet#69307c1a: field emojis element with index %d: %w", idx, err) } b.Comma() } @@ -478,105 +468,99 @@ func (s *StickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *StickerSet) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode stickerSet#5ccde520 to nil") + return fmt.Errorf("can't decode stickerSet#69307c1a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("stickerSet"); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: %w", err) } case "id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field id: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field id: %w", err) } s.ID = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field title: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field title: %w", err) } s.Title = value case "name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field name: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field name: %w", err) } s.Name = value case "thumbnail": if err := s.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field thumbnail: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field thumbnail: %w", err) } case "thumbnail_outline": if err := b.Arr(func(b tdjson.Decoder) error { var value ClosedVectorPath if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field thumbnail_outline: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field thumbnail_outline: %w", err) } s.ThumbnailOutline = append(s.ThumbnailOutline, value) return nil }); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field thumbnail_outline: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field thumbnail_outline: %w", err) } case "is_installed": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_installed: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field is_installed: %w", err) } s.IsInstalled = value case "is_archived": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_archived: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field is_archived: %w", err) } s.IsArchived = value case "is_official": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_official: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field is_official: %w", err) } s.IsOfficial = value - case "is_animated": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_animated: %w", err) - } - s.IsAnimated = value - case "is_masks": - value, err := b.Bool() + case "sticker_type": + value, err := DecodeTDLibJSONStickerType(b) if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_masks: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field sticker_type: %w", err) } - s.IsMasks = value + s.StickerType = value case "is_viewed": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field is_viewed: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field is_viewed: %w", err) } s.IsViewed = value case "stickers": if err := b.Arr(func(b tdjson.Decoder) error { var value Sticker if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field stickers: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field stickers: %w", err) } s.Stickers = append(s.Stickers, value) return nil }); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field stickers: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field stickers: %w", err) } case "emojis": if err := b.Arr(func(b tdjson.Decoder) error { var value Emojis if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field emojis: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field emojis: %w", err) } s.Emojis = append(s.Emojis, value) return nil }); err != nil { - return fmt.Errorf("unable to decode stickerSet#5ccde520: field emojis: %w", err) + return fmt.Errorf("unable to decode stickerSet#69307c1a: field emojis: %w", err) } default: return b.Skip() @@ -649,20 +633,12 @@ func (s *StickerSet) GetIsOfficial() (value bool) { return s.IsOfficial } -// GetIsAnimated returns value of IsAnimated field. -func (s *StickerSet) GetIsAnimated() (value bool) { - if s == nil { - return - } - return s.IsAnimated -} - -// GetIsMasks returns value of IsMasks field. -func (s *StickerSet) GetIsMasks() (value bool) { +// GetStickerType returns value of StickerType field. +func (s *StickerSet) GetStickerType() (value StickerTypeClass) { if s == nil { return } - return s.IsMasks + return s.StickerType } // GetIsViewed returns value of IsViewed field. diff --git a/tdapi/tl_sticker_set_info_gen.go b/tdapi/tl_sticker_set_info_gen.go index c0ab151875..61d4177832 100644 --- a/tdapi/tl_sticker_set_info_gen.go +++ b/tdapi/tl_sticker_set_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StickerSetInfo represents TL type `stickerSetInfo#aba733ac`. +// StickerSetInfo represents TL type `stickerSetInfo#1f54c66b`. type StickerSetInfo struct { // Identifier of the sticker set ID int64 @@ -39,7 +39,8 @@ type StickerSetInfo struct { Title string // Name of the sticker set Name string - // Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null + // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be + // null Thumbnail Thumbnail // Sticker set thumbnail's outline represented as a list of closed vector paths; may be // empty. The coordinate system origin is in the upper-left corner @@ -51,10 +52,8 @@ type StickerSetInfo struct { IsArchived bool // True, if the sticker set is official IsOfficial bool - // True, is the stickers in the set are animated - IsAnimated bool - // True, if the stickers in the set are masks - IsMasks bool + // Type of the stickers in the set + StickerType StickerTypeClass // True for already viewed trending sticker sets IsViewed bool // Total number of stickers in the set @@ -65,7 +64,7 @@ type StickerSetInfo struct { } // StickerSetInfoTypeID is TL type id of StickerSetInfo. -const StickerSetInfoTypeID = 0xaba733ac +const StickerSetInfoTypeID = 0x1f54c66b // Ensuring interfaces in compile-time for StickerSetInfo. var ( @@ -103,10 +102,7 @@ func (s *StickerSetInfo) Zero() bool { if !(s.IsOfficial == false) { return false } - if !(s.IsAnimated == false) { - return false - } - if !(s.IsMasks == false) { + if !(s.StickerType == nil) { return false } if !(s.IsViewed == false) { @@ -187,12 +183,8 @@ func (s *StickerSetInfo) TypeInfo() tdp.Type { SchemaName: "is_official", }, { - Name: "IsAnimated", - SchemaName: "is_animated", - }, - { - Name: "IsMasks", - SchemaName: "is_masks", + Name: "StickerType", + SchemaName: "sticker_type", }, { Name: "IsViewed", @@ -213,7 +205,7 @@ func (s *StickerSetInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *StickerSetInfo) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stickerSetInfo#aba733ac as nil") + return fmt.Errorf("can't encode stickerSetInfo#1f54c66b as nil") } b.PutID(StickerSetInfoTypeID) return s.EncodeBare(b) @@ -222,31 +214,35 @@ func (s *StickerSetInfo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StickerSetInfo) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stickerSetInfo#aba733ac as nil") + return fmt.Errorf("can't encode stickerSetInfo#1f54c66b as nil") } b.PutLong(s.ID) b.PutString(s.Title) b.PutString(s.Name) if err := s.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#aba733ac: field thumbnail: %w", err) + return fmt.Errorf("unable to encode stickerSetInfo#1f54c66b: field thumbnail: %w", err) } b.PutInt(len(s.ThumbnailOutline)) for idx, v := range s.ThumbnailOutline { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickerSetInfo#aba733ac: field thumbnail_outline element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare stickerSetInfo#1f54c66b: field thumbnail_outline element with index %d: %w", idx, err) } } b.PutBool(s.IsInstalled) b.PutBool(s.IsArchived) b.PutBool(s.IsOfficial) - b.PutBool(s.IsAnimated) - b.PutBool(s.IsMasks) + if s.StickerType == nil { + return fmt.Errorf("unable to encode stickerSetInfo#1f54c66b: field sticker_type is nil") + } + if err := s.StickerType.Encode(b); err != nil { + return fmt.Errorf("unable to encode stickerSetInfo#1f54c66b: field sticker_type: %w", err) + } b.PutBool(s.IsViewed) b.PutInt32(s.Size) b.PutInt(len(s.Covers)) for idx, v := range s.Covers { if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickerSetInfo#aba733ac: field covers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare stickerSetInfo#1f54c66b: field covers element with index %d: %w", idx, err) } } return nil @@ -255,10 +251,10 @@ func (s *StickerSetInfo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *StickerSetInfo) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stickerSetInfo#aba733ac to nil") + return fmt.Errorf("can't decode stickerSetInfo#1f54c66b to nil") } if err := b.ConsumeID(StickerSetInfoTypeID); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: %w", err) } return s.DecodeBare(b) } @@ -266,38 +262,38 @@ func (s *StickerSetInfo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StickerSetInfo) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stickerSetInfo#aba733ac to nil") + return fmt.Errorf("can't decode stickerSetInfo#1f54c66b to nil") } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field id: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field id: %w", err) } s.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field title: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field title: %w", err) } s.Title = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field name: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field name: %w", err) } s.Name = value } { if err := s.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field thumbnail: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field thumbnail: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field thumbnail_outline: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field thumbnail_outline: %w", err) } if headerLen > 0 { @@ -306,7 +302,7 @@ func (s *StickerSetInfo) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value ClosedVectorPath if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickerSetInfo#aba733ac: field thumbnail_outline: %w", err) + return fmt.Errorf("unable to decode bare stickerSetInfo#1f54c66b: field thumbnail_outline: %w", err) } s.ThumbnailOutline = append(s.ThumbnailOutline, value) } @@ -314,56 +310,49 @@ func (s *StickerSetInfo) DecodeBare(b *bin.Buffer) error { { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_installed: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field is_installed: %w", err) } s.IsInstalled = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_archived: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field is_archived: %w", err) } s.IsArchived = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_official: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field is_official: %w", err) } s.IsOfficial = value } { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_animated: %w", err) - } - s.IsAnimated = value - } - { - value, err := b.Bool() + value, err := DecodeStickerType(b) if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_masks: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field sticker_type: %w", err) } - s.IsMasks = value + s.StickerType = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_viewed: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field is_viewed: %w", err) } s.IsViewed = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field size: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field size: %w", err) } s.Size = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field covers: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field covers: %w", err) } if headerLen > 0 { @@ -372,7 +361,7 @@ func (s *StickerSetInfo) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value Sticker if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickerSetInfo#aba733ac: field covers: %w", err) + return fmt.Errorf("unable to decode bare stickerSetInfo#1f54c66b: field covers: %w", err) } s.Covers = append(s.Covers, value) } @@ -383,7 +372,7 @@ func (s *StickerSetInfo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *StickerSetInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode stickerSetInfo#aba733ac as nil") + return fmt.Errorf("can't encode stickerSetInfo#1f54c66b as nil") } b.ObjStart() b.PutID("stickerSetInfo") @@ -399,14 +388,14 @@ func (s *StickerSetInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("thumbnail") if err := s.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#aba733ac: field thumbnail: %w", err) + return fmt.Errorf("unable to encode stickerSetInfo#1f54c66b: field thumbnail: %w", err) } b.Comma() b.FieldStart("thumbnail_outline") b.ArrStart() for idx, v := range s.ThumbnailOutline { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#aba733ac: field thumbnail_outline element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stickerSetInfo#1f54c66b: field thumbnail_outline element with index %d: %w", idx, err) } b.Comma() } @@ -422,11 +411,13 @@ func (s *StickerSetInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_official") b.PutBool(s.IsOfficial) b.Comma() - b.FieldStart("is_animated") - b.PutBool(s.IsAnimated) - b.Comma() - b.FieldStart("is_masks") - b.PutBool(s.IsMasks) + b.FieldStart("sticker_type") + if s.StickerType == nil { + return fmt.Errorf("unable to encode stickerSetInfo#1f54c66b: field sticker_type is nil") + } + if err := s.StickerType.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode stickerSetInfo#1f54c66b: field sticker_type: %w", err) + } b.Comma() b.FieldStart("is_viewed") b.PutBool(s.IsViewed) @@ -438,7 +429,7 @@ func (s *StickerSetInfo) EncodeTDLibJSON(b tdjson.Encoder) error { b.ArrStart() for idx, v := range s.Covers { if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#aba733ac: field covers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stickerSetInfo#1f54c66b: field covers element with index %d: %w", idx, err) } b.Comma() } @@ -453,100 +444,94 @@ func (s *StickerSetInfo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *StickerSetInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode stickerSetInfo#aba733ac to nil") + return fmt.Errorf("can't decode stickerSetInfo#1f54c66b to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("stickerSetInfo"); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: %w", err) } case "id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field id: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field id: %w", err) } s.ID = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field title: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field title: %w", err) } s.Title = value case "name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field name: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field name: %w", err) } s.Name = value case "thumbnail": if err := s.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field thumbnail: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field thumbnail: %w", err) } case "thumbnail_outline": if err := b.Arr(func(b tdjson.Decoder) error { var value ClosedVectorPath if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field thumbnail_outline: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field thumbnail_outline: %w", err) } s.ThumbnailOutline = append(s.ThumbnailOutline, value) return nil }); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field thumbnail_outline: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field thumbnail_outline: %w", err) } case "is_installed": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_installed: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field is_installed: %w", err) } s.IsInstalled = value case "is_archived": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_archived: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field is_archived: %w", err) } s.IsArchived = value case "is_official": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_official: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field is_official: %w", err) } s.IsOfficial = value - case "is_animated": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_animated: %w", err) - } - s.IsAnimated = value - case "is_masks": - value, err := b.Bool() + case "sticker_type": + value, err := DecodeTDLibJSONStickerType(b) if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_masks: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field sticker_type: %w", err) } - s.IsMasks = value + s.StickerType = value case "is_viewed": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field is_viewed: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field is_viewed: %w", err) } s.IsViewed = value case "size": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field size: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field size: %w", err) } s.Size = value case "covers": if err := b.Arr(func(b tdjson.Decoder) error { var value Sticker if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field covers: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field covers: %w", err) } s.Covers = append(s.Covers, value) return nil }); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#aba733ac: field covers: %w", err) + return fmt.Errorf("unable to decode stickerSetInfo#1f54c66b: field covers: %w", err) } default: return b.Skip() @@ -619,20 +604,12 @@ func (s *StickerSetInfo) GetIsOfficial() (value bool) { return s.IsOfficial } -// GetIsAnimated returns value of IsAnimated field. -func (s *StickerSetInfo) GetIsAnimated() (value bool) { - if s == nil { - return - } - return s.IsAnimated -} - -// GetIsMasks returns value of IsMasks field. -func (s *StickerSetInfo) GetIsMasks() (value bool) { +// GetStickerType returns value of StickerType field. +func (s *StickerSetInfo) GetStickerType() (value StickerTypeClass) { if s == nil { return } - return s.IsMasks + return s.StickerType } // GetIsViewed returns value of IsViewed field. diff --git a/tdapi/tl_sticker_type_gen.go b/tdapi/tl_sticker_type_gen.go new file mode 100644 index 0000000000..0686303c48 --- /dev/null +++ b/tdapi/tl_sticker_type_gen.go @@ -0,0 +1,757 @@ +// 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{} +) + +// StickerTypeStatic represents TL type `stickerTypeStatic#6b8e3cd1`. +type StickerTypeStatic struct { +} + +// StickerTypeStaticTypeID is TL type id of StickerTypeStatic. +const StickerTypeStaticTypeID = 0x6b8e3cd1 + +// construct implements constructor of StickerTypeClass. +func (s StickerTypeStatic) construct() StickerTypeClass { return &s } + +// Ensuring interfaces in compile-time for StickerTypeStatic. +var ( + _ bin.Encoder = &StickerTypeStatic{} + _ bin.Decoder = &StickerTypeStatic{} + _ bin.BareEncoder = &StickerTypeStatic{} + _ bin.BareDecoder = &StickerTypeStatic{} + + _ StickerTypeClass = &StickerTypeStatic{} +) + +func (s *StickerTypeStatic) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *StickerTypeStatic) String() string { + if s == nil { + return "StickerTypeStatic(nil)" + } + type Alias StickerTypeStatic + return fmt.Sprintf("StickerTypeStatic%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StickerTypeStatic) TypeID() uint32 { + return StickerTypeStaticTypeID +} + +// TypeName returns name of type in TL schema. +func (*StickerTypeStatic) TypeName() string { + return "stickerTypeStatic" +} + +// TypeInfo returns info about TL type. +func (s *StickerTypeStatic) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stickerTypeStatic", + ID: StickerTypeStaticTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *StickerTypeStatic) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeStatic#6b8e3cd1 as nil") + } + b.PutID(StickerTypeStaticTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StickerTypeStatic) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeStatic#6b8e3cd1 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StickerTypeStatic) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeStatic#6b8e3cd1 to nil") + } + if err := b.ConsumeID(StickerTypeStaticTypeID); err != nil { + return fmt.Errorf("unable to decode stickerTypeStatic#6b8e3cd1: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StickerTypeStatic) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeStatic#6b8e3cd1 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StickerTypeStatic) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeStatic#6b8e3cd1 as nil") + } + b.ObjStart() + b.PutID("stickerTypeStatic") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StickerTypeStatic) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeStatic#6b8e3cd1 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("stickerTypeStatic"); err != nil { + return fmt.Errorf("unable to decode stickerTypeStatic#6b8e3cd1: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// StickerTypeAnimated represents TL type `stickerTypeAnimated#691926ad`. +type StickerTypeAnimated struct { +} + +// StickerTypeAnimatedTypeID is TL type id of StickerTypeAnimated. +const StickerTypeAnimatedTypeID = 0x691926ad + +// construct implements constructor of StickerTypeClass. +func (s StickerTypeAnimated) construct() StickerTypeClass { return &s } + +// Ensuring interfaces in compile-time for StickerTypeAnimated. +var ( + _ bin.Encoder = &StickerTypeAnimated{} + _ bin.Decoder = &StickerTypeAnimated{} + _ bin.BareEncoder = &StickerTypeAnimated{} + _ bin.BareDecoder = &StickerTypeAnimated{} + + _ StickerTypeClass = &StickerTypeAnimated{} +) + +func (s *StickerTypeAnimated) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *StickerTypeAnimated) String() string { + if s == nil { + return "StickerTypeAnimated(nil)" + } + type Alias StickerTypeAnimated + return fmt.Sprintf("StickerTypeAnimated%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StickerTypeAnimated) TypeID() uint32 { + return StickerTypeAnimatedTypeID +} + +// TypeName returns name of type in TL schema. +func (*StickerTypeAnimated) TypeName() string { + return "stickerTypeAnimated" +} + +// TypeInfo returns info about TL type. +func (s *StickerTypeAnimated) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stickerTypeAnimated", + ID: StickerTypeAnimatedTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *StickerTypeAnimated) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeAnimated#691926ad as nil") + } + b.PutID(StickerTypeAnimatedTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StickerTypeAnimated) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeAnimated#691926ad as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StickerTypeAnimated) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeAnimated#691926ad to nil") + } + if err := b.ConsumeID(StickerTypeAnimatedTypeID); err != nil { + return fmt.Errorf("unable to decode stickerTypeAnimated#691926ad: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StickerTypeAnimated) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeAnimated#691926ad to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StickerTypeAnimated) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeAnimated#691926ad as nil") + } + b.ObjStart() + b.PutID("stickerTypeAnimated") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StickerTypeAnimated) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeAnimated#691926ad to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("stickerTypeAnimated"); err != nil { + return fmt.Errorf("unable to decode stickerTypeAnimated#691926ad: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// StickerTypeVideo represents TL type `stickerTypeVideo#1f22af74`. +type StickerTypeVideo struct { +} + +// StickerTypeVideoTypeID is TL type id of StickerTypeVideo. +const StickerTypeVideoTypeID = 0x1f22af74 + +// construct implements constructor of StickerTypeClass. +func (s StickerTypeVideo) construct() StickerTypeClass { return &s } + +// Ensuring interfaces in compile-time for StickerTypeVideo. +var ( + _ bin.Encoder = &StickerTypeVideo{} + _ bin.Decoder = &StickerTypeVideo{} + _ bin.BareEncoder = &StickerTypeVideo{} + _ bin.BareDecoder = &StickerTypeVideo{} + + _ StickerTypeClass = &StickerTypeVideo{} +) + +func (s *StickerTypeVideo) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *StickerTypeVideo) String() string { + if s == nil { + return "StickerTypeVideo(nil)" + } + type Alias StickerTypeVideo + return fmt.Sprintf("StickerTypeVideo%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StickerTypeVideo) TypeID() uint32 { + return StickerTypeVideoTypeID +} + +// TypeName returns name of type in TL schema. +func (*StickerTypeVideo) TypeName() string { + return "stickerTypeVideo" +} + +// TypeInfo returns info about TL type. +func (s *StickerTypeVideo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stickerTypeVideo", + ID: StickerTypeVideoTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *StickerTypeVideo) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeVideo#1f22af74 as nil") + } + b.PutID(StickerTypeVideoTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StickerTypeVideo) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeVideo#1f22af74 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StickerTypeVideo) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeVideo#1f22af74 to nil") + } + if err := b.ConsumeID(StickerTypeVideoTypeID); err != nil { + return fmt.Errorf("unable to decode stickerTypeVideo#1f22af74: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StickerTypeVideo) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeVideo#1f22af74 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StickerTypeVideo) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeVideo#1f22af74 as nil") + } + b.ObjStart() + b.PutID("stickerTypeVideo") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StickerTypeVideo) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeVideo#1f22af74 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("stickerTypeVideo"); err != nil { + return fmt.Errorf("unable to decode stickerTypeVideo#1f22af74: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// StickerTypeMask represents TL type `stickerTypeMask#cdf254e3`. +type StickerTypeMask struct { + // Position where the mask is placed; may be null + MaskPosition MaskPosition +} + +// StickerTypeMaskTypeID is TL type id of StickerTypeMask. +const StickerTypeMaskTypeID = 0xcdf254e3 + +// construct implements constructor of StickerTypeClass. +func (s StickerTypeMask) construct() StickerTypeClass { return &s } + +// Ensuring interfaces in compile-time for StickerTypeMask. +var ( + _ bin.Encoder = &StickerTypeMask{} + _ bin.Decoder = &StickerTypeMask{} + _ bin.BareEncoder = &StickerTypeMask{} + _ bin.BareDecoder = &StickerTypeMask{} + + _ StickerTypeClass = &StickerTypeMask{} +) + +func (s *StickerTypeMask) Zero() bool { + if s == nil { + return true + } + if !(s.MaskPosition.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StickerTypeMask) String() string { + if s == nil { + return "StickerTypeMask(nil)" + } + type Alias StickerTypeMask + return fmt.Sprintf("StickerTypeMask%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StickerTypeMask) TypeID() uint32 { + return StickerTypeMaskTypeID +} + +// TypeName returns name of type in TL schema. +func (*StickerTypeMask) TypeName() string { + return "stickerTypeMask" +} + +// TypeInfo returns info about TL type. +func (s *StickerTypeMask) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stickerTypeMask", + ID: StickerTypeMaskTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MaskPosition", + SchemaName: "mask_position", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StickerTypeMask) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeMask#cdf254e3 as nil") + } + b.PutID(StickerTypeMaskTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StickerTypeMask) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeMask#cdf254e3 as nil") + } + if err := s.MaskPosition.Encode(b); err != nil { + return fmt.Errorf("unable to encode stickerTypeMask#cdf254e3: field mask_position: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StickerTypeMask) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeMask#cdf254e3 to nil") + } + if err := b.ConsumeID(StickerTypeMaskTypeID); err != nil { + return fmt.Errorf("unable to decode stickerTypeMask#cdf254e3: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StickerTypeMask) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeMask#cdf254e3 to nil") + } + { + if err := s.MaskPosition.Decode(b); err != nil { + return fmt.Errorf("unable to decode stickerTypeMask#cdf254e3: field mask_position: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StickerTypeMask) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode stickerTypeMask#cdf254e3 as nil") + } + b.ObjStart() + b.PutID("stickerTypeMask") + b.Comma() + b.FieldStart("mask_position") + if err := s.MaskPosition.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode stickerTypeMask#cdf254e3: field mask_position: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StickerTypeMask) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode stickerTypeMask#cdf254e3 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("stickerTypeMask"); err != nil { + return fmt.Errorf("unable to decode stickerTypeMask#cdf254e3: %w", err) + } + case "mask_position": + if err := s.MaskPosition.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode stickerTypeMask#cdf254e3: field mask_position: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetMaskPosition returns value of MaskPosition field. +func (s *StickerTypeMask) GetMaskPosition() (value MaskPosition) { + if s == nil { + return + } + return s.MaskPosition +} + +// StickerTypeClassName is schema name of StickerTypeClass. +const StickerTypeClassName = "StickerType" + +// StickerTypeClass represents StickerType generic type. +// +// Example: +// g, err := tdapi.DecodeStickerType(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tdapi.StickerTypeStatic: // stickerTypeStatic#6b8e3cd1 +// case *tdapi.StickerTypeAnimated: // stickerTypeAnimated#691926ad +// case *tdapi.StickerTypeVideo: // stickerTypeVideo#1f22af74 +// case *tdapi.StickerTypeMask: // stickerTypeMask#cdf254e3 +// default: panic(v) +// } +type StickerTypeClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() StickerTypeClass + + // 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 +} + +// DecodeStickerType implements binary de-serialization for StickerTypeClass. +func DecodeStickerType(buf *bin.Buffer) (StickerTypeClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case StickerTypeStaticTypeID: + // Decoding stickerTypeStatic#6b8e3cd1. + v := StickerTypeStatic{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) + } + return &v, nil + case StickerTypeAnimatedTypeID: + // Decoding stickerTypeAnimated#691926ad. + v := StickerTypeAnimated{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) + } + return &v, nil + case StickerTypeVideoTypeID: + // Decoding stickerTypeVideo#1f22af74. + v := StickerTypeVideo{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) + } + return &v, nil + case StickerTypeMaskTypeID: + // Decoding stickerTypeMask#cdf254e3. + v := StickerTypeMask{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", bin.NewUnexpectedID(id)) + } +} + +// DecodeTDLibJSONStickerType implements binary de-serialization for StickerTypeClass. +func DecodeTDLibJSONStickerType(buf tdjson.Decoder) (StickerTypeClass, error) { + id, err := buf.FindTypeID() + if err != nil { + return nil, err + } + switch id { + case "stickerTypeStatic": + // Decoding stickerTypeStatic#6b8e3cd1. + v := StickerTypeStatic{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) + } + return &v, nil + case "stickerTypeAnimated": + // Decoding stickerTypeAnimated#691926ad. + v := StickerTypeAnimated{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) + } + return &v, nil + case "stickerTypeVideo": + // Decoding stickerTypeVideo#1f22af74. + v := StickerTypeVideo{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) + } + return &v, nil + case "stickerTypeMask": + // Decoding stickerTypeMask#cdf254e3. + v := StickerTypeMask{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", tdjson.NewUnexpectedID(id)) + } +} + +// StickerType boxes the StickerTypeClass providing a helper. +type StickerTypeBox struct { + StickerType StickerTypeClass +} + +// Decode implements bin.Decoder for StickerTypeBox. +func (b *StickerTypeBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode StickerTypeBox to nil") + } + v, err := DecodeStickerType(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StickerType = v + return nil +} + +// Encode implements bin.Encode for StickerTypeBox. +func (b *StickerTypeBox) Encode(buf *bin.Buffer) error { + if b == nil || b.StickerType == nil { + return fmt.Errorf("unable to encode StickerTypeClass as nil") + } + return b.StickerType.Encode(buf) +} + +// DecodeTDLibJSON implements bin.Decoder for StickerTypeBox. +func (b *StickerTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("unable to decode StickerTypeBox to nil") + } + v, err := DecodeTDLibJSONStickerType(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StickerType = v + return nil +} + +// EncodeTDLibJSON implements bin.Encode for StickerTypeBox. +func (b *StickerTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil || b.StickerType == nil { + return fmt.Errorf("unable to encode StickerTypeClass as nil") + } + return b.StickerType.EncodeTDLibJSON(buf) +} diff --git a/tdapi/tl_supergroup_full_info_gen.go b/tdapi/tl_supergroup_full_info_gen.go index 20074971b0..f5e6d99a3e 100644 --- a/tdapi/tl_supergroup_full_info_gen.go +++ b/tdapi/tl_supergroup_full_info_gen.go @@ -74,7 +74,7 @@ type SupergroupFullInfo struct { StickerSetID int64 // Location to which the supergroup is connected; may be null Location ChatLocation - // Primary invite link for this chat; may be null. For chat administrators with + // Primary invite link for the chat; may be null. For chat administrators with // can_invite_users right only InviteLink ChatInviteLink // List of commands of bots in the group diff --git a/tdapi/tl_thumbnail_format_gen.go b/tdapi/tl_thumbnail_format_gen.go index 4a4b38d118..58f9f8c016 100644 --- a/tdapi/tl_thumbnail_format_gen.go +++ b/tdapi/tl_thumbnail_format_gen.go @@ -162,27 +162,27 @@ func (t *ThumbnailFormatJpeg) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// ThumbnailFormatPng represents TL type `thumbnailFormatPng#5e0697f5`. -type ThumbnailFormatPng struct { +// ThumbnailFormatGif represents TL type `thumbnailFormatGif#4aa3258a`. +type ThumbnailFormatGif struct { } -// ThumbnailFormatPngTypeID is TL type id of ThumbnailFormatPng. -const ThumbnailFormatPngTypeID = 0x5e0697f5 +// ThumbnailFormatGifTypeID is TL type id of ThumbnailFormatGif. +const ThumbnailFormatGifTypeID = 0x4aa3258a // construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatPng) construct() ThumbnailFormatClass { return &t } +func (t ThumbnailFormatGif) construct() ThumbnailFormatClass { return &t } -// Ensuring interfaces in compile-time for ThumbnailFormatPng. +// Ensuring interfaces in compile-time for ThumbnailFormatGif. var ( - _ bin.Encoder = &ThumbnailFormatPng{} - _ bin.Decoder = &ThumbnailFormatPng{} - _ bin.BareEncoder = &ThumbnailFormatPng{} - _ bin.BareDecoder = &ThumbnailFormatPng{} + _ bin.Encoder = &ThumbnailFormatGif{} + _ bin.Decoder = &ThumbnailFormatGif{} + _ bin.BareEncoder = &ThumbnailFormatGif{} + _ bin.BareDecoder = &ThumbnailFormatGif{} - _ ThumbnailFormatClass = &ThumbnailFormatPng{} + _ ThumbnailFormatClass = &ThumbnailFormatGif{} ) -func (t *ThumbnailFormatPng) Zero() bool { +func (t *ThumbnailFormatGif) Zero() bool { if t == nil { return true } @@ -191,31 +191,31 @@ func (t *ThumbnailFormatPng) Zero() bool { } // String implements fmt.Stringer. -func (t *ThumbnailFormatPng) String() string { +func (t *ThumbnailFormatGif) String() string { if t == nil { - return "ThumbnailFormatPng(nil)" + return "ThumbnailFormatGif(nil)" } - type Alias ThumbnailFormatPng - return fmt.Sprintf("ThumbnailFormatPng%+v", Alias(*t)) + type Alias ThumbnailFormatGif + return fmt.Sprintf("ThumbnailFormatGif%+v", Alias(*t)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatPng) TypeID() uint32 { - return ThumbnailFormatPngTypeID +func (*ThumbnailFormatGif) TypeID() uint32 { + return ThumbnailFormatGifTypeID } // TypeName returns name of type in TL schema. -func (*ThumbnailFormatPng) TypeName() string { - return "thumbnailFormatPng" +func (*ThumbnailFormatGif) TypeName() string { + return "thumbnailFormatGif" } // TypeInfo returns info about TL type. -func (t *ThumbnailFormatPng) TypeInfo() tdp.Type { +func (t *ThumbnailFormatGif) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "thumbnailFormatPng", - ID: ThumbnailFormatPngTypeID, + Name: "thumbnailFormatGif", + ID: ThumbnailFormatGifTypeID, } if t == nil { typ.Null = true @@ -226,48 +226,48 @@ func (t *ThumbnailFormatPng) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (t *ThumbnailFormatPng) Encode(b *bin.Buffer) error { +func (t *ThumbnailFormatGif) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatPng#5e0697f5 as nil") + return fmt.Errorf("can't encode thumbnailFormatGif#4aa3258a as nil") } - b.PutID(ThumbnailFormatPngTypeID) + b.PutID(ThumbnailFormatGifTypeID) return t.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatPng) EncodeBare(b *bin.Buffer) error { +func (t *ThumbnailFormatGif) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatPng#5e0697f5 as nil") + return fmt.Errorf("can't encode thumbnailFormatGif#4aa3258a as nil") } return nil } // Decode implements bin.Decoder. -func (t *ThumbnailFormatPng) Decode(b *bin.Buffer) error { +func (t *ThumbnailFormatGif) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatPng#5e0697f5 to nil") + return fmt.Errorf("can't decode thumbnailFormatGif#4aa3258a to nil") } - if err := b.ConsumeID(ThumbnailFormatPngTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatPng#5e0697f5: %w", err) + if err := b.ConsumeID(ThumbnailFormatGifTypeID); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatGif#4aa3258a: %w", err) } return t.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatPng) DecodeBare(b *bin.Buffer) error { +func (t *ThumbnailFormatGif) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatPng#5e0697f5 to nil") + return fmt.Errorf("can't decode thumbnailFormatGif#4aa3258a to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatPng) EncodeTDLibJSON(b tdjson.Encoder) error { +func (t *ThumbnailFormatGif) EncodeTDLibJSON(b tdjson.Encoder) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatPng#5e0697f5 as nil") + return fmt.Errorf("can't encode thumbnailFormatGif#4aa3258a as nil") } b.ObjStart() - b.PutID("thumbnailFormatPng") + b.PutID("thumbnailFormatGif") b.Comma() b.StripComma() b.ObjEnd() @@ -275,16 +275,16 @@ func (t *ThumbnailFormatPng) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatPng) DecodeTDLibJSON(b tdjson.Decoder) error { +func (t *ThumbnailFormatGif) DecodeTDLibJSON(b tdjson.Decoder) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatPng#5e0697f5 to nil") + return fmt.Errorf("can't decode thumbnailFormatGif#4aa3258a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatPng"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatPng#5e0697f5: %w", err) + if err := b.ConsumeID("thumbnailFormatGif"); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatGif#4aa3258a: %w", err) } default: return b.Skip() @@ -293,27 +293,27 @@ func (t *ThumbnailFormatPng) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// ThumbnailFormatWebp represents TL type `thumbnailFormatWebp#fcce4c12`. -type ThumbnailFormatWebp struct { +// ThumbnailFormatMpeg4 represents TL type `thumbnailFormatMpeg4#109b57fe`. +type ThumbnailFormatMpeg4 struct { } -// ThumbnailFormatWebpTypeID is TL type id of ThumbnailFormatWebp. -const ThumbnailFormatWebpTypeID = 0xfcce4c12 +// ThumbnailFormatMpeg4TypeID is TL type id of ThumbnailFormatMpeg4. +const ThumbnailFormatMpeg4TypeID = 0x109b57fe // construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatWebp) construct() ThumbnailFormatClass { return &t } +func (t ThumbnailFormatMpeg4) construct() ThumbnailFormatClass { return &t } -// Ensuring interfaces in compile-time for ThumbnailFormatWebp. +// Ensuring interfaces in compile-time for ThumbnailFormatMpeg4. var ( - _ bin.Encoder = &ThumbnailFormatWebp{} - _ bin.Decoder = &ThumbnailFormatWebp{} - _ bin.BareEncoder = &ThumbnailFormatWebp{} - _ bin.BareDecoder = &ThumbnailFormatWebp{} + _ bin.Encoder = &ThumbnailFormatMpeg4{} + _ bin.Decoder = &ThumbnailFormatMpeg4{} + _ bin.BareEncoder = &ThumbnailFormatMpeg4{} + _ bin.BareDecoder = &ThumbnailFormatMpeg4{} - _ ThumbnailFormatClass = &ThumbnailFormatWebp{} + _ ThumbnailFormatClass = &ThumbnailFormatMpeg4{} ) -func (t *ThumbnailFormatWebp) Zero() bool { +func (t *ThumbnailFormatMpeg4) Zero() bool { if t == nil { return true } @@ -322,31 +322,31 @@ func (t *ThumbnailFormatWebp) Zero() bool { } // String implements fmt.Stringer. -func (t *ThumbnailFormatWebp) String() string { +func (t *ThumbnailFormatMpeg4) String() string { if t == nil { - return "ThumbnailFormatWebp(nil)" + return "ThumbnailFormatMpeg4(nil)" } - type Alias ThumbnailFormatWebp - return fmt.Sprintf("ThumbnailFormatWebp%+v", Alias(*t)) + type Alias ThumbnailFormatMpeg4 + return fmt.Sprintf("ThumbnailFormatMpeg4%+v", Alias(*t)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatWebp) TypeID() uint32 { - return ThumbnailFormatWebpTypeID +func (*ThumbnailFormatMpeg4) TypeID() uint32 { + return ThumbnailFormatMpeg4TypeID } // TypeName returns name of type in TL schema. -func (*ThumbnailFormatWebp) TypeName() string { - return "thumbnailFormatWebp" +func (*ThumbnailFormatMpeg4) TypeName() string { + return "thumbnailFormatMpeg4" } // TypeInfo returns info about TL type. -func (t *ThumbnailFormatWebp) TypeInfo() tdp.Type { +func (t *ThumbnailFormatMpeg4) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "thumbnailFormatWebp", - ID: ThumbnailFormatWebpTypeID, + Name: "thumbnailFormatMpeg4", + ID: ThumbnailFormatMpeg4TypeID, } if t == nil { typ.Null = true @@ -357,48 +357,48 @@ func (t *ThumbnailFormatWebp) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (t *ThumbnailFormatWebp) Encode(b *bin.Buffer) error { +func (t *ThumbnailFormatMpeg4) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatWebp#fcce4c12 as nil") + return fmt.Errorf("can't encode thumbnailFormatMpeg4#109b57fe as nil") } - b.PutID(ThumbnailFormatWebpTypeID) + b.PutID(ThumbnailFormatMpeg4TypeID) return t.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatWebp) EncodeBare(b *bin.Buffer) error { +func (t *ThumbnailFormatMpeg4) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatWebp#fcce4c12 as nil") + return fmt.Errorf("can't encode thumbnailFormatMpeg4#109b57fe as nil") } return nil } // Decode implements bin.Decoder. -func (t *ThumbnailFormatWebp) Decode(b *bin.Buffer) error { +func (t *ThumbnailFormatMpeg4) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatWebp#fcce4c12 to nil") + return fmt.Errorf("can't decode thumbnailFormatMpeg4#109b57fe to nil") } - if err := b.ConsumeID(ThumbnailFormatWebpTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatWebp#fcce4c12: %w", err) + if err := b.ConsumeID(ThumbnailFormatMpeg4TypeID); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatMpeg4#109b57fe: %w", err) } return t.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatWebp) DecodeBare(b *bin.Buffer) error { +func (t *ThumbnailFormatMpeg4) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatWebp#fcce4c12 to nil") + return fmt.Errorf("can't decode thumbnailFormatMpeg4#109b57fe to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatWebp) EncodeTDLibJSON(b tdjson.Encoder) error { +func (t *ThumbnailFormatMpeg4) EncodeTDLibJSON(b tdjson.Encoder) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatWebp#fcce4c12 as nil") + return fmt.Errorf("can't encode thumbnailFormatMpeg4#109b57fe as nil") } b.ObjStart() - b.PutID("thumbnailFormatWebp") + b.PutID("thumbnailFormatMpeg4") b.Comma() b.StripComma() b.ObjEnd() @@ -406,16 +406,16 @@ func (t *ThumbnailFormatWebp) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatWebp) DecodeTDLibJSON(b tdjson.Decoder) error { +func (t *ThumbnailFormatMpeg4) DecodeTDLibJSON(b tdjson.Decoder) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatWebp#fcce4c12 to nil") + return fmt.Errorf("can't decode thumbnailFormatMpeg4#109b57fe to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatWebp"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatWebp#fcce4c12: %w", err) + if err := b.ConsumeID("thumbnailFormatMpeg4"); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatMpeg4#109b57fe: %w", err) } default: return b.Skip() @@ -424,27 +424,27 @@ func (t *ThumbnailFormatWebp) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// ThumbnailFormatGif represents TL type `thumbnailFormatGif#4aa3258a`. -type ThumbnailFormatGif struct { +// ThumbnailFormatPng represents TL type `thumbnailFormatPng#5e0697f5`. +type ThumbnailFormatPng struct { } -// ThumbnailFormatGifTypeID is TL type id of ThumbnailFormatGif. -const ThumbnailFormatGifTypeID = 0x4aa3258a +// ThumbnailFormatPngTypeID is TL type id of ThumbnailFormatPng. +const ThumbnailFormatPngTypeID = 0x5e0697f5 // construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatGif) construct() ThumbnailFormatClass { return &t } +func (t ThumbnailFormatPng) construct() ThumbnailFormatClass { return &t } -// Ensuring interfaces in compile-time for ThumbnailFormatGif. +// Ensuring interfaces in compile-time for ThumbnailFormatPng. var ( - _ bin.Encoder = &ThumbnailFormatGif{} - _ bin.Decoder = &ThumbnailFormatGif{} - _ bin.BareEncoder = &ThumbnailFormatGif{} - _ bin.BareDecoder = &ThumbnailFormatGif{} + _ bin.Encoder = &ThumbnailFormatPng{} + _ bin.Decoder = &ThumbnailFormatPng{} + _ bin.BareEncoder = &ThumbnailFormatPng{} + _ bin.BareDecoder = &ThumbnailFormatPng{} - _ ThumbnailFormatClass = &ThumbnailFormatGif{} + _ ThumbnailFormatClass = &ThumbnailFormatPng{} ) -func (t *ThumbnailFormatGif) Zero() bool { +func (t *ThumbnailFormatPng) Zero() bool { if t == nil { return true } @@ -453,31 +453,31 @@ func (t *ThumbnailFormatGif) Zero() bool { } // String implements fmt.Stringer. -func (t *ThumbnailFormatGif) String() string { +func (t *ThumbnailFormatPng) String() string { if t == nil { - return "ThumbnailFormatGif(nil)" + return "ThumbnailFormatPng(nil)" } - type Alias ThumbnailFormatGif - return fmt.Sprintf("ThumbnailFormatGif%+v", Alias(*t)) + type Alias ThumbnailFormatPng + return fmt.Sprintf("ThumbnailFormatPng%+v", Alias(*t)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatGif) TypeID() uint32 { - return ThumbnailFormatGifTypeID +func (*ThumbnailFormatPng) TypeID() uint32 { + return ThumbnailFormatPngTypeID } // TypeName returns name of type in TL schema. -func (*ThumbnailFormatGif) TypeName() string { - return "thumbnailFormatGif" +func (*ThumbnailFormatPng) TypeName() string { + return "thumbnailFormatPng" } // TypeInfo returns info about TL type. -func (t *ThumbnailFormatGif) TypeInfo() tdp.Type { +func (t *ThumbnailFormatPng) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "thumbnailFormatGif", - ID: ThumbnailFormatGifTypeID, + Name: "thumbnailFormatPng", + ID: ThumbnailFormatPngTypeID, } if t == nil { typ.Null = true @@ -488,48 +488,48 @@ func (t *ThumbnailFormatGif) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (t *ThumbnailFormatGif) Encode(b *bin.Buffer) error { +func (t *ThumbnailFormatPng) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatGif#4aa3258a as nil") + return fmt.Errorf("can't encode thumbnailFormatPng#5e0697f5 as nil") } - b.PutID(ThumbnailFormatGifTypeID) + b.PutID(ThumbnailFormatPngTypeID) return t.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatGif) EncodeBare(b *bin.Buffer) error { +func (t *ThumbnailFormatPng) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatGif#4aa3258a as nil") + return fmt.Errorf("can't encode thumbnailFormatPng#5e0697f5 as nil") } return nil } // Decode implements bin.Decoder. -func (t *ThumbnailFormatGif) Decode(b *bin.Buffer) error { +func (t *ThumbnailFormatPng) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatGif#4aa3258a to nil") + return fmt.Errorf("can't decode thumbnailFormatPng#5e0697f5 to nil") } - if err := b.ConsumeID(ThumbnailFormatGifTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatGif#4aa3258a: %w", err) + if err := b.ConsumeID(ThumbnailFormatPngTypeID); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatPng#5e0697f5: %w", err) } return t.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatGif) DecodeBare(b *bin.Buffer) error { +func (t *ThumbnailFormatPng) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatGif#4aa3258a to nil") + return fmt.Errorf("can't decode thumbnailFormatPng#5e0697f5 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatGif) EncodeTDLibJSON(b tdjson.Encoder) error { +func (t *ThumbnailFormatPng) EncodeTDLibJSON(b tdjson.Encoder) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatGif#4aa3258a as nil") + return fmt.Errorf("can't encode thumbnailFormatPng#5e0697f5 as nil") } b.ObjStart() - b.PutID("thumbnailFormatGif") + b.PutID("thumbnailFormatPng") b.Comma() b.StripComma() b.ObjEnd() @@ -537,16 +537,16 @@ func (t *ThumbnailFormatGif) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatGif) DecodeTDLibJSON(b tdjson.Decoder) error { +func (t *ThumbnailFormatPng) DecodeTDLibJSON(b tdjson.Decoder) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatGif#4aa3258a to nil") + return fmt.Errorf("can't decode thumbnailFormatPng#5e0697f5 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatGif"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatGif#4aa3258a: %w", err) + if err := b.ConsumeID("thumbnailFormatPng"); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatPng#5e0697f5: %w", err) } default: return b.Skip() @@ -686,27 +686,27 @@ func (t *ThumbnailFormatTgs) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// ThumbnailFormatMpeg4 represents TL type `thumbnailFormatMpeg4#109b57fe`. -type ThumbnailFormatMpeg4 struct { +// ThumbnailFormatWebm represents TL type `thumbnailFormatWebm#d8a7e727`. +type ThumbnailFormatWebm struct { } -// ThumbnailFormatMpeg4TypeID is TL type id of ThumbnailFormatMpeg4. -const ThumbnailFormatMpeg4TypeID = 0x109b57fe +// ThumbnailFormatWebmTypeID is TL type id of ThumbnailFormatWebm. +const ThumbnailFormatWebmTypeID = 0xd8a7e727 // construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatMpeg4) construct() ThumbnailFormatClass { return &t } +func (t ThumbnailFormatWebm) construct() ThumbnailFormatClass { return &t } -// Ensuring interfaces in compile-time for ThumbnailFormatMpeg4. +// Ensuring interfaces in compile-time for ThumbnailFormatWebm. var ( - _ bin.Encoder = &ThumbnailFormatMpeg4{} - _ bin.Decoder = &ThumbnailFormatMpeg4{} - _ bin.BareEncoder = &ThumbnailFormatMpeg4{} - _ bin.BareDecoder = &ThumbnailFormatMpeg4{} + _ bin.Encoder = &ThumbnailFormatWebm{} + _ bin.Decoder = &ThumbnailFormatWebm{} + _ bin.BareEncoder = &ThumbnailFormatWebm{} + _ bin.BareDecoder = &ThumbnailFormatWebm{} - _ ThumbnailFormatClass = &ThumbnailFormatMpeg4{} + _ ThumbnailFormatClass = &ThumbnailFormatWebm{} ) -func (t *ThumbnailFormatMpeg4) Zero() bool { +func (t *ThumbnailFormatWebm) Zero() bool { if t == nil { return true } @@ -715,31 +715,31 @@ func (t *ThumbnailFormatMpeg4) Zero() bool { } // String implements fmt.Stringer. -func (t *ThumbnailFormatMpeg4) String() string { +func (t *ThumbnailFormatWebm) String() string { if t == nil { - return "ThumbnailFormatMpeg4(nil)" + return "ThumbnailFormatWebm(nil)" } - type Alias ThumbnailFormatMpeg4 - return fmt.Sprintf("ThumbnailFormatMpeg4%+v", Alias(*t)) + type Alias ThumbnailFormatWebm + return fmt.Sprintf("ThumbnailFormatWebm%+v", Alias(*t)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatMpeg4) TypeID() uint32 { - return ThumbnailFormatMpeg4TypeID +func (*ThumbnailFormatWebm) TypeID() uint32 { + return ThumbnailFormatWebmTypeID } // TypeName returns name of type in TL schema. -func (*ThumbnailFormatMpeg4) TypeName() string { - return "thumbnailFormatMpeg4" +func (*ThumbnailFormatWebm) TypeName() string { + return "thumbnailFormatWebm" } // TypeInfo returns info about TL type. -func (t *ThumbnailFormatMpeg4) TypeInfo() tdp.Type { +func (t *ThumbnailFormatWebm) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "thumbnailFormatMpeg4", - ID: ThumbnailFormatMpeg4TypeID, + Name: "thumbnailFormatWebm", + ID: ThumbnailFormatWebmTypeID, } if t == nil { typ.Null = true @@ -750,48 +750,48 @@ func (t *ThumbnailFormatMpeg4) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (t *ThumbnailFormatMpeg4) Encode(b *bin.Buffer) error { +func (t *ThumbnailFormatWebm) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatMpeg4#109b57fe as nil") + return fmt.Errorf("can't encode thumbnailFormatWebm#d8a7e727 as nil") } - b.PutID(ThumbnailFormatMpeg4TypeID) + b.PutID(ThumbnailFormatWebmTypeID) return t.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatMpeg4) EncodeBare(b *bin.Buffer) error { +func (t *ThumbnailFormatWebm) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatMpeg4#109b57fe as nil") + return fmt.Errorf("can't encode thumbnailFormatWebm#d8a7e727 as nil") } return nil } // Decode implements bin.Decoder. -func (t *ThumbnailFormatMpeg4) Decode(b *bin.Buffer) error { +func (t *ThumbnailFormatWebm) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatMpeg4#109b57fe to nil") + return fmt.Errorf("can't decode thumbnailFormatWebm#d8a7e727 to nil") } - if err := b.ConsumeID(ThumbnailFormatMpeg4TypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatMpeg4#109b57fe: %w", err) + if err := b.ConsumeID(ThumbnailFormatWebmTypeID); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatWebm#d8a7e727: %w", err) } return t.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatMpeg4) DecodeBare(b *bin.Buffer) error { +func (t *ThumbnailFormatWebm) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatMpeg4#109b57fe to nil") + return fmt.Errorf("can't decode thumbnailFormatWebm#d8a7e727 to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatMpeg4) EncodeTDLibJSON(b tdjson.Encoder) error { +func (t *ThumbnailFormatWebm) EncodeTDLibJSON(b tdjson.Encoder) error { if t == nil { - return fmt.Errorf("can't encode thumbnailFormatMpeg4#109b57fe as nil") + return fmt.Errorf("can't encode thumbnailFormatWebm#d8a7e727 as nil") } b.ObjStart() - b.PutID("thumbnailFormatMpeg4") + b.PutID("thumbnailFormatWebm") b.Comma() b.StripComma() b.ObjEnd() @@ -799,16 +799,147 @@ func (t *ThumbnailFormatMpeg4) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatMpeg4) DecodeTDLibJSON(b tdjson.Decoder) error { +func (t *ThumbnailFormatWebm) DecodeTDLibJSON(b tdjson.Decoder) error { if t == nil { - return fmt.Errorf("can't decode thumbnailFormatMpeg4#109b57fe to nil") + return fmt.Errorf("can't decode thumbnailFormatWebm#d8a7e727 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatMpeg4"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatMpeg4#109b57fe: %w", err) + if err := b.ConsumeID("thumbnailFormatWebm"); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatWebm#d8a7e727: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// ThumbnailFormatWebp represents TL type `thumbnailFormatWebp#fcce4c12`. +type ThumbnailFormatWebp struct { +} + +// ThumbnailFormatWebpTypeID is TL type id of ThumbnailFormatWebp. +const ThumbnailFormatWebpTypeID = 0xfcce4c12 + +// construct implements constructor of ThumbnailFormatClass. +func (t ThumbnailFormatWebp) construct() ThumbnailFormatClass { return &t } + +// Ensuring interfaces in compile-time for ThumbnailFormatWebp. +var ( + _ bin.Encoder = &ThumbnailFormatWebp{} + _ bin.Decoder = &ThumbnailFormatWebp{} + _ bin.BareEncoder = &ThumbnailFormatWebp{} + _ bin.BareDecoder = &ThumbnailFormatWebp{} + + _ ThumbnailFormatClass = &ThumbnailFormatWebp{} +) + +func (t *ThumbnailFormatWebp) Zero() bool { + if t == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (t *ThumbnailFormatWebp) String() string { + if t == nil { + return "ThumbnailFormatWebp(nil)" + } + type Alias ThumbnailFormatWebp + return fmt.Sprintf("ThumbnailFormatWebp%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ThumbnailFormatWebp) TypeID() uint32 { + return ThumbnailFormatWebpTypeID +} + +// TypeName returns name of type in TL schema. +func (*ThumbnailFormatWebp) TypeName() string { + return "thumbnailFormatWebp" +} + +// TypeInfo returns info about TL type. +func (t *ThumbnailFormatWebp) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "thumbnailFormatWebp", + ID: ThumbnailFormatWebpTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (t *ThumbnailFormatWebp) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode thumbnailFormatWebp#fcce4c12 as nil") + } + b.PutID(ThumbnailFormatWebpTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *ThumbnailFormatWebp) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode thumbnailFormatWebp#fcce4c12 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (t *ThumbnailFormatWebp) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode thumbnailFormatWebp#fcce4c12 to nil") + } + if err := b.ConsumeID(ThumbnailFormatWebpTypeID); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatWebp#fcce4c12: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *ThumbnailFormatWebp) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode thumbnailFormatWebp#fcce4c12 to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *ThumbnailFormatWebp) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode thumbnailFormatWebp#fcce4c12 as nil") + } + b.ObjStart() + b.PutID("thumbnailFormatWebp") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *ThumbnailFormatWebp) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode thumbnailFormatWebp#fcce4c12 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("thumbnailFormatWebp"); err != nil { + return fmt.Errorf("unable to decode thumbnailFormatWebp#fcce4c12: %w", err) } default: return b.Skip() @@ -829,11 +960,12 @@ const ThumbnailFormatClassName = "ThumbnailFormat" // } // switch v := g.(type) { // case *tdapi.ThumbnailFormatJpeg: // thumbnailFormatJpeg#d90c5488 -// case *tdapi.ThumbnailFormatPng: // thumbnailFormatPng#5e0697f5 -// case *tdapi.ThumbnailFormatWebp: // thumbnailFormatWebp#fcce4c12 // case *tdapi.ThumbnailFormatGif: // thumbnailFormatGif#4aa3258a -// case *tdapi.ThumbnailFormatTgs: // thumbnailFormatTgs#4e694852 // case *tdapi.ThumbnailFormatMpeg4: // thumbnailFormatMpeg4#109b57fe +// case *tdapi.ThumbnailFormatPng: // thumbnailFormatPng#5e0697f5 +// case *tdapi.ThumbnailFormatTgs: // thumbnailFormatTgs#4e694852 +// case *tdapi.ThumbnailFormatWebm: // thumbnailFormatWebm#d8a7e727 +// case *tdapi.ThumbnailFormatWebp: // thumbnailFormatWebp#fcce4c12 // default: panic(v) // } type ThumbnailFormatClass interface { @@ -872,23 +1004,23 @@ func DecodeThumbnailFormat(buf *bin.Buffer) (ThumbnailFormatClass, error) { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } return &v, nil - case ThumbnailFormatPngTypeID: - // Decoding thumbnailFormatPng#5e0697f5. - v := ThumbnailFormatPng{} + case ThumbnailFormatGifTypeID: + // Decoding thumbnailFormatGif#4aa3258a. + v := ThumbnailFormatGif{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } return &v, nil - case ThumbnailFormatWebpTypeID: - // Decoding thumbnailFormatWebp#fcce4c12. - v := ThumbnailFormatWebp{} + case ThumbnailFormatMpeg4TypeID: + // Decoding thumbnailFormatMpeg4#109b57fe. + v := ThumbnailFormatMpeg4{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } return &v, nil - case ThumbnailFormatGifTypeID: - // Decoding thumbnailFormatGif#4aa3258a. - v := ThumbnailFormatGif{} + case ThumbnailFormatPngTypeID: + // Decoding thumbnailFormatPng#5e0697f5. + v := ThumbnailFormatPng{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } @@ -900,9 +1032,16 @@ func DecodeThumbnailFormat(buf *bin.Buffer) (ThumbnailFormatClass, error) { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } return &v, nil - case ThumbnailFormatMpeg4TypeID: - // Decoding thumbnailFormatMpeg4#109b57fe. - v := ThumbnailFormatMpeg4{} + case ThumbnailFormatWebmTypeID: + // Decoding thumbnailFormatWebm#d8a7e727. + v := ThumbnailFormatWebm{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) + } + return &v, nil + case ThumbnailFormatWebpTypeID: + // Decoding thumbnailFormatWebp#fcce4c12. + v := ThumbnailFormatWebp{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } @@ -926,23 +1065,23 @@ func DecodeTDLibJSONThumbnailFormat(buf tdjson.Decoder) (ThumbnailFormatClass, e return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } return &v, nil - case "thumbnailFormatPng": - // Decoding thumbnailFormatPng#5e0697f5. - v := ThumbnailFormatPng{} + case "thumbnailFormatGif": + // Decoding thumbnailFormatGif#4aa3258a. + v := ThumbnailFormatGif{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } return &v, nil - case "thumbnailFormatWebp": - // Decoding thumbnailFormatWebp#fcce4c12. - v := ThumbnailFormatWebp{} + case "thumbnailFormatMpeg4": + // Decoding thumbnailFormatMpeg4#109b57fe. + v := ThumbnailFormatMpeg4{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } return &v, nil - case "thumbnailFormatGif": - // Decoding thumbnailFormatGif#4aa3258a. - v := ThumbnailFormatGif{} + case "thumbnailFormatPng": + // Decoding thumbnailFormatPng#5e0697f5. + v := ThumbnailFormatPng{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } @@ -954,9 +1093,16 @@ func DecodeTDLibJSONThumbnailFormat(buf tdjson.Decoder) (ThumbnailFormatClass, e return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } return &v, nil - case "thumbnailFormatMpeg4": - // Decoding thumbnailFormatMpeg4#109b57fe. - v := ThumbnailFormatMpeg4{} + case "thumbnailFormatWebm": + // Decoding thumbnailFormatWebm#d8a7e727. + v := ThumbnailFormatWebm{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) + } + return &v, nil + case "thumbnailFormatWebp": + // Decoding thumbnailFormatWebp#fcce4c12. + v := ThumbnailFormatWebp{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) } diff --git a/tdapi/tl_translate_text_gen.go b/tdapi/tl_translate_text_gen.go new file mode 100644 index 0000000000..132dd523c2 --- /dev/null +++ b/tdapi/tl_translate_text_gen.go @@ -0,0 +1,273 @@ +// 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{} +) + +// TranslateTextRequest represents TL type `translateText#9f758a6d`. +type TranslateTextRequest struct { + // Text to translate + Text string + // A two-letter ISO 639-1 language code of the language from which the message is + // translated. If empty, the language will be detected automatically + FromLanguageCode string + // A two-letter ISO 639-1 language code of the language to which the message is + // translated + ToLanguageCode string +} + +// TranslateTextRequestTypeID is TL type id of TranslateTextRequest. +const TranslateTextRequestTypeID = 0x9f758a6d + +// Ensuring interfaces in compile-time for TranslateTextRequest. +var ( + _ bin.Encoder = &TranslateTextRequest{} + _ bin.Decoder = &TranslateTextRequest{} + _ bin.BareEncoder = &TranslateTextRequest{} + _ bin.BareDecoder = &TranslateTextRequest{} +) + +func (t *TranslateTextRequest) Zero() bool { + if t == nil { + return true + } + if !(t.Text == "") { + return false + } + if !(t.FromLanguageCode == "") { + return false + } + if !(t.ToLanguageCode == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *TranslateTextRequest) String() string { + if t == nil { + return "TranslateTextRequest(nil)" + } + type Alias TranslateTextRequest + return fmt.Sprintf("TranslateTextRequest%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*TranslateTextRequest) TypeID() uint32 { + return TranslateTextRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*TranslateTextRequest) TypeName() string { + return "translateText" +} + +// TypeInfo returns info about TL type. +func (t *TranslateTextRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "translateText", + ID: TranslateTextRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Text", + SchemaName: "text", + }, + { + Name: "FromLanguageCode", + SchemaName: "from_language_code", + }, + { + Name: "ToLanguageCode", + SchemaName: "to_language_code", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *TranslateTextRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode translateText#9f758a6d as nil") + } + b.PutID(TranslateTextRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *TranslateTextRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode translateText#9f758a6d as nil") + } + b.PutString(t.Text) + b.PutString(t.FromLanguageCode) + b.PutString(t.ToLanguageCode) + return nil +} + +// Decode implements bin.Decoder. +func (t *TranslateTextRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode translateText#9f758a6d to nil") + } + if err := b.ConsumeID(TranslateTextRequestTypeID); err != nil { + return fmt.Errorf("unable to decode translateText#9f758a6d: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *TranslateTextRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode translateText#9f758a6d to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode translateText#9f758a6d: field text: %w", err) + } + t.Text = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode translateText#9f758a6d: field from_language_code: %w", err) + } + t.FromLanguageCode = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode translateText#9f758a6d: field to_language_code: %w", err) + } + t.ToLanguageCode = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *TranslateTextRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode translateText#9f758a6d as nil") + } + b.ObjStart() + b.PutID("translateText") + b.Comma() + b.FieldStart("text") + b.PutString(t.Text) + b.Comma() + b.FieldStart("from_language_code") + b.PutString(t.FromLanguageCode) + b.Comma() + b.FieldStart("to_language_code") + b.PutString(t.ToLanguageCode) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *TranslateTextRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode translateText#9f758a6d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("translateText"); err != nil { + return fmt.Errorf("unable to decode translateText#9f758a6d: %w", err) + } + case "text": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode translateText#9f758a6d: field text: %w", err) + } + t.Text = value + case "from_language_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode translateText#9f758a6d: field from_language_code: %w", err) + } + t.FromLanguageCode = value + case "to_language_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode translateText#9f758a6d: field to_language_code: %w", err) + } + t.ToLanguageCode = value + default: + return b.Skip() + } + return nil + }) +} + +// GetText returns value of Text field. +func (t *TranslateTextRequest) GetText() (value string) { + if t == nil { + return + } + return t.Text +} + +// GetFromLanguageCode returns value of FromLanguageCode field. +func (t *TranslateTextRequest) GetFromLanguageCode() (value string) { + if t == nil { + return + } + return t.FromLanguageCode +} + +// GetToLanguageCode returns value of ToLanguageCode field. +func (t *TranslateTextRequest) GetToLanguageCode() (value string) { + if t == nil { + return + } + return t.ToLanguageCode +} + +// TranslateText invokes method translateText#9f758a6d returning error if any. +func (c *Client) TranslateText(ctx context.Context, request *TranslateTextRequest) (*Text, error) { + var result Text + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_unread_reaction_gen.go b/tdapi/tl_unread_reaction_gen.go new file mode 100644 index 0000000000..89b4fb23f2 --- /dev/null +++ b/tdapi/tl_unread_reaction_gen.go @@ -0,0 +1,271 @@ +// 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{} +) + +// UnreadReaction represents TL type `unreadReaction#54afb43`. +type UnreadReaction struct { + // Text representation of the reaction + Reaction string + // Identifier of the sender, added the reaction + SenderID MessageSenderClass + // True, if the reaction was added with a big animation + IsBig bool +} + +// UnreadReactionTypeID is TL type id of UnreadReaction. +const UnreadReactionTypeID = 0x54afb43 + +// Ensuring interfaces in compile-time for UnreadReaction. +var ( + _ bin.Encoder = &UnreadReaction{} + _ bin.Decoder = &UnreadReaction{} + _ bin.BareEncoder = &UnreadReaction{} + _ bin.BareDecoder = &UnreadReaction{} +) + +func (u *UnreadReaction) Zero() bool { + if u == nil { + return true + } + if !(u.Reaction == "") { + return false + } + if !(u.SenderID == nil) { + return false + } + if !(u.IsBig == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UnreadReaction) String() string { + if u == nil { + return "UnreadReaction(nil)" + } + type Alias UnreadReaction + return fmt.Sprintf("UnreadReaction%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UnreadReaction) TypeID() uint32 { + return UnreadReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*UnreadReaction) TypeName() string { + return "unreadReaction" +} + +// TypeInfo returns info about TL type. +func (u *UnreadReaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "unreadReaction", + ID: UnreadReactionTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Reaction", + SchemaName: "reaction", + }, + { + Name: "SenderID", + SchemaName: "sender_id", + }, + { + Name: "IsBig", + SchemaName: "is_big", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UnreadReaction) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode unreadReaction#54afb43 as nil") + } + b.PutID(UnreadReactionTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UnreadReaction) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode unreadReaction#54afb43 as nil") + } + b.PutString(u.Reaction) + if u.SenderID == nil { + return fmt.Errorf("unable to encode unreadReaction#54afb43: field sender_id is nil") + } + if err := u.SenderID.Encode(b); err != nil { + return fmt.Errorf("unable to encode unreadReaction#54afb43: field sender_id: %w", err) + } + b.PutBool(u.IsBig) + return nil +} + +// Decode implements bin.Decoder. +func (u *UnreadReaction) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode unreadReaction#54afb43 to nil") + } + if err := b.ConsumeID(UnreadReactionTypeID); err != nil { + return fmt.Errorf("unable to decode unreadReaction#54afb43: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UnreadReaction) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode unreadReaction#54afb43 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode unreadReaction#54afb43: field reaction: %w", err) + } + u.Reaction = value + } + { + value, err := DecodeMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode unreadReaction#54afb43: field sender_id: %w", err) + } + u.SenderID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode unreadReaction#54afb43: field is_big: %w", err) + } + u.IsBig = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UnreadReaction) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode unreadReaction#54afb43 as nil") + } + b.ObjStart() + b.PutID("unreadReaction") + b.Comma() + b.FieldStart("reaction") + b.PutString(u.Reaction) + b.Comma() + b.FieldStart("sender_id") + if u.SenderID == nil { + return fmt.Errorf("unable to encode unreadReaction#54afb43: field sender_id is nil") + } + if err := u.SenderID.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode unreadReaction#54afb43: field sender_id: %w", err) + } + b.Comma() + b.FieldStart("is_big") + b.PutBool(u.IsBig) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UnreadReaction) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode unreadReaction#54afb43 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("unreadReaction"); err != nil { + return fmt.Errorf("unable to decode unreadReaction#54afb43: %w", err) + } + case "reaction": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode unreadReaction#54afb43: field reaction: %w", err) + } + u.Reaction = value + case "sender_id": + value, err := DecodeTDLibJSONMessageSender(b) + if err != nil { + return fmt.Errorf("unable to decode unreadReaction#54afb43: field sender_id: %w", err) + } + u.SenderID = value + case "is_big": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode unreadReaction#54afb43: field is_big: %w", err) + } + u.IsBig = value + default: + return b.Skip() + } + return nil + }) +} + +// GetReaction returns value of Reaction field. +func (u *UnreadReaction) GetReaction() (value string) { + if u == nil { + return + } + return u.Reaction +} + +// GetSenderID returns value of SenderID field. +func (u *UnreadReaction) GetSenderID() (value MessageSenderClass) { + if u == nil { + return + } + return u.SenderID +} + +// GetIsBig returns value of IsBig field. +func (u *UnreadReaction) GetIsBig() (value bool) { + if u == nil { + return + } + return u.IsBig +} diff --git a/tdapi/tl_update_gen.go b/tdapi/tl_update_gen.go index 9a8a93333c..53556d973f 100644 --- a/tdapi/tl_update_gen.go +++ b/tdapi/tl_update_gen.go @@ -2466,6 +2466,302 @@ func (u *UpdateMessageMentionRead) GetUnreadMentionCount() (value int32) { return u.UnreadMentionCount } +// UpdateMessageUnreadReactions represents TL type `updateMessageUnreadReactions#12a7220a`. +type UpdateMessageUnreadReactions struct { + // Chat identifier + ChatID int64 + // Message identifier + MessageID int64 + // The new list of unread reactions + UnreadReactions []UnreadReaction + // The new number of messages with unread reactions left in the chat + UnreadReactionCount int32 +} + +// UpdateMessageUnreadReactionsTypeID is TL type id of UpdateMessageUnreadReactions. +const UpdateMessageUnreadReactionsTypeID = 0x12a7220a + +// construct implements constructor of UpdateClass. +func (u UpdateMessageUnreadReactions) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateMessageUnreadReactions. +var ( + _ bin.Encoder = &UpdateMessageUnreadReactions{} + _ bin.Decoder = &UpdateMessageUnreadReactions{} + _ bin.BareEncoder = &UpdateMessageUnreadReactions{} + _ bin.BareDecoder = &UpdateMessageUnreadReactions{} + + _ UpdateClass = &UpdateMessageUnreadReactions{} +) + +func (u *UpdateMessageUnreadReactions) Zero() bool { + if u == nil { + return true + } + if !(u.ChatID == 0) { + return false + } + if !(u.MessageID == 0) { + return false + } + if !(u.UnreadReactions == nil) { + return false + } + if !(u.UnreadReactionCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateMessageUnreadReactions) String() string { + if u == nil { + return "UpdateMessageUnreadReactions(nil)" + } + type Alias UpdateMessageUnreadReactions + return fmt.Sprintf("UpdateMessageUnreadReactions%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateMessageUnreadReactions) TypeID() uint32 { + return UpdateMessageUnreadReactionsTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateMessageUnreadReactions) TypeName() string { + return "updateMessageUnreadReactions" +} + +// TypeInfo returns info about TL type. +func (u *UpdateMessageUnreadReactions) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateMessageUnreadReactions", + ID: UpdateMessageUnreadReactionsTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + { + Name: "UnreadReactions", + SchemaName: "unread_reactions", + }, + { + Name: "UnreadReactionCount", + SchemaName: "unread_reaction_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateMessageUnreadReactions) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateMessageUnreadReactions#12a7220a as nil") + } + b.PutID(UpdateMessageUnreadReactionsTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateMessageUnreadReactions) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateMessageUnreadReactions#12a7220a as nil") + } + b.PutInt53(u.ChatID) + b.PutInt53(u.MessageID) + b.PutInt(len(u.UnreadReactions)) + for idx, v := range u.UnreadReactions { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare updateMessageUnreadReactions#12a7220a: field unread_reactions element with index %d: %w", idx, err) + } + } + b.PutInt32(u.UnreadReactionCount) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateMessageUnreadReactions) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateMessageUnreadReactions#12a7220a to nil") + } + if err := b.ConsumeID(UpdateMessageUnreadReactionsTypeID); err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateMessageUnreadReactions) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateMessageUnreadReactions#12a7220a to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field chat_id: %w", err) + } + u.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field message_id: %w", err) + } + u.MessageID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field unread_reactions: %w", err) + } + + if headerLen > 0 { + u.UnreadReactions = make([]UnreadReaction, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value UnreadReaction + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare updateMessageUnreadReactions#12a7220a: field unread_reactions: %w", err) + } + u.UnreadReactions = append(u.UnreadReactions, value) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field unread_reaction_count: %w", err) + } + u.UnreadReactionCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateMessageUnreadReactions) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateMessageUnreadReactions#12a7220a as nil") + } + b.ObjStart() + b.PutID("updateMessageUnreadReactions") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(u.ChatID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(u.MessageID) + b.Comma() + b.FieldStart("unread_reactions") + b.ArrStart() + for idx, v := range u.UnreadReactions { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateMessageUnreadReactions#12a7220a: field unread_reactions element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("unread_reaction_count") + b.PutInt32(u.UnreadReactionCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateMessageUnreadReactions) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateMessageUnreadReactions#12a7220a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateMessageUnreadReactions"); err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field chat_id: %w", err) + } + u.ChatID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field message_id: %w", err) + } + u.MessageID = value + 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 updateMessageUnreadReactions#12a7220a: field unread_reactions: %w", err) + } + u.UnreadReactions = append(u.UnreadReactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field unread_reactions: %w", err) + } + case "unread_reaction_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field unread_reaction_count: %w", err) + } + u.UnreadReactionCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (u *UpdateMessageUnreadReactions) GetChatID() (value int64) { + if u == nil { + return + } + return u.ChatID +} + +// GetMessageID returns value of MessageID field. +func (u *UpdateMessageUnreadReactions) GetMessageID() (value int64) { + if u == nil { + return + } + return u.MessageID +} + +// GetUnreadReactions returns value of UnreadReactions field. +func (u *UpdateMessageUnreadReactions) GetUnreadReactions() (value []UnreadReaction) { + if u == nil { + return + } + return u.UnreadReactions +} + +// GetUnreadReactionCount returns value of UnreadReactionCount field. +func (u *UpdateMessageUnreadReactions) GetUnreadReactionCount() (value int32) { + if u == nil { + return + } + return u.UnreadReactionCount +} + // UpdateMessageLiveLocationViewed represents TL type `updateMessageLiveLocationViewed#b2058595`. type UpdateMessageLiveLocationViewed struct { // Identifier of the chat with the live location message @@ -4538,43 +4834,38 @@ func (u *UpdateChatActionBar) GetActionBar() (value ChatActionBarClass) { return u.ActionBar } -// UpdateChatDraftMessage represents TL type `updateChatDraftMessage#2bf257d4`. -type UpdateChatDraftMessage struct { +// UpdateChatAvailableReactions represents TL type `updateChatAvailableReactions#852fb10d`. +type UpdateChatAvailableReactions struct { // Chat identifier ChatID int64 - // The new draft message; may be null - DraftMessage DraftMessage - // The new chat positions in the chat lists - Positions []ChatPosition + // The new list of reactions, available in the chat + AvailableReactions []string } -// UpdateChatDraftMessageTypeID is TL type id of UpdateChatDraftMessage. -const UpdateChatDraftMessageTypeID = 0x2bf257d4 +// UpdateChatAvailableReactionsTypeID is TL type id of UpdateChatAvailableReactions. +const UpdateChatAvailableReactionsTypeID = 0x852fb10d // construct implements constructor of UpdateClass. -func (u UpdateChatDraftMessage) construct() UpdateClass { return &u } +func (u UpdateChatAvailableReactions) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatDraftMessage. +// Ensuring interfaces in compile-time for UpdateChatAvailableReactions. var ( - _ bin.Encoder = &UpdateChatDraftMessage{} - _ bin.Decoder = &UpdateChatDraftMessage{} - _ bin.BareEncoder = &UpdateChatDraftMessage{} - _ bin.BareDecoder = &UpdateChatDraftMessage{} + _ bin.Encoder = &UpdateChatAvailableReactions{} + _ bin.Decoder = &UpdateChatAvailableReactions{} + _ bin.BareEncoder = &UpdateChatAvailableReactions{} + _ bin.BareDecoder = &UpdateChatAvailableReactions{} - _ UpdateClass = &UpdateChatDraftMessage{} + _ UpdateClass = &UpdateChatAvailableReactions{} ) -func (u *UpdateChatDraftMessage) Zero() bool { +func (u *UpdateChatAvailableReactions) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.DraftMessage.Zero()) { - return false - } - if !(u.Positions == nil) { + if !(u.AvailableReactions == nil) { return false } @@ -4582,31 +4873,31 @@ func (u *UpdateChatDraftMessage) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatDraftMessage) String() string { +func (u *UpdateChatAvailableReactions) String() string { if u == nil { - return "UpdateChatDraftMessage(nil)" + return "UpdateChatAvailableReactions(nil)" } - type Alias UpdateChatDraftMessage - return fmt.Sprintf("UpdateChatDraftMessage%+v", Alias(*u)) + type Alias UpdateChatAvailableReactions + return fmt.Sprintf("UpdateChatAvailableReactions%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatDraftMessage) TypeID() uint32 { - return UpdateChatDraftMessageTypeID +func (*UpdateChatAvailableReactions) TypeID() uint32 { + return UpdateChatAvailableReactionsTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatDraftMessage) TypeName() string { - return "updateChatDraftMessage" +func (*UpdateChatAvailableReactions) TypeName() string { + return "updateChatAvailableReactions" } // TypeInfo returns info about TL type. -func (u *UpdateChatDraftMessage) TypeInfo() tdp.Type { +func (u *UpdateChatAvailableReactions) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatDraftMessage", - ID: UpdateChatDraftMessageTypeID, + Name: "updateChatAvailableReactions", + ID: UpdateChatAvailableReactionsTypeID, } if u == nil { typ.Null = true @@ -4618,37 +4909,266 @@ func (u *UpdateChatDraftMessage) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "DraftMessage", - SchemaName: "draft_message", - }, - { - Name: "Positions", - SchemaName: "positions", + Name: "AvailableReactions", + SchemaName: "available_reactions", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatDraftMessage) Encode(b *bin.Buffer) error { +func (u *UpdateChatAvailableReactions) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") + return fmt.Errorf("can't encode updateChatAvailableReactions#852fb10d as nil") } - b.PutID(UpdateChatDraftMessageTypeID) + b.PutID(UpdateChatAvailableReactionsTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatDraftMessage) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatAvailableReactions) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") + return fmt.Errorf("can't encode updateChatAvailableReactions#852fb10d as nil") } b.PutInt53(u.ChatID) - if err := u.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) + b.PutInt(len(u.AvailableReactions)) + for _, v := range u.AvailableReactions { + b.PutString(v) } - b.PutInt(len(u.Positions)) - for idx, v := range u.Positions { + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChatAvailableReactions) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatAvailableReactions#852fb10d to nil") + } + if err := b.ConsumeID(UpdateChatAvailableReactionsTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#852fb10d: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChatAvailableReactions) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatAvailableReactions#852fb10d to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#852fb10d: field chat_id: %w", err) + } + u.ChatID = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#852fb10d: field available_reactions: %w", err) + } + + if headerLen > 0 { + u.AvailableReactions = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#852fb10d: field available_reactions: %w", err) + } + u.AvailableReactions = append(u.AvailableReactions, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateChatAvailableReactions) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateChatAvailableReactions#852fb10d as nil") + } + b.ObjStart() + b.PutID("updateChatAvailableReactions") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(u.ChatID) + b.Comma() + b.FieldStart("available_reactions") + b.ArrStart() + for _, v := range u.AvailableReactions { + b.PutString(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateChatAvailableReactions) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateChatAvailableReactions#852fb10d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateChatAvailableReactions"); err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#852fb10d: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#852fb10d: field chat_id: %w", err) + } + u.ChatID = value + case "available_reactions": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#852fb10d: field available_reactions: %w", err) + } + u.AvailableReactions = append(u.AvailableReactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode updateChatAvailableReactions#852fb10d: field available_reactions: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (u *UpdateChatAvailableReactions) GetChatID() (value int64) { + if u == nil { + return + } + return u.ChatID +} + +// GetAvailableReactions returns value of AvailableReactions field. +func (u *UpdateChatAvailableReactions) GetAvailableReactions() (value []string) { + if u == nil { + return + } + return u.AvailableReactions +} + +// UpdateChatDraftMessage represents TL type `updateChatDraftMessage#2bf257d4`. +type UpdateChatDraftMessage struct { + // Chat identifier + ChatID int64 + // The new draft message; may be null + DraftMessage DraftMessage + // The new chat positions in the chat lists + Positions []ChatPosition +} + +// UpdateChatDraftMessageTypeID is TL type id of UpdateChatDraftMessage. +const UpdateChatDraftMessageTypeID = 0x2bf257d4 + +// construct implements constructor of UpdateClass. +func (u UpdateChatDraftMessage) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChatDraftMessage. +var ( + _ bin.Encoder = &UpdateChatDraftMessage{} + _ bin.Decoder = &UpdateChatDraftMessage{} + _ bin.BareEncoder = &UpdateChatDraftMessage{} + _ bin.BareDecoder = &UpdateChatDraftMessage{} + + _ UpdateClass = &UpdateChatDraftMessage{} +) + +func (u *UpdateChatDraftMessage) Zero() bool { + if u == nil { + return true + } + if !(u.ChatID == 0) { + return false + } + if !(u.DraftMessage.Zero()) { + return false + } + if !(u.Positions == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChatDraftMessage) String() string { + if u == nil { + return "UpdateChatDraftMessage(nil)" + } + type Alias UpdateChatDraftMessage + return fmt.Sprintf("UpdateChatDraftMessage%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChatDraftMessage) TypeID() uint32 { + return UpdateChatDraftMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChatDraftMessage) TypeName() string { + return "updateChatDraftMessage" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChatDraftMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChatDraftMessage", + ID: UpdateChatDraftMessageTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "DraftMessage", + SchemaName: "draft_message", + }, + { + Name: "Positions", + SchemaName: "positions", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChatDraftMessage) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") + } + b.PutID(UpdateChatDraftMessageTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChatDraftMessage) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") + } + b.PutInt53(u.ChatID) + if err := u.DraftMessage.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) + } + b.PutInt(len(u.Positions)) + for idx, v := range u.Positions { if err := v.EncodeBare(b); err != nil { return fmt.Errorf("unable to encode bare updateChatDraftMessage#2bf257d4: field positions element with index %d: %w", idx, err) } @@ -5948,16 +6468,216 @@ func (u *UpdateChatTheme) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UpdateChatTheme) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") + return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") + } + b.ObjStart() + b.PutID("updateChatTheme") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(u.ChatID) + b.Comma() + b.FieldStart("theme_name") + b.PutString(u.ThemeName) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateChatTheme) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateChatTheme"); err != nil { + return fmt.Errorf("unable to decode updateChatTheme#31f3d465: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field chat_id: %w", err) + } + u.ChatID = value + case "theme_name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field theme_name: %w", err) + } + u.ThemeName = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (u *UpdateChatTheme) GetChatID() (value int64) { + if u == nil { + return + } + return u.ChatID +} + +// GetThemeName returns value of ThemeName field. +func (u *UpdateChatTheme) GetThemeName() (value string) { + if u == nil { + return + } + return u.ThemeName +} + +// UpdateChatUnreadMentionCount represents TL type `updateChatUnreadMentionCount#80f47b1c`. +type UpdateChatUnreadMentionCount struct { + // Chat identifier + ChatID int64 + // The number of unread mention messages left in the chat + UnreadMentionCount int32 +} + +// UpdateChatUnreadMentionCountTypeID is TL type id of UpdateChatUnreadMentionCount. +const UpdateChatUnreadMentionCountTypeID = 0x80f47b1c + +// construct implements constructor of UpdateClass. +func (u UpdateChatUnreadMentionCount) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChatUnreadMentionCount. +var ( + _ bin.Encoder = &UpdateChatUnreadMentionCount{} + _ bin.Decoder = &UpdateChatUnreadMentionCount{} + _ bin.BareEncoder = &UpdateChatUnreadMentionCount{} + _ bin.BareDecoder = &UpdateChatUnreadMentionCount{} + + _ UpdateClass = &UpdateChatUnreadMentionCount{} +) + +func (u *UpdateChatUnreadMentionCount) Zero() bool { + if u == nil { + return true + } + if !(u.ChatID == 0) { + return false + } + if !(u.UnreadMentionCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChatUnreadMentionCount) String() string { + if u == nil { + return "UpdateChatUnreadMentionCount(nil)" + } + type Alias UpdateChatUnreadMentionCount + return fmt.Sprintf("UpdateChatUnreadMentionCount%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChatUnreadMentionCount) TypeID() uint32 { + return UpdateChatUnreadMentionCountTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChatUnreadMentionCount) TypeName() string { + return "updateChatUnreadMentionCount" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChatUnreadMentionCount) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChatUnreadMentionCount", + ID: UpdateChatUnreadMentionCountTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "UnreadMentionCount", + SchemaName: "unread_mention_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChatUnreadMentionCount) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") + } + b.PutID(UpdateChatUnreadMentionCountTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChatUnreadMentionCount) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") + } + b.PutInt53(u.ChatID) + b.PutInt32(u.UnreadMentionCount) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChatUnreadMentionCount) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") + } + if err := b.ConsumeID(UpdateChatUnreadMentionCountTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChatUnreadMentionCount) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) + } + u.ChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) + } + u.UnreadMentionCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateChatUnreadMentionCount) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") } b.ObjStart() - b.PutID("updateChatTheme") + b.PutID("updateChatUnreadMentionCount") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("theme_name") - b.PutString(u.ThemeName) + b.FieldStart("unread_mention_count") + b.PutInt32(u.UnreadMentionCount) b.Comma() b.StripComma() b.ObjEnd() @@ -5965,29 +6685,29 @@ func (u *UpdateChatTheme) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatTheme) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatUnreadMentionCount) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") + return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatTheme"); err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: %w", err) + if err := b.ConsumeID("updateChatUnreadMentionCount"); err != nil { + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) } u.ChatID = value - case "theme_name": - value, err := b.String() + case "unread_mention_count": + value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field theme_name: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) } - u.ThemeName = value + u.UnreadMentionCount = value default: return b.Skip() } @@ -5996,53 +6716,53 @@ func (u *UpdateChatTheme) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatTheme) GetChatID() (value int64) { +func (u *UpdateChatUnreadMentionCount) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetThemeName returns value of ThemeName field. -func (u *UpdateChatTheme) GetThemeName() (value string) { +// GetUnreadMentionCount returns value of UnreadMentionCount field. +func (u *UpdateChatUnreadMentionCount) GetUnreadMentionCount() (value int32) { if u == nil { return } - return u.ThemeName + return u.UnreadMentionCount } -// UpdateChatUnreadMentionCount represents TL type `updateChatUnreadMentionCount#80f47b1c`. -type UpdateChatUnreadMentionCount struct { +// UpdateChatUnreadReactionCount represents TL type `updateChatUnreadReactionCount#81603cdd`. +type UpdateChatUnreadReactionCount struct { // Chat identifier ChatID int64 - // The number of unread mention messages left in the chat - UnreadMentionCount int32 + // The number of messages with unread reactions left in the chat + UnreadReactionCount int32 } -// UpdateChatUnreadMentionCountTypeID is TL type id of UpdateChatUnreadMentionCount. -const UpdateChatUnreadMentionCountTypeID = 0x80f47b1c +// UpdateChatUnreadReactionCountTypeID is TL type id of UpdateChatUnreadReactionCount. +const UpdateChatUnreadReactionCountTypeID = 0x81603cdd // construct implements constructor of UpdateClass. -func (u UpdateChatUnreadMentionCount) construct() UpdateClass { return &u } +func (u UpdateChatUnreadReactionCount) construct() UpdateClass { return &u } -// Ensuring interfaces in compile-time for UpdateChatUnreadMentionCount. +// Ensuring interfaces in compile-time for UpdateChatUnreadReactionCount. var ( - _ bin.Encoder = &UpdateChatUnreadMentionCount{} - _ bin.Decoder = &UpdateChatUnreadMentionCount{} - _ bin.BareEncoder = &UpdateChatUnreadMentionCount{} - _ bin.BareDecoder = &UpdateChatUnreadMentionCount{} + _ bin.Encoder = &UpdateChatUnreadReactionCount{} + _ bin.Decoder = &UpdateChatUnreadReactionCount{} + _ bin.BareEncoder = &UpdateChatUnreadReactionCount{} + _ bin.BareDecoder = &UpdateChatUnreadReactionCount{} - _ UpdateClass = &UpdateChatUnreadMentionCount{} + _ UpdateClass = &UpdateChatUnreadReactionCount{} ) -func (u *UpdateChatUnreadMentionCount) Zero() bool { +func (u *UpdateChatUnreadReactionCount) Zero() bool { if u == nil { return true } if !(u.ChatID == 0) { return false } - if !(u.UnreadMentionCount == 0) { + if !(u.UnreadReactionCount == 0) { return false } @@ -6050,31 +6770,31 @@ func (u *UpdateChatUnreadMentionCount) Zero() bool { } // String implements fmt.Stringer. -func (u *UpdateChatUnreadMentionCount) String() string { +func (u *UpdateChatUnreadReactionCount) String() string { if u == nil { - return "UpdateChatUnreadMentionCount(nil)" + return "UpdateChatUnreadReactionCount(nil)" } - type Alias UpdateChatUnreadMentionCount - return fmt.Sprintf("UpdateChatUnreadMentionCount%+v", Alias(*u)) + type Alias UpdateChatUnreadReactionCount + return fmt.Sprintf("UpdateChatUnreadReactionCount%+v", Alias(*u)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatUnreadMentionCount) TypeID() uint32 { - return UpdateChatUnreadMentionCountTypeID +func (*UpdateChatUnreadReactionCount) TypeID() uint32 { + return UpdateChatUnreadReactionCountTypeID } // TypeName returns name of type in TL schema. -func (*UpdateChatUnreadMentionCount) TypeName() string { - return "updateChatUnreadMentionCount" +func (*UpdateChatUnreadReactionCount) TypeName() string { + return "updateChatUnreadReactionCount" } // TypeInfo returns info about TL type. -func (u *UpdateChatUnreadMentionCount) TypeInfo() tdp.Type { +func (u *UpdateChatUnreadReactionCount) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "updateChatUnreadMentionCount", - ID: UpdateChatUnreadMentionCountTypeID, + Name: "updateChatUnreadReactionCount", + ID: UpdateChatUnreadReactionCountTypeID, } if u == nil { typ.Null = true @@ -6086,78 +6806,78 @@ func (u *UpdateChatUnreadMentionCount) TypeInfo() tdp.Type { SchemaName: "chat_id", }, { - Name: "UnreadMentionCount", - SchemaName: "unread_mention_count", + Name: "UnreadReactionCount", + SchemaName: "unread_reaction_count", }, } return typ } // Encode implements bin.Encoder. -func (u *UpdateChatUnreadMentionCount) Encode(b *bin.Buffer) error { +func (u *UpdateChatUnreadReactionCount) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") + return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") } - b.PutID(UpdateChatUnreadMentionCountTypeID) + b.PutID(UpdateChatUnreadReactionCountTypeID) return u.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (u *UpdateChatUnreadMentionCount) EncodeBare(b *bin.Buffer) error { +func (u *UpdateChatUnreadReactionCount) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") + return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") } b.PutInt53(u.ChatID) - b.PutInt32(u.UnreadMentionCount) + b.PutInt32(u.UnreadReactionCount) return nil } // Decode implements bin.Decoder. -func (u *UpdateChatUnreadMentionCount) Decode(b *bin.Buffer) error { +func (u *UpdateChatUnreadReactionCount) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") + return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") } - if err := b.ConsumeID(UpdateChatUnreadMentionCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) + if err := b.ConsumeID(UpdateChatUnreadReactionCountTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: %w", err) } return u.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (u *UpdateChatUnreadMentionCount) DecodeBare(b *bin.Buffer) error { +func (u *UpdateChatUnreadReactionCount) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") + return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field chat_id: %w", err) } u.ChatID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field unread_reaction_count: %w", err) } - u.UnreadMentionCount = value + u.UnreadReactionCount = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatUnreadMentionCount) EncodeTDLibJSON(b tdjson.Encoder) error { +func (u *UpdateChatUnreadReactionCount) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") + return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") } b.ObjStart() - b.PutID("updateChatUnreadMentionCount") + b.PutID("updateChatUnreadReactionCount") b.Comma() b.FieldStart("chat_id") b.PutInt53(u.ChatID) b.Comma() - b.FieldStart("unread_mention_count") - b.PutInt32(u.UnreadMentionCount) + b.FieldStart("unread_reaction_count") + b.PutInt32(u.UnreadReactionCount) b.Comma() b.StripComma() b.ObjEnd() @@ -6165,29 +6885,29 @@ func (u *UpdateChatUnreadMentionCount) EncodeTDLibJSON(b tdjson.Encoder) error { } // DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatUnreadMentionCount) DecodeTDLibJSON(b tdjson.Decoder) error { +func (u *UpdateChatUnreadReactionCount) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") + return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: - if err := b.ConsumeID("updateChatUnreadMentionCount"); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) + if err := b.ConsumeID("updateChatUnreadReactionCount"); err != nil { + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: %w", err) } case "chat_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field chat_id: %w", err) } u.ChatID = value - case "unread_mention_count": + case "unread_reaction_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) + return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field unread_reaction_count: %w", err) } - u.UnreadMentionCount = value + u.UnreadReactionCount = value default: return b.Skip() } @@ -6196,19 +6916,19 @@ func (u *UpdateChatUnreadMentionCount) DecodeTDLibJSON(b tdjson.Decoder) error { } // GetChatID returns value of ChatID field. -func (u *UpdateChatUnreadMentionCount) GetChatID() (value int64) { +func (u *UpdateChatUnreadReactionCount) GetChatID() (value int64) { if u == nil { return } return u.ChatID } -// GetUnreadMentionCount returns value of UnreadMentionCount field. -func (u *UpdateChatUnreadMentionCount) GetUnreadMentionCount() (value int32) { +// GetUnreadReactionCount returns value of UnreadReactionCount field. +func (u *UpdateChatUnreadReactionCount) GetUnreadReactionCount() (value int32) { if u == nil { return } - return u.UnreadMentionCount + return u.UnreadReactionCount } // UpdateChatVideoChat represents TL type `updateChatVideoChat#25fb4ca6`. @@ -16077,6 +16797,200 @@ func (u *UpdateUsersNearby) GetUsersNearby() (value []ChatNearby) { return u.UsersNearby } +// UpdateReactions represents TL type `updateReactions#e769e4e7`. +type UpdateReactions struct { + // The new list of supported reactions + Reactions []Reaction +} + +// UpdateReactionsTypeID is TL type id of UpdateReactions. +const UpdateReactionsTypeID = 0xe769e4e7 + +// construct implements constructor of UpdateClass. +func (u UpdateReactions) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateReactions. +var ( + _ bin.Encoder = &UpdateReactions{} + _ bin.Decoder = &UpdateReactions{} + _ bin.BareEncoder = &UpdateReactions{} + _ bin.BareDecoder = &UpdateReactions{} + + _ UpdateClass = &UpdateReactions{} +) + +func (u *UpdateReactions) Zero() bool { + if u == nil { + return true + } + if !(u.Reactions == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateReactions) String() string { + if u == nil { + return "UpdateReactions(nil)" + } + type Alias UpdateReactions + return fmt.Sprintf("UpdateReactions%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateReactions) TypeID() uint32 { + return UpdateReactionsTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateReactions) TypeName() string { + return "updateReactions" +} + +// TypeInfo returns info about TL type. +func (u *UpdateReactions) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateReactions", + ID: UpdateReactionsTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Reactions", + SchemaName: "reactions", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateReactions) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateReactions#e769e4e7 as nil") + } + b.PutID(UpdateReactionsTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateReactions) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateReactions#e769e4e7 as nil") + } + b.PutInt(len(u.Reactions)) + for idx, v := range u.Reactions { + if err := v.EncodeBare(b); err != nil { + return fmt.Errorf("unable to encode bare updateReactions#e769e4e7: field reactions element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateReactions) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateReactions#e769e4e7 to nil") + } + if err := b.ConsumeID(UpdateReactionsTypeID); err != nil { + return fmt.Errorf("unable to decode updateReactions#e769e4e7: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateReactions) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateReactions#e769e4e7 to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateReactions#e769e4e7: field reactions: %w", err) + } + + if headerLen > 0 { + u.Reactions = make([]Reaction, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value Reaction + if err := value.DecodeBare(b); err != nil { + return fmt.Errorf("unable to decode bare updateReactions#e769e4e7: field reactions: %w", err) + } + u.Reactions = append(u.Reactions, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (u *UpdateReactions) EncodeTDLibJSON(b tdjson.Encoder) error { + if u == nil { + return fmt.Errorf("can't encode updateReactions#e769e4e7 as nil") + } + b.ObjStart() + b.PutID("updateReactions") + b.Comma() + b.FieldStart("reactions") + b.ArrStart() + for idx, v := range u.Reactions { + if err := v.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode updateReactions#e769e4e7: field reactions element with index %d: %w", idx, err) + } + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (u *UpdateReactions) DecodeTDLibJSON(b tdjson.Decoder) error { + if u == nil { + return fmt.Errorf("can't decode updateReactions#e769e4e7 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("updateReactions"); err != nil { + return fmt.Errorf("unable to decode updateReactions#e769e4e7: %w", err) + } + case "reactions": + if err := b.Arr(func(b tdjson.Decoder) error { + var value Reaction + if err := value.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode updateReactions#e769e4e7: field reactions: %w", err) + } + u.Reactions = append(u.Reactions, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode updateReactions#e769e4e7: field reactions: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetReactions returns value of Reactions field. +func (u *UpdateReactions) GetReactions() (value []Reaction) { + if u == nil { + return + } + return u.Reactions +} + // UpdateDiceEmojis represents TL type `updateDiceEmojis#9d0f91df`. type UpdateDiceEmojis struct { // The new list of supported dice emojis @@ -20353,6 +21267,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateMessageInteractionInfo: // updateMessageInteractionInfo#ab803bfe // case *tdapi.UpdateMessageContentOpened: // updateMessageContentOpened#a55ea885 // case *tdapi.UpdateMessageMentionRead: // updateMessageMentionRead#f0f74d46 +// case *tdapi.UpdateMessageUnreadReactions: // updateMessageUnreadReactions#12a7220a // case *tdapi.UpdateMessageLiveLocationViewed: // updateMessageLiveLocationViewed#b2058595 // case *tdapi.UpdateNewChat: // updateNewChat#7bb98ccd // case *tdapi.UpdateChatTitle: // updateChatTitle#f58b85a4 @@ -20363,6 +21278,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateChatReadInbox: // updateChatReadInbox#d07036e7 // case *tdapi.UpdateChatReadOutbox: // updateChatReadOutbox#2a385285 // case *tdapi.UpdateChatActionBar: // updateChatActionBar#d9a258c2 +// case *tdapi.UpdateChatAvailableReactions: // updateChatAvailableReactions#852fb10d // case *tdapi.UpdateChatDraftMessage: // updateChatDraftMessage#2bf257d4 // case *tdapi.UpdateChatMessageSender: // updateChatMessageSender#77705241 // case *tdapi.UpdateChatMessageTTL: // updateChatMessageTtl#dde0a978 @@ -20371,6 +21287,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateChatReplyMarkup: // updateChatReplyMarkup#4e0ba5a0 // case *tdapi.UpdateChatTheme: // updateChatTheme#31f3d465 // case *tdapi.UpdateChatUnreadMentionCount: // updateChatUnreadMentionCount#80f47b1c +// case *tdapi.UpdateChatUnreadReactionCount: // updateChatUnreadReactionCount#81603cdd // case *tdapi.UpdateChatVideoChat: // updateChatVideoChat#25fb4ca6 // case *tdapi.UpdateChatDefaultDisableNotification: // updateChatDefaultDisableNotification#1ba96a9b // case *tdapi.UpdateChatHasProtectedContent: // updateChatHasProtectedContent#6b50071b @@ -20418,6 +21335,7 @@ const UpdateClassName = "Update" // case *tdapi.UpdateConnectionState: // updateConnectionState#57939e2e // case *tdapi.UpdateTermsOfService: // updateTermsOfService#b23cc55e // case *tdapi.UpdateUsersNearby: // updateUsersNearby#97c8ab5 +// case *tdapi.UpdateReactions: // updateReactions#e769e4e7 // case *tdapi.UpdateDiceEmojis: // updateDiceEmojis#9d0f91df // case *tdapi.UpdateAnimatedEmojiMessageClicked: // updateAnimatedEmojiMessageClicked#a3167405 // case *tdapi.UpdateAnimationSearchParameters: // updateAnimationSearchParameters#6016ef01 @@ -20542,6 +21460,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateMessageUnreadReactionsTypeID: + // Decoding updateMessageUnreadReactions#12a7220a. + v := UpdateMessageUnreadReactions{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateMessageLiveLocationViewedTypeID: // Decoding updateMessageLiveLocationViewed#b2058595. v := UpdateMessageLiveLocationViewed{} @@ -20612,6 +21537,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateChatAvailableReactionsTypeID: + // Decoding updateChatAvailableReactions#852fb10d. + v := UpdateChatAvailableReactions{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateChatDraftMessageTypeID: // Decoding updateChatDraftMessage#2bf257d4. v := UpdateChatDraftMessage{} @@ -20668,6 +21600,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateChatUnreadReactionCountTypeID: + // Decoding updateChatUnreadReactionCount#81603cdd. + v := UpdateChatUnreadReactionCount{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateChatVideoChatTypeID: // Decoding updateChatVideoChat#25fb4ca6. v := UpdateChatVideoChat{} @@ -20997,6 +21936,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateReactionsTypeID: + // Decoding updateReactions#e769e4e7. + v := UpdateReactions{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case UpdateDiceEmojisTypeID: // Decoding updateDiceEmojis#9d0f91df. v := UpdateDiceEmojis{} @@ -21198,6 +22144,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateMessageUnreadReactions": + // Decoding updateMessageUnreadReactions#12a7220a. + v := UpdateMessageUnreadReactions{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateMessageLiveLocationViewed": // Decoding updateMessageLiveLocationViewed#b2058595. v := UpdateMessageLiveLocationViewed{} @@ -21268,6 +22221,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateChatAvailableReactions": + // Decoding updateChatAvailableReactions#852fb10d. + v := UpdateChatAvailableReactions{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateChatDraftMessage": // Decoding updateChatDraftMessage#2bf257d4. v := UpdateChatDraftMessage{} @@ -21324,6 +22284,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateChatUnreadReactionCount": + // Decoding updateChatUnreadReactionCount#81603cdd. + v := UpdateChatUnreadReactionCount{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateChatVideoChat": // Decoding updateChatVideoChat#25fb4ca6. v := UpdateChatVideoChat{} @@ -21653,6 +22620,13 @@ func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case "updateReactions": + // Decoding updateReactions#e769e4e7. + v := UpdateReactions{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil case "updateDiceEmojis": // Decoding updateDiceEmojis#9d0f91df. v := UpdateDiceEmojis{} diff --git a/tdapi/tl_upload_sticker_file_gen.go b/tdapi/tl_upload_sticker_file_gen.go index 8bbe107847..5c1fcde382 100644 --- a/tdapi/tl_upload_sticker_file_gen.go +++ b/tdapi/tl_upload_sticker_file_gen.go @@ -31,16 +31,16 @@ var ( _ = tdjson.Encoder{} ) -// UploadStickerFileRequest represents TL type `uploadStickerFile#23a0f58e`. +// UploadStickerFileRequest represents TL type `uploadStickerFile#524839a`. type UploadStickerFileRequest struct { // Sticker file owner; ignored for regular users UserID int64 // Sticker file to upload - Sticker InputStickerClass + Sticker InputSticker } // UploadStickerFileRequestTypeID is TL type id of UploadStickerFileRequest. -const UploadStickerFileRequestTypeID = 0x23a0f58e +const UploadStickerFileRequestTypeID = 0x524839a // Ensuring interfaces in compile-time for UploadStickerFileRequest. var ( @@ -57,7 +57,7 @@ func (u *UploadStickerFileRequest) Zero() bool { if !(u.UserID == 0) { return false } - if !(u.Sticker == nil) { + if !(u.Sticker.Zero()) { return false } @@ -111,7 +111,7 @@ func (u *UploadStickerFileRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UploadStickerFileRequest) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode uploadStickerFile#23a0f58e as nil") + return fmt.Errorf("can't encode uploadStickerFile#524839a as nil") } b.PutID(UploadStickerFileRequestTypeID) return u.EncodeBare(b) @@ -120,14 +120,11 @@ func (u *UploadStickerFileRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UploadStickerFileRequest) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode uploadStickerFile#23a0f58e as nil") + return fmt.Errorf("can't encode uploadStickerFile#524839a as nil") } b.PutInt53(u.UserID) - if u.Sticker == nil { - return fmt.Errorf("unable to encode uploadStickerFile#23a0f58e: field sticker is nil") - } if err := u.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode uploadStickerFile#23a0f58e: field sticker: %w", err) + return fmt.Errorf("unable to encode uploadStickerFile#524839a: field sticker: %w", err) } return nil } @@ -135,10 +132,10 @@ func (u *UploadStickerFileRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *UploadStickerFileRequest) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode uploadStickerFile#23a0f58e to nil") + return fmt.Errorf("can't decode uploadStickerFile#524839a to nil") } if err := b.ConsumeID(UploadStickerFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#23a0f58e: %w", err) + return fmt.Errorf("unable to decode uploadStickerFile#524839a: %w", err) } return u.DecodeBare(b) } @@ -146,21 +143,19 @@ func (u *UploadStickerFileRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UploadStickerFileRequest) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode uploadStickerFile#23a0f58e to nil") + return fmt.Errorf("can't decode uploadStickerFile#524839a to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#23a0f58e: field user_id: %w", err) + return fmt.Errorf("unable to decode uploadStickerFile#524839a: field user_id: %w", err) } u.UserID = value } { - value, err := DecodeInputSticker(b) - if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#23a0f58e: field sticker: %w", err) + if err := u.Sticker.Decode(b); err != nil { + return fmt.Errorf("unable to decode uploadStickerFile#524839a: field sticker: %w", err) } - u.Sticker = value } return nil } @@ -168,7 +163,7 @@ func (u *UploadStickerFileRequest) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UploadStickerFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode uploadStickerFile#23a0f58e as nil") + return fmt.Errorf("can't encode uploadStickerFile#524839a as nil") } b.ObjStart() b.PutID("uploadStickerFile") @@ -177,11 +172,8 @@ func (u *UploadStickerFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { b.PutInt53(u.UserID) b.Comma() b.FieldStart("sticker") - if u.Sticker == nil { - return fmt.Errorf("unable to encode uploadStickerFile#23a0f58e: field sticker is nil") - } if err := u.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode uploadStickerFile#23a0f58e: field sticker: %w", err) + return fmt.Errorf("unable to encode uploadStickerFile#524839a: field sticker: %w", err) } b.Comma() b.StripComma() @@ -192,27 +184,25 @@ func (u *UploadStickerFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UploadStickerFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode uploadStickerFile#23a0f58e to nil") + return fmt.Errorf("can't decode uploadStickerFile#524839a to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("uploadStickerFile"); err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#23a0f58e: %w", err) + return fmt.Errorf("unable to decode uploadStickerFile#524839a: %w", err) } case "user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#23a0f58e: field user_id: %w", err) + return fmt.Errorf("unable to decode uploadStickerFile#524839a: field user_id: %w", err) } u.UserID = value case "sticker": - value, err := DecodeTDLibJSONInputSticker(b) - if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#23a0f58e: field sticker: %w", err) + if err := u.Sticker.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode uploadStickerFile#524839a: field sticker: %w", err) } - u.Sticker = value default: return b.Skip() } @@ -229,14 +219,14 @@ func (u *UploadStickerFileRequest) GetUserID() (value int64) { } // GetSticker returns value of Sticker field. -func (u *UploadStickerFileRequest) GetSticker() (value InputStickerClass) { +func (u *UploadStickerFileRequest) GetSticker() (value InputSticker) { if u == nil { return } return u.Sticker } -// UploadStickerFile invokes method uploadStickerFile#23a0f58e returning error if any. +// UploadStickerFile invokes method uploadStickerFile#524839a returning error if any. func (c *Client) UploadStickerFile(ctx context.Context, request *UploadStickerFileRequest) (*File, error) { var result File