From c2c48398a72520bb3ab447cd3dc06e2bb00e9412 Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 1 Aug 2024 07:44:59 +0000 Subject: [PATCH] feat(schema): update TDLib to the latest layer --- _schema/tdapi.tl | 458 +++++--- tdapi/tl_add_bot_media_preview_gen.go | 282 +++++ tdapi/tl_bot_info_gen.go | 162 +-- tdapi/tl_bot_media_preview_gen.go | 237 ++++ tdapi/tl_bot_media_preview_info_gen.go | 279 +++++ tdapi/tl_bot_media_previews_gen.go | 221 ++++ tdapi/tl_chat_active_stories_gen.go | 2 +- tdapi/tl_current_weather_gen.go | 227 ++++ tdapi/tl_delete_bot_media_previews_gen.go | 295 +++++ tdapi/tl_delete_messages_gen.go | 4 +- tdapi/tl_edit_bot_media_preview_gen.go | 315 +++++ tdapi/tl_edit_message_caption_gen.go | 3 +- tdapi/tl_edit_message_live_location_gen.go | 3 +- tdapi/tl_edit_message_media_gen.go | 3 +- tdapi/tl_edit_message_reply_markup_gen.go | 3 +- tdapi/tl_edit_message_scheduling_state_gen.go | 3 +- tdapi/tl_edit_message_text_gen.go | 3 +- tdapi/tl_edit_story_cover_gen.go | 271 +++++ tdapi/tl_forward_messages_gen.go | 2 +- tdapi/tl_found_users_gen.go | 251 ++++ tdapi/tl_get_bot_media_preview_info_gen.go | 238 ++++ tdapi/tl_get_bot_media_previews_gen.go | 206 ++++ tdapi/tl_get_callback_query_answer_gen.go | 3 +- tdapi/tl_get_current_weather_gen.go | 206 ++++ tdapi/tl_get_login_url_info_gen.go | 2 +- tdapi/tl_get_main_web_app_gen.go | 339 ++++++ tdapi/tl_get_message_added_reactions_gen.go | 3 +- tdapi/tl_get_message_properties_gen.go | 237 ++++ tdapi/tl_get_popular_web_app_bots_gen.go | 238 ++++ tdapi/tl_get_star_ad_account_url_gen.go | 2 +- tdapi/tl_get_star_gift_payment_options_gen.go | 207 ++++ tdapi/tl_get_star_revenue_statistics_gen.go | 2 +- tdapi/tl_get_star_transactions_gen.go | 2 +- tdapi/tl_get_star_withdrawal_url_gen.go | 4 +- tdapi/tl_get_web_app_link_url_gen.go | 2 +- tdapi/tl_get_web_app_url_gen.go | 5 +- tdapi/tl_input_message_content_gen.go | 6 +- tdapi/tl_input_message_reply_to_gen.go | 7 +- tdapi/tl_input_story_area_type_gen.go | 253 +++- tdapi/tl_input_story_content_gen.go | 88 +- tdapi/tl_internal_link_type_gen.go | 638 ++++++----- tdapi/tl_link_preview_gen.go | 111 +- tdapi/tl_link_preview_type_gen.go | 575 +++++++++- tdapi/tl_main_web_app_gen.go | 228 ++++ tdapi/tl_message_content_gen.go | 553 ++++++++- tdapi/tl_message_gen.go | 654 ++--------- tdapi/tl_message_properties_gen.go | 1020 +++++++++++++++++ tdapi/tl_message_sending_state_gen.go | 3 +- tdapi/tl_message_thread_info_gen.go | 2 +- tdapi/tl_open_web_app_gen.go | 2 +- tdapi/tl_payment_form_type_gen.go | 2 +- tdapi/tl_payment_receipt_type_gen.go | 2 +- tdapi/tl_push_message_content_gen.go | 3 +- tdapi/tl_recognize_speech_gen.go | 3 +- tdapi/tl_registry_gen.go | 124 +- tdapi/tl_reorder_bot_media_previews_gen.go | 295 +++++ tdapi/tl_report_chat_gen.go | 3 +- ...supergroup_anti_spam_false_positive_gen.go | 2 +- tdapi/tl_report_supergroup_spam_gen.go | 3 +- tdapi/tl_send_payment_form_gen.go | 2 +- .../tl_set_business_message_is_pinned_gen.go | 305 +++++ tdapi/tl_set_message_fact_check_gen.go | 4 +- tdapi/tl_star_payment_option_gen.go | 2 +- tdapi/tl_star_revenue_statistics_gen.go | 4 +- tdapi/tl_star_revenue_status_gen.go | 8 +- tdapi/tl_star_transaction_gen.go | 2 +- tdapi/tl_star_transaction_partner_gen.go | 285 ++++- tdapi/tl_star_transactions_gen.go | 4 +- tdapi/tl_stop_poll_gen.go | 3 +- tdapi/tl_store_payment_purpose_gen.go | 287 ++++- tdapi/tl_story_area_type_gen.go | 249 ++++ tdapi/tl_story_video_gen.go | 102 +- tdapi/tl_telegram_payment_purpose_gen.go | 285 ++++- tdapi/tl_top_chat_category_gen.go | 146 +++ tdapi/tl_update_gen.go | 6 +- tdapi/tl_user_type_gen.go | 126 +- 76 files changed, 9785 insertions(+), 1332 deletions(-) create mode 100644 tdapi/tl_add_bot_media_preview_gen.go create mode 100644 tdapi/tl_bot_media_preview_gen.go create mode 100644 tdapi/tl_bot_media_preview_info_gen.go create mode 100644 tdapi/tl_bot_media_previews_gen.go create mode 100644 tdapi/tl_current_weather_gen.go create mode 100644 tdapi/tl_delete_bot_media_previews_gen.go create mode 100644 tdapi/tl_edit_bot_media_preview_gen.go create mode 100644 tdapi/tl_edit_story_cover_gen.go create mode 100644 tdapi/tl_found_users_gen.go create mode 100644 tdapi/tl_get_bot_media_preview_info_gen.go create mode 100644 tdapi/tl_get_bot_media_previews_gen.go create mode 100644 tdapi/tl_get_current_weather_gen.go create mode 100644 tdapi/tl_get_main_web_app_gen.go create mode 100644 tdapi/tl_get_message_properties_gen.go create mode 100644 tdapi/tl_get_popular_web_app_bots_gen.go create mode 100644 tdapi/tl_get_star_gift_payment_options_gen.go create mode 100644 tdapi/tl_main_web_app_gen.go create mode 100644 tdapi/tl_message_properties_gen.go create mode 100644 tdapi/tl_reorder_bot_media_previews_gen.go create mode 100644 tdapi/tl_set_business_message_is_pinned_gen.go diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl index 3d2abfaac3..0d448c304b 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: b3e6365f3400fafbd5288b7ea0a3111162eb452a7bb2efa13b78d986adb93c03 +// SHA256: d1e8d9ca578190c75e48ce1095887073e20b2968bb45530d25fa84521cc5d685 double#2210c154 ? = Double; @@ -575,12 +575,14 @@ userTypeDeleted#94403d24 = UserType; //@can_be_edited True, if the bot is owned by the current user and can be edited using the methods toggleBotUsernameIsActive, reorderBotActiveUsernames, setBotProfilePhoto, setBotName, setBotInfoDescription, and setBotInfoShortDescription //@can_join_groups True, if the bot can be invited to basic group and supergroup chats //@can_read_all_group_messages True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages +//@has_main_web_app True, if the bot has the main Web App //@is_inline True, if the bot supports inline queries //@inline_query_placeholder Placeholder for inline queries (displayed on the application input field) //@need_location True, if the location of the user is expected to be sent with every inline query to this bot //@can_connect_to_business True, if the bot supports connection to Telegram Business accounts //@can_be_added_to_attachment_menu True, if the bot can be added to attachment or side menu -userTypeBot#ae30a83a can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool = UserType; +//@active_user_count The number of recently active users of the bot +userTypeBot#8ba3cc26 can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool has_main_web_app:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool active_user_count:int32 = UserType; //@description No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type userTypeUnknown#d4d0613d = UserType; @@ -853,27 +855,27 @@ premiumGiftCodePaymentOptions#97a8cf2e options:vector = StarPaymentOptions; -//@class StarTransactionDirection @description Describes direction of a transaction with Telegram stars +//@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars -//@description The transaction is incoming and increases the number of owned Telegram stars +//@description The transaction is incoming and increases the number of owned Telegram Stars starTransactionDirectionIncoming#b2cabe46 = StarTransactionDirection; -//@description The transaction is outgoing and decreases the number of owned Telegram stars +//@description The transaction is outgoing and decreases the number of owned Telegram Stars starTransactionDirectionOutgoing#6e83b5a0 = StarTransactionDirection; -//@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram stars +//@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram Stars //@description The transaction is a transaction with Telegram through a bot starTransactionPartnerTelegram#7a899cc0 = StarTransactionPartner; @@ -892,10 +894,10 @@ starTransactionPartnerFragment#da1849b5 withdrawal_state:RevenueWithdrawalState starTransactionPartnerTelegramAds#91f9c6b = StarTransactionPartner; //@description The transaction is a transaction with a bot -//@bot_user_id Identifier of the bot +//@user_id Identifier of the bot for the user, or the user for the bot //@product_info Information about the bought product; may be null if not applicable //@invoice_payload Invoice payload; for bots only -starTransactionPartnerBot#1bdcb459 bot_user_id:int53 product_info:productInfo invoice_payload:bytes = StarTransactionPartner; +starTransactionPartnerBot#298ce3d9 user_id:int53 product_info:productInfo invoice_payload:bytes = StarTransactionPartner; //@description The transaction is a transaction with a channel chat //@chat_id Identifier of the chat @@ -903,20 +905,25 @@ starTransactionPartnerBot#1bdcb459 bot_user_id:int53 product_info:productInfo in //@media Information about the bought media starTransactionPartnerChannel#44b29c29 chat_id:int53 paid_media_message_id:int53 media:vector = StarTransactionPartner; +//@description The transaction is a gift of Telegram Stars from another user +//@user_id Identifier of the user; 0 if the gift was anonymous +//@sticker A sticker to be shown in the transaction information; may be null if unknown +starTransactionPartnerUser#2cf89d66 user_id:int53 sticker:sticker = StarTransactionPartner; + //@description The transaction is a transaction with unknown partner starTransactionPartnerUnsupported#c4b20d73 = StarTransactionPartner; -//@description Represents a transaction changing the amount of owned Telegram stars +//@description Represents a transaction changing the amount of owned Telegram Stars //@id Unique identifier of the transaction -//@star_count The amount of added owned Telegram stars; negative for outgoing transactions +//@star_count The amount of added owned Telegram Stars; negative for outgoing transactions //@is_refund True, if the transaction is a refund of a previous transaction //@date Point in time (Unix timestamp) when the transaction was completed //@partner Source of the incoming transaction, or its recipient for outgoing transactions starTransaction#ce1084a8 id:string star_count:int53 is_refund:Bool date:int32 partner:StarTransactionPartner = StarTransaction; -//@description Represents a list of Telegram star transactions -//@star_count The amount of owned Telegram stars -//@transactions List of transactions with Telegram stars +//@description Represents a list of Telegram Star transactions +//@star_count The amount of owned Telegram Stars +//@transactions List of transactions with Telegram Stars //@next_offset The offset for the next request. If empty, then there are no more results starTransactions#306a010e star_count:int53 transactions:vector next_offset:string = StarTransactions; @@ -1034,11 +1041,12 @@ user#18552c62 id:int53 first_name:string last_name:string usernames:usernames ph //@commands List of the bot commands //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null +//@has_media_previews True, if the bot has media previews //@edit_commands_link The internal link, which can be used to edit bot commands; may be null //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo#bfdb89a short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo#32ab8617 short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. @@ -1068,6 +1076,11 @@ userFullInfo#b61c9c5 personal_photo:chatPhoto photo:chatPhoto public_photo:chatP //@user_ids A list of user identifiers users#9d955a12 total_count:int32 user_ids:vector = Users; +//@description Represents a list of found users +//@user_ids Identifiers of the found users +//@next_offset The offset for the next request. If empty, then there are no more results +foundUsers#c531e854 user_ids:vector next_offset:string = FoundUsers; + //@description Contains information about a chat administrator //@user_id User identifier of the administrator //@custom_title Custom title of the administrator @@ -1524,7 +1537,7 @@ messageSendingStatePending#f32b63b4 sending_id:int32 = MessageSendingState; //@description The message failed to be sent //@error The cause of the message sending failure -//@can_retry True, if the message can be re-sent +//@can_retry True, if the message can be re-sent using resendMessages or readdQuickReplyShortcutMessages //@need_another_sender True, if the message can be re-sent only on behalf of a different sender //@need_another_reply_quote True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message //@need_drop_reply True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages @@ -1561,13 +1574,13 @@ messageReplyToStory#708ca939 story_sender_chat_id:int53 story_id:int32 = Message //@class InputMessageReplyTo @description Contains information about the message or the story to be replied //@description Describes a message to be replied in the same chat and forum topic -//@message_id The identifier of the message to be replied in the same chat and forum topic +//@message_id The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if messageProperties.can_be_replied //@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats inputMessageReplyToMessage#c25e9903 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; //@description Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats //@chat_id The identifier of the chat to which the message to be replied belongs -//@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat +//@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if messageProperties.can_be_replied_in_another_chat //@quote Quote from the message to be replied; pass null if none inputMessageReplyToExternalMessage#892d232a chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; @@ -1590,19 +1603,7 @@ factCheck#c185f918 text:formattedText country_code:string = FactCheck; //@is_outgoing True, if the message is outgoing //@is_pinned True, if the message is pinned //@is_from_offline True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message -//@can_be_edited True, if the message can be edited. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message by the application -//@can_be_forwarded True, if the message can be forwarded -//@can_be_replied_in_another_chat True, if the message can be replied in another chat or topic //@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_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 information about the message thread is available through getMessageThread and getMessageThreadHistory -//@can_get_read_date True, if read date of the message can be received through getMessageReadDate -//@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 link preview description through getMessageLink -//@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions //@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 //@is_topic_message True, if the message is a forum topic message @@ -1629,7 +1630,7 @@ factCheck#c185f918 text:formattedText country_code:string = FactCheck; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message#bdf0da63 id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat: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_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message#dc764ddc id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages //@total_count Approximate total number of messages found @@ -2251,12 +2252,17 @@ foundWebApp#eea8d01e web_app:webApp request_write_access:Bool skip_confirmation: //@url A Web App URL to open in a web view webAppInfo#2efdb2e8 launch_id:int64 url:string = WebAppInfo; +//@description Contains information about the main Web App of a bot +//@url URL of the Web App to open +//@is_compact True, if the Web App must always be opened in the compact mode instead of the full-size mode +mainWebApp#4fb068f1 url:string is_compact:Bool = MainWebApp; + //@description Contains information about a message thread //@chat_id Identifier of the chat to which the message thread belongs //@message_thread_id Message thread identifier, unique within the chat //@reply_info Information about the message thread; may be null for forum topic threads //@unread_message_count Approximate number of unread messages in the message thread -//@messages The messages from which the thread starts. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +//@messages The messages from which the thread starts. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) //@draft_message A draft of a message in the message thread; may be null if none messageThreadInfo#683fd5ad chat_id:int53 message_thread_id:int53 reply_info:messageReplyInfo unread_message_count:int32 messages:vector draft_message:draftMessage = MessageThreadInfo; @@ -2705,19 +2711,32 @@ linkPreviewTypeChat#ae2fa122 type:InviteLinkChatType photo:chatPhoto creates_joi //@author Author of the document linkPreviewTypeDocument#53b02747 document:document author:string = LinkPreviewType; +//@description The link is a link to an animation player +//@url URL of the external animation player +//@thumbnail Thumbnail of the animation; may be null if unknown +//@duration Duration of the animation, in seconds +//@author Author of the animation +//@width Expected width of the embedded player +//@height Expected height of the embedded player +linkPreviewTypeEmbeddedAnimationPlayer#c45fddca url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; + //@description The link is a link to an audio player //@url URL of the external audio player +//@thumbnail Thumbnail of the audio; may be null if unknown //@duration Duration of the audio, in seconds //@author Author of the audio -linkPreviewTypeEmbeddedAudioPlayer#2bb06106 url:string duration:int32 author:string = LinkPreviewType; +//@width Expected width of the embedded player +//@height Expected height of the embedded player +linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; //@description The link is a link to a video player //@url URL of the external video player +//@thumbnail Thumbnail of the video; may be null if unknown //@duration Duration of the video, in seconds //@author Author of the video -//@width Expected width of the preview -//@height Expected height of the preview -linkPreviewTypeEmbeddedVideoPlayer#fd4c9719 url:string duration:int32 author:string width:int32 height:int32 = LinkPreviewType; +//@width Expected width of the embedded player +//@height Expected height of the embedded player +linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 url:string thumbnail:photo duration:int32 author:string width:int32 height:int32 = LinkPreviewType; //@description The link is a link to an invoice linkPreviewTypeInvoice#d47f48da = LinkPreviewType; @@ -2802,10 +2821,11 @@ linkPreviewTypeWebApp#a62eef8a photo:photo = LinkPreviewType; //@type Type of the link preview //@has_large_media True, if size of media in the preview can be changed //@show_large_media True, if large media preview must be shown; otherwise, the media preview must be shown small and only the first frame must be shown for videos +//@show_media_above_description True, if media must be shown above link preview description; otherwise, the media must be shown below the description //@skip_confirmation True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear //@show_above_text True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text //@instant_view_version Version of instant view (currently, can be 1 or 2) for the web page; 0 if none -linkPreview#d3d67eed url:string display_url:string site_name:string title:string description:formattedText type:LinkPreviewType has_large_media:Bool show_large_media:Bool skip_confirmation:Bool show_above_text:Bool instant_view_version:int32 = LinkPreview; +linkPreview#52a366d6 url:string display_url:string site_name:string title:string description:formattedText type:LinkPreviewType has_large_media:Bool show_large_media:Bool show_media_above_description:Bool skip_confirmation:Bool show_above_text:Bool instant_view_version:int32 = LinkPreview; //@description Contains information about a country //@country_code A two-letter ISO 3166-1 alpha-2 country code @@ -2983,8 +3003,8 @@ paymentOption#ee79989b title:string url:string = PaymentOption; //@need_password True, if the user will be able to save credentials, if sets up a 2-step verification password paymentFormTypeRegular#ba6d2f0f invoice:invoice payment_provider_user_id:int53 payment_provider:PaymentProvider additional_payment_options:vector saved_order_info:orderInfo saved_credentials:vector can_save_credentials:Bool need_password:Bool = PaymentFormType; -//@description The payment form is for a payment in Telegram stars -//@star_count Number of Telegram stars that will be paid +//@description The payment form is for a payment in Telegram Stars +//@star_count Number of Telegram Stars that will be paid paymentFormTypeStars#56b9d3d star_count:int53 = PaymentFormType; //@description Contains information about an invoice payment form @@ -3015,8 +3035,8 @@ paymentResult#d00fe85d success:Bool verification_url:string = PaymentResult; //@tip_amount The amount of tip chosen by the buyer in the smallest units of the currency paymentReceiptTypeRegular#9e7715b6 payment_provider_user_id:int53 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceiptType; -//@description The payment was done using Telegram stars -//@star_count Number of Telegram stars that were paid +//@description The payment was done using Telegram Stars +//@star_count Number of Telegram Stars that were paid //@transaction_id Unique identifier of the transaction that can be used to dispute it paymentReceiptTypeStars#1194074c star_count:int53 transaction_id:string = PaymentReceiptType; @@ -3427,7 +3447,7 @@ messageAudio#107e741c audio:audio caption:formattedText = MessageContent; messageDocument#2394ab77 document:document caption:formattedText = MessageContent; //@description A message with paid media -//@star_count Number of stars needed to buy access to the media in the message +//@star_count Number of Telegram Stars needed to buy access to the media in the message //@media Information about the media //@caption Media caption //@show_caption_above_media True, if the caption must be shown above the media; otherwise, the caption must be shown below the media @@ -3682,7 +3702,7 @@ messagePaymentSuccessful#53d93cdc invoice_chat_id:int53 invoice_message_id:int53 messagePaymentSuccessfulBot#68e13eb9 currency:string total_amount:int53 is_recurring:Bool is_first_recurring:Bool invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; //@description A payment has been refunded -//@owner_id Identifier of the previous owner of the Telegram stars that refunds them +//@owner_id Identifier of the previous owner of the Telegram Stars that refunds them //@currency Currency for the price of the product //@total_amount Total price for the product, in the smallest units of the currency //@invoice_payload Invoice payload; only for bots @@ -3690,15 +3710,16 @@ messagePaymentSuccessfulBot#68e13eb9 currency:string total_amount:int53 is_recur //@provider_payment_charge_id Provider payment identifier messagePaymentRefunded#11bcb8f3 owner_id:MessageSender currency:string total_amount:int53 invoice_payload:bytes telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; -//@description Telegram Premium was gifted to the user -//@gifter_user_id The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous +//@description Telegram Premium was gifted to a user +//@gifter_user_id The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous or is outgoing +//@receiver_user_id The identifier of a user that received Telegram Premium; 0 if the gift is incoming //@currency Currency for the paid amount //@amount The paid amount, in the smallest units of the currency //@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none //@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if none //@month_count Number of months the Telegram Premium subscription will be active //@sticker A sticker to be shown in the message; may be null if unknown -messageGiftedPremium#78d1d0a gifter_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; +messageGiftedPremium#30dd808e gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; //@description A Telegram Premium gift code was created for the user //@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown @@ -3743,6 +3764,18 @@ messagePremiumGiveawayCompleted#80533949 giveaway_message_id:int53 winner_count: //@unclaimed_prize_count Number of undistributed prizes messagePremiumGiveawayWinners#815d5f31 boosted_chat_id:int53 giveaway_message_id:int53 additional_chat_count:int32 actual_winners_selection_date:int32 only_new_members:Bool was_refunded:Bool month_count:int32 prize_description:string winner_count:int32 winner_user_ids:vector unclaimed_prize_count:int32 = MessageContent; +//@description Telegram Stars were gifted to a user +//@gifter_user_id The identifier of a user that gifted Telegram Stars; 0 if the gift was anonymous or is outgoing +//@receiver_user_id The identifier of a user that received Telegram Stars; 0 if the gift is incoming +//@currency Currency for the paid amount +//@amount The paid amount, in the smallest units of the currency +//@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none +//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if none +//@star_count Number of Telegram Stars that were gifted +//@transaction_id Identifier of the transaction for Telegram Stars purchase; for receiver only +//@sticker A sticker to be shown in the message; may be null if unknown +messageGiftedStars#41bdbea7 gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 star_count:int53 transaction_id:string sticker:sticker = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered#a678fcff = MessageContent; @@ -3958,7 +3991,7 @@ inputMessageAudio#daa400b2 audio:InputFile album_cover_thumbnail:inputThumbnail inputMessageDocument#615b72b9 document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; //@description A message with paid media; can be used only in channel chats with supergroupFullInfo.has_paid_media_allowed -//@star_count The number of stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") +//@star_count The number of Telegram Stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") //@paid_media The content of the paid media //@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats @@ -4072,11 +4105,39 @@ inputMessageStory#21099d63 story_sender_chat_id:int53 story_id:int32 = InputMess //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from -//@message_id Identifier of the message to forward. A message can be forwarded only if message.can_be_forwarded +//@message_id Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded //@in_game_share True, if a game message is being shared from a launched game; applies only to game messages //@copy_options Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual inputMessageForwarded#651a73f8 from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent; +//@description Contains properties of a message and describes actions that can be done with the message right now +//@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 using the method deleteMessages with revoke == false +//@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true +//@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. +//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages +//@can_be_paid True, if the message can be paid using inputInvoiceMessage +//@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage +//@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage +//@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage +//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options +//@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage +//@can_edit_scheduling_state True, if scheduling state of the message can be edited +//@can_get_added_reactions True, if the list of added reactions is available using getMessageAddedReactions +//@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode +//@can_get_link True, if a link can be generated for the message using getMessageLink +//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink +//@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory +//@can_get_read_date True, if read date of the message can be received through getMessageReadDate +//@can_get_statistics True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards +//@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers +//@can_recognize_speech True, if speech can be recognized for the message through recognizeSpeech +//@can_report_chat True, if the message can be reported using reportChat +//@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions +//@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam +//@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck +//@need_show_statistics True, if message statistics must be available from context menu of the message +messageProperties#5ae4cb28 can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_scheduling_state:Bool can_get_added_reactions:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; + //@class SearchMessagesFilter @description Represents a filter for message search results //@description Returns all found messages, no filter is applied @@ -4306,6 +4367,11 @@ emojiCategoryTypeEmojiStatus#5254b347 = EmojiCategoryType; //@description The category must be used for chat photo emoji selection emojiCategoryTypeChatPhoto#3f200529 = EmojiCategoryType; +//@description Describes the current weather +//@temperature Temperature, in degree Celsius +//@emoji Emoji representing the weather +currentWeather#eacea8c0 temperature:double emoji:string = CurrentWeather; + //@description Describes position of a clickable rectangle area on a story media //@x_percentage The abscissa of the rectangle's center, as a percentage of the media width //@y_percentage The ordinate of the rectangle's center, as a percentage of the media height @@ -4315,7 +4381,7 @@ emojiCategoryTypeChatPhoto#3f200529 = EmojiCategoryType; //@corner_radius_percentage The radius of the rectangle corner rounding, as a percentage of the media width storyAreaPosition#a49fec6c x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double corner_radius_percentage:double = StoryAreaPosition; -//@class StoryAreaType @description Describes type of clickable rectangle area on a story media +//@class StoryAreaType @description Describes type of clickable area on a story media //@description An area pointing to a location //@location The location @@ -4342,12 +4408,18 @@ storyAreaTypeMessage#bfef76b4 chat_id:int53 message_id:int53 = StoryAreaType; //@url HTTP or tg:// URL to be opened when the area is clicked storyAreaTypeLink#f8626185 url:string = StoryAreaType; +//@description An area with information about weather +//@temperature Temperature, in degree Celsius +//@emoji Emoji representing the weather +//@background_color A color of the area background in the ARGB format +storyAreaTypeWeather#a6587dbe temperature:double emoji:string background_color:int32 = StoryAreaType; + //@description Describes a clickable rectangle area on a story media //@position Position of the area //@type Type of the area storyArea#c9ff075e position:storyAreaPosition type:StoryAreaType = StoryArea; -//@class InputStoryAreaType @description Describes type of clickable rectangle area on a story media to be added +//@class InputStoryAreaType @description Describes type of clickable area on a story media to be added //@description An area pointing to a location //@location The location @@ -4372,13 +4444,19 @@ inputStoryAreaTypeSuggestedReaction#7d4751d3 reaction_type:ReactionType is_dark: //@description An area pointing to a message //@chat_id Identifier of the chat with the message. Currently, the chat must be a supergroup or a channel chat -//@message_id Identifier of the message. Only successfully sent non-scheduled messages can be specified +//@message_id Identifier of the message. Use messageProperties.can_be_shared_in_story to check whether the message is suitable inputStoryAreaTypeMessage#f01be457 chat_id:int53 message_id:int53 = InputStoryAreaType; //@description An area pointing to a HTTP or tg:// link //@url HTTP or tg:// URL to be opened when the area is clicked inputStoryAreaTypeLink#53f31b48 url:string = InputStoryAreaType; +//@description An area with information about weather +//@temperature Temperature, in degree Celsius +//@emoji Emoji representing the weather +//@background_color A color of the area background in the ARGB format +inputStoryAreaTypeWeather#b7b7de9d temperature:double emoji:string background_color:int32 = InputStoryAreaType; + //@description Describes a clickable rectangle area on a story media to be added //@position Position of the area //@type Type of the area @@ -4397,8 +4475,9 @@ inputStoryAreas#b8ba29fe areas:vector = InputStoryAreas; //@minithumbnail Video minithumbnail; may be null //@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null //@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes +//@cover_frame_timestamp Timestamp of the frame used as video thumbnail //@video File containing the video -storyVideo#8588ba3 duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 video:file = StoryVideo; +storyVideo#562b0a45 duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 cover_frame_timestamp:double video:file = StoryVideo; //@class StoryContent @description Contains the content of a story @@ -4425,8 +4504,9 @@ inputStoryContentPhoto#3286fbe0 photo:InputFile added_sticker_file_ids:vector duration:double is_animation:Bool = InputStoryContent; +inputStoryContentVideo#cc1e4239 video:InputFile added_sticker_file_ids:vector duration:double cover_frame_timestamp:double is_animation:Bool = InputStoryContent; //@class StoryList @description Describes a list of stories @@ -4514,7 +4594,7 @@ storyInfo#8997c352 story_id:int32 date:int32 is_for_close_friends:Bool = StoryIn //@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list //@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order //@max_read_story_id Identifier of the last read active story -//@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) +//@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) chatActiveStories#d923d773 chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; //@class StoryInteractionType @description Describes type of interaction with a story @@ -4584,6 +4664,20 @@ publicForwardStory#7fdf26af story:story = PublicForward; //@next_offset The offset for the next request. If empty, then there are no more results publicForwards#3ed29447 total_count:int32 forwards:vector next_offset:string = PublicForwards; +//@description Describes media previews of a bot +//@date Point in time (Unix timestamp) when the preview was added or changed last time +//@content Content of the preview +botMediaPreview#9eb59ce8 date:int32 content:StoryContent = BotMediaPreview; + +//@description Contains a list of media previews of a bot +//@previews List of media previews +botMediaPreviews#f1b8f27d previews:vector = BotMediaPreviews; + +//@description Contains a list of media previews of a bot for the given language and the list of languages for which the bot has dedicated previews +//@previews List of media previews +//@language_codes List of language codes for which the bot has dedicated previews +botMediaPreviewInfo#e49169db previews:vector language_codes:vector = BotMediaPreviewInfo; + //@description Contains a list of features available on a specific chat boost level //@level Target chat boost level //@story_per_day_count Number of stories that the chat can publish daily @@ -5905,7 +5999,7 @@ premiumState#91a8799 state:formattedText payment_options:vector = ChatRevenueTransactions; -//@description Contains information about Telegram stars earned by a bot or a chat -//@total_count Total number of the stars earned -//@current_count The number of Telegram stars that aren't withdrawn yet -//@available_count The number of Telegram stars that are available for withdrawal -//@withdrawal_enabled True, if Telegram stars can be withdrawn now or later +//@description Contains information about Telegram Stars earned by a bot or a chat +//@total_count Total number of Telegram Stars earned +//@current_count The number of Telegram Stars that aren't withdrawn yet +//@available_count The number of Telegram Stars that are available for withdrawal +//@withdrawal_enabled True, if Telegram Stars can be withdrawn now or later //@next_withdrawal_in Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now starRevenueStatus#e85bd5fb total_count:int53 current_count:int53 available_count:int53 withdrawal_enabled:Bool next_withdrawal_in:int32 = StarRevenueStatus; -//@description A detailed statistics about Telegram stars earned by a bot or a chat +//@description A detailed statistics about Telegram Stars earned by a bot or a chat //@revenue_by_day_graph A graph containing amount of revenue in a given day -//@status Telegram star revenue status -//@usd_rate Current conversion rate of a Telegram star to USD +//@status Telegram Star revenue status +//@usd_rate Current conversion rate of a Telegram Star to USD starRevenueStatistics#bd2d9257 revenue_by_day_graph:StatisticalGraph status:starRevenueStatus usd_rate:double = StarRevenueStatistics; //@description A point on a Cartesian plane @@ -8164,8 +8277,8 @@ updateDefaultReactionType#4b615105 reaction_type:ReactionType = Update; //@tags The new tags updateSavedMessagesTags#7386424a saved_messages_topic_id:int53 tags:savedMessagesTags = Update; -//@description The number of Telegram stars owned by the current user has changed -//@star_count The new number of Telegram stars owned +//@description The number of Telegram Stars owned by the current user has changed +//@star_count The new number of Telegram Stars owned updateOwnedStarCount#de995b79 star_count:int53 = Update; //@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions @@ -8173,9 +8286,9 @@ updateOwnedStarCount#de995b79 star_count:int53 = Update; //@revenue_amount New amount of earned revenue updateChatRevenueAmount#c6c9bcc4 chat_id:int53 revenue_amount:chatRevenueAmount = Update; -//@description The Telegram star revenue earned by a bot or a chat has changed. If star transactions screen of the chat is opened, then getStarTransactions may be called to fetch new transactions -//@owner_id Identifier of the owner of the Telegram stars -//@status New Telegram star revenue status +//@description The Telegram Star revenue earned by a bot or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions +//@owner_id Identifier of the owner of the Telegram Stars +//@status New Telegram Star revenue status updateStarRevenueStatus#ef4bfccb owner_id:MessageSender status:starRevenueStatus = Update; //@description The parameters of speech recognition without Telegram Premium subscription has changed @@ -8656,17 +8769,22 @@ getCallbackQueryMessage#bd209172 chat_id:int53 message_id:int53 callback_query_i //@message_ids Identifiers of the messages to get getMessages#d5dd28bf chat_id:int53 message_ids:vector = Messages; -//@description Returns information about a message thread. Can be used only if message.can_get_message_thread == true +//@description Returns properties of a message; this is an offline request +//@chat_id Chat identifier +//@message_id Identifier of the message +getMessageProperties#2e18e1ab chat_id:int53 message_id:int53 = MessageProperties; + +//@description Returns information about a message thread. Can be used only if messageProperties.can_get_message_thread == true //@chat_id Chat identifier //@message_id Identifier of the message getMessageThread#7af23e3e chat_id:int53 message_id:int53 = MessageThreadInfo; -//@description Returns read date of a recent outgoing message in a private chat. The method can be called if message.can_get_read_date == true and the message is read +//@description Returns read date of a recent outgoing message in a private chat. The method can be called if messageProperties.can_get_read_date == true //@chat_id Chat identifier //@message_id Identifier of the message getMessageReadDate#a7850343 chat_id:int53 message_id:int53 = MessageReadDate; -//@description Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if message.can_get_viewers == true +//@description Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if messageProperties.can_get_viewers == true //@chat_id Chat identifier //@message_id Identifier of the message getMessageViewers#a18f1ace chat_id:int53 message_id:int53 = MessageViewers; @@ -8785,7 +8903,7 @@ getSuitablePersonalChats#90849bf5 = Chats; //@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached loadSavedMessagesTopics#1146d6b8 limit:int32 = Ok; -//@description Returns messages in a Saved Messages topic. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +//@description Returns messages in a Saved Messages topic. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) //@saved_messages_topic_id Identifier of Saved Messages topic which messages will be fetched //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages @@ -8822,7 +8940,7 @@ setPinnedSavedMessagesTopics#475a1110 saved_messages_topic_ids:vector = O //@limit The maximum number of chats to be returned; up to 100 getGroupsInCommon#16bdd36a user_id:int53 offset_chat_id:int53 limit:int32 = Chats; -//@description Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). +//@description Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). //@chat_id Chat identifier //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages @@ -8830,7 +8948,7 @@ getGroupsInCommon#16bdd36a user_id:int53 offset_chat_id:int53 limit:int32 = Chat //@only_local Pass true to get only messages that are available without sending network requests getChatHistory#d051927d chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only_local:Bool = Messages; -//@description Returns messages in a message thread of a message. Can be used only if message.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. +//@description Returns messages in a message thread of a message. Can be used only if messageProperties.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. //@chat_id Chat identifier //@message_id Message identifier, which thread history needs to be returned //@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message @@ -8984,7 +9102,7 @@ getChatMessageCount#38f78909 chat_id:int53 filter:SearchMessagesFilter saved_mes //@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages getChatMessagePosition#81bfcc7 chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = Count; -//@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +//@description Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) //@chat_id Chat identifier getChatScheduledMessages#df3d2ffb chat_id:int53 = Messages; @@ -9013,7 +9131,7 @@ removeNotification#336ab34e notification_group_id:int32 notification_id:int32 = //@max_notification_id The maximum identifier of removed notifications removeNotificationGroup#661a638e notification_group_id:int32 max_notification_id:int32 = Ok; -//@description Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels, or if message.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request +//@description Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message //@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its link preview @@ -9021,7 +9139,7 @@ removeNotificationGroup#661a638e notification_group_id:int32 max_notification_id //@in_message_thread Pass true to create a link to the message as a channel post comment, in a message thread, or a forum topic getMessageLink#c556ef7a chat_id:int53 message_id:int53 media_timestamp:int32 for_album:Bool in_message_thread:Bool = MessageLink; -//@description Returns an HTML code for embedding the message. Available only for messages in supergroups and channels with a username +//@description Returns an HTML code for embedding the message. Available only if messageProperties.can_get_embedding_code //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message //@for_album Pass true to return an HTML code for embedding of the whole media album @@ -9042,9 +9160,9 @@ translateText#252264f2 text:formattedText to_language_code:string = FormattedTex //@to_language_code Language code of the language to which the message is translated. Must be one of translateMessageText#53c51ed2 chat_id:int53 message_id:int53 to_language_code:string = FormattedText; -//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent, must not be scheduled, and must be from a non-secret chat +//@description Recognizes speech in a video note or a voice note message //@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_recognize_speech to check whether the message is suitable recognizeSpeech#67d402b9 chat_id:int53 message_id:int53 = Ok; //@description Rates recognized speech in a video note or a voice note message @@ -9099,7 +9217,7 @@ sendInlineQueryResultMessage#467c5478 chat_id:int53 message_thread_id:int53 repl //@chat_id Identifier of the chat to which to forward messages //@message_thread_id If not 0, the message thread identifier in which the message will be sent; for forum threads only //@from_chat_id Identifier of the chat from which to forward messages -//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if message.can_be_forwarded +//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options //@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false @@ -9127,7 +9245,7 @@ addLocalMessage#f617b7a1 chat_id:int53 sender_id:MessageSender reply_to:InputMes //@description Deletes messages //@chat_id Chat identifier -//@message_ids Identifiers of the messages to be deleted +//@message_ids Identifiers of the messages to be deleted. Use messageProperties.can_be_deleted_only_for_self and messageProperties.can_be_deleted_for_all_users to get suitable messages //@revoke Pass true to delete messages for all chat members. Always true for supergroups, channels and secret chats deleteMessages#c3ed9de2 chat_id:int53 message_ids:vector revoke:Bool = Ok; @@ -9143,16 +9261,16 @@ deleteChatMessagesBySender#ba9b2e67 chat_id:int53 sender_id:MessageSender = Ok; //@revoke Pass true to delete chat messages for all users; private chats only deleteChatMessagesByDate#9e44e0bf chat_id:int53 min_date:int32 max_date:int32 revoke:Bool = Ok; -//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side. +//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New text content of the message. Must be of type inputMessageText editMessageText#bb2e1b7 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; //@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@location New location content of the message; pass null to stop sharing the live location //@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. @@ -9162,22 +9280,22 @@ editMessageLiveLocation#8f511394 chat_id:int53 message_id:int53 reply_markup:Rep //@description Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo editMessageMedia#bb4b8713 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; -//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side. +//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none; for bots only //@caption New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption //@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages editMessageCaption#87977241 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Message; -//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side. +//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@reply_markup The new message reply markup; pass null if none editMessageReplyMarkup#13cbde89 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Message; @@ -9216,13 +9334,13 @@ editInlineMessageReplyMarkup#fbf906de inline_message_id:string reply_markup:Repl //@description Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed //@chat_id The chat the message belongs to -//@message_id Identifier of the message +//@message_id Identifier of the message. Use messageProperties.can_edit_scheduling_state to check whether the message is suitable //@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 Changes the fact-check of a message. Can be only used if getOption("can_edit_fact_check") == true +//@description Changes the fact-check of a message. Can be only used if messageProperties.can_set_fact_check == true //@chat_id The channel chat the message belongs to -//@message_id Identifier of the message. The message must be one of the following types: messageAnimation, messageAudio, messageDocument, messagePhoto, messageText, messageVideo +//@message_id Identifier of the message //@text New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported setMessageFactCheck#ffbe3d08 chat_id:int53 message_id:int53 text:formattedText = Ok; @@ -9297,6 +9415,13 @@ editBusinessMessageReplyMarkup#29d46c17 business_connection_id:string chat_id:in //@reply_markup The new message reply markup; pass null if none stopBusinessPoll#bbeb2160 business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = BusinessMessage; +//@description Pins or unpins a message sent on behalf of a business account; for bots only +//@business_connection_id Unique identifier of business connection on behalf of which the message was sent +//@chat_id The chat the message belongs to +//@message_id Identifier of the message +//@is_pinned Pass true to pin the message, pass false to unpin it +setBusinessMessageIsPinned#ff14f5f0 business_connection_id:string chat_id:int53 message_id:int53 is_pinned:Bool = Ok; + //@description Checks validness of a name for a quick reply shortcut. Can be called synchronously //@name The name of the shortcut; 1-32 characters checkQuickReplyShortcutName#7d3dd129 name:string = Ok; @@ -9465,7 +9590,7 @@ setMessageReactions#71fa9e8f chat_id:int53 message_id:int53 reaction_types:vecto //@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 +//@message_id Identifier of the message. Use messageProperties.can_get_added_reactions to check whether added reactions can be received for the message //@reaction_type Type of the reactions to return; pass null to return all added reactions //@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 @@ -9560,9 +9685,9 @@ setPollAnswer#5303b916 chat_id:int53 message_id:int53 option_ids:vector = //@limit The maximum number of voters to be returned; must be positive and can't be greater than 50. For optimal performance, the number of returned voters is chosen by TDLib and can be smaller than the specified limit, even if the end of the voter list has not been reached getPollVoters#c45ba9ac chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit:int32 = MessageSenders; -//@description Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag is set +//@description Stops a poll //@chat_id Identifier of the chat to which the poll belongs -//@message_id Identifier of the message containing the poll +//@message_id Identifier of the message containing the poll. Use messageProperties.can_be_edited to check whether the poll can be stopped //@reply_markup The new message reply markup; pass null if none; for bots only stopPoll#62e80aad chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; @@ -9579,7 +9704,7 @@ getBusinessConnection#81f42420 connection_id:string = BusinessConnection; //@description Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. The method needs to be called when the user presses the button //@chat_id Chat identifier of the message with the button -//@message_id Message identifier of the message with the button +//@message_id Message identifier of the message with the button. The message must not be scheduled //@button_id Button identifier getLoginUrlInfo#ccc99db3 chat_id:int53 message_id:int53 button_id:int53 = LoginUrlInfo; @@ -9623,6 +9748,11 @@ getInlineQueryResults#79dcf86c bot_user_id:int53 chat_id:int53 user_location:loc //@next_offset Offset for the next inline query; pass an empty string if there are no more results answerInlineQuery#ac7cc5e6 inline_query_id:int64 is_personal:Bool button:inlineQueryResultsButton results:vector cache_time:int32 next_offset:string = Ok; +//@description Returns popular Web App bots +//@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 bots to be returned; up to 100 +getPopularWebAppBots#e8d04cb offset:string limit:int32 = FoundUsers; + //@description Returns information about a Web App by its short name. Returns a 404 error if the Web App is not found //@bot_user_id Identifier of the target bot //@web_app_short_name Short name of the Web App @@ -9634,15 +9764,23 @@ searchWebApp#b5fc8a35 bot_user_id:int53 web_app_short_name:string = FoundWebApp; //@web_app_short_name Short name of the Web App //@start_parameter Start parameter from internalLinkTypeWebApp //@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the application; 0-64 English letters, digits, and underscores +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores //@allow_write_access Pass true if the current user allowed the bot to send them messages getWebAppLinkUrl#4f0ef3cc chat_id:int53 bot_user_id:int53 web_app_short_name:string start_parameter:string theme:themeParameters application_name:string allow_write_access:Bool = HttpUrl; -//@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, an inlineQueryResultsButtonTypeWebApp button, or an internalLinkTypeSideMenuBot link +//@description Returns information needed to open the main Web App of a bot +//@chat_id Identifier of the chat in which the Web App is opened; pass 0 if none +//@bot_user_id Identifier of the target bot +//@start_parameter Start parameter from internalLinkTypeMainWebApp +//@theme Preferred Web App theme; pass null to use the default theme +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores +getMainWebApp#be84329a chat_id:int53 bot_user_id:int53 start_parameter:string theme:themeParameters application_name:string = MainWebApp; + +//@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button //@bot_user_id Identifier of the target bot -//@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, an internalLinkTypeSideMenuBot link, or an empty when the bot is opened from the side menu +//@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu //@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the application; 0-64 English letters, digits, and underscores +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores getWebAppUrl#64c42cbe bot_user_id:int53 url:string theme:themeParameters application_name:string = HttpUrl; //@description Sends data received from a keyboardButtonTypeWebApp Web App to a bot @@ -9656,7 +9794,7 @@ sendWebAppData#ab1fce0c bot_user_id:int53 button_text:string data:string = Ok; //@bot_user_id Identifier of the bot, providing the Web App //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise //@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the application; 0-64 English letters, digits, and underscores +//@application_name Short name of the current application; 0-64 English letters, digits, and underscores //@message_thread_id If not 0, the message thread identifier in which the message will be sent //@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none openWebApp#b02666b0 chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:InputMessageReplyTo = WebAppInfo; @@ -9672,7 +9810,7 @@ answerWebAppQuery#a0b49cf1 web_app_query_id:string result:InputInlineQueryResult //@description Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires //@chat_id Identifier of the chat with the message -//@message_id Identifier of the message from which the query originated +//@message_id Identifier of the message from which the query originated. The message must not be scheduled //@payload Query payload getCallbackQueryAnswer#6ef7a5f chat_id:int53 message_id:int53 payload:CallbackQueryPayload = CallbackQueryAnswer; @@ -10062,7 +10200,7 @@ setChatLocation#d2471daa chat_id:int53 location:chatLocation = Ok; //@slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 setChatSlowModeDelay#dfcae63e chat_id:int53 slow_mode_delay:int32 = Ok; -//@description Pins a message in a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel +//@description Pins a message in a chat. A message can be pinned only if messageProperties.can_be_pinned //@chat_id Identifier of the chat //@message_id Identifier of the new pinned message //@disable_notification Pass true to disable notification about the pinned message. Notifications are always disabled in channels and private chats @@ -10195,6 +10333,10 @@ setPinnedChats#c6c6edf1 chat_list:ChatList chat_ids:vector = Ok; //@chat_list Chat list in which to mark all chats as read readChatList#bd6498aa chat_list:ChatList = Ok; +//@description Returns the current weather in the given location +//@location The location +getCurrentWeather#8ada9bc9 location:location = CurrentWeather; + //@description Returns a story //@story_sender_chat_id Identifier of the chat that posted the story //@story_id Story identifier @@ -10228,6 +10370,12 @@ sendStory#e6ab3302 chat_id:int53 content:InputStoryContent areas:inputStoryAreas //@caption New story caption; pass null to keep the current caption editStory#5e6a21b1 story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; +//@description Changes cover of a video story. Can be called only if story.can_be_edited == true and the story isn't being edited now +//@story_sender_chat_id Identifier of the chat that posted the story +//@story_id Identifier of the story to edit +//@cover_frame_timestamp New timestamp of the frame, which will be used as video thumbnail +editStoryCover#ab2a0c4b story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:double = Ok; + //@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true //@story_id Identifier of the story //@privacy_settings The new privacy settigs for the story @@ -11266,6 +11414,40 @@ allowBotToSendMessages#69e9c58e bot_user_id:int53 = Ok; //@parameters JSON-serialized method parameters sendWebAppCustomRequest#36ff5dc8 bot_user_id:int53 method:string parameters:string = CustomRequestResult; +//@description Returns the list of media previews of a bot +//@bot_user_id Identifier of the target bot. The bot must have the main Web App +getBotMediaPreviews#22665458 bot_user_id:int53 = BotMediaPreviews; + +//@description Returns the list of media previews for the given language and the list of languages for which the bot has dedicated previews +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code A two-letter ISO 639-1 language code for which to get previews. If empty, then default previews are returned +getBotMediaPreviewInfo#50f60136 bot_user_id:int53 language_code:string = BotMediaPreviewInfo; + +//@description Adds a new media preview to the beginning of the list of media previews of a bot. Returns the added preview after addition is completed server-side. The total number of previews must not exceed getOption("bot_media_preview_count_max") for the given language +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code A two-letter ISO 639-1 language code for which preview is added. If empty, then the preview will be shown to all users for whose languages there are no dedicated previews. +//@content Content of the added preview +addBotMediaPreview#504b852b bot_user_id:int53 language_code:string content:InputStoryContent = BotMediaPreview; + +//@description Replaces media preview in the list of media previews of a bot. Returns the new preview after edit is completed server-side +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code Language code of the media preview to edit +//@file_id File identifier of the media to replace +//@content Content of the new preview +editBotMediaPreview#86955d62 bot_user_id:int53 language_code:string file_id:int32 content:InputStoryContent = BotMediaPreview; + +//@description Changes order of media previews in the list of media previews of a bot +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code Language code of the media previews to reorder +//@file_ids File identifiers of the media in the new order +reorderBotMediaPreviews#89ea0cc6 bot_user_id:int53 language_code:string file_ids:vector = Ok; + +//@description Delete media previews from the list of media previews of a bot +//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App +//@language_code Language code of the media previews to delete +//@file_ids File identifiers of the media to delete +deleteBotMediaPreviews#f7d259db bot_user_id:int53 language_code:string file_ids:vector = Ok; + //@description Sets the name of a bot. Can be called only if userTypeBot.can_be_edited == true //@bot_user_id Identifier of the target bot //@language_code A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose languages there is no dedicated name @@ -11434,12 +11616,12 @@ toggleSupergroupIsBroadcastGroup#34b22215 supergroup_id:int53 = Ok; //@description Reports messages in a supergroup as spam; requires administrator rights in the supergroup //@supergroup_id Supergroup identifier -//@message_ids Identifiers of messages to report +//@message_ids Identifiers of messages to report. Use messageProperties.can_be_reported to check whether the message can be reported reportSupergroupSpam#383e26f2 supergroup_id:int53 message_ids:vector = Ok; //@description Reports a false deletion of a message by aggressive anti-spam checks; requires administrator rights in the supergroup. Can be called only for messages from chatEventMessageDeleted with can_report_anti_spam_false_positive == true //@supergroup_id Supergroup identifier -//@message_id Identifier of the erroneously deleted message +//@message_id Identifier of the erroneously deleted message from chatEventMessageDeleted reportSupergroupAntiSpamFalsePositive#e13db048 supergroup_id:int53 message_id:int53 = Ok; //@description Returns information about members or banned users in a supergroup or channel. Can be used only if supergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters @@ -11481,7 +11663,7 @@ validateOrderInfo#b5985fcf input_invoice:InputInvoice order_info:orderInfo allow //@payment_form_id Payment form identifier returned by getPaymentForm //@order_info_id Identifier returned by validateOrderInfo, or an empty string //@shipping_option_id Identifier of a chosen shipping option, if applicable -//@credentials The credentials chosen by user for payment; pass null for a payment in Telegram stars +//@credentials The credentials chosen by user for payment; pass null for a payment in Telegram Stars //@tip_amount Chosen by the user amount of tip in the smallest units of the currency sendPaymentForm#c66e388a input_invoice:InputInvoice payment_form_id:int64 order_info_id:string shipping_option_id:string credentials:InputCredentials tip_amount:int53 = PaymentResult; @@ -11659,7 +11841,7 @@ removeChatActionBar#9d9839fa chat_id:int53 = Ok; //@description Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported //@chat_id Chat identifier -//@message_ids Identifiers of reported messages; may be empty to report the whole chat +//@message_ids Identifiers of reported messages; may be empty to report the whole chat. Use messageProperties.can_be_reported to check whether the message can be reported //@reason The reason for reporting the chat //@text Additional report details; 0-1024 characters reportChat#d92c3a8a chat_id:int53 message_ids:vector reason:ReportReason text:string = Ok; @@ -11671,7 +11853,7 @@ reportChat#d92c3a8a chat_id:int53 message_ids:vector reason:ReportReason //@text Additional report details; 0-1024 characters reportChatPhoto#d9701288 chat_id:int53 file_id:int32 reason:ReportReason text:string = Ok; -//@description Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if message.can_report_reactions +//@description Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if messageProperties.can_report_reactions //@chat_id Chat identifier //@message_id Message identifier //@sender_id Identifier of the sender, which added the reaction @@ -11693,19 +11875,19 @@ getChatRevenueWithdrawalUrl#1e320720 chat_id:int53 password:string = HttpUrl; //@limit The maximum number of transactions to be returned; up to 200 getChatRevenueTransactions#472f0715 chat_id:int53 offset:int32 limit:int32 = ChatRevenueTransactions; -//@description Returns detailed Telegram star revenue statistics -//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true +//@description Returns detailed Telegram Star revenue statistics +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true //@is_dark Pass true if a dark theme is used by the application getStarRevenueStatistics#f07b4517 owner_id:MessageSender is_dark:Bool = StarRevenueStatistics; -//@description Returns a URL for Telegram star withdrawal -//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat -//@star_count The number of Telegram stars to withdraw. Must be at least getOption("star_withdrawal_count_min") +//@description Returns a URL for Telegram Star withdrawal +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat +//@star_count The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") //@password The 2-step verification password of the current user getStarWithdrawalUrl#a9d23712 owner_id:MessageSender star_count:int53 password:string = HttpUrl; -//@description Returns a URL for a Telegram Ad platform account that can be used to set up advertisements for the chat paid in the owned Telegram stars -//@owner_id Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat +//@description Returns a URL for a Telegram Ad platform account that can be used to set up advertisements for the chat paid in the owned Telegram Stars +//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat getStarAdAccountUrl#73a9455d owner_id:MessageSender = HttpUrl; //@description Returns detailed statistics about a chat. Currently, this method can be used only for supergroups and channels. Can be used only if supergroupFullInfo.can_get_statistics == true @@ -11713,13 +11895,13 @@ getStarAdAccountUrl#73a9455d owner_id:MessageSender = HttpUrl; //@is_dark Pass true if a dark theme is used by the application getChatStatistics#137e8198 chat_id:int53 is_dark:Bool = ChatStatistics; -//@description Returns detailed statistics about a message. Can be used only if message.can_get_statistics == true +//@description Returns detailed statistics about a message. Can be used only if messageProperties.can_get_statistics == true //@chat_id Chat identifier //@message_id Message identifier //@is_dark Pass true if a dark theme is used by the application getMessageStatistics#4bb5a1d8 chat_id:int53 message_id:int53 is_dark:Bool = MessageStatistics; -//@description Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib +//@description Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if messageProperties.can_get_statistics == true. For optimal performance, the number of returned messages and stories 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 the first chunk of results @@ -11997,11 +12179,15 @@ launchPrepaidPremiumGiveaway#5328fea1 giveaway_id:int64 parameters:premiumGiveaw //@message_id Identifier of the giveaway or a giveaway winners message in the chat getPremiumGiveawayInfo#6adb7b97 chat_id:int53 message_id:int53 = PremiumGiveawayInfo; -//@description Returns available options for Telegram stars purchase +//@description Returns available options for Telegram Stars purchase getStarPaymentOptions#6d930644 = StarPaymentOptions; -//@description Returns the list of Telegram star transactions for the specified owner -//@owner_id Identifier of the owner of the Telegram stars; can be the identifier of the current user, identifier of an owned bot, +//@description Returns available options for Telegram Stars gifting +//@user_id Identifier of the user that will receive Telegram Stars; pass 0 to get options for an unspecified user +getStarGiftPaymentOptions#e22760e3 user_id:int53 = StarPaymentOptions; + +//@description Returns the list of Telegram Star transactions for the specified owner +//@owner_id Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, //@direction Direction of the transactions to receive; pass null to get all transactions //@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of transactions to return diff --git a/tdapi/tl_add_bot_media_preview_gen.go b/tdapi/tl_add_bot_media_preview_gen.go new file mode 100644 index 0000000000..9a8383434b --- /dev/null +++ b/tdapi/tl_add_bot_media_preview_gen.go @@ -0,0 +1,282 @@ +// 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{} +) + +// AddBotMediaPreviewRequest represents TL type `addBotMediaPreview#504b852b`. +type AddBotMediaPreviewRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserID int64 + // A two-letter ISO 639-1 language code for which preview is added. If empty, then the + // preview will be shown to all users for whose languages there are no dedicated previews. + LanguageCode string + // Content of the added preview + Content InputStoryContentClass +} + +// AddBotMediaPreviewRequestTypeID is TL type id of AddBotMediaPreviewRequest. +const AddBotMediaPreviewRequestTypeID = 0x504b852b + +// Ensuring interfaces in compile-time for AddBotMediaPreviewRequest. +var ( + _ bin.Encoder = &AddBotMediaPreviewRequest{} + _ bin.Decoder = &AddBotMediaPreviewRequest{} + _ bin.BareEncoder = &AddBotMediaPreviewRequest{} + _ bin.BareDecoder = &AddBotMediaPreviewRequest{} +) + +func (a *AddBotMediaPreviewRequest) Zero() bool { + if a == nil { + return true + } + if !(a.BotUserID == 0) { + return false + } + if !(a.LanguageCode == "") { + return false + } + if !(a.Content == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (a *AddBotMediaPreviewRequest) String() string { + if a == nil { + return "AddBotMediaPreviewRequest(nil)" + } + type Alias AddBotMediaPreviewRequest + return fmt.Sprintf("AddBotMediaPreviewRequest%+v", Alias(*a)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AddBotMediaPreviewRequest) TypeID() uint32 { + return AddBotMediaPreviewRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AddBotMediaPreviewRequest) TypeName() string { + return "addBotMediaPreview" +} + +// TypeInfo returns info about TL type. +func (a *AddBotMediaPreviewRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "addBotMediaPreview", + ID: AddBotMediaPreviewRequestTypeID, + } + if a == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "LanguageCode", + SchemaName: "language_code", + }, + { + Name: "Content", + SchemaName: "content", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (a *AddBotMediaPreviewRequest) Encode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addBotMediaPreview#504b852b as nil") + } + b.PutID(AddBotMediaPreviewRequestTypeID) + return a.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (a *AddBotMediaPreviewRequest) EncodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't encode addBotMediaPreview#504b852b as nil") + } + b.PutInt53(a.BotUserID) + b.PutString(a.LanguageCode) + if a.Content == nil { + return fmt.Errorf("unable to encode addBotMediaPreview#504b852b: field content is nil") + } + if err := a.Content.Encode(b); err != nil { + return fmt.Errorf("unable to encode addBotMediaPreview#504b852b: field content: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (a *AddBotMediaPreviewRequest) Decode(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addBotMediaPreview#504b852b to nil") + } + if err := b.ConsumeID(AddBotMediaPreviewRequestTypeID); err != nil { + return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: %w", err) + } + return a.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (a *AddBotMediaPreviewRequest) DecodeBare(b *bin.Buffer) error { + if a == nil { + return fmt.Errorf("can't decode addBotMediaPreview#504b852b to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field bot_user_id: %w", err) + } + a.BotUserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field language_code: %w", err) + } + a.LanguageCode = value + } + { + value, err := DecodeInputStoryContent(b) + if err != nil { + return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field content: %w", err) + } + a.Content = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (a *AddBotMediaPreviewRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if a == nil { + return fmt.Errorf("can't encode addBotMediaPreview#504b852b as nil") + } + b.ObjStart() + b.PutID("addBotMediaPreview") + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(a.BotUserID) + b.Comma() + b.FieldStart("language_code") + b.PutString(a.LanguageCode) + b.Comma() + b.FieldStart("content") + if a.Content == nil { + return fmt.Errorf("unable to encode addBotMediaPreview#504b852b: field content is nil") + } + if err := a.Content.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode addBotMediaPreview#504b852b: field content: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (a *AddBotMediaPreviewRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if a == nil { + return fmt.Errorf("can't decode addBotMediaPreview#504b852b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("addBotMediaPreview"); err != nil { + return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: %w", err) + } + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field bot_user_id: %w", err) + } + a.BotUserID = value + case "language_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field language_code: %w", err) + } + a.LanguageCode = value + case "content": + value, err := DecodeTDLibJSONInputStoryContent(b) + if err != nil { + return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field content: %w", err) + } + a.Content = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (a *AddBotMediaPreviewRequest) GetBotUserID() (value int64) { + if a == nil { + return + } + return a.BotUserID +} + +// GetLanguageCode returns value of LanguageCode field. +func (a *AddBotMediaPreviewRequest) GetLanguageCode() (value string) { + if a == nil { + return + } + return a.LanguageCode +} + +// GetContent returns value of Content field. +func (a *AddBotMediaPreviewRequest) GetContent() (value InputStoryContentClass) { + if a == nil { + return + } + return a.Content +} + +// AddBotMediaPreview invokes method addBotMediaPreview#504b852b returning error if any. +func (c *Client) AddBotMediaPreview(ctx context.Context, request *AddBotMediaPreviewRequest) (*BotMediaPreview, error) { + var result BotMediaPreview + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_bot_info_gen.go b/tdapi/tl_bot_info_gen.go index 35e0d16c51..d1efa37c13 100644 --- a/tdapi/tl_bot_info_gen.go +++ b/tdapi/tl_bot_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// BotInfo represents TL type `botInfo#bfdb89a`. +// BotInfo represents TL type `botInfo#32ab8617`. type BotInfo struct { // The text that is shown on the bot's profile page and is sent together with the link // when users share the bot @@ -52,6 +52,8 @@ type BotInfo struct { DefaultGroupAdministratorRights ChatAdministratorRights // Default administrator rights for adding the bot to channels; may be null DefaultChannelAdministratorRights ChatAdministratorRights + // True, if the bot has media previews + HasMediaPreviews bool // The internal link, which can be used to edit bot commands; may be null EditCommandsLink InternalLinkTypeClass // The internal link, which can be used to edit bot description; may be null @@ -64,7 +66,7 @@ type BotInfo struct { } // BotInfoTypeID is TL type id of BotInfo. -const BotInfoTypeID = 0xbfdb89a +const BotInfoTypeID = 0x32ab8617 // Ensuring interfaces in compile-time for BotInfo. var ( @@ -102,6 +104,9 @@ func (b *BotInfo) Zero() bool { if !(b.DefaultChannelAdministratorRights.Zero()) { return false } + if !(b.HasMediaPreviews == false) { + return false + } if !(b.EditCommandsLink == nil) { return false } @@ -182,6 +187,10 @@ func (b *BotInfo) TypeInfo() tdp.Type { Name: "DefaultChannelAdministratorRights", SchemaName: "default_channel_administrator_rights", }, + { + Name: "HasMediaPreviews", + SchemaName: "has_media_previews", + }, { Name: "EditCommandsLink", SchemaName: "edit_commands_link", @@ -205,7 +214,7 @@ func (b *BotInfo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (b *BotInfo) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode botInfo#bfdb89a as nil") + return fmt.Errorf("can't encode botInfo#32ab8617 as nil") } buf.PutID(BotInfoTypeID) return b.EncodeBare(buf) @@ -214,54 +223,55 @@ func (b *BotInfo) Encode(buf *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (b *BotInfo) EncodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode botInfo#bfdb89a as nil") + return fmt.Errorf("can't encode botInfo#32ab8617 as nil") } buf.PutString(b.ShortDescription) buf.PutString(b.Description) if err := b.Photo.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field photo: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field photo: %w", err) } if err := b.Animation.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field animation: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field animation: %w", err) } if err := b.MenuButton.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field menu_button: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field menu_button: %w", err) } buf.PutInt(len(b.Commands)) for idx, v := range b.Commands { if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare botInfo#bfdb89a: field commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare botInfo#32ab8617: field commands element with index %d: %w", idx, err) } } if err := b.DefaultGroupAdministratorRights.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field default_group_administrator_rights: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field default_group_administrator_rights: %w", err) } if err := b.DefaultChannelAdministratorRights.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field default_channel_administrator_rights: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field default_channel_administrator_rights: %w", err) } + buf.PutBool(b.HasMediaPreviews) if b.EditCommandsLink == nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_commands_link is nil") + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_commands_link is nil") } if err := b.EditCommandsLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_commands_link: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_commands_link: %w", err) } if b.EditDescriptionLink == nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_description_link is nil") + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_description_link is nil") } if err := b.EditDescriptionLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_description_link: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_description_link: %w", err) } if b.EditDescriptionMediaLink == nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_description_media_link is nil") + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_description_media_link is nil") } if err := b.EditDescriptionMediaLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_description_media_link: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_description_media_link: %w", err) } if b.EditSettingsLink == nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_settings_link is nil") + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_settings_link is nil") } if err := b.EditSettingsLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_settings_link: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_settings_link: %w", err) } return nil } @@ -269,10 +279,10 @@ func (b *BotInfo) EncodeBare(buf *bin.Buffer) error { // Decode implements bin.Decoder. func (b *BotInfo) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode botInfo#bfdb89a to nil") + return fmt.Errorf("can't decode botInfo#32ab8617 to nil") } if err := buf.ConsumeID(BotInfoTypeID); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: %w", err) } return b.DecodeBare(buf) } @@ -280,41 +290,41 @@ func (b *BotInfo) Decode(buf *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode botInfo#bfdb89a to nil") + return fmt.Errorf("can't decode botInfo#32ab8617 to nil") } { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field short_description: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field short_description: %w", err) } b.ShortDescription = value } { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field description: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field description: %w", err) } b.Description = value } { if err := b.Photo.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field photo: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field photo: %w", err) } } { if err := b.Animation.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field animation: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field animation: %w", err) } } { if err := b.MenuButton.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field menu_button: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field menu_button: %w", err) } } { headerLen, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field commands: %w", err) } if headerLen > 0 { @@ -323,46 +333,53 @@ func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value BotCommand if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare botInfo#bfdb89a: field commands: %w", err) + return fmt.Errorf("unable to decode bare botInfo#32ab8617: field commands: %w", err) } b.Commands = append(b.Commands, value) } } { if err := b.DefaultGroupAdministratorRights.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field default_group_administrator_rights: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field default_group_administrator_rights: %w", err) } } { if err := b.DefaultChannelAdministratorRights.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field default_channel_administrator_rights: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field default_channel_administrator_rights: %w", err) + } + } + { + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode botInfo#32ab8617: field has_media_previews: %w", err) } + b.HasMediaPreviews = value } { value, err := DecodeInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field edit_commands_link: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field edit_commands_link: %w", err) } b.EditCommandsLink = value } { value, err := DecodeInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field edit_description_link: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field edit_description_link: %w", err) } b.EditDescriptionLink = value } { value, err := DecodeInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field edit_description_media_link: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field edit_description_media_link: %w", err) } b.EditDescriptionMediaLink = value } { value, err := DecodeInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field edit_settings_link: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field edit_settings_link: %w", err) } b.EditSettingsLink = value } @@ -372,7 +389,7 @@ func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { if b == nil { - return fmt.Errorf("can't encode botInfo#bfdb89a as nil") + return fmt.Errorf("can't encode botInfo#32ab8617 as nil") } buf.ObjStart() buf.PutID("botInfo") @@ -385,24 +402,24 @@ func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { buf.Comma() buf.FieldStart("photo") if err := b.Photo.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field photo: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field photo: %w", err) } buf.Comma() buf.FieldStart("animation") if err := b.Animation.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field animation: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field animation: %w", err) } buf.Comma() buf.FieldStart("menu_button") if err := b.MenuButton.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field menu_button: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field menu_button: %w", err) } buf.Comma() buf.FieldStart("commands") buf.ArrStart() for idx, v := range b.Commands { if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field commands element with index %d: %w", idx, err) } buf.Comma() } @@ -411,44 +428,47 @@ func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { buf.Comma() buf.FieldStart("default_group_administrator_rights") if err := b.DefaultGroupAdministratorRights.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field default_group_administrator_rights: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field default_group_administrator_rights: %w", err) } buf.Comma() buf.FieldStart("default_channel_administrator_rights") if err := b.DefaultChannelAdministratorRights.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field default_channel_administrator_rights: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field default_channel_administrator_rights: %w", err) } buf.Comma() + buf.FieldStart("has_media_previews") + buf.PutBool(b.HasMediaPreviews) + buf.Comma() buf.FieldStart("edit_commands_link") if b.EditCommandsLink == nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_commands_link is nil") + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_commands_link is nil") } if err := b.EditCommandsLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_commands_link: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_commands_link: %w", err) } buf.Comma() buf.FieldStart("edit_description_link") if b.EditDescriptionLink == nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_description_link is nil") + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_description_link is nil") } if err := b.EditDescriptionLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_description_link: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_description_link: %w", err) } buf.Comma() buf.FieldStart("edit_description_media_link") if b.EditDescriptionMediaLink == nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_description_media_link is nil") + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_description_media_link is nil") } if err := b.EditDescriptionMediaLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_description_media_link: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_description_media_link: %w", err) } buf.Comma() buf.FieldStart("edit_settings_link") if b.EditSettingsLink == nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_settings_link is nil") + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_settings_link is nil") } if err := b.EditSettingsLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#bfdb89a: field edit_settings_link: %w", err) + return fmt.Errorf("unable to encode botInfo#32ab8617: field edit_settings_link: %w", err) } buf.Comma() buf.StripComma() @@ -459,80 +479,86 @@ func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (b *BotInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { if b == nil { - return fmt.Errorf("can't decode botInfo#bfdb89a to nil") + return fmt.Errorf("can't decode botInfo#32ab8617 to nil") } return buf.Obj(func(buf tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := buf.ConsumeID("botInfo"); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: %w", err) } case "short_description": value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field short_description: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field short_description: %w", err) } b.ShortDescription = value case "description": value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field description: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field description: %w", err) } b.Description = value case "photo": if err := b.Photo.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field photo: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field photo: %w", err) } case "animation": if err := b.Animation.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field animation: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field animation: %w", err) } case "menu_button": if err := b.MenuButton.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field menu_button: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field menu_button: %w", err) } case "commands": if err := buf.Arr(func(buf tdjson.Decoder) error { var value BotCommand if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field commands: %w", err) } b.Commands = append(b.Commands, value) return nil }); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field commands: %w", err) } case "default_group_administrator_rights": if err := b.DefaultGroupAdministratorRights.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field default_group_administrator_rights: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field default_group_administrator_rights: %w", err) } case "default_channel_administrator_rights": if err := b.DefaultChannelAdministratorRights.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field default_channel_administrator_rights: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field default_channel_administrator_rights: %w", err) + } + case "has_media_previews": + value, err := buf.Bool() + if err != nil { + return fmt.Errorf("unable to decode botInfo#32ab8617: field has_media_previews: %w", err) } + b.HasMediaPreviews = value case "edit_commands_link": value, err := DecodeTDLibJSONInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field edit_commands_link: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field edit_commands_link: %w", err) } b.EditCommandsLink = value case "edit_description_link": value, err := DecodeTDLibJSONInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field edit_description_link: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field edit_description_link: %w", err) } b.EditDescriptionLink = value case "edit_description_media_link": value, err := DecodeTDLibJSONInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field edit_description_media_link: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field edit_description_media_link: %w", err) } b.EditDescriptionMediaLink = value case "edit_settings_link": value, err := DecodeTDLibJSONInternalLinkType(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#bfdb89a: field edit_settings_link: %w", err) + return fmt.Errorf("unable to decode botInfo#32ab8617: field edit_settings_link: %w", err) } b.EditSettingsLink = value default: @@ -606,6 +632,14 @@ func (b *BotInfo) GetDefaultChannelAdministratorRights() (value ChatAdministrato return b.DefaultChannelAdministratorRights } +// GetHasMediaPreviews returns value of HasMediaPreviews field. +func (b *BotInfo) GetHasMediaPreviews() (value bool) { + if b == nil { + return + } + return b.HasMediaPreviews +} + // GetEditCommandsLink returns value of EditCommandsLink field. func (b *BotInfo) GetEditCommandsLink() (value InternalLinkTypeClass) { if b == nil { diff --git a/tdapi/tl_bot_media_preview_gen.go b/tdapi/tl_bot_media_preview_gen.go new file mode 100644 index 0000000000..cff5db6fb1 --- /dev/null +++ b/tdapi/tl_bot_media_preview_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{} +) + +// BotMediaPreview represents TL type `botMediaPreview#9eb59ce8`. +type BotMediaPreview struct { + // Point in time (Unix timestamp) when the preview was added or changed last time + Date int32 + // Content of the preview + Content StoryContentClass +} + +// BotMediaPreviewTypeID is TL type id of BotMediaPreview. +const BotMediaPreviewTypeID = 0x9eb59ce8 + +// Ensuring interfaces in compile-time for BotMediaPreview. +var ( + _ bin.Encoder = &BotMediaPreview{} + _ bin.Decoder = &BotMediaPreview{} + _ bin.BareEncoder = &BotMediaPreview{} + _ bin.BareDecoder = &BotMediaPreview{} +) + +func (b *BotMediaPreview) Zero() bool { + if b == nil { + return true + } + if !(b.Date == 0) { + return false + } + if !(b.Content == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotMediaPreview) String() string { + if b == nil { + return "BotMediaPreview(nil)" + } + type Alias BotMediaPreview + return fmt.Sprintf("BotMediaPreview%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotMediaPreview) TypeID() uint32 { + return BotMediaPreviewTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotMediaPreview) TypeName() string { + return "botMediaPreview" +} + +// TypeInfo returns info about TL type. +func (b *BotMediaPreview) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botMediaPreview", + ID: BotMediaPreviewTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Date", + SchemaName: "date", + }, + { + Name: "Content", + SchemaName: "content", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BotMediaPreview) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botMediaPreview#9eb59ce8 as nil") + } + buf.PutID(BotMediaPreviewTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotMediaPreview) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botMediaPreview#9eb59ce8 as nil") + } + buf.PutInt32(b.Date) + if b.Content == nil { + return fmt.Errorf("unable to encode botMediaPreview#9eb59ce8: field content is nil") + } + if err := b.Content.Encode(buf); err != nil { + return fmt.Errorf("unable to encode botMediaPreview#9eb59ce8: field content: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BotMediaPreview) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botMediaPreview#9eb59ce8 to nil") + } + if err := buf.ConsumeID(BotMediaPreviewTypeID); err != nil { + return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotMediaPreview) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botMediaPreview#9eb59ce8 to nil") + } + { + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: field date: %w", err) + } + b.Date = value + } + { + value, err := DecodeStoryContent(buf) + if err != nil { + return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: field content: %w", err) + } + b.Content = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BotMediaPreview) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode botMediaPreview#9eb59ce8 as nil") + } + buf.ObjStart() + buf.PutID("botMediaPreview") + buf.Comma() + buf.FieldStart("date") + buf.PutInt32(b.Date) + buf.Comma() + buf.FieldStart("content") + if b.Content == nil { + return fmt.Errorf("unable to encode botMediaPreview#9eb59ce8: field content is nil") + } + if err := b.Content.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode botMediaPreview#9eb59ce8: field content: %w", err) + } + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BotMediaPreview) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode botMediaPreview#9eb59ce8 to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("botMediaPreview"); err != nil { + return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: %w", err) + } + case "date": + value, err := buf.Int32() + if err != nil { + return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: field date: %w", err) + } + b.Date = value + case "content": + value, err := DecodeTDLibJSONStoryContent(buf) + if err != nil { + return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: field content: %w", err) + } + b.Content = value + default: + return buf.Skip() + } + return nil + }) +} + +// GetDate returns value of Date field. +func (b *BotMediaPreview) GetDate() (value int32) { + if b == nil { + return + } + return b.Date +} + +// GetContent returns value of Content field. +func (b *BotMediaPreview) GetContent() (value StoryContentClass) { + if b == nil { + return + } + return b.Content +} diff --git a/tdapi/tl_bot_media_preview_info_gen.go b/tdapi/tl_bot_media_preview_info_gen.go new file mode 100644 index 0000000000..dd2f83556b --- /dev/null +++ b/tdapi/tl_bot_media_preview_info_gen.go @@ -0,0 +1,279 @@ +// 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{} +) + +// BotMediaPreviewInfo represents TL type `botMediaPreviewInfo#e49169db`. +type BotMediaPreviewInfo struct { + // List of media previews + Previews []BotMediaPreview + // List of language codes for which the bot has dedicated previews + LanguageCodes []string +} + +// BotMediaPreviewInfoTypeID is TL type id of BotMediaPreviewInfo. +const BotMediaPreviewInfoTypeID = 0xe49169db + +// Ensuring interfaces in compile-time for BotMediaPreviewInfo. +var ( + _ bin.Encoder = &BotMediaPreviewInfo{} + _ bin.Decoder = &BotMediaPreviewInfo{} + _ bin.BareEncoder = &BotMediaPreviewInfo{} + _ bin.BareDecoder = &BotMediaPreviewInfo{} +) + +func (b *BotMediaPreviewInfo) Zero() bool { + if b == nil { + return true + } + if !(b.Previews == nil) { + return false + } + if !(b.LanguageCodes == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotMediaPreviewInfo) String() string { + if b == nil { + return "BotMediaPreviewInfo(nil)" + } + type Alias BotMediaPreviewInfo + return fmt.Sprintf("BotMediaPreviewInfo%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotMediaPreviewInfo) TypeID() uint32 { + return BotMediaPreviewInfoTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotMediaPreviewInfo) TypeName() string { + return "botMediaPreviewInfo" +} + +// TypeInfo returns info about TL type. +func (b *BotMediaPreviewInfo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botMediaPreviewInfo", + ID: BotMediaPreviewInfoTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Previews", + SchemaName: "previews", + }, + { + Name: "LanguageCodes", + SchemaName: "language_codes", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BotMediaPreviewInfo) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botMediaPreviewInfo#e49169db as nil") + } + buf.PutID(BotMediaPreviewInfoTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotMediaPreviewInfo) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botMediaPreviewInfo#e49169db as nil") + } + buf.PutInt(len(b.Previews)) + for idx, v := range b.Previews { + if err := v.EncodeBare(buf); err != nil { + return fmt.Errorf("unable to encode bare botMediaPreviewInfo#e49169db: field previews element with index %d: %w", idx, err) + } + } + buf.PutInt(len(b.LanguageCodes)) + for _, v := range b.LanguageCodes { + buf.PutString(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BotMediaPreviewInfo) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botMediaPreviewInfo#e49169db to nil") + } + if err := buf.ConsumeID(BotMediaPreviewInfoTypeID); err != nil { + return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotMediaPreviewInfo) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botMediaPreviewInfo#e49169db to nil") + } + { + headerLen, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field previews: %w", err) + } + + if headerLen > 0 { + b.Previews = make([]BotMediaPreview, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value BotMediaPreview + if err := value.DecodeBare(buf); err != nil { + return fmt.Errorf("unable to decode bare botMediaPreviewInfo#e49169db: field previews: %w", err) + } + b.Previews = append(b.Previews, value) + } + } + { + headerLen, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field language_codes: %w", err) + } + + if headerLen > 0 { + b.LanguageCodes = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field language_codes: %w", err) + } + b.LanguageCodes = append(b.LanguageCodes, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BotMediaPreviewInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode botMediaPreviewInfo#e49169db as nil") + } + buf.ObjStart() + buf.PutID("botMediaPreviewInfo") + buf.Comma() + buf.FieldStart("previews") + buf.ArrStart() + for idx, v := range b.Previews { + if err := v.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode botMediaPreviewInfo#e49169db: field previews element with index %d: %w", idx, err) + } + buf.Comma() + } + buf.StripComma() + buf.ArrEnd() + buf.Comma() + buf.FieldStart("language_codes") + buf.ArrStart() + for _, v := range b.LanguageCodes { + buf.PutString(v) + buf.Comma() + } + buf.StripComma() + buf.ArrEnd() + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BotMediaPreviewInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode botMediaPreviewInfo#e49169db to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("botMediaPreviewInfo"); err != nil { + return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: %w", err) + } + case "previews": + if err := buf.Arr(func(buf tdjson.Decoder) error { + var value BotMediaPreview + if err := value.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field previews: %w", err) + } + b.Previews = append(b.Previews, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field previews: %w", err) + } + case "language_codes": + if err := buf.Arr(func(buf tdjson.Decoder) error { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field language_codes: %w", err) + } + b.LanguageCodes = append(b.LanguageCodes, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field language_codes: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// GetPreviews returns value of Previews field. +func (b *BotMediaPreviewInfo) GetPreviews() (value []BotMediaPreview) { + if b == nil { + return + } + return b.Previews +} + +// GetLanguageCodes returns value of LanguageCodes field. +func (b *BotMediaPreviewInfo) GetLanguageCodes() (value []string) { + if b == nil { + return + } + return b.LanguageCodes +} diff --git a/tdapi/tl_bot_media_previews_gen.go b/tdapi/tl_bot_media_previews_gen.go new file mode 100644 index 0000000000..aee920f4db --- /dev/null +++ b/tdapi/tl_bot_media_previews_gen.go @@ -0,0 +1,221 @@ +// 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{} +) + +// BotMediaPreviews represents TL type `botMediaPreviews#f1b8f27d`. +type BotMediaPreviews struct { + // List of media previews + Previews []BotMediaPreview +} + +// BotMediaPreviewsTypeID is TL type id of BotMediaPreviews. +const BotMediaPreviewsTypeID = 0xf1b8f27d + +// Ensuring interfaces in compile-time for BotMediaPreviews. +var ( + _ bin.Encoder = &BotMediaPreviews{} + _ bin.Decoder = &BotMediaPreviews{} + _ bin.BareEncoder = &BotMediaPreviews{} + _ bin.BareDecoder = &BotMediaPreviews{} +) + +func (b *BotMediaPreviews) Zero() bool { + if b == nil { + return true + } + if !(b.Previews == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotMediaPreviews) String() string { + if b == nil { + return "BotMediaPreviews(nil)" + } + type Alias BotMediaPreviews + return fmt.Sprintf("BotMediaPreviews%+v", Alias(*b)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotMediaPreviews) TypeID() uint32 { + return BotMediaPreviewsTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotMediaPreviews) TypeName() string { + return "botMediaPreviews" +} + +// TypeInfo returns info about TL type. +func (b *BotMediaPreviews) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botMediaPreviews", + ID: BotMediaPreviewsTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Previews", + SchemaName: "previews", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *BotMediaPreviews) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botMediaPreviews#f1b8f27d as nil") + } + buf.PutID(BotMediaPreviewsTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotMediaPreviews) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botMediaPreviews#f1b8f27d as nil") + } + buf.PutInt(len(b.Previews)) + for idx, v := range b.Previews { + if err := v.EncodeBare(buf); err != nil { + return fmt.Errorf("unable to encode bare botMediaPreviews#f1b8f27d: field previews element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BotMediaPreviews) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botMediaPreviews#f1b8f27d to nil") + } + if err := buf.ConsumeID(BotMediaPreviewsTypeID); err != nil { + return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotMediaPreviews) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botMediaPreviews#f1b8f27d to nil") + } + { + headerLen, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: field previews: %w", err) + } + + if headerLen > 0 { + b.Previews = make([]BotMediaPreview, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value BotMediaPreview + if err := value.DecodeBare(buf); err != nil { + return fmt.Errorf("unable to decode bare botMediaPreviews#f1b8f27d: field previews: %w", err) + } + b.Previews = append(b.Previews, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (b *BotMediaPreviews) EncodeTDLibJSON(buf tdjson.Encoder) error { + if b == nil { + return fmt.Errorf("can't encode botMediaPreviews#f1b8f27d as nil") + } + buf.ObjStart() + buf.PutID("botMediaPreviews") + buf.Comma() + buf.FieldStart("previews") + buf.ArrStart() + for idx, v := range b.Previews { + if err := v.EncodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to encode botMediaPreviews#f1b8f27d: field previews element with index %d: %w", idx, err) + } + buf.Comma() + } + buf.StripComma() + buf.ArrEnd() + buf.Comma() + buf.StripComma() + buf.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (b *BotMediaPreviews) DecodeTDLibJSON(buf tdjson.Decoder) error { + if b == nil { + return fmt.Errorf("can't decode botMediaPreviews#f1b8f27d to nil") + } + + return buf.Obj(func(buf tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := buf.ConsumeID("botMediaPreviews"); err != nil { + return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: %w", err) + } + case "previews": + if err := buf.Arr(func(buf tdjson.Decoder) error { + var value BotMediaPreview + if err := value.DecodeTDLibJSON(buf); err != nil { + return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: field previews: %w", err) + } + b.Previews = append(b.Previews, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: field previews: %w", err) + } + default: + return buf.Skip() + } + return nil + }) +} + +// GetPreviews returns value of Previews field. +func (b *BotMediaPreviews) GetPreviews() (value []BotMediaPreview) { + if b == nil { + return + } + return b.Previews +} diff --git a/tdapi/tl_chat_active_stories_gen.go b/tdapi/tl_chat_active_stories_gen.go index 0df8c37a91..53c41cfa3e 100644 --- a/tdapi/tl_chat_active_stories_gen.go +++ b/tdapi/tl_chat_active_stories_gen.go @@ -45,7 +45,7 @@ type ChatActiveStories struct { // Identifier of the last read active story MaxReadStoryID int32 // Basic information about the stories; use getStory to get full information about the - // stories. The stories are in a chronological order (i.e., in order of increasing story + // stories. The stories are in chronological order (i.e., in order of increasing story // identifiers) Stories []StoryInfo } diff --git a/tdapi/tl_current_weather_gen.go b/tdapi/tl_current_weather_gen.go new file mode 100644 index 0000000000..78cfa1592d --- /dev/null +++ b/tdapi/tl_current_weather_gen.go @@ -0,0 +1,227 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tdapi + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// CurrentWeather represents TL type `currentWeather#eacea8c0`. +type CurrentWeather struct { + // Temperature, in degree Celsius + Temperature float64 + // Emoji representing the weather + Emoji string +} + +// CurrentWeatherTypeID is TL type id of CurrentWeather. +const CurrentWeatherTypeID = 0xeacea8c0 + +// Ensuring interfaces in compile-time for CurrentWeather. +var ( + _ bin.Encoder = &CurrentWeather{} + _ bin.Decoder = &CurrentWeather{} + _ bin.BareEncoder = &CurrentWeather{} + _ bin.BareDecoder = &CurrentWeather{} +) + +func (c *CurrentWeather) Zero() bool { + if c == nil { + return true + } + if !(c.Temperature == 0) { + return false + } + if !(c.Emoji == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *CurrentWeather) String() string { + if c == nil { + return "CurrentWeather(nil)" + } + type Alias CurrentWeather + return fmt.Sprintf("CurrentWeather%+v", Alias(*c)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*CurrentWeather) TypeID() uint32 { + return CurrentWeatherTypeID +} + +// TypeName returns name of type in TL schema. +func (*CurrentWeather) TypeName() string { + return "currentWeather" +} + +// TypeInfo returns info about TL type. +func (c *CurrentWeather) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "currentWeather", + ID: CurrentWeatherTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Temperature", + SchemaName: "temperature", + }, + { + Name: "Emoji", + SchemaName: "emoji", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *CurrentWeather) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode currentWeather#eacea8c0 as nil") + } + b.PutID(CurrentWeatherTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *CurrentWeather) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode currentWeather#eacea8c0 as nil") + } + b.PutDouble(c.Temperature) + b.PutString(c.Emoji) + return nil +} + +// Decode implements bin.Decoder. +func (c *CurrentWeather) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode currentWeather#eacea8c0 to nil") + } + if err := b.ConsumeID(CurrentWeatherTypeID); err != nil { + return fmt.Errorf("unable to decode currentWeather#eacea8c0: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *CurrentWeather) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode currentWeather#eacea8c0 to nil") + } + { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode currentWeather#eacea8c0: field temperature: %w", err) + } + c.Temperature = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode currentWeather#eacea8c0: field emoji: %w", err) + } + c.Emoji = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (c *CurrentWeather) EncodeTDLibJSON(b tdjson.Encoder) error { + if c == nil { + return fmt.Errorf("can't encode currentWeather#eacea8c0 as nil") + } + b.ObjStart() + b.PutID("currentWeather") + b.Comma() + b.FieldStart("temperature") + b.PutDouble(c.Temperature) + b.Comma() + b.FieldStart("emoji") + b.PutString(c.Emoji) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (c *CurrentWeather) DecodeTDLibJSON(b tdjson.Decoder) error { + if c == nil { + return fmt.Errorf("can't decode currentWeather#eacea8c0 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("currentWeather"); err != nil { + return fmt.Errorf("unable to decode currentWeather#eacea8c0: %w", err) + } + case "temperature": + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode currentWeather#eacea8c0: field temperature: %w", err) + } + c.Temperature = value + case "emoji": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode currentWeather#eacea8c0: field emoji: %w", err) + } + c.Emoji = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTemperature returns value of Temperature field. +func (c *CurrentWeather) GetTemperature() (value float64) { + if c == nil { + return + } + return c.Temperature +} + +// GetEmoji returns value of Emoji field. +func (c *CurrentWeather) GetEmoji() (value string) { + if c == nil { + return + } + return c.Emoji +} diff --git a/tdapi/tl_delete_bot_media_previews_gen.go b/tdapi/tl_delete_bot_media_previews_gen.go new file mode 100644 index 0000000000..3743a9dedc --- /dev/null +++ b/tdapi/tl_delete_bot_media_previews_gen.go @@ -0,0 +1,295 @@ +// 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{} +) + +// DeleteBotMediaPreviewsRequest represents TL type `deleteBotMediaPreviews#f7d259db`. +type DeleteBotMediaPreviewsRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserID int64 + // Language code of the media previews to delete + LanguageCode string + // File identifiers of the media to delete + FileIDs []int32 +} + +// DeleteBotMediaPreviewsRequestTypeID is TL type id of DeleteBotMediaPreviewsRequest. +const DeleteBotMediaPreviewsRequestTypeID = 0xf7d259db + +// Ensuring interfaces in compile-time for DeleteBotMediaPreviewsRequest. +var ( + _ bin.Encoder = &DeleteBotMediaPreviewsRequest{} + _ bin.Decoder = &DeleteBotMediaPreviewsRequest{} + _ bin.BareEncoder = &DeleteBotMediaPreviewsRequest{} + _ bin.BareDecoder = &DeleteBotMediaPreviewsRequest{} +) + +func (d *DeleteBotMediaPreviewsRequest) Zero() bool { + if d == nil { + return true + } + if !(d.BotUserID == 0) { + return false + } + if !(d.LanguageCode == "") { + return false + } + if !(d.FileIDs == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *DeleteBotMediaPreviewsRequest) String() string { + if d == nil { + return "DeleteBotMediaPreviewsRequest(nil)" + } + type Alias DeleteBotMediaPreviewsRequest + return fmt.Sprintf("DeleteBotMediaPreviewsRequest%+v", Alias(*d)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*DeleteBotMediaPreviewsRequest) TypeID() uint32 { + return DeleteBotMediaPreviewsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*DeleteBotMediaPreviewsRequest) TypeName() string { + return "deleteBotMediaPreviews" +} + +// TypeInfo returns info about TL type. +func (d *DeleteBotMediaPreviewsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "deleteBotMediaPreviews", + ID: DeleteBotMediaPreviewsRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "LanguageCode", + SchemaName: "language_code", + }, + { + Name: "FileIDs", + SchemaName: "file_ids", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *DeleteBotMediaPreviewsRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteBotMediaPreviews#f7d259db as nil") + } + b.PutID(DeleteBotMediaPreviewsRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *DeleteBotMediaPreviewsRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode deleteBotMediaPreviews#f7d259db as nil") + } + b.PutInt53(d.BotUserID) + b.PutString(d.LanguageCode) + b.PutInt(len(d.FileIDs)) + for _, v := range d.FileIDs { + b.PutInt32(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (d *DeleteBotMediaPreviewsRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteBotMediaPreviews#f7d259db to nil") + } + if err := b.ConsumeID(DeleteBotMediaPreviewsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *DeleteBotMediaPreviewsRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode deleteBotMediaPreviews#f7d259db to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field bot_user_id: %w", err) + } + d.BotUserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field language_code: %w", err) + } + d.LanguageCode = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field file_ids: %w", err) + } + + if headerLen > 0 { + d.FileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field file_ids: %w", err) + } + d.FileIDs = append(d.FileIDs, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (d *DeleteBotMediaPreviewsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if d == nil { + return fmt.Errorf("can't encode deleteBotMediaPreviews#f7d259db as nil") + } + b.ObjStart() + b.PutID("deleteBotMediaPreviews") + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(d.BotUserID) + b.Comma() + b.FieldStart("language_code") + b.PutString(d.LanguageCode) + b.Comma() + b.FieldStart("file_ids") + b.ArrStart() + for _, v := range d.FileIDs { + b.PutInt32(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (d *DeleteBotMediaPreviewsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if d == nil { + return fmt.Errorf("can't decode deleteBotMediaPreviews#f7d259db to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("deleteBotMediaPreviews"); err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: %w", err) + } + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field bot_user_id: %w", err) + } + d.BotUserID = value + case "language_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field language_code: %w", err) + } + d.LanguageCode = value + case "file_ids": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field file_ids: %w", err) + } + d.FileIDs = append(d.FileIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field file_ids: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (d *DeleteBotMediaPreviewsRequest) GetBotUserID() (value int64) { + if d == nil { + return + } + return d.BotUserID +} + +// GetLanguageCode returns value of LanguageCode field. +func (d *DeleteBotMediaPreviewsRequest) GetLanguageCode() (value string) { + if d == nil { + return + } + return d.LanguageCode +} + +// GetFileIDs returns value of FileIDs field. +func (d *DeleteBotMediaPreviewsRequest) GetFileIDs() (value []int32) { + if d == nil { + return + } + return d.FileIDs +} + +// DeleteBotMediaPreviews invokes method deleteBotMediaPreviews#f7d259db returning error if any. +func (c *Client) DeleteBotMediaPreviews(ctx context.Context, request *DeleteBotMediaPreviewsRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_delete_messages_gen.go b/tdapi/tl_delete_messages_gen.go index 8a347e2f0e..64e099ddd2 100644 --- a/tdapi/tl_delete_messages_gen.go +++ b/tdapi/tl_delete_messages_gen.go @@ -35,7 +35,9 @@ var ( type DeleteMessagesRequest struct { // Chat identifier ChatID int64 - // Identifiers of the messages to be deleted + // Identifiers of the messages to be deleted. Use messageProperties + // can_be_deleted_only_for_self and messageProperties.can_be_deleted_for_all_users to get + // suitable messages MessageIDs []int64 // Pass true to delete messages for all chat members. Always true for supergroups, // channels and secret chats diff --git a/tdapi/tl_edit_bot_media_preview_gen.go b/tdapi/tl_edit_bot_media_preview_gen.go new file mode 100644 index 0000000000..7ea8cbe0c8 --- /dev/null +++ b/tdapi/tl_edit_bot_media_preview_gen.go @@ -0,0 +1,315 @@ +// 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{} +) + +// EditBotMediaPreviewRequest represents TL type `editBotMediaPreview#86955d62`. +type EditBotMediaPreviewRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserID int64 + // Language code of the media preview to edit + LanguageCode string + // File identifier of the media to replace + FileID int32 + // Content of the new preview + Content InputStoryContentClass +} + +// EditBotMediaPreviewRequestTypeID is TL type id of EditBotMediaPreviewRequest. +const EditBotMediaPreviewRequestTypeID = 0x86955d62 + +// Ensuring interfaces in compile-time for EditBotMediaPreviewRequest. +var ( + _ bin.Encoder = &EditBotMediaPreviewRequest{} + _ bin.Decoder = &EditBotMediaPreviewRequest{} + _ bin.BareEncoder = &EditBotMediaPreviewRequest{} + _ bin.BareDecoder = &EditBotMediaPreviewRequest{} +) + +func (e *EditBotMediaPreviewRequest) Zero() bool { + if e == nil { + return true + } + if !(e.BotUserID == 0) { + return false + } + if !(e.LanguageCode == "") { + return false + } + if !(e.FileID == 0) { + return false + } + if !(e.Content == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *EditBotMediaPreviewRequest) String() string { + if e == nil { + return "EditBotMediaPreviewRequest(nil)" + } + type Alias EditBotMediaPreviewRequest + return fmt.Sprintf("EditBotMediaPreviewRequest%+v", Alias(*e)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*EditBotMediaPreviewRequest) TypeID() uint32 { + return EditBotMediaPreviewRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*EditBotMediaPreviewRequest) TypeName() string { + return "editBotMediaPreview" +} + +// TypeInfo returns info about TL type. +func (e *EditBotMediaPreviewRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "editBotMediaPreview", + ID: EditBotMediaPreviewRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "LanguageCode", + SchemaName: "language_code", + }, + { + Name: "FileID", + SchemaName: "file_id", + }, + { + Name: "Content", + SchemaName: "content", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *EditBotMediaPreviewRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode editBotMediaPreview#86955d62 as nil") + } + b.PutID(EditBotMediaPreviewRequestTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *EditBotMediaPreviewRequest) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode editBotMediaPreview#86955d62 as nil") + } + b.PutInt53(e.BotUserID) + b.PutString(e.LanguageCode) + b.PutInt32(e.FileID) + if e.Content == nil { + return fmt.Errorf("unable to encode editBotMediaPreview#86955d62: field content is nil") + } + if err := e.Content.Encode(b); err != nil { + return fmt.Errorf("unable to encode editBotMediaPreview#86955d62: field content: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (e *EditBotMediaPreviewRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode editBotMediaPreview#86955d62 to nil") + } + if err := b.ConsumeID(EditBotMediaPreviewRequestTypeID); err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *EditBotMediaPreviewRequest) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode editBotMediaPreview#86955d62 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field bot_user_id: %w", err) + } + e.BotUserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field language_code: %w", err) + } + e.LanguageCode = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field file_id: %w", err) + } + e.FileID = value + } + { + value, err := DecodeInputStoryContent(b) + if err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field content: %w", err) + } + e.Content = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (e *EditBotMediaPreviewRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if e == nil { + return fmt.Errorf("can't encode editBotMediaPreview#86955d62 as nil") + } + b.ObjStart() + b.PutID("editBotMediaPreview") + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(e.BotUserID) + b.Comma() + b.FieldStart("language_code") + b.PutString(e.LanguageCode) + b.Comma() + b.FieldStart("file_id") + b.PutInt32(e.FileID) + b.Comma() + b.FieldStart("content") + if e.Content == nil { + return fmt.Errorf("unable to encode editBotMediaPreview#86955d62: field content is nil") + } + if err := e.Content.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode editBotMediaPreview#86955d62: field content: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (e *EditBotMediaPreviewRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if e == nil { + return fmt.Errorf("can't decode editBotMediaPreview#86955d62 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("editBotMediaPreview"); err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: %w", err) + } + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field bot_user_id: %w", err) + } + e.BotUserID = value + case "language_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field language_code: %w", err) + } + e.LanguageCode = value + case "file_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field file_id: %w", err) + } + e.FileID = value + case "content": + value, err := DecodeTDLibJSONInputStoryContent(b) + if err != nil { + return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field content: %w", err) + } + e.Content = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (e *EditBotMediaPreviewRequest) GetBotUserID() (value int64) { + if e == nil { + return + } + return e.BotUserID +} + +// GetLanguageCode returns value of LanguageCode field. +func (e *EditBotMediaPreviewRequest) GetLanguageCode() (value string) { + if e == nil { + return + } + return e.LanguageCode +} + +// GetFileID returns value of FileID field. +func (e *EditBotMediaPreviewRequest) GetFileID() (value int32) { + if e == nil { + return + } + return e.FileID +} + +// GetContent returns value of Content field. +func (e *EditBotMediaPreviewRequest) GetContent() (value InputStoryContentClass) { + if e == nil { + return + } + return e.Content +} + +// EditBotMediaPreview invokes method editBotMediaPreview#86955d62 returning error if any. +func (c *Client) EditBotMediaPreview(ctx context.Context, request *EditBotMediaPreviewRequest) (*BotMediaPreview, error) { + var result BotMediaPreview + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_edit_message_caption_gen.go b/tdapi/tl_edit_message_caption_gen.go index b658bb70d2..7fdb6de645 100644 --- a/tdapi/tl_edit_message_caption_gen.go +++ b/tdapi/tl_edit_message_caption_gen.go @@ -35,7 +35,8 @@ var ( type EditMessageCaptionRequest struct { // The chat the message belongs to ChatID int64 - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the + // message can be edited MessageID int64 // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkupClass diff --git a/tdapi/tl_edit_message_live_location_gen.go b/tdapi/tl_edit_message_live_location_gen.go index 93351e826b..c6bdc248a4 100644 --- a/tdapi/tl_edit_message_live_location_gen.go +++ b/tdapi/tl_edit_message_live_location_gen.go @@ -35,7 +35,8 @@ var ( type EditMessageLiveLocationRequest struct { // The chat the message belongs to ChatID int64 - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the + // message can be edited MessageID int64 // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkupClass diff --git a/tdapi/tl_edit_message_media_gen.go b/tdapi/tl_edit_message_media_gen.go index 57dc59ea25..444e206dc8 100644 --- a/tdapi/tl_edit_message_media_gen.go +++ b/tdapi/tl_edit_message_media_gen.go @@ -35,7 +35,8 @@ var ( type EditMessageMediaRequest struct { // The chat the message belongs to ChatID int64 - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the + // message can be edited MessageID int64 // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkupClass diff --git a/tdapi/tl_edit_message_reply_markup_gen.go b/tdapi/tl_edit_message_reply_markup_gen.go index 6ca257acb5..519b180822 100644 --- a/tdapi/tl_edit_message_reply_markup_gen.go +++ b/tdapi/tl_edit_message_reply_markup_gen.go @@ -35,7 +35,8 @@ var ( type EditMessageReplyMarkupRequest struct { // The chat the message belongs to ChatID int64 - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the + // message can be edited MessageID int64 // The new message reply markup; pass null if none ReplyMarkup ReplyMarkupClass diff --git a/tdapi/tl_edit_message_scheduling_state_gen.go b/tdapi/tl_edit_message_scheduling_state_gen.go index 478ad9f560..3509536627 100644 --- a/tdapi/tl_edit_message_scheduling_state_gen.go +++ b/tdapi/tl_edit_message_scheduling_state_gen.go @@ -35,7 +35,8 @@ var ( type EditMessageSchedulingStateRequest struct { // The chat the message belongs to ChatID int64 - // Identifier of the message + // Identifier of the message. Use messageProperties.can_edit_scheduling_state to check + // whether the message is suitable MessageID int64 // The new message scheduling state; pass null to send the message immediately SchedulingState MessageSchedulingStateClass diff --git a/tdapi/tl_edit_message_text_gen.go b/tdapi/tl_edit_message_text_gen.go index 1b2b0c1e0d..c1849d3a48 100644 --- a/tdapi/tl_edit_message_text_gen.go +++ b/tdapi/tl_edit_message_text_gen.go @@ -35,7 +35,8 @@ var ( type EditMessageTextRequest struct { // The chat the message belongs to ChatID int64 - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the + // message can be edited MessageID int64 // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkupClass diff --git a/tdapi/tl_edit_story_cover_gen.go b/tdapi/tl_edit_story_cover_gen.go new file mode 100644 index 0000000000..c202784038 --- /dev/null +++ b/tdapi/tl_edit_story_cover_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{} +) + +// EditStoryCoverRequest represents TL type `editStoryCover#ab2a0c4b`. +type EditStoryCoverRequest struct { + // Identifier of the chat that posted the story + StorySenderChatID int64 + // Identifier of the story to edit + StoryID int32 + // New timestamp of the frame, which will be used as video thumbnail + CoverFrameTimestamp float64 +} + +// EditStoryCoverRequestTypeID is TL type id of EditStoryCoverRequest. +const EditStoryCoverRequestTypeID = 0xab2a0c4b + +// Ensuring interfaces in compile-time for EditStoryCoverRequest. +var ( + _ bin.Encoder = &EditStoryCoverRequest{} + _ bin.Decoder = &EditStoryCoverRequest{} + _ bin.BareEncoder = &EditStoryCoverRequest{} + _ bin.BareDecoder = &EditStoryCoverRequest{} +) + +func (e *EditStoryCoverRequest) Zero() bool { + if e == nil { + return true + } + if !(e.StorySenderChatID == 0) { + return false + } + if !(e.StoryID == 0) { + return false + } + if !(e.CoverFrameTimestamp == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *EditStoryCoverRequest) String() string { + if e == nil { + return "EditStoryCoverRequest(nil)" + } + type Alias EditStoryCoverRequest + return fmt.Sprintf("EditStoryCoverRequest%+v", Alias(*e)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*EditStoryCoverRequest) TypeID() uint32 { + return EditStoryCoverRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*EditStoryCoverRequest) TypeName() string { + return "editStoryCover" +} + +// TypeInfo returns info about TL type. +func (e *EditStoryCoverRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "editStoryCover", + ID: EditStoryCoverRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StorySenderChatID", + SchemaName: "story_sender_chat_id", + }, + { + Name: "StoryID", + SchemaName: "story_id", + }, + { + Name: "CoverFrameTimestamp", + SchemaName: "cover_frame_timestamp", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *EditStoryCoverRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode editStoryCover#ab2a0c4b as nil") + } + b.PutID(EditStoryCoverRequestTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *EditStoryCoverRequest) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode editStoryCover#ab2a0c4b as nil") + } + b.PutInt53(e.StorySenderChatID) + b.PutInt32(e.StoryID) + b.PutDouble(e.CoverFrameTimestamp) + return nil +} + +// Decode implements bin.Decoder. +func (e *EditStoryCoverRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode editStoryCover#ab2a0c4b to nil") + } + if err := b.ConsumeID(EditStoryCoverRequestTypeID); err != nil { + return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *EditStoryCoverRequest) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode editStoryCover#ab2a0c4b to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field story_sender_chat_id: %w", err) + } + e.StorySenderChatID = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field story_id: %w", err) + } + e.StoryID = value + } + { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field cover_frame_timestamp: %w", err) + } + e.CoverFrameTimestamp = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (e *EditStoryCoverRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if e == nil { + return fmt.Errorf("can't encode editStoryCover#ab2a0c4b as nil") + } + b.ObjStart() + b.PutID("editStoryCover") + b.Comma() + b.FieldStart("story_sender_chat_id") + b.PutInt53(e.StorySenderChatID) + b.Comma() + b.FieldStart("story_id") + b.PutInt32(e.StoryID) + b.Comma() + b.FieldStart("cover_frame_timestamp") + b.PutDouble(e.CoverFrameTimestamp) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (e *EditStoryCoverRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if e == nil { + return fmt.Errorf("can't decode editStoryCover#ab2a0c4b to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("editStoryCover"); err != nil { + return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: %w", err) + } + case "story_sender_chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field story_sender_chat_id: %w", err) + } + e.StorySenderChatID = value + case "story_id": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field story_id: %w", err) + } + e.StoryID = value + case "cover_frame_timestamp": + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field cover_frame_timestamp: %w", err) + } + e.CoverFrameTimestamp = value + default: + return b.Skip() + } + return nil + }) +} + +// GetStorySenderChatID returns value of StorySenderChatID field. +func (e *EditStoryCoverRequest) GetStorySenderChatID() (value int64) { + if e == nil { + return + } + return e.StorySenderChatID +} + +// GetStoryID returns value of StoryID field. +func (e *EditStoryCoverRequest) GetStoryID() (value int32) { + if e == nil { + return + } + return e.StoryID +} + +// GetCoverFrameTimestamp returns value of CoverFrameTimestamp field. +func (e *EditStoryCoverRequest) GetCoverFrameTimestamp() (value float64) { + if e == nil { + return + } + return e.CoverFrameTimestamp +} + +// EditStoryCover invokes method editStoryCover#ab2a0c4b returning error if any. +func (c *Client) EditStoryCover(ctx context.Context, request *EditStoryCoverRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_forward_messages_gen.go b/tdapi/tl_forward_messages_gen.go index dcea2db3af..9b03fc8133 100644 --- a/tdapi/tl_forward_messages_gen.go +++ b/tdapi/tl_forward_messages_gen.go @@ -42,7 +42,7 @@ type ForwardMessagesRequest struct { FromChatID int64 // Identifiers of the messages to forward. Message identifiers must be in a strictly // increasing order. At most 100 messages can be forwarded simultaneously. A message can - // be forwarded only if message.can_be_forwarded + // be forwarded only if messageProperties.can_be_forwarded MessageIDs []int64 // Options to be used to send the messages; pass null to use default options Options MessageSendOptions diff --git a/tdapi/tl_found_users_gen.go b/tdapi/tl_found_users_gen.go new file mode 100644 index 0000000000..a8a4544c24 --- /dev/null +++ b/tdapi/tl_found_users_gen.go @@ -0,0 +1,251 @@ +// 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{} +) + +// FoundUsers represents TL type `foundUsers#c531e854`. +type FoundUsers struct { + // Identifiers of the found users + UserIDs []int64 + // The offset for the next request. If empty, then there are no more results + NextOffset string +} + +// FoundUsersTypeID is TL type id of FoundUsers. +const FoundUsersTypeID = 0xc531e854 + +// Ensuring interfaces in compile-time for FoundUsers. +var ( + _ bin.Encoder = &FoundUsers{} + _ bin.Decoder = &FoundUsers{} + _ bin.BareEncoder = &FoundUsers{} + _ bin.BareDecoder = &FoundUsers{} +) + +func (f *FoundUsers) Zero() bool { + if f == nil { + return true + } + if !(f.UserIDs == nil) { + return false + } + if !(f.NextOffset == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (f *FoundUsers) String() string { + if f == nil { + return "FoundUsers(nil)" + } + type Alias FoundUsers + return fmt.Sprintf("FoundUsers%+v", Alias(*f)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*FoundUsers) TypeID() uint32 { + return FoundUsersTypeID +} + +// TypeName returns name of type in TL schema. +func (*FoundUsers) TypeName() string { + return "foundUsers" +} + +// TypeInfo returns info about TL type. +func (f *FoundUsers) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "foundUsers", + ID: FoundUsersTypeID, + } + if f == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserIDs", + SchemaName: "user_ids", + }, + { + Name: "NextOffset", + SchemaName: "next_offset", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (f *FoundUsers) Encode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode foundUsers#c531e854 as nil") + } + b.PutID(FoundUsersTypeID) + return f.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (f *FoundUsers) EncodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode foundUsers#c531e854 as nil") + } + b.PutInt(len(f.UserIDs)) + for _, v := range f.UserIDs { + b.PutInt53(v) + } + b.PutString(f.NextOffset) + return nil +} + +// Decode implements bin.Decoder. +func (f *FoundUsers) Decode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode foundUsers#c531e854 to nil") + } + if err := b.ConsumeID(FoundUsersTypeID); err != nil { + return fmt.Errorf("unable to decode foundUsers#c531e854: %w", err) + } + return f.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (f *FoundUsers) DecodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode foundUsers#c531e854 to nil") + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode foundUsers#c531e854: field user_ids: %w", err) + } + + if headerLen > 0 { + f.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode foundUsers#c531e854: field user_ids: %w", err) + } + f.UserIDs = append(f.UserIDs, value) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode foundUsers#c531e854: field next_offset: %w", err) + } + f.NextOffset = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (f *FoundUsers) EncodeTDLibJSON(b tdjson.Encoder) error { + if f == nil { + return fmt.Errorf("can't encode foundUsers#c531e854 as nil") + } + b.ObjStart() + b.PutID("foundUsers") + b.Comma() + b.FieldStart("user_ids") + b.ArrStart() + for _, v := range f.UserIDs { + b.PutInt53(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.FieldStart("next_offset") + b.PutString(f.NextOffset) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (f *FoundUsers) DecodeTDLibJSON(b tdjson.Decoder) error { + if f == nil { + return fmt.Errorf("can't decode foundUsers#c531e854 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("foundUsers"); err != nil { + return fmt.Errorf("unable to decode foundUsers#c531e854: %w", err) + } + case "user_ids": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode foundUsers#c531e854: field user_ids: %w", err) + } + f.UserIDs = append(f.UserIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode foundUsers#c531e854: field user_ids: %w", err) + } + case "next_offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode foundUsers#c531e854: field next_offset: %w", err) + } + f.NextOffset = value + default: + return b.Skip() + } + return nil + }) +} + +// GetUserIDs returns value of UserIDs field. +func (f *FoundUsers) GetUserIDs() (value []int64) { + if f == nil { + return + } + return f.UserIDs +} + +// GetNextOffset returns value of NextOffset field. +func (f *FoundUsers) GetNextOffset() (value string) { + if f == nil { + return + } + return f.NextOffset +} diff --git a/tdapi/tl_get_bot_media_preview_info_gen.go b/tdapi/tl_get_bot_media_preview_info_gen.go new file mode 100644 index 0000000000..390b4904b1 --- /dev/null +++ b/tdapi/tl_get_bot_media_preview_info_gen.go @@ -0,0 +1,238 @@ +// 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{} +) + +// GetBotMediaPreviewInfoRequest represents TL type `getBotMediaPreviewInfo#50f60136`. +type GetBotMediaPreviewInfoRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserID int64 + // A two-letter ISO 639-1 language code for which to get previews. If empty, then default + // previews are returned + LanguageCode string +} + +// GetBotMediaPreviewInfoRequestTypeID is TL type id of GetBotMediaPreviewInfoRequest. +const GetBotMediaPreviewInfoRequestTypeID = 0x50f60136 + +// Ensuring interfaces in compile-time for GetBotMediaPreviewInfoRequest. +var ( + _ bin.Encoder = &GetBotMediaPreviewInfoRequest{} + _ bin.Decoder = &GetBotMediaPreviewInfoRequest{} + _ bin.BareEncoder = &GetBotMediaPreviewInfoRequest{} + _ bin.BareDecoder = &GetBotMediaPreviewInfoRequest{} +) + +func (g *GetBotMediaPreviewInfoRequest) Zero() bool { + if g == nil { + return true + } + if !(g.BotUserID == 0) { + return false + } + if !(g.LanguageCode == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetBotMediaPreviewInfoRequest) String() string { + if g == nil { + return "GetBotMediaPreviewInfoRequest(nil)" + } + type Alias GetBotMediaPreviewInfoRequest + return fmt.Sprintf("GetBotMediaPreviewInfoRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetBotMediaPreviewInfoRequest) TypeID() uint32 { + return GetBotMediaPreviewInfoRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetBotMediaPreviewInfoRequest) TypeName() string { + return "getBotMediaPreviewInfo" +} + +// TypeInfo returns info about TL type. +func (g *GetBotMediaPreviewInfoRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getBotMediaPreviewInfo", + ID: GetBotMediaPreviewInfoRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "LanguageCode", + SchemaName: "language_code", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetBotMediaPreviewInfoRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getBotMediaPreviewInfo#50f60136 as nil") + } + b.PutID(GetBotMediaPreviewInfoRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetBotMediaPreviewInfoRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getBotMediaPreviewInfo#50f60136 as nil") + } + b.PutInt53(g.BotUserID) + b.PutString(g.LanguageCode) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetBotMediaPreviewInfoRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getBotMediaPreviewInfo#50f60136 to nil") + } + if err := b.ConsumeID(GetBotMediaPreviewInfoRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetBotMediaPreviewInfoRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getBotMediaPreviewInfo#50f60136 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: field bot_user_id: %w", err) + } + g.BotUserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: field language_code: %w", err) + } + g.LanguageCode = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetBotMediaPreviewInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getBotMediaPreviewInfo#50f60136 as nil") + } + b.ObjStart() + b.PutID("getBotMediaPreviewInfo") + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(g.BotUserID) + b.Comma() + b.FieldStart("language_code") + b.PutString(g.LanguageCode) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetBotMediaPreviewInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getBotMediaPreviewInfo#50f60136 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getBotMediaPreviewInfo"); err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: %w", err) + } + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: field bot_user_id: %w", err) + } + g.BotUserID = value + case "language_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: field language_code: %w", err) + } + g.LanguageCode = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (g *GetBotMediaPreviewInfoRequest) GetBotUserID() (value int64) { + if g == nil { + return + } + return g.BotUserID +} + +// GetLanguageCode returns value of LanguageCode field. +func (g *GetBotMediaPreviewInfoRequest) GetLanguageCode() (value string) { + if g == nil { + return + } + return g.LanguageCode +} + +// GetBotMediaPreviewInfo invokes method getBotMediaPreviewInfo#50f60136 returning error if any. +func (c *Client) GetBotMediaPreviewInfo(ctx context.Context, request *GetBotMediaPreviewInfoRequest) (*BotMediaPreviewInfo, error) { + var result BotMediaPreviewInfo + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_bot_media_previews_gen.go b/tdapi/tl_get_bot_media_previews_gen.go new file mode 100644 index 0000000000..509afb3883 --- /dev/null +++ b/tdapi/tl_get_bot_media_previews_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{} +) + +// GetBotMediaPreviewsRequest represents TL type `getBotMediaPreviews#22665458`. +type GetBotMediaPreviewsRequest struct { + // Identifier of the target bot. The bot must have the main Web App + BotUserID int64 +} + +// GetBotMediaPreviewsRequestTypeID is TL type id of GetBotMediaPreviewsRequest. +const GetBotMediaPreviewsRequestTypeID = 0x22665458 + +// Ensuring interfaces in compile-time for GetBotMediaPreviewsRequest. +var ( + _ bin.Encoder = &GetBotMediaPreviewsRequest{} + _ bin.Decoder = &GetBotMediaPreviewsRequest{} + _ bin.BareEncoder = &GetBotMediaPreviewsRequest{} + _ bin.BareDecoder = &GetBotMediaPreviewsRequest{} +) + +func (g *GetBotMediaPreviewsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.BotUserID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetBotMediaPreviewsRequest) String() string { + if g == nil { + return "GetBotMediaPreviewsRequest(nil)" + } + type Alias GetBotMediaPreviewsRequest + return fmt.Sprintf("GetBotMediaPreviewsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetBotMediaPreviewsRequest) TypeID() uint32 { + return GetBotMediaPreviewsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetBotMediaPreviewsRequest) TypeName() string { + return "getBotMediaPreviews" +} + +// TypeInfo returns info about TL type. +func (g *GetBotMediaPreviewsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getBotMediaPreviews", + ID: GetBotMediaPreviewsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetBotMediaPreviewsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getBotMediaPreviews#22665458 as nil") + } + b.PutID(GetBotMediaPreviewsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetBotMediaPreviewsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getBotMediaPreviews#22665458 as nil") + } + b.PutInt53(g.BotUserID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetBotMediaPreviewsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getBotMediaPreviews#22665458 to nil") + } + if err := b.ConsumeID(GetBotMediaPreviewsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviews#22665458: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetBotMediaPreviewsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getBotMediaPreviews#22665458 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviews#22665458: field bot_user_id: %w", err) + } + g.BotUserID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetBotMediaPreviewsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getBotMediaPreviews#22665458 as nil") + } + b.ObjStart() + b.PutID("getBotMediaPreviews") + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(g.BotUserID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetBotMediaPreviewsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getBotMediaPreviews#22665458 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getBotMediaPreviews"); err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviews#22665458: %w", err) + } + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getBotMediaPreviews#22665458: field bot_user_id: %w", err) + } + g.BotUserID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (g *GetBotMediaPreviewsRequest) GetBotUserID() (value int64) { + if g == nil { + return + } + return g.BotUserID +} + +// GetBotMediaPreviews invokes method getBotMediaPreviews#22665458 returning error if any. +func (c *Client) GetBotMediaPreviews(ctx context.Context, botuserid int64) (*BotMediaPreviews, error) { + var result BotMediaPreviews + + request := &GetBotMediaPreviewsRequest{ + BotUserID: botuserid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_callback_query_answer_gen.go b/tdapi/tl_get_callback_query_answer_gen.go index 4a24bab8ed..d8ce784ba0 100644 --- a/tdapi/tl_get_callback_query_answer_gen.go +++ b/tdapi/tl_get_callback_query_answer_gen.go @@ -35,7 +35,8 @@ var ( type GetCallbackQueryAnswerRequest struct { // Identifier of the chat with the message ChatID int64 - // Identifier of the message from which the query originated + // Identifier of the message from which the query originated. The message must not be + // scheduled MessageID int64 // Query payload Payload CallbackQueryPayloadClass diff --git a/tdapi/tl_get_current_weather_gen.go b/tdapi/tl_get_current_weather_gen.go new file mode 100644 index 0000000000..47eef973bb --- /dev/null +++ b/tdapi/tl_get_current_weather_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{} +) + +// GetCurrentWeatherRequest represents TL type `getCurrentWeather#8ada9bc9`. +type GetCurrentWeatherRequest struct { + // The location + Location Location +} + +// GetCurrentWeatherRequestTypeID is TL type id of GetCurrentWeatherRequest. +const GetCurrentWeatherRequestTypeID = 0x8ada9bc9 + +// Ensuring interfaces in compile-time for GetCurrentWeatherRequest. +var ( + _ bin.Encoder = &GetCurrentWeatherRequest{} + _ bin.Decoder = &GetCurrentWeatherRequest{} + _ bin.BareEncoder = &GetCurrentWeatherRequest{} + _ bin.BareDecoder = &GetCurrentWeatherRequest{} +) + +func (g *GetCurrentWeatherRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Location.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetCurrentWeatherRequest) String() string { + if g == nil { + return "GetCurrentWeatherRequest(nil)" + } + type Alias GetCurrentWeatherRequest + return fmt.Sprintf("GetCurrentWeatherRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetCurrentWeatherRequest) TypeID() uint32 { + return GetCurrentWeatherRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetCurrentWeatherRequest) TypeName() string { + return "getCurrentWeather" +} + +// TypeInfo returns info about TL type. +func (g *GetCurrentWeatherRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getCurrentWeather", + ID: GetCurrentWeatherRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Location", + SchemaName: "location", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetCurrentWeatherRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getCurrentWeather#8ada9bc9 as nil") + } + b.PutID(GetCurrentWeatherRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetCurrentWeatherRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getCurrentWeather#8ada9bc9 as nil") + } + if err := g.Location.Encode(b); err != nil { + return fmt.Errorf("unable to encode getCurrentWeather#8ada9bc9: field location: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *GetCurrentWeatherRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getCurrentWeather#8ada9bc9 to nil") + } + if err := b.ConsumeID(GetCurrentWeatherRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getCurrentWeather#8ada9bc9: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetCurrentWeatherRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getCurrentWeather#8ada9bc9 to nil") + } + { + if err := g.Location.Decode(b); err != nil { + return fmt.Errorf("unable to decode getCurrentWeather#8ada9bc9: field location: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetCurrentWeatherRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getCurrentWeather#8ada9bc9 as nil") + } + b.ObjStart() + b.PutID("getCurrentWeather") + b.Comma() + b.FieldStart("location") + if err := g.Location.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode getCurrentWeather#8ada9bc9: field location: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetCurrentWeatherRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getCurrentWeather#8ada9bc9 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getCurrentWeather"); err != nil { + return fmt.Errorf("unable to decode getCurrentWeather#8ada9bc9: %w", err) + } + case "location": + if err := g.Location.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode getCurrentWeather#8ada9bc9: field location: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetLocation returns value of Location field. +func (g *GetCurrentWeatherRequest) GetLocation() (value Location) { + if g == nil { + return + } + return g.Location +} + +// GetCurrentWeather invokes method getCurrentWeather#8ada9bc9 returning error if any. +func (c *Client) GetCurrentWeather(ctx context.Context, location Location) (*CurrentWeather, error) { + var result CurrentWeather + + request := &GetCurrentWeatherRequest{ + Location: location, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_login_url_info_gen.go b/tdapi/tl_get_login_url_info_gen.go index 5c8a8c5cd4..873ed755c7 100644 --- a/tdapi/tl_get_login_url_info_gen.go +++ b/tdapi/tl_get_login_url_info_gen.go @@ -35,7 +35,7 @@ var ( type GetLoginURLInfoRequest struct { // Chat identifier of the message with the button ChatID int64 - // Message identifier of the message with the button + // Message identifier of the message with the button. The message must not be scheduled MessageID int64 // Button identifier ButtonID int64 diff --git a/tdapi/tl_get_main_web_app_gen.go b/tdapi/tl_get_main_web_app_gen.go new file mode 100644 index 0000000000..d3ace8ebe4 --- /dev/null +++ b/tdapi/tl_get_main_web_app_gen.go @@ -0,0 +1,339 @@ +// 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{} +) + +// GetMainWebAppRequest represents TL type `getMainWebApp#be84329a`. +type GetMainWebAppRequest struct { + // Identifier of the chat in which the Web App is opened; pass 0 if none + ChatID int64 + // Identifier of the target bot + BotUserID int64 + // Start parameter from internalLinkTypeMainWebApp + StartParameter string + // Preferred Web App theme; pass null to use the default theme + Theme ThemeParameters + // Short name of the current application; 0-64 English letters, digits, and underscores + ApplicationName string +} + +// GetMainWebAppRequestTypeID is TL type id of GetMainWebAppRequest. +const GetMainWebAppRequestTypeID = 0xbe84329a + +// Ensuring interfaces in compile-time for GetMainWebAppRequest. +var ( + _ bin.Encoder = &GetMainWebAppRequest{} + _ bin.Decoder = &GetMainWebAppRequest{} + _ bin.BareEncoder = &GetMainWebAppRequest{} + _ bin.BareDecoder = &GetMainWebAppRequest{} +) + +func (g *GetMainWebAppRequest) Zero() bool { + if g == nil { + return true + } + if !(g.ChatID == 0) { + return false + } + if !(g.BotUserID == 0) { + return false + } + if !(g.StartParameter == "") { + return false + } + if !(g.Theme.Zero()) { + return false + } + if !(g.ApplicationName == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetMainWebAppRequest) String() string { + if g == nil { + return "GetMainWebAppRequest(nil)" + } + type Alias GetMainWebAppRequest + return fmt.Sprintf("GetMainWebAppRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetMainWebAppRequest) TypeID() uint32 { + return GetMainWebAppRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetMainWebAppRequest) TypeName() string { + return "getMainWebApp" +} + +// TypeInfo returns info about TL type. +func (g *GetMainWebAppRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getMainWebApp", + ID: GetMainWebAppRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "StartParameter", + SchemaName: "start_parameter", + }, + { + Name: "Theme", + SchemaName: "theme", + }, + { + Name: "ApplicationName", + SchemaName: "application_name", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetMainWebAppRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getMainWebApp#be84329a as nil") + } + b.PutID(GetMainWebAppRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetMainWebAppRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getMainWebApp#be84329a as nil") + } + b.PutInt53(g.ChatID) + b.PutInt53(g.BotUserID) + b.PutString(g.StartParameter) + if err := g.Theme.Encode(b); err != nil { + return fmt.Errorf("unable to encode getMainWebApp#be84329a: field theme: %w", err) + } + b.PutString(g.ApplicationName) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetMainWebAppRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getMainWebApp#be84329a to nil") + } + if err := b.ConsumeID(GetMainWebAppRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetMainWebAppRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getMainWebApp#be84329a to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field bot_user_id: %w", err) + } + g.BotUserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field start_parameter: %w", err) + } + g.StartParameter = value + } + { + if err := g.Theme.Decode(b); err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field theme: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field application_name: %w", err) + } + g.ApplicationName = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetMainWebAppRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getMainWebApp#be84329a as nil") + } + b.ObjStart() + b.PutID("getMainWebApp") + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(g.ChatID) + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(g.BotUserID) + b.Comma() + b.FieldStart("start_parameter") + b.PutString(g.StartParameter) + b.Comma() + b.FieldStart("theme") + if err := g.Theme.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode getMainWebApp#be84329a: field theme: %w", err) + } + b.Comma() + b.FieldStart("application_name") + b.PutString(g.ApplicationName) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetMainWebAppRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getMainWebApp#be84329a to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getMainWebApp"); err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field chat_id: %w", err) + } + g.ChatID = value + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field bot_user_id: %w", err) + } + g.BotUserID = value + case "start_parameter": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field start_parameter: %w", err) + } + g.StartParameter = value + case "theme": + if err := g.Theme.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field theme: %w", err) + } + case "application_name": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getMainWebApp#be84329a: field application_name: %w", err) + } + g.ApplicationName = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetMainWebAppRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetBotUserID returns value of BotUserID field. +func (g *GetMainWebAppRequest) GetBotUserID() (value int64) { + if g == nil { + return + } + return g.BotUserID +} + +// GetStartParameter returns value of StartParameter field. +func (g *GetMainWebAppRequest) GetStartParameter() (value string) { + if g == nil { + return + } + return g.StartParameter +} + +// GetTheme returns value of Theme field. +func (g *GetMainWebAppRequest) GetTheme() (value ThemeParameters) { + if g == nil { + return + } + return g.Theme +} + +// GetApplicationName returns value of ApplicationName field. +func (g *GetMainWebAppRequest) GetApplicationName() (value string) { + if g == nil { + return + } + return g.ApplicationName +} + +// GetMainWebApp invokes method getMainWebApp#be84329a returning error if any. +func (c *Client) GetMainWebApp(ctx context.Context, request *GetMainWebAppRequest) (*MainWebApp, error) { + var result MainWebApp + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_message_added_reactions_gen.go b/tdapi/tl_get_message_added_reactions_gen.go index b7c01d0768..cfefa0f997 100644 --- a/tdapi/tl_get_message_added_reactions_gen.go +++ b/tdapi/tl_get_message_added_reactions_gen.go @@ -35,7 +35,8 @@ var ( type GetMessageAddedReactionsRequest struct { // Identifier of the chat to which the message belongs ChatID int64 - // Identifier of the message + // Identifier of the message. Use messageProperties.can_get_added_reactions to check + // whether added reactions can be received for the message MessageID int64 // Type of the reactions to return; pass null to return all added reactions ReactionType ReactionTypeClass diff --git a/tdapi/tl_get_message_properties_gen.go b/tdapi/tl_get_message_properties_gen.go new file mode 100644 index 0000000000..63af073ccb --- /dev/null +++ b/tdapi/tl_get_message_properties_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{} +) + +// GetMessagePropertiesRequest represents TL type `getMessageProperties#2e18e1ab`. +type GetMessagePropertiesRequest struct { + // Chat identifier + ChatID int64 + // Identifier of the message + MessageID int64 +} + +// GetMessagePropertiesRequestTypeID is TL type id of GetMessagePropertiesRequest. +const GetMessagePropertiesRequestTypeID = 0x2e18e1ab + +// Ensuring interfaces in compile-time for GetMessagePropertiesRequest. +var ( + _ bin.Encoder = &GetMessagePropertiesRequest{} + _ bin.Decoder = &GetMessagePropertiesRequest{} + _ bin.BareEncoder = &GetMessagePropertiesRequest{} + _ bin.BareDecoder = &GetMessagePropertiesRequest{} +) + +func (g *GetMessagePropertiesRequest) 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 *GetMessagePropertiesRequest) String() string { + if g == nil { + return "GetMessagePropertiesRequest(nil)" + } + type Alias GetMessagePropertiesRequest + return fmt.Sprintf("GetMessagePropertiesRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetMessagePropertiesRequest) TypeID() uint32 { + return GetMessagePropertiesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetMessagePropertiesRequest) TypeName() string { + return "getMessageProperties" +} + +// TypeInfo returns info about TL type. +func (g *GetMessagePropertiesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getMessageProperties", + ID: GetMessagePropertiesRequestTypeID, + } + 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 *GetMessagePropertiesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getMessageProperties#2e18e1ab as nil") + } + b.PutID(GetMessagePropertiesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetMessagePropertiesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getMessageProperties#2e18e1ab as nil") + } + b.PutInt53(g.ChatID) + b.PutInt53(g.MessageID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetMessagePropertiesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getMessageProperties#2e18e1ab to nil") + } + if err := b.ConsumeID(GetMessagePropertiesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetMessagePropertiesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getMessageProperties#2e18e1ab to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: field chat_id: %w", err) + } + g.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: field message_id: %w", err) + } + g.MessageID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetMessagePropertiesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getMessageProperties#2e18e1ab as nil") + } + b.ObjStart() + b.PutID("getMessageProperties") + 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 *GetMessagePropertiesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getMessageProperties#2e18e1ab to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getMessageProperties"); err != nil { + return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: %w", err) + } + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: field chat_id: %w", err) + } + g.ChatID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: field message_id: %w", err) + } + g.MessageID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetChatID returns value of ChatID field. +func (g *GetMessagePropertiesRequest) GetChatID() (value int64) { + if g == nil { + return + } + return g.ChatID +} + +// GetMessageID returns value of MessageID field. +func (g *GetMessagePropertiesRequest) GetMessageID() (value int64) { + if g == nil { + return + } + return g.MessageID +} + +// GetMessageProperties invokes method getMessageProperties#2e18e1ab returning error if any. +func (c *Client) GetMessageProperties(ctx context.Context, request *GetMessagePropertiesRequest) (*MessageProperties, error) { + var result MessageProperties + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_popular_web_app_bots_gen.go b/tdapi/tl_get_popular_web_app_bots_gen.go new file mode 100644 index 0000000000..35f1dc6fe1 --- /dev/null +++ b/tdapi/tl_get_popular_web_app_bots_gen.go @@ -0,0 +1,238 @@ +// 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{} +) + +// GetPopularWebAppBotsRequest represents TL type `getPopularWebAppBots#e8d04cb`. +type GetPopularWebAppBotsRequest struct { + // 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 bots to be returned; up to 100 + Limit int32 +} + +// GetPopularWebAppBotsRequestTypeID is TL type id of GetPopularWebAppBotsRequest. +const GetPopularWebAppBotsRequestTypeID = 0xe8d04cb + +// Ensuring interfaces in compile-time for GetPopularWebAppBotsRequest. +var ( + _ bin.Encoder = &GetPopularWebAppBotsRequest{} + _ bin.Decoder = &GetPopularWebAppBotsRequest{} + _ bin.BareEncoder = &GetPopularWebAppBotsRequest{} + _ bin.BareDecoder = &GetPopularWebAppBotsRequest{} +) + +func (g *GetPopularWebAppBotsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetPopularWebAppBotsRequest) String() string { + if g == nil { + return "GetPopularWebAppBotsRequest(nil)" + } + type Alias GetPopularWebAppBotsRequest + return fmt.Sprintf("GetPopularWebAppBotsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetPopularWebAppBotsRequest) TypeID() uint32 { + return GetPopularWebAppBotsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetPopularWebAppBotsRequest) TypeName() string { + return "getPopularWebAppBots" +} + +// TypeInfo returns info about TL type. +func (g *GetPopularWebAppBotsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getPopularWebAppBots", + ID: GetPopularWebAppBotsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetPopularWebAppBotsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getPopularWebAppBots#e8d04cb as nil") + } + b.PutID(GetPopularWebAppBotsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetPopularWebAppBotsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getPopularWebAppBots#e8d04cb as nil") + } + b.PutString(g.Offset) + b.PutInt32(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetPopularWebAppBotsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getPopularWebAppBots#e8d04cb to nil") + } + if err := b.ConsumeID(GetPopularWebAppBotsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetPopularWebAppBotsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getPopularWebAppBots#e8d04cb to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetPopularWebAppBotsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getPopularWebAppBots#e8d04cb as nil") + } + b.ObjStart() + b.PutID("getPopularWebAppBots") + 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 *GetPopularWebAppBotsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getPopularWebAppBots#e8d04cb to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getPopularWebAppBots"); err != nil { + return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: %w", err) + } + case "offset": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: field offset: %w", err) + } + g.Offset = value + case "limit": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode getPopularWebAppBots#e8d04cb: field limit: %w", err) + } + g.Limit = value + default: + return b.Skip() + } + return nil + }) +} + +// GetOffset returns value of Offset field. +func (g *GetPopularWebAppBotsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// GetLimit returns value of Limit field. +func (g *GetPopularWebAppBotsRequest) GetLimit() (value int32) { + if g == nil { + return + } + return g.Limit +} + +// GetPopularWebAppBots invokes method getPopularWebAppBots#e8d04cb returning error if any. +func (c *Client) GetPopularWebAppBots(ctx context.Context, request *GetPopularWebAppBotsRequest) (*FoundUsers, error) { + var result FoundUsers + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_star_ad_account_url_gen.go b/tdapi/tl_get_star_ad_account_url_gen.go index 79b2b9ebac..9c32493764 100644 --- a/tdapi/tl_get_star_ad_account_url_gen.go +++ b/tdapi/tl_get_star_ad_account_url_gen.go @@ -33,7 +33,7 @@ var ( // GetStarAdAccountURLRequest represents TL type `getStarAdAccountUrl#73a9455d`. type GetStarAdAccountURLRequest struct { - // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or + // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or // identifier of an owned channel chat OwnerID MessageSenderClass } diff --git a/tdapi/tl_get_star_gift_payment_options_gen.go b/tdapi/tl_get_star_gift_payment_options_gen.go new file mode 100644 index 0000000000..1cf3b9b18b --- /dev/null +++ b/tdapi/tl_get_star_gift_payment_options_gen.go @@ -0,0 +1,207 @@ +// 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{} +) + +// GetStarGiftPaymentOptionsRequest represents TL type `getStarGiftPaymentOptions#e22760e3`. +type GetStarGiftPaymentOptionsRequest struct { + // Identifier of the user that will receive Telegram Stars; pass 0 to get options for an + // unspecified user + UserID int64 +} + +// GetStarGiftPaymentOptionsRequestTypeID is TL type id of GetStarGiftPaymentOptionsRequest. +const GetStarGiftPaymentOptionsRequestTypeID = 0xe22760e3 + +// Ensuring interfaces in compile-time for GetStarGiftPaymentOptionsRequest. +var ( + _ bin.Encoder = &GetStarGiftPaymentOptionsRequest{} + _ bin.Decoder = &GetStarGiftPaymentOptionsRequest{} + _ bin.BareEncoder = &GetStarGiftPaymentOptionsRequest{} + _ bin.BareDecoder = &GetStarGiftPaymentOptionsRequest{} +) + +func (g *GetStarGiftPaymentOptionsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.UserID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *GetStarGiftPaymentOptionsRequest) String() string { + if g == nil { + return "GetStarGiftPaymentOptionsRequest(nil)" + } + type Alias GetStarGiftPaymentOptionsRequest + return fmt.Sprintf("GetStarGiftPaymentOptionsRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*GetStarGiftPaymentOptionsRequest) TypeID() uint32 { + return GetStarGiftPaymentOptionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*GetStarGiftPaymentOptionsRequest) TypeName() string { + return "getStarGiftPaymentOptions" +} + +// TypeInfo returns info about TL type. +func (g *GetStarGiftPaymentOptionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "getStarGiftPaymentOptions", + ID: GetStarGiftPaymentOptionsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *GetStarGiftPaymentOptionsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStarGiftPaymentOptions#e22760e3 as nil") + } + b.PutID(GetStarGiftPaymentOptionsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *GetStarGiftPaymentOptionsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode getStarGiftPaymentOptions#e22760e3 as nil") + } + b.PutInt53(g.UserID) + return nil +} + +// Decode implements bin.Decoder. +func (g *GetStarGiftPaymentOptionsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStarGiftPaymentOptions#e22760e3 to nil") + } + if err := b.ConsumeID(GetStarGiftPaymentOptionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode getStarGiftPaymentOptions#e22760e3: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *GetStarGiftPaymentOptionsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode getStarGiftPaymentOptions#e22760e3 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getStarGiftPaymentOptions#e22760e3: field user_id: %w", err) + } + g.UserID = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (g *GetStarGiftPaymentOptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if g == nil { + return fmt.Errorf("can't encode getStarGiftPaymentOptions#e22760e3 as nil") + } + b.ObjStart() + b.PutID("getStarGiftPaymentOptions") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(g.UserID) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (g *GetStarGiftPaymentOptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if g == nil { + return fmt.Errorf("can't decode getStarGiftPaymentOptions#e22760e3 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("getStarGiftPaymentOptions"); err != nil { + return fmt.Errorf("unable to decode getStarGiftPaymentOptions#e22760e3: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode getStarGiftPaymentOptions#e22760e3: field user_id: %w", err) + } + g.UserID = value + default: + return b.Skip() + } + return nil + }) +} + +// GetUserID returns value of UserID field. +func (g *GetStarGiftPaymentOptionsRequest) GetUserID() (value int64) { + if g == nil { + return + } + return g.UserID +} + +// GetStarGiftPaymentOptions invokes method getStarGiftPaymentOptions#e22760e3 returning error if any. +func (c *Client) GetStarGiftPaymentOptions(ctx context.Context, userid int64) (*StarPaymentOptions, error) { + var result StarPaymentOptions + + request := &GetStarGiftPaymentOptionsRequest{ + UserID: userid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tdapi/tl_get_star_revenue_statistics_gen.go b/tdapi/tl_get_star_revenue_statistics_gen.go index a1f80e70d8..906ed22096 100644 --- a/tdapi/tl_get_star_revenue_statistics_gen.go +++ b/tdapi/tl_get_star_revenue_statistics_gen.go @@ -33,7 +33,7 @@ var ( // GetStarRevenueStatisticsRequest represents TL type `getStarRevenueStatistics#f07b4517`. type GetStarRevenueStatisticsRequest struct { - // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or + // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or // identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics // == true OwnerID MessageSenderClass diff --git a/tdapi/tl_get_star_transactions_gen.go b/tdapi/tl_get_star_transactions_gen.go index ce233c5b60..b204ec27c5 100644 --- a/tdapi/tl_get_star_transactions_gen.go +++ b/tdapi/tl_get_star_transactions_gen.go @@ -33,7 +33,7 @@ var ( // GetStarTransactionsRequest represents TL type `getStarTransactions#eb1e109d`. type GetStarTransactionsRequest struct { - // Identifier of the owner of the Telegram stars; can be the identifier of the current + // Identifier of the owner of the Telegram Stars; can be the identifier of the current // user, identifier of an owned bot, OwnerID MessageSenderClass // Direction of the transactions to receive; pass null to get all transactions diff --git a/tdapi/tl_get_star_withdrawal_url_gen.go b/tdapi/tl_get_star_withdrawal_url_gen.go index 8ba253f0d0..fa3e822b2c 100644 --- a/tdapi/tl_get_star_withdrawal_url_gen.go +++ b/tdapi/tl_get_star_withdrawal_url_gen.go @@ -33,10 +33,10 @@ var ( // GetStarWithdrawalURLRequest represents TL type `getStarWithdrawalUrl#a9d23712`. type GetStarWithdrawalURLRequest struct { - // Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or + // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or // identifier of an owned channel chat OwnerID MessageSenderClass - // The number of Telegram stars to withdraw. Must be at least + // The number of Telegram Stars to withdraw. Must be at least // getOption("star_withdrawal_count_min") StarCount int64 // The 2-step verification password of the current user diff --git a/tdapi/tl_get_web_app_link_url_gen.go b/tdapi/tl_get_web_app_link_url_gen.go index c94be2819d..f831af1105 100644 --- a/tdapi/tl_get_web_app_link_url_gen.go +++ b/tdapi/tl_get_web_app_link_url_gen.go @@ -43,7 +43,7 @@ type GetWebAppLinkURLRequest struct { StartParameter string // Preferred Web App theme; pass null to use the default theme Theme ThemeParameters - // Short name of the application; 0-64 English letters, digits, and underscores + // Short name of the current application; 0-64 English letters, digits, and underscores ApplicationName string // Pass true if the current user allowed the bot to send them messages AllowWriteAccess bool diff --git a/tdapi/tl_get_web_app_url_gen.go b/tdapi/tl_get_web_app_url_gen.go index 4471b40ed9..2d497c6ef5 100644 --- a/tdapi/tl_get_web_app_url_gen.go +++ b/tdapi/tl_get_web_app_url_gen.go @@ -36,12 +36,11 @@ type GetWebAppURLRequest struct { // Identifier of the target bot BotUserID int64 // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp - // button, an internalLinkTypeSideMenuBot link, or an empty when the bot is opened from - // the side menu + // button, or an empty string when the bot is opened from the side menu URL string // Preferred Web App theme; pass null to use the default theme Theme ThemeParameters - // Short name of the application; 0-64 English letters, digits, and underscores + // Short name of the current application; 0-64 English letters, digits, and underscores ApplicationName string } diff --git a/tdapi/tl_input_message_content_gen.go b/tdapi/tl_input_message_content_gen.go index dbe654151f..7b45981d5c 100644 --- a/tdapi/tl_input_message_content_gen.go +++ b/tdapi/tl_input_message_content_gen.go @@ -1372,7 +1372,7 @@ func (i *InputMessageDocument) GetCaption() (value FormattedText) { // InputMessagePaidMedia represents TL type `inputMessagePaidMedia#36f9c23c`. type InputMessagePaidMedia struct { - // The number of stars that must be paid to see the media; + // The number of Telegram Stars that must be paid to see the media; // 1-getOption("paid_media_message_star_count_max") StarCount int64 // The content of the paid media @@ -5866,8 +5866,8 @@ func (i *InputMessageStory) GetStoryID() (value int32) { type InputMessageForwarded struct { // Identifier for the chat this forwarded message came from FromChatID int64 - // Identifier of the message to forward. A message can be forwarded only if message - // can_be_forwarded + // Identifier of the message to forward. A message can be forwarded only if + // messageProperties.can_be_forwarded MessageID int64 // True, if a game message is being shared from a launched game; applies only to game // messages diff --git a/tdapi/tl_input_message_reply_to_gen.go b/tdapi/tl_input_message_reply_to_gen.go index 58b29be9ed..b239d56bfa 100644 --- a/tdapi/tl_input_message_reply_to_gen.go +++ b/tdapi/tl_input_message_reply_to_gen.go @@ -33,7 +33,9 @@ var ( // InputMessageReplyToMessage represents TL type `inputMessageReplyToMessage#c25e9903`. type InputMessageReplyToMessage struct { - // The identifier of the message to be replied in the same chat and forum topic + // The identifier of the message to be replied in the same chat and forum topic. A + // message can be replied in the same chat and forum topic only if messageProperties + // can_be_replied MessageID int64 // Quote from the message to be replied; pass null if none. Must always be null for // replies in secret chats @@ -237,7 +239,8 @@ type InputMessageReplyToExternalMessage struct { // The identifier of the chat to which the message to be replied belongs ChatID int64 // The identifier of the message to be replied in the specified chat. A message can be - // replied in another chat or topic only if message.can_be_replied_in_another_chat + // replied in another chat or forum topic only if messageProperties + // can_be_replied_in_another_chat MessageID int64 // Quote from the message to be replied; pass null if none Quote InputTextQuote diff --git a/tdapi/tl_input_story_area_type_gen.go b/tdapi/tl_input_story_area_type_gen.go index c2ed8e9dc7..506140a555 100644 --- a/tdapi/tl_input_story_area_type_gen.go +++ b/tdapi/tl_input_story_area_type_gen.go @@ -880,8 +880,8 @@ type InputStoryAreaTypeMessage struct { // Identifier of the chat with the message. Currently, the chat must be a supergroup or a // channel chat ChatID int64 - // Identifier of the message. Only successfully sent non-scheduled messages can be - // specified + // Identifier of the message. Use messageProperties.can_be_shared_in_story to check + // whether the message is suitable MessageID int64 } @@ -1243,6 +1243,240 @@ func (i *InputStoryAreaTypeLink) GetURL() (value string) { return i.URL } +// InputStoryAreaTypeWeather represents TL type `inputStoryAreaTypeWeather#b7b7de9d`. +type InputStoryAreaTypeWeather struct { + // Temperature, in degree Celsius + Temperature float64 + // Emoji representing the weather + Emoji string + // A color of the area background in the ARGB format + BackgroundColor int32 +} + +// InputStoryAreaTypeWeatherTypeID is TL type id of InputStoryAreaTypeWeather. +const InputStoryAreaTypeWeatherTypeID = 0xb7b7de9d + +// construct implements constructor of InputStoryAreaTypeClass. +func (i InputStoryAreaTypeWeather) construct() InputStoryAreaTypeClass { return &i } + +// Ensuring interfaces in compile-time for InputStoryAreaTypeWeather. +var ( + _ bin.Encoder = &InputStoryAreaTypeWeather{} + _ bin.Decoder = &InputStoryAreaTypeWeather{} + _ bin.BareEncoder = &InputStoryAreaTypeWeather{} + _ bin.BareDecoder = &InputStoryAreaTypeWeather{} + + _ InputStoryAreaTypeClass = &InputStoryAreaTypeWeather{} +) + +func (i *InputStoryAreaTypeWeather) Zero() bool { + if i == nil { + return true + } + if !(i.Temperature == 0) { + return false + } + if !(i.Emoji == "") { + return false + } + if !(i.BackgroundColor == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputStoryAreaTypeWeather) String() string { + if i == nil { + return "InputStoryAreaTypeWeather(nil)" + } + type Alias InputStoryAreaTypeWeather + return fmt.Sprintf("InputStoryAreaTypeWeather%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputStoryAreaTypeWeather) TypeID() uint32 { + return InputStoryAreaTypeWeatherTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputStoryAreaTypeWeather) TypeName() string { + return "inputStoryAreaTypeWeather" +} + +// TypeInfo returns info about TL type. +func (i *InputStoryAreaTypeWeather) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputStoryAreaTypeWeather", + ID: InputStoryAreaTypeWeatherTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Temperature", + SchemaName: "temperature", + }, + { + Name: "Emoji", + SchemaName: "emoji", + }, + { + Name: "BackgroundColor", + SchemaName: "background_color", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputStoryAreaTypeWeather) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStoryAreaTypeWeather#b7b7de9d as nil") + } + b.PutID(InputStoryAreaTypeWeatherTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputStoryAreaTypeWeather) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStoryAreaTypeWeather#b7b7de9d as nil") + } + b.PutDouble(i.Temperature) + b.PutString(i.Emoji) + b.PutInt32(i.BackgroundColor) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputStoryAreaTypeWeather) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStoryAreaTypeWeather#b7b7de9d to nil") + } + if err := b.ConsumeID(InputStoryAreaTypeWeatherTypeID); err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputStoryAreaTypeWeather) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStoryAreaTypeWeather#b7b7de9d to nil") + } + { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field temperature: %w", err) + } + i.Temperature = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field emoji: %w", err) + } + i.Emoji = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field background_color: %w", err) + } + i.BackgroundColor = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (i *InputStoryAreaTypeWeather) EncodeTDLibJSON(b tdjson.Encoder) error { + if i == nil { + return fmt.Errorf("can't encode inputStoryAreaTypeWeather#b7b7de9d as nil") + } + b.ObjStart() + b.PutID("inputStoryAreaTypeWeather") + b.Comma() + b.FieldStart("temperature") + b.PutDouble(i.Temperature) + b.Comma() + b.FieldStart("emoji") + b.PutString(i.Emoji) + b.Comma() + b.FieldStart("background_color") + b.PutInt32(i.BackgroundColor) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (i *InputStoryAreaTypeWeather) DecodeTDLibJSON(b tdjson.Decoder) error { + if i == nil { + return fmt.Errorf("can't decode inputStoryAreaTypeWeather#b7b7de9d to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("inputStoryAreaTypeWeather"); err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: %w", err) + } + case "temperature": + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field temperature: %w", err) + } + i.Temperature = value + case "emoji": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field emoji: %w", err) + } + i.Emoji = value + case "background_color": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field background_color: %w", err) + } + i.BackgroundColor = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTemperature returns value of Temperature field. +func (i *InputStoryAreaTypeWeather) GetTemperature() (value float64) { + if i == nil { + return + } + return i.Temperature +} + +// GetEmoji returns value of Emoji field. +func (i *InputStoryAreaTypeWeather) GetEmoji() (value string) { + if i == nil { + return + } + return i.Emoji +} + +// GetBackgroundColor returns value of BackgroundColor field. +func (i *InputStoryAreaTypeWeather) GetBackgroundColor() (value int32) { + if i == nil { + return + } + return i.BackgroundColor +} + // InputStoryAreaTypeClassName is schema name of InputStoryAreaTypeClass. const InputStoryAreaTypeClassName = "InputStoryAreaType" @@ -1261,6 +1495,7 @@ const InputStoryAreaTypeClassName = "InputStoryAreaType" // case *tdapi.InputStoryAreaTypeSuggestedReaction: // inputStoryAreaTypeSuggestedReaction#7d4751d3 // case *tdapi.InputStoryAreaTypeMessage: // inputStoryAreaTypeMessage#f01be457 // case *tdapi.InputStoryAreaTypeLink: // inputStoryAreaTypeLink#53f31b48 +// case *tdapi.InputStoryAreaTypeWeather: // inputStoryAreaTypeWeather#b7b7de9d // default: panic(v) // } type InputStoryAreaTypeClass interface { @@ -1334,6 +1569,13 @@ func DecodeInputStoryAreaType(buf *bin.Buffer) (InputStoryAreaTypeClass, error) return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) } return &v, nil + case InputStoryAreaTypeWeatherTypeID: + // Decoding inputStoryAreaTypeWeather#b7b7de9d. + v := InputStoryAreaTypeWeather{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", bin.NewUnexpectedID(id)) } @@ -1388,6 +1630,13 @@ func DecodeTDLibJSONInputStoryAreaType(buf tdjson.Decoder) (InputStoryAreaTypeCl return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) } return &v, nil + case "inputStoryAreaTypeWeather": + // Decoding inputStoryAreaTypeWeather#b7b7de9d. + v := InputStoryAreaTypeWeather{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_input_story_content_gen.go b/tdapi/tl_input_story_content_gen.go index e17a4297bf..ee9730ccb4 100644 --- a/tdapi/tl_input_story_content_gen.go +++ b/tdapi/tl_input_story_content_gen.go @@ -266,7 +266,7 @@ func (i *InputStoryContentPhoto) GetAddedStickerFileIDs() (value []int32) { return i.AddedStickerFileIDs } -// InputStoryContentVideo represents TL type `inputStoryContentVideo#d7383f99`. +// InputStoryContentVideo represents TL type `inputStoryContentVideo#cc1e4239`. type InputStoryContentVideo struct { // Video to be sent. The video size must be 720x1280. The video must be streamable and // stored in MPEG4 format, after encoding with x265 codec and key frames added each @@ -276,12 +276,14 @@ type InputStoryContentVideo struct { AddedStickerFileIDs []int32 // Precise duration of the video, in seconds; 0-60 Duration float64 + // Timestamp of the frame, which will be used as video thumbnail + CoverFrameTimestamp float64 // True, if the video has no sound IsAnimation bool } // InputStoryContentVideoTypeID is TL type id of InputStoryContentVideo. -const InputStoryContentVideoTypeID = 0xd7383f99 +const InputStoryContentVideoTypeID = 0xcc1e4239 // construct implements constructor of InputStoryContentClass. func (i InputStoryContentVideo) construct() InputStoryContentClass { return &i } @@ -309,6 +311,9 @@ func (i *InputStoryContentVideo) Zero() bool { if !(i.Duration == 0) { return false } + if !(i.CoverFrameTimestamp == 0) { + return false + } if !(i.IsAnimation == false) { return false } @@ -360,6 +365,10 @@ func (i *InputStoryContentVideo) TypeInfo() tdp.Type { Name: "Duration", SchemaName: "duration", }, + { + Name: "CoverFrameTimestamp", + SchemaName: "cover_frame_timestamp", + }, { Name: "IsAnimation", SchemaName: "is_animation", @@ -371,7 +380,7 @@ func (i *InputStoryContentVideo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InputStoryContentVideo) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStoryContentVideo#d7383f99 as nil") + return fmt.Errorf("can't encode inputStoryContentVideo#cc1e4239 as nil") } b.PutID(InputStoryContentVideoTypeID) return i.EncodeBare(b) @@ -380,19 +389,20 @@ func (i *InputStoryContentVideo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputStoryContentVideo) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStoryContentVideo#d7383f99 as nil") + return fmt.Errorf("can't encode inputStoryContentVideo#cc1e4239 as nil") } if i.Video == nil { - return fmt.Errorf("unable to encode inputStoryContentVideo#d7383f99: field video is nil") + return fmt.Errorf("unable to encode inputStoryContentVideo#cc1e4239: field video is nil") } if err := i.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStoryContentVideo#d7383f99: field video: %w", err) + return fmt.Errorf("unable to encode inputStoryContentVideo#cc1e4239: field video: %w", err) } b.PutInt(len(i.AddedStickerFileIDs)) for _, v := range i.AddedStickerFileIDs { b.PutInt32(v) } b.PutDouble(i.Duration) + b.PutDouble(i.CoverFrameTimestamp) b.PutBool(i.IsAnimation) return nil } @@ -400,10 +410,10 @@ func (i *InputStoryContentVideo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputStoryContentVideo) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStoryContentVideo#d7383f99 to nil") + return fmt.Errorf("can't decode inputStoryContentVideo#cc1e4239 to nil") } if err := b.ConsumeID(InputStoryContentVideoTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: %w", err) } return i.DecodeBare(b) } @@ -411,19 +421,19 @@ func (i *InputStoryContentVideo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputStoryContentVideo) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStoryContentVideo#d7383f99 to nil") + return fmt.Errorf("can't decode inputStoryContentVideo#cc1e4239 to nil") } { value, err := DecodeInputFile(b) if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field video: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field video: %w", err) } i.Video = value } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field added_sticker_file_ids: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field added_sticker_file_ids: %w", err) } if headerLen > 0 { @@ -432,7 +442,7 @@ func (i *InputStoryContentVideo) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field added_sticker_file_ids: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field added_sticker_file_ids: %w", err) } i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) } @@ -440,14 +450,21 @@ func (i *InputStoryContentVideo) DecodeBare(b *bin.Buffer) error { { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field duration: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field duration: %w", err) } i.Duration = value } + { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field cover_frame_timestamp: %w", err) + } + i.CoverFrameTimestamp = value + } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field is_animation: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field is_animation: %w", err) } i.IsAnimation = value } @@ -457,17 +474,17 @@ func (i *InputStoryContentVideo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (i *InputStoryContentVideo) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode inputStoryContentVideo#d7383f99 as nil") + return fmt.Errorf("can't encode inputStoryContentVideo#cc1e4239 as nil") } b.ObjStart() b.PutID("inputStoryContentVideo") b.Comma() b.FieldStart("video") if i.Video == nil { - return fmt.Errorf("unable to encode inputStoryContentVideo#d7383f99: field video is nil") + return fmt.Errorf("unable to encode inputStoryContentVideo#cc1e4239: field video is nil") } if err := i.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStoryContentVideo#d7383f99: field video: %w", err) + return fmt.Errorf("unable to encode inputStoryContentVideo#cc1e4239: field video: %w", err) } b.Comma() b.FieldStart("added_sticker_file_ids") @@ -482,6 +499,9 @@ func (i *InputStoryContentVideo) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("duration") b.PutDouble(i.Duration) b.Comma() + b.FieldStart("cover_frame_timestamp") + b.PutDouble(i.CoverFrameTimestamp) + b.Comma() b.FieldStart("is_animation") b.PutBool(i.IsAnimation) b.Comma() @@ -493,42 +513,48 @@ func (i *InputStoryContentVideo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (i *InputStoryContentVideo) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode inputStoryContentVideo#d7383f99 to nil") + return fmt.Errorf("can't decode inputStoryContentVideo#cc1e4239 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("inputStoryContentVideo"); err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: %w", err) } case "video": value, err := DecodeTDLibJSONInputFile(b) if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field video: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field video: %w", err) } i.Video = value case "added_sticker_file_ids": if err := b.Arr(func(b tdjson.Decoder) error { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field added_sticker_file_ids: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field added_sticker_file_ids: %w", err) } i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) return nil }); err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field added_sticker_file_ids: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field added_sticker_file_ids: %w", err) } case "duration": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field duration: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field duration: %w", err) } i.Duration = value + case "cover_frame_timestamp": + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field cover_frame_timestamp: %w", err) + } + i.CoverFrameTimestamp = value case "is_animation": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#d7383f99: field is_animation: %w", err) + return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field is_animation: %w", err) } i.IsAnimation = value default: @@ -562,6 +588,14 @@ func (i *InputStoryContentVideo) GetDuration() (value float64) { return i.Duration } +// GetCoverFrameTimestamp returns value of CoverFrameTimestamp field. +func (i *InputStoryContentVideo) GetCoverFrameTimestamp() (value float64) { + if i == nil { + return + } + return i.CoverFrameTimestamp +} + // GetIsAnimation returns value of IsAnimation field. func (i *InputStoryContentVideo) GetIsAnimation() (value bool) { if i == nil { @@ -583,7 +617,7 @@ const InputStoryContentClassName = "InputStoryContent" // } // switch v := g.(type) { // case *tdapi.InputStoryContentPhoto: // inputStoryContentPhoto#3286fbe0 -// case *tdapi.InputStoryContentVideo: // inputStoryContentVideo#d7383f99 +// case *tdapi.InputStoryContentVideo: // inputStoryContentVideo#cc1e4239 // default: panic(v) // } type InputStoryContentClass interface { @@ -626,7 +660,7 @@ func DecodeInputStoryContent(buf *bin.Buffer) (InputStoryContentClass, error) { } return &v, nil case InputStoryContentVideoTypeID: - // Decoding inputStoryContentVideo#d7383f99. + // Decoding inputStoryContentVideo#cc1e4239. v := InputStoryContentVideo{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputStoryContentClass: %w", err) @@ -652,7 +686,7 @@ func DecodeTDLibJSONInputStoryContent(buf tdjson.Decoder) (InputStoryContentClas } return &v, nil case "inputStoryContentVideo": - // Decoding inputStoryContentVideo#d7383f99. + // Decoding inputStoryContentVideo#cc1e4239. v := InputStoryContentVideo{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode InputStoryContentClass: %w", err) diff --git a/tdapi/tl_internal_link_type_gen.go b/tdapi/tl_internal_link_type_gen.go index 687138e5f3..685d1c06e0 100644 --- a/tdapi/tl_internal_link_type_gen.go +++ b/tdapi/tl_internal_link_type_gen.go @@ -3460,6 +3460,240 @@ func (i *InternalLinkTypeLanguageSettings) DecodeTDLibJSON(b tdjson.Decoder) err }) } +// InternalLinkTypeMainWebApp represents TL type `internalLinkTypeMainWebApp#9c942666`. +type InternalLinkTypeMainWebApp struct { + // Username of the bot + BotUsername string + // Start parameter to be passed to getMainWebApp + StartParameter string + // True, if the Web App must be opened in the compact mode instead of the full-size mode + IsCompact bool +} + +// InternalLinkTypeMainWebAppTypeID is TL type id of InternalLinkTypeMainWebApp. +const InternalLinkTypeMainWebAppTypeID = 0x9c942666 + +// construct implements constructor of InternalLinkTypeClass. +func (i InternalLinkTypeMainWebApp) construct() InternalLinkTypeClass { return &i } + +// Ensuring interfaces in compile-time for InternalLinkTypeMainWebApp. +var ( + _ bin.Encoder = &InternalLinkTypeMainWebApp{} + _ bin.Decoder = &InternalLinkTypeMainWebApp{} + _ bin.BareEncoder = &InternalLinkTypeMainWebApp{} + _ bin.BareDecoder = &InternalLinkTypeMainWebApp{} + + _ InternalLinkTypeClass = &InternalLinkTypeMainWebApp{} +) + +func (i *InternalLinkTypeMainWebApp) Zero() bool { + if i == nil { + return true + } + if !(i.BotUsername == "") { + return false + } + if !(i.StartParameter == "") { + return false + } + if !(i.IsCompact == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InternalLinkTypeMainWebApp) String() string { + if i == nil { + return "InternalLinkTypeMainWebApp(nil)" + } + type Alias InternalLinkTypeMainWebApp + return fmt.Sprintf("InternalLinkTypeMainWebApp%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InternalLinkTypeMainWebApp) TypeID() uint32 { + return InternalLinkTypeMainWebAppTypeID +} + +// TypeName returns name of type in TL schema. +func (*InternalLinkTypeMainWebApp) TypeName() string { + return "internalLinkTypeMainWebApp" +} + +// TypeInfo returns info about TL type. +func (i *InternalLinkTypeMainWebApp) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "internalLinkTypeMainWebApp", + ID: InternalLinkTypeMainWebAppTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUsername", + SchemaName: "bot_username", + }, + { + Name: "StartParameter", + SchemaName: "start_parameter", + }, + { + Name: "IsCompact", + SchemaName: "is_compact", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InternalLinkTypeMainWebApp) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode internalLinkTypeMainWebApp#9c942666 as nil") + } + b.PutID(InternalLinkTypeMainWebAppTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InternalLinkTypeMainWebApp) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode internalLinkTypeMainWebApp#9c942666 as nil") + } + b.PutString(i.BotUsername) + b.PutString(i.StartParameter) + b.PutBool(i.IsCompact) + return nil +} + +// Decode implements bin.Decoder. +func (i *InternalLinkTypeMainWebApp) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode internalLinkTypeMainWebApp#9c942666 to nil") + } + if err := b.ConsumeID(InternalLinkTypeMainWebAppTypeID); err != nil { + return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#9c942666: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InternalLinkTypeMainWebApp) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode internalLinkTypeMainWebApp#9c942666 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#9c942666: field bot_username: %w", err) + } + i.BotUsername = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#9c942666: field start_parameter: %w", err) + } + i.StartParameter = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#9c942666: field is_compact: %w", err) + } + i.IsCompact = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (i *InternalLinkTypeMainWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { + if i == nil { + return fmt.Errorf("can't encode internalLinkTypeMainWebApp#9c942666 as nil") + } + b.ObjStart() + b.PutID("internalLinkTypeMainWebApp") + b.Comma() + b.FieldStart("bot_username") + b.PutString(i.BotUsername) + b.Comma() + b.FieldStart("start_parameter") + b.PutString(i.StartParameter) + b.Comma() + b.FieldStart("is_compact") + b.PutBool(i.IsCompact) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (i *InternalLinkTypeMainWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { + if i == nil { + return fmt.Errorf("can't decode internalLinkTypeMainWebApp#9c942666 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("internalLinkTypeMainWebApp"); err != nil { + return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#9c942666: %w", err) + } + case "bot_username": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#9c942666: field bot_username: %w", err) + } + i.BotUsername = value + case "start_parameter": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#9c942666: field start_parameter: %w", err) + } + i.StartParameter = value + case "is_compact": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#9c942666: field is_compact: %w", err) + } + i.IsCompact = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUsername returns value of BotUsername field. +func (i *InternalLinkTypeMainWebApp) GetBotUsername() (value string) { + if i == nil { + return + } + return i.BotUsername +} + +// GetStartParameter returns value of StartParameter field. +func (i *InternalLinkTypeMainWebApp) GetStartParameter() (value string) { + if i == nil { + return + } + return i.StartParameter +} + +// GetIsCompact returns value of IsCompact field. +func (i *InternalLinkTypeMainWebApp) GetIsCompact() (value bool) { + if i == nil { + return + } + return i.IsCompact +} + // InternalLinkTypeMessage represents TL type `internalLinkTypeMessage#3a535c52`. type InternalLinkTypeMessage struct { // URL to be passed to getMessageLinkInfo @@ -5204,16 +5438,19 @@ func (i *InternalLinkTypeProxy) GetType() (value ProxyTypeClass) { return i.Type } -// InternalLinkTypePublicChat represents TL type `internalLinkTypePublicChat#e5226d5e`. +// InternalLinkTypePublicChat represents TL type `internalLinkTypePublicChat#697a2d00`. type InternalLinkTypePublicChat struct { // Username of the chat ChatUsername string // Draft text for message to send in the chat DraftText string + // True, if chat profile information screen must be opened; otherwise, the chat itself + // must be opened + OpenProfile bool } // InternalLinkTypePublicChatTypeID is TL type id of InternalLinkTypePublicChat. -const InternalLinkTypePublicChatTypeID = 0xe5226d5e +const InternalLinkTypePublicChatTypeID = 0x697a2d00 // construct implements constructor of InternalLinkTypeClass. func (i InternalLinkTypePublicChat) construct() InternalLinkTypeClass { return &i } @@ -5238,6 +5475,9 @@ func (i *InternalLinkTypePublicChat) Zero() bool { if !(i.DraftText == "") { return false } + if !(i.OpenProfile == false) { + return false + } return true } @@ -5282,6 +5522,10 @@ func (i *InternalLinkTypePublicChat) TypeInfo() tdp.Type { Name: "DraftText", SchemaName: "draft_text", }, + { + Name: "OpenProfile", + SchemaName: "open_profile", + }, } return typ } @@ -5289,7 +5533,7 @@ func (i *InternalLinkTypePublicChat) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InternalLinkTypePublicChat) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode internalLinkTypePublicChat#e5226d5e as nil") + return fmt.Errorf("can't encode internalLinkTypePublicChat#697a2d00 as nil") } b.PutID(InternalLinkTypePublicChatTypeID) return i.EncodeBare(b) @@ -5298,20 +5542,21 @@ func (i *InternalLinkTypePublicChat) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InternalLinkTypePublicChat) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode internalLinkTypePublicChat#e5226d5e as nil") + return fmt.Errorf("can't encode internalLinkTypePublicChat#697a2d00 as nil") } b.PutString(i.ChatUsername) b.PutString(i.DraftText) + b.PutBool(i.OpenProfile) return nil } // Decode implements bin.Decoder. func (i *InternalLinkTypePublicChat) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode internalLinkTypePublicChat#e5226d5e to nil") + return fmt.Errorf("can't decode internalLinkTypePublicChat#697a2d00 to nil") } if err := b.ConsumeID(InternalLinkTypePublicChatTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#e5226d5e: %w", err) + return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: %w", err) } return i.DecodeBare(b) } @@ -5319,29 +5564,36 @@ func (i *InternalLinkTypePublicChat) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InternalLinkTypePublicChat) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode internalLinkTypePublicChat#e5226d5e to nil") + return fmt.Errorf("can't decode internalLinkTypePublicChat#697a2d00 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#e5226d5e: field chat_username: %w", err) + return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field chat_username: %w", err) } i.ChatUsername = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#e5226d5e: field draft_text: %w", err) + return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field draft_text: %w", err) } i.DraftText = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field open_profile: %w", err) + } + i.OpenProfile = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (i *InternalLinkTypePublicChat) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode internalLinkTypePublicChat#e5226d5e as nil") + return fmt.Errorf("can't encode internalLinkTypePublicChat#697a2d00 as nil") } b.ObjStart() b.PutID("internalLinkTypePublicChat") @@ -5352,6 +5604,9 @@ func (i *InternalLinkTypePublicChat) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("draft_text") b.PutString(i.DraftText) b.Comma() + b.FieldStart("open_profile") + b.PutBool(i.OpenProfile) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -5360,27 +5615,33 @@ func (i *InternalLinkTypePublicChat) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (i *InternalLinkTypePublicChat) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode internalLinkTypePublicChat#e5226d5e to nil") + return fmt.Errorf("can't decode internalLinkTypePublicChat#697a2d00 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("internalLinkTypePublicChat"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#e5226d5e: %w", err) + return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: %w", err) } case "chat_username": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#e5226d5e: field chat_username: %w", err) + return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field chat_username: %w", err) } i.ChatUsername = value case "draft_text": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#e5226d5e: field draft_text: %w", err) + return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field draft_text: %w", err) } i.DraftText = value + case "open_profile": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field open_profile: %w", err) + } + i.OpenProfile = value default: return b.Skip() } @@ -5404,6 +5665,14 @@ func (i *InternalLinkTypePublicChat) GetDraftText() (value string) { return i.DraftText } +// GetOpenProfile returns value of OpenProfile field. +func (i *InternalLinkTypePublicChat) GetOpenProfile() (value bool) { + if i == nil { + return + } + return i.OpenProfile +} + // InternalLinkTypeQrCodeAuthentication represents TL type `internalLinkTypeQrCodeAuthentication#bf121924`. type InternalLinkTypeQrCodeAuthentication struct { } @@ -5797,240 +6066,6 @@ func (i *InternalLinkTypeSettings) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// InternalLinkTypeSideMenuBot represents TL type `internalLinkTypeSideMenuBot#c45f0c16`. -type InternalLinkTypeSideMenuBot struct { - // Username of the bot - BotUsername string - // URL to be passed to getWebAppUrl - URL string - // True, if the Web App must be opened in a compact mode instead of a full-size mode - IsCompact bool -} - -// InternalLinkTypeSideMenuBotTypeID is TL type id of InternalLinkTypeSideMenuBot. -const InternalLinkTypeSideMenuBotTypeID = 0xc45f0c16 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeSideMenuBot) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeSideMenuBot. -var ( - _ bin.Encoder = &InternalLinkTypeSideMenuBot{} - _ bin.Decoder = &InternalLinkTypeSideMenuBot{} - _ bin.BareEncoder = &InternalLinkTypeSideMenuBot{} - _ bin.BareDecoder = &InternalLinkTypeSideMenuBot{} - - _ InternalLinkTypeClass = &InternalLinkTypeSideMenuBot{} -) - -func (i *InternalLinkTypeSideMenuBot) Zero() bool { - if i == nil { - return true - } - if !(i.BotUsername == "") { - return false - } - if !(i.URL == "") { - return false - } - if !(i.IsCompact == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeSideMenuBot) String() string { - if i == nil { - return "InternalLinkTypeSideMenuBot(nil)" - } - type Alias InternalLinkTypeSideMenuBot - return fmt.Sprintf("InternalLinkTypeSideMenuBot%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeSideMenuBot) TypeID() uint32 { - return InternalLinkTypeSideMenuBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeSideMenuBot) TypeName() string { - return "internalLinkTypeSideMenuBot" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeSideMenuBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeSideMenuBot", - ID: InternalLinkTypeSideMenuBotTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUsername", - SchemaName: "bot_username", - }, - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "IsCompact", - SchemaName: "is_compact", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeSideMenuBot) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeSideMenuBot#c45f0c16 as nil") - } - b.PutID(InternalLinkTypeSideMenuBotTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeSideMenuBot) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeSideMenuBot#c45f0c16 as nil") - } - b.PutString(i.BotUsername) - b.PutString(i.URL) - b.PutBool(i.IsCompact) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeSideMenuBot) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeSideMenuBot#c45f0c16 to nil") - } - if err := b.ConsumeID(InternalLinkTypeSideMenuBotTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSideMenuBot#c45f0c16: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeSideMenuBot) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeSideMenuBot#c45f0c16 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSideMenuBot#c45f0c16: field bot_username: %w", err) - } - i.BotUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSideMenuBot#c45f0c16: field url: %w", err) - } - i.URL = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSideMenuBot#c45f0c16: field is_compact: %w", err) - } - i.IsCompact = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeSideMenuBot) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeSideMenuBot#c45f0c16 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeSideMenuBot") - b.Comma() - b.FieldStart("bot_username") - b.PutString(i.BotUsername) - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.FieldStart("is_compact") - b.PutBool(i.IsCompact) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeSideMenuBot) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeSideMenuBot#c45f0c16 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeSideMenuBot"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSideMenuBot#c45f0c16: %w", err) - } - case "bot_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSideMenuBot#c45f0c16: field bot_username: %w", err) - } - i.BotUsername = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSideMenuBot#c45f0c16: field url: %w", err) - } - i.URL = value - case "is_compact": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSideMenuBot#c45f0c16: field is_compact: %w", err) - } - i.IsCompact = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUsername returns value of BotUsername field. -func (i *InternalLinkTypeSideMenuBot) GetBotUsername() (value string) { - if i == nil { - return - } - return i.BotUsername -} - -// GetURL returns value of URL field. -func (i *InternalLinkTypeSideMenuBot) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// GetIsCompact returns value of IsCompact field. -func (i *InternalLinkTypeSideMenuBot) GetIsCompact() (value bool) { - if i == nil { - return - } - return i.IsCompact -} - // InternalLinkTypeStickerSet represents TL type `internalLinkTypeStickerSet#a1464fa2`. type InternalLinkTypeStickerSet struct { // Name of the sticker set @@ -7025,16 +7060,19 @@ func (i *InternalLinkTypeUnsupportedProxy) DecodeTDLibJSON(b tdjson.Decoder) err }) } -// InternalLinkTypeUserPhoneNumber represents TL type `internalLinkTypeUserPhoneNumber#77c08091`. +// InternalLinkTypeUserPhoneNumber represents TL type `internalLinkTypeUserPhoneNumber#104bbb08`. type InternalLinkTypeUserPhoneNumber struct { // Phone number of the user PhoneNumber string // Draft text for message to send in the chat DraftText string + // True, if user's profile information screen must be opened; otherwise, the chat itself + // must be opened + OpenProfile bool } // InternalLinkTypeUserPhoneNumberTypeID is TL type id of InternalLinkTypeUserPhoneNumber. -const InternalLinkTypeUserPhoneNumberTypeID = 0x77c08091 +const InternalLinkTypeUserPhoneNumberTypeID = 0x104bbb08 // construct implements constructor of InternalLinkTypeClass. func (i InternalLinkTypeUserPhoneNumber) construct() InternalLinkTypeClass { return &i } @@ -7059,6 +7097,9 @@ func (i *InternalLinkTypeUserPhoneNumber) Zero() bool { if !(i.DraftText == "") { return false } + if !(i.OpenProfile == false) { + return false + } return true } @@ -7103,6 +7144,10 @@ func (i *InternalLinkTypeUserPhoneNumber) TypeInfo() tdp.Type { Name: "DraftText", SchemaName: "draft_text", }, + { + Name: "OpenProfile", + SchemaName: "open_profile", + }, } return typ } @@ -7110,7 +7155,7 @@ func (i *InternalLinkTypeUserPhoneNumber) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InternalLinkTypeUserPhoneNumber) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#77c08091 as nil") + return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#104bbb08 as nil") } b.PutID(InternalLinkTypeUserPhoneNumberTypeID) return i.EncodeBare(b) @@ -7119,20 +7164,21 @@ func (i *InternalLinkTypeUserPhoneNumber) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InternalLinkTypeUserPhoneNumber) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#77c08091 as nil") + return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#104bbb08 as nil") } b.PutString(i.PhoneNumber) b.PutString(i.DraftText) + b.PutBool(i.OpenProfile) return nil } // Decode implements bin.Decoder. func (i *InternalLinkTypeUserPhoneNumber) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#77c08091 to nil") + return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#104bbb08 to nil") } if err := b.ConsumeID(InternalLinkTypeUserPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#77c08091: %w", err) + return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: %w", err) } return i.DecodeBare(b) } @@ -7140,29 +7186,36 @@ func (i *InternalLinkTypeUserPhoneNumber) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InternalLinkTypeUserPhoneNumber) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#77c08091 to nil") + return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#104bbb08 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#77c08091: field phone_number: %w", err) + return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field phone_number: %w", err) } i.PhoneNumber = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#77c08091: field draft_text: %w", err) + return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field draft_text: %w", err) } i.DraftText = value } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field open_profile: %w", err) + } + i.OpenProfile = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (i *InternalLinkTypeUserPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#77c08091 as nil") + return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#104bbb08 as nil") } b.ObjStart() b.PutID("internalLinkTypeUserPhoneNumber") @@ -7173,6 +7226,9 @@ func (i *InternalLinkTypeUserPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) erro b.FieldStart("draft_text") b.PutString(i.DraftText) b.Comma() + b.FieldStart("open_profile") + b.PutBool(i.OpenProfile) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -7181,27 +7237,33 @@ func (i *InternalLinkTypeUserPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) erro // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (i *InternalLinkTypeUserPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#77c08091 to nil") + return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#104bbb08 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("internalLinkTypeUserPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#77c08091: %w", err) + return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: %w", err) } case "phone_number": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#77c08091: field phone_number: %w", err) + return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field phone_number: %w", err) } i.PhoneNumber = value case "draft_text": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#77c08091: field draft_text: %w", err) + return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field draft_text: %w", err) } i.DraftText = value + case "open_profile": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field open_profile: %w", err) + } + i.OpenProfile = value default: return b.Skip() } @@ -7225,6 +7287,14 @@ func (i *InternalLinkTypeUserPhoneNumber) GetDraftText() (value string) { return i.DraftText } +// GetOpenProfile returns value of OpenProfile field. +func (i *InternalLinkTypeUserPhoneNumber) GetOpenProfile() (value bool) { + if i == nil { + return + } + return i.OpenProfile +} + // InternalLinkTypeUserToken represents TL type `internalLinkTypeUserToken#a8d7db59`. type InternalLinkTypeUserToken struct { // The token @@ -7635,7 +7705,7 @@ type InternalLinkTypeWebApp struct { WebAppShortName string // Start parameter to be passed to getWebAppLinkUrl StartParameter string - // True, if the Web App must be opened in a compact mode instead of a full-size mode + // True, if the Web App must be opened in the compact mode instead of the full-size mode IsCompact bool } @@ -7927,6 +7997,7 @@ const InternalLinkTypeClassName = "InternalLinkType" // case *tdapi.InternalLinkTypeInvoice: // internalLinkTypeInvoice#f34c6dac // case *tdapi.InternalLinkTypeLanguagePack: // internalLinkTypeLanguagePack#a9870d6c // case *tdapi.InternalLinkTypeLanguageSettings: // internalLinkTypeLanguageSettings#b019e6e6 +// case *tdapi.InternalLinkTypeMainWebApp: // internalLinkTypeMainWebApp#9c942666 // case *tdapi.InternalLinkTypeMessage: // internalLinkTypeMessage#3a535c52 // case *tdapi.InternalLinkTypeMessageDraft: // internalLinkTypeMessageDraft#276fbad5 // case *tdapi.InternalLinkTypePassportDataRequest: // internalLinkTypePassportDataRequest#c50fce81 @@ -7936,18 +8007,17 @@ const InternalLinkTypeClassName = "InternalLinkType" // case *tdapi.InternalLinkTypePremiumGiftCode: // internalLinkTypePremiumGiftCode#de5c9892 // case *tdapi.InternalLinkTypePrivacyAndSecuritySettings: // internalLinkTypePrivacyAndSecuritySettings#ad5f6acf // case *tdapi.InternalLinkTypeProxy: // internalLinkTypeProxy#b1b12cea -// case *tdapi.InternalLinkTypePublicChat: // internalLinkTypePublicChat#e5226d5e +// case *tdapi.InternalLinkTypePublicChat: // internalLinkTypePublicChat#697a2d00 // case *tdapi.InternalLinkTypeQrCodeAuthentication: // internalLinkTypeQrCodeAuthentication#bf121924 // case *tdapi.InternalLinkTypeRestorePurchases: // internalLinkTypeRestorePurchases#24203483 // case *tdapi.InternalLinkTypeSettings: // internalLinkTypeSettings#177545b4 -// case *tdapi.InternalLinkTypeSideMenuBot: // internalLinkTypeSideMenuBot#c45f0c16 // case *tdapi.InternalLinkTypeStickerSet: // internalLinkTypeStickerSet#a1464fa2 // case *tdapi.InternalLinkTypeStory: // internalLinkTypeStory#57bce647 // case *tdapi.InternalLinkTypeTheme: // internalLinkTypeTheme#f405f807 // case *tdapi.InternalLinkTypeThemeSettings: // internalLinkTypeThemeSettings#c14d3916 // case *tdapi.InternalLinkTypeUnknownDeepLink: // internalLinkTypeUnknownDeepLink#2549d7db // case *tdapi.InternalLinkTypeUnsupportedProxy: // internalLinkTypeUnsupportedProxy#de399f09 -// case *tdapi.InternalLinkTypeUserPhoneNumber: // internalLinkTypeUserPhoneNumber#77c08091 +// case *tdapi.InternalLinkTypeUserPhoneNumber: // internalLinkTypeUserPhoneNumber#104bbb08 // case *tdapi.InternalLinkTypeUserToken: // internalLinkTypeUserToken#a8d7db59 // case *tdapi.InternalLinkTypeVideoChat: // internalLinkTypeVideoChat#8796f8b4 // case *tdapi.InternalLinkTypeWebApp: // internalLinkTypeWebApp#4c68bb0d @@ -8122,6 +8192,13 @@ func DecodeInternalLinkType(buf *bin.Buffer) (InternalLinkTypeClass, error) { return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) } return &v, nil + case InternalLinkTypeMainWebAppTypeID: + // Decoding internalLinkTypeMainWebApp#9c942666. + v := InternalLinkTypeMainWebApp{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) + } + return &v, nil case InternalLinkTypeMessageTypeID: // Decoding internalLinkTypeMessage#3a535c52. v := InternalLinkTypeMessage{} @@ -8186,7 +8263,7 @@ func DecodeInternalLinkType(buf *bin.Buffer) (InternalLinkTypeClass, error) { } return &v, nil case InternalLinkTypePublicChatTypeID: - // Decoding internalLinkTypePublicChat#e5226d5e. + // Decoding internalLinkTypePublicChat#697a2d00. v := InternalLinkTypePublicChat{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) @@ -8213,13 +8290,6 @@ func DecodeInternalLinkType(buf *bin.Buffer) (InternalLinkTypeClass, error) { return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) } return &v, nil - case InternalLinkTypeSideMenuBotTypeID: - // Decoding internalLinkTypeSideMenuBot#c45f0c16. - v := InternalLinkTypeSideMenuBot{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil case InternalLinkTypeStickerSetTypeID: // Decoding internalLinkTypeStickerSet#a1464fa2. v := InternalLinkTypeStickerSet{} @@ -8263,7 +8333,7 @@ func DecodeInternalLinkType(buf *bin.Buffer) (InternalLinkTypeClass, error) { } return &v, nil case InternalLinkTypeUserPhoneNumberTypeID: - // Decoding internalLinkTypeUserPhoneNumber#77c08091. + // Decoding internalLinkTypeUserPhoneNumber#104bbb08. v := InternalLinkTypeUserPhoneNumber{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) @@ -8442,6 +8512,13 @@ func DecodeTDLibJSONInternalLinkType(buf tdjson.Decoder) (InternalLinkTypeClass, return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) } return &v, nil + case "internalLinkTypeMainWebApp": + // Decoding internalLinkTypeMainWebApp#9c942666. + v := InternalLinkTypeMainWebApp{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) + } + return &v, nil case "internalLinkTypeMessage": // Decoding internalLinkTypeMessage#3a535c52. v := InternalLinkTypeMessage{} @@ -8506,7 +8583,7 @@ func DecodeTDLibJSONInternalLinkType(buf tdjson.Decoder) (InternalLinkTypeClass, } return &v, nil case "internalLinkTypePublicChat": - // Decoding internalLinkTypePublicChat#e5226d5e. + // Decoding internalLinkTypePublicChat#697a2d00. v := InternalLinkTypePublicChat{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) @@ -8533,13 +8610,6 @@ func DecodeTDLibJSONInternalLinkType(buf tdjson.Decoder) (InternalLinkTypeClass, return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) } return &v, nil - case "internalLinkTypeSideMenuBot": - // Decoding internalLinkTypeSideMenuBot#c45f0c16. - v := InternalLinkTypeSideMenuBot{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil case "internalLinkTypeStickerSet": // Decoding internalLinkTypeStickerSet#a1464fa2. v := InternalLinkTypeStickerSet{} @@ -8583,7 +8653,7 @@ func DecodeTDLibJSONInternalLinkType(buf tdjson.Decoder) (InternalLinkTypeClass, } return &v, nil case "internalLinkTypeUserPhoneNumber": - // Decoding internalLinkTypeUserPhoneNumber#77c08091. + // Decoding internalLinkTypeUserPhoneNumber#104bbb08. v := InternalLinkTypeUserPhoneNumber{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) diff --git a/tdapi/tl_link_preview_gen.go b/tdapi/tl_link_preview_gen.go index ad63c7c4d7..c0c7efd282 100644 --- a/tdapi/tl_link_preview_gen.go +++ b/tdapi/tl_link_preview_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// LinkPreview represents TL type `linkPreview#d3d67eed`. +// LinkPreview represents TL type `linkPreview#52a366d6`. type LinkPreview struct { // Original URL of the link URL string @@ -50,6 +50,9 @@ type LinkPreview struct { // True, if large media preview must be shown; otherwise, the media preview must be shown // small and only the first frame must be shown for videos ShowLargeMedia bool + // True, if media must be shown above link preview description; otherwise, the media must + // be shown below the description + ShowMediaAboveDescription bool // True, if there is no need to show an ordinary open URL confirmation, when opening the // URL from the preview, because the URL is shown in the message text in clear SkipConfirmation bool @@ -61,7 +64,7 @@ type LinkPreview struct { } // LinkPreviewTypeID is TL type id of LinkPreview. -const LinkPreviewTypeID = 0xd3d67eed +const LinkPreviewTypeID = 0x52a366d6 // Ensuring interfaces in compile-time for LinkPreview. var ( @@ -99,6 +102,9 @@ func (l *LinkPreview) Zero() bool { if !(l.ShowLargeMedia == false) { return false } + if !(l.ShowMediaAboveDescription == false) { + return false + } if !(l.SkipConfirmation == false) { return false } @@ -176,6 +182,10 @@ func (l *LinkPreview) TypeInfo() tdp.Type { Name: "ShowLargeMedia", SchemaName: "show_large_media", }, + { + Name: "ShowMediaAboveDescription", + SchemaName: "show_media_above_description", + }, { Name: "SkipConfirmation", SchemaName: "skip_confirmation", @@ -195,7 +205,7 @@ func (l *LinkPreview) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreview) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreview#d3d67eed as nil") + return fmt.Errorf("can't encode linkPreview#52a366d6 as nil") } b.PutID(LinkPreviewTypeID) return l.EncodeBare(b) @@ -204,23 +214,24 @@ func (l *LinkPreview) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreview) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreview#d3d67eed as nil") + return fmt.Errorf("can't encode linkPreview#52a366d6 as nil") } b.PutString(l.URL) b.PutString(l.DisplayURL) b.PutString(l.SiteName) b.PutString(l.Title) if err := l.Description.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#d3d67eed: field description: %w", err) + return fmt.Errorf("unable to encode linkPreview#52a366d6: field description: %w", err) } if l.Type == nil { - return fmt.Errorf("unable to encode linkPreview#d3d67eed: field type is nil") + return fmt.Errorf("unable to encode linkPreview#52a366d6: field type is nil") } if err := l.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#d3d67eed: field type: %w", err) + return fmt.Errorf("unable to encode linkPreview#52a366d6: field type: %w", err) } b.PutBool(l.HasLargeMedia) b.PutBool(l.ShowLargeMedia) + b.PutBool(l.ShowMediaAboveDescription) b.PutBool(l.SkipConfirmation) b.PutBool(l.ShowAboveText) b.PutInt32(l.InstantViewVersion) @@ -230,10 +241,10 @@ func (l *LinkPreview) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (l *LinkPreview) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreview#d3d67eed to nil") + return fmt.Errorf("can't decode linkPreview#52a366d6 to nil") } if err := b.ConsumeID(LinkPreviewTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: %w", err) } return l.DecodeBare(b) } @@ -241,80 +252,87 @@ func (l *LinkPreview) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreview) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreview#d3d67eed to nil") + return fmt.Errorf("can't decode linkPreview#52a366d6 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field url: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field url: %w", err) } l.URL = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field display_url: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field display_url: %w", err) } l.DisplayURL = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field site_name: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field site_name: %w", err) } l.SiteName = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field title: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field title: %w", err) } l.Title = value } { if err := l.Description.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field description: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field description: %w", err) } } { value, err := DecodeLinkPreviewType(b) if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field type: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field type: %w", err) } l.Type = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field has_large_media: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field has_large_media: %w", err) } l.HasLargeMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field show_large_media: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_large_media: %w", err) } l.ShowLargeMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field skip_confirmation: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_media_above_description: %w", err) + } + l.ShowMediaAboveDescription = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode linkPreview#52a366d6: field skip_confirmation: %w", err) } l.SkipConfirmation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field show_above_text: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_above_text: %w", err) } l.ShowAboveText = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field instant_view_version: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field instant_view_version: %w", err) } l.InstantViewVersion = value } @@ -324,7 +342,7 @@ func (l *LinkPreview) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreview) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreview#d3d67eed as nil") + return fmt.Errorf("can't encode linkPreview#52a366d6 as nil") } b.ObjStart() b.PutID("linkPreview") @@ -343,15 +361,15 @@ func (l *LinkPreview) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("description") if err := l.Description.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#d3d67eed: field description: %w", err) + return fmt.Errorf("unable to encode linkPreview#52a366d6: field description: %w", err) } b.Comma() b.FieldStart("type") if l.Type == nil { - return fmt.Errorf("unable to encode linkPreview#d3d67eed: field type is nil") + return fmt.Errorf("unable to encode linkPreview#52a366d6: field type is nil") } if err := l.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#d3d67eed: field type: %w", err) + return fmt.Errorf("unable to encode linkPreview#52a366d6: field type: %w", err) } b.Comma() b.FieldStart("has_large_media") @@ -360,6 +378,9 @@ func (l *LinkPreview) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("show_large_media") b.PutBool(l.ShowLargeMedia) b.Comma() + b.FieldStart("show_media_above_description") + b.PutBool(l.ShowMediaAboveDescription) + b.Comma() b.FieldStart("skip_confirmation") b.PutBool(l.SkipConfirmation) b.Comma() @@ -377,77 +398,83 @@ func (l *LinkPreview) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreview) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreview#d3d67eed to nil") + return fmt.Errorf("can't decode linkPreview#52a366d6 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreview"); err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: %w", err) } case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field url: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field url: %w", err) } l.URL = value case "display_url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field display_url: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field display_url: %w", err) } l.DisplayURL = value case "site_name": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field site_name: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field site_name: %w", err) } l.SiteName = value case "title": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field title: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field title: %w", err) } l.Title = value case "description": if err := l.Description.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field description: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field description: %w", err) } case "type": value, err := DecodeTDLibJSONLinkPreviewType(b) if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field type: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field type: %w", err) } l.Type = value case "has_large_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field has_large_media: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field has_large_media: %w", err) } l.HasLargeMedia = value case "show_large_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field show_large_media: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_large_media: %w", err) } l.ShowLargeMedia = value + case "show_media_above_description": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_media_above_description: %w", err) + } + l.ShowMediaAboveDescription = value case "skip_confirmation": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field skip_confirmation: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field skip_confirmation: %w", err) } l.SkipConfirmation = value case "show_above_text": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field show_above_text: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field show_above_text: %w", err) } l.ShowAboveText = value case "instant_view_version": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreview#d3d67eed: field instant_view_version: %w", err) + return fmt.Errorf("unable to decode linkPreview#52a366d6: field instant_view_version: %w", err) } l.InstantViewVersion = value default: @@ -521,6 +548,14 @@ func (l *LinkPreview) GetShowLargeMedia() (value bool) { return l.ShowLargeMedia } +// GetShowMediaAboveDescription returns value of ShowMediaAboveDescription field. +func (l *LinkPreview) GetShowMediaAboveDescription() (value bool) { + if l == nil { + return + } + return l.ShowMediaAboveDescription +} + // GetSkipConfirmation returns value of SkipConfirmation field. func (l *LinkPreview) GetSkipConfirmation() (value bool) { if l == nil { diff --git a/tdapi/tl_link_preview_type_gen.go b/tdapi/tl_link_preview_type_gen.go index 1e6967a56c..d697fb29bf 100644 --- a/tdapi/tl_link_preview_type_gen.go +++ b/tdapi/tl_link_preview_type_gen.go @@ -1943,18 +1943,360 @@ func (l *LinkPreviewTypeDocument) GetAuthor() (value string) { return l.Author } -// LinkPreviewTypeEmbeddedAudioPlayer represents TL type `linkPreviewTypeEmbeddedAudioPlayer#2bb06106`. +// LinkPreviewTypeEmbeddedAnimationPlayer represents TL type `linkPreviewTypeEmbeddedAnimationPlayer#c45fddca`. +type LinkPreviewTypeEmbeddedAnimationPlayer struct { + // URL of the external animation player + URL string + // Thumbnail of the animation; may be null if unknown + Thumbnail Photo + // Duration of the animation, in seconds + Duration int32 + // Author of the animation + Author string + // Expected width of the embedded player + Width int32 + // Expected height of the embedded player + Height int32 +} + +// LinkPreviewTypeEmbeddedAnimationPlayerTypeID is TL type id of LinkPreviewTypeEmbeddedAnimationPlayer. +const LinkPreviewTypeEmbeddedAnimationPlayerTypeID = 0xc45fddca + +// construct implements constructor of LinkPreviewTypeClass. +func (l LinkPreviewTypeEmbeddedAnimationPlayer) construct() LinkPreviewTypeClass { return &l } + +// Ensuring interfaces in compile-time for LinkPreviewTypeEmbeddedAnimationPlayer. +var ( + _ bin.Encoder = &LinkPreviewTypeEmbeddedAnimationPlayer{} + _ bin.Decoder = &LinkPreviewTypeEmbeddedAnimationPlayer{} + _ bin.BareEncoder = &LinkPreviewTypeEmbeddedAnimationPlayer{} + _ bin.BareDecoder = &LinkPreviewTypeEmbeddedAnimationPlayer{} + + _ LinkPreviewTypeClass = &LinkPreviewTypeEmbeddedAnimationPlayer{} +) + +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Zero() bool { + if l == nil { + return true + } + if !(l.URL == "") { + return false + } + if !(l.Thumbnail.Zero()) { + return false + } + if !(l.Duration == 0) { + return false + } + if !(l.Author == "") { + return false + } + if !(l.Width == 0) { + return false + } + if !(l.Height == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) String() string { + if l == nil { + return "LinkPreviewTypeEmbeddedAnimationPlayer(nil)" + } + type Alias LinkPreviewTypeEmbeddedAnimationPlayer + return fmt.Sprintf("LinkPreviewTypeEmbeddedAnimationPlayer%+v", Alias(*l)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*LinkPreviewTypeEmbeddedAnimationPlayer) TypeID() uint32 { + return LinkPreviewTypeEmbeddedAnimationPlayerTypeID +} + +// TypeName returns name of type in TL schema. +func (*LinkPreviewTypeEmbeddedAnimationPlayer) TypeName() string { + return "linkPreviewTypeEmbeddedAnimationPlayer" +} + +// TypeInfo returns info about TL type. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "linkPreviewTypeEmbeddedAnimationPlayer", + ID: LinkPreviewTypeEmbeddedAnimationPlayerTypeID, + } + if l == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + { + Name: "Thumbnail", + SchemaName: "thumbnail", + }, + { + Name: "Duration", + SchemaName: "duration", + }, + { + Name: "Author", + SchemaName: "author", + }, + { + Name: "Width", + SchemaName: "width", + }, + { + Name: "Height", + SchemaName: "height", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Encode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca as nil") + } + b.PutID(LinkPreviewTypeEmbeddedAnimationPlayerTypeID) + return l.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) EncodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca as nil") + } + b.PutString(l.URL) + if err := l.Thumbnail.Encode(b); err != nil { + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field thumbnail: %w", err) + } + b.PutInt32(l.Duration) + b.PutString(l.Author) + b.PutInt32(l.Width) + b.PutInt32(l.Height) + return nil +} + +// Decode implements bin.Decoder. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Decode(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca to nil") + } + if err := b.ConsumeID(LinkPreviewTypeEmbeddedAnimationPlayerTypeID); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: %w", err) + } + return l.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) DecodeBare(b *bin.Buffer) error { + if l == nil { + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field url: %w", err) + } + l.URL = value + } + { + if err := l.Thumbnail.Decode(b); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field thumbnail: %w", err) + } + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field duration: %w", err) + } + l.Duration = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field author: %w", err) + } + l.Author = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field width: %w", err) + } + l.Width = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field height: %w", err) + } + l.Height = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) EncodeTDLibJSON(b tdjson.Encoder) error { + if l == nil { + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca as nil") + } + b.ObjStart() + b.PutID("linkPreviewTypeEmbeddedAnimationPlayer") + b.Comma() + b.FieldStart("url") + b.PutString(l.URL) + b.Comma() + b.FieldStart("thumbnail") + if err := l.Thumbnail.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field thumbnail: %w", err) + } + b.Comma() + b.FieldStart("duration") + b.PutInt32(l.Duration) + b.Comma() + b.FieldStart("author") + b.PutString(l.Author) + b.Comma() + b.FieldStart("width") + b.PutInt32(l.Width) + b.Comma() + b.FieldStart("height") + b.PutInt32(l.Height) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { + if l == nil { + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("linkPreviewTypeEmbeddedAnimationPlayer"); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: %w", err) + } + case "url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field url: %w", err) + } + l.URL = value + case "thumbnail": + if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field thumbnail: %w", err) + } + case "duration": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field duration: %w", err) + } + l.Duration = value + case "author": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field author: %w", err) + } + l.Author = value + case "width": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field width: %w", err) + } + l.Width = value + case "height": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#c45fddca: field height: %w", err) + } + l.Height = value + default: + return b.Skip() + } + return nil + }) +} + +// GetURL returns value of URL field. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetURL() (value string) { + if l == nil { + return + } + return l.URL +} + +// GetThumbnail returns value of Thumbnail field. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetThumbnail() (value Photo) { + if l == nil { + return + } + return l.Thumbnail +} + +// GetDuration returns value of Duration field. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetDuration() (value int32) { + if l == nil { + return + } + return l.Duration +} + +// GetAuthor returns value of Author field. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetAuthor() (value string) { + if l == nil { + return + } + return l.Author +} + +// GetWidth returns value of Width field. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetWidth() (value int32) { + if l == nil { + return + } + return l.Width +} + +// GetHeight returns value of Height field. +func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetHeight() (value int32) { + if l == nil { + return + } + return l.Height +} + +// LinkPreviewTypeEmbeddedAudioPlayer represents TL type `linkPreviewTypeEmbeddedAudioPlayer#31e0dae6`. type LinkPreviewTypeEmbeddedAudioPlayer struct { // URL of the external audio player URL string + // Thumbnail of the audio; may be null if unknown + Thumbnail Photo // Duration of the audio, in seconds Duration int32 // Author of the audio Author string + // Expected width of the embedded player + Width int32 + // Expected height of the embedded player + Height int32 } // LinkPreviewTypeEmbeddedAudioPlayerTypeID is TL type id of LinkPreviewTypeEmbeddedAudioPlayer. -const LinkPreviewTypeEmbeddedAudioPlayerTypeID = 0x2bb06106 +const LinkPreviewTypeEmbeddedAudioPlayerTypeID = 0x31e0dae6 // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeEmbeddedAudioPlayer) construct() LinkPreviewTypeClass { return &l } @@ -1976,12 +2318,21 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) Zero() bool { if !(l.URL == "") { return false } + if !(l.Thumbnail.Zero()) { + return false + } if !(l.Duration == 0) { return false } if !(l.Author == "") { return false } + if !(l.Width == 0) { + return false + } + if !(l.Height == 0) { + return false + } return true } @@ -2022,6 +2373,10 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) TypeInfo() tdp.Type { Name: "URL", SchemaName: "url", }, + { + Name: "Thumbnail", + SchemaName: "thumbnail", + }, { Name: "Duration", SchemaName: "duration", @@ -2030,6 +2385,14 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) TypeInfo() tdp.Type { Name: "Author", SchemaName: "author", }, + { + Name: "Width", + SchemaName: "width", + }, + { + Name: "Height", + SchemaName: "height", + }, } return typ } @@ -2037,7 +2400,7 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#2bb06106 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 as nil") } b.PutID(LinkPreviewTypeEmbeddedAudioPlayerTypeID) return l.EncodeBare(b) @@ -2046,21 +2409,26 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#2bb06106 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 as nil") } b.PutString(l.URL) + if err := l.Thumbnail.Encode(b); err != nil { + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field thumbnail: %w", err) + } b.PutInt32(l.Duration) b.PutString(l.Author) + b.PutInt32(l.Width) + b.PutInt32(l.Height) return nil } // Decode implements bin.Decoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 to nil") } if err := b.ConsumeID(LinkPreviewTypeEmbeddedAudioPlayerTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: %w", err) } return l.DecodeBare(b) } @@ -2068,36 +2436,55 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field url: %w", err) } l.URL = value } + { + if err := l.Thumbnail.Decode(b); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field thumbnail: %w", err) + } + } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field duration: %w", err) } l.Duration = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field author: %w", err) } l.Author = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field width: %w", err) + } + l.Width = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field height: %w", err) + } + l.Height = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#2bb06106 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 as nil") } b.ObjStart() b.PutID("linkPreviewTypeEmbeddedAudioPlayer") @@ -2105,12 +2492,23 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeTDLibJSON(b tdjson.Encoder) e b.FieldStart("url") b.PutString(l.URL) b.Comma() + b.FieldStart("thumbnail") + if err := l.Thumbnail.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field thumbnail: %w", err) + } + b.Comma() b.FieldStart("duration") b.PutInt32(l.Duration) b.Comma() b.FieldStart("author") b.PutString(l.Author) b.Comma() + b.FieldStart("width") + b.PutInt32(l.Width) + b.Comma() + b.FieldStart("height") + b.PutInt32(l.Height) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -2119,33 +2517,49 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeTDLibJSON(b tdjson.Encoder) e // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeEmbeddedAudioPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeEmbeddedAudioPlayer"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: %w", err) } case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field url: %w", err) } l.URL = value + case "thumbnail": + if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field thumbnail: %w", err) + } case "duration": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field duration: %w", err) } l.Duration = value case "author": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#2bb06106: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field author: %w", err) } l.Author = value + case "width": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field width: %w", err) + } + l.Width = value + case "height": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#31e0dae6: field height: %w", err) + } + l.Height = value default: return b.Skip() } @@ -2161,6 +2575,14 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetURL() (value string) { return l.URL } +// GetThumbnail returns value of Thumbnail field. +func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetThumbnail() (value Photo) { + if l == nil { + return + } + return l.Thumbnail +} + // GetDuration returns value of Duration field. func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetDuration() (value int32) { if l == nil { @@ -2177,22 +2599,40 @@ func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetAuthor() (value string) { return l.Author } -// LinkPreviewTypeEmbeddedVideoPlayer represents TL type `linkPreviewTypeEmbeddedVideoPlayer#fd4c9719`. +// GetWidth returns value of Width field. +func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetWidth() (value int32) { + if l == nil { + return + } + return l.Width +} + +// GetHeight returns value of Height field. +func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetHeight() (value int32) { + if l == nil { + return + } + return l.Height +} + +// LinkPreviewTypeEmbeddedVideoPlayer represents TL type `linkPreviewTypeEmbeddedVideoPlayer#6ee015a3`. type LinkPreviewTypeEmbeddedVideoPlayer struct { // URL of the external video player URL string + // Thumbnail of the video; may be null if unknown + Thumbnail Photo // Duration of the video, in seconds Duration int32 // Author of the video Author string - // Expected width of the preview + // Expected width of the embedded player Width int32 - // Expected height of the preview + // Expected height of the embedded player Height int32 } // LinkPreviewTypeEmbeddedVideoPlayerTypeID is TL type id of LinkPreviewTypeEmbeddedVideoPlayer. -const LinkPreviewTypeEmbeddedVideoPlayerTypeID = 0xfd4c9719 +const LinkPreviewTypeEmbeddedVideoPlayerTypeID = 0x6ee015a3 // construct implements constructor of LinkPreviewTypeClass. func (l LinkPreviewTypeEmbeddedVideoPlayer) construct() LinkPreviewTypeClass { return &l } @@ -2214,6 +2654,9 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) Zero() bool { if !(l.URL == "") { return false } + if !(l.Thumbnail.Zero()) { + return false + } if !(l.Duration == 0) { return false } @@ -2266,6 +2709,10 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) TypeInfo() tdp.Type { Name: "URL", SchemaName: "url", }, + { + Name: "Thumbnail", + SchemaName: "thumbnail", + }, { Name: "Duration", SchemaName: "duration", @@ -2289,7 +2736,7 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) Encode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 as nil") } b.PutID(LinkPreviewTypeEmbeddedVideoPlayerTypeID) return l.EncodeBare(b) @@ -2298,9 +2745,12 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 as nil") } b.PutString(l.URL) + if err := l.Thumbnail.Encode(b); err != nil { + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field thumbnail: %w", err) + } b.PutInt32(l.Duration) b.PutString(l.Author) b.PutInt32(l.Width) @@ -2311,10 +2761,10 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) Decode(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 to nil") } if err := b.ConsumeID(LinkPreviewTypeEmbeddedVideoPlayerTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: %w", err) } return l.DecodeBare(b) } @@ -2322,40 +2772,45 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeBare(b *bin.Buffer) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field url: %w", err) } l.URL = value } + { + if err := l.Thumbnail.Decode(b); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field thumbnail: %w", err) + } + } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field duration: %w", err) } l.Duration = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field author: %w", err) } l.Author = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field width: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field width: %w", err) } l.Width = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field height: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field height: %w", err) } l.Height = value } @@ -2365,7 +2820,7 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeTDLibJSON(b tdjson.Encoder) error { if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719 as nil") + return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 as nil") } b.ObjStart() b.PutID("linkPreviewTypeEmbeddedVideoPlayer") @@ -2373,6 +2828,11 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeTDLibJSON(b tdjson.Encoder) e b.FieldStart("url") b.PutString(l.URL) b.Comma() + b.FieldStart("thumbnail") + if err := l.Thumbnail.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field thumbnail: %w", err) + } + b.Comma() b.FieldStart("duration") b.PutInt32(l.Duration) b.Comma() @@ -2393,43 +2853,47 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeTDLibJSON(b tdjson.Encoder) e // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719 to nil") + return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("linkPreviewTypeEmbeddedVideoPlayer"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: %w", err) } case "url": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field url: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field url: %w", err) } l.URL = value + case "thumbnail": + if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field thumbnail: %w", err) + } case "duration": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field duration: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field duration: %w", err) } l.Duration = value case "author": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field author: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field author: %w", err) } l.Author = value case "width": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field width: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field width: %w", err) } l.Width = value case "height": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#fd4c9719: field height: %w", err) + return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#6ee015a3: field height: %w", err) } l.Height = value default: @@ -2447,6 +2911,14 @@ func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetURL() (value string) { return l.URL } +// GetThumbnail returns value of Thumbnail field. +func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetThumbnail() (value Photo) { + if l == nil { + return + } + return l.Thumbnail +} + // GetDuration returns value of Duration field. func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetDuration() (value int32) { if l == nil { @@ -5578,8 +6050,9 @@ const LinkPreviewTypeClassName = "LinkPreviewType" // case *tdapi.LinkPreviewTypeChannelBoost: // linkPreviewTypeChannelBoost#c6f40456 // case *tdapi.LinkPreviewTypeChat: // linkPreviewTypeChat#ae2fa122 // case *tdapi.LinkPreviewTypeDocument: // linkPreviewTypeDocument#53b02747 -// case *tdapi.LinkPreviewTypeEmbeddedAudioPlayer: // linkPreviewTypeEmbeddedAudioPlayer#2bb06106 -// case *tdapi.LinkPreviewTypeEmbeddedVideoPlayer: // linkPreviewTypeEmbeddedVideoPlayer#fd4c9719 +// case *tdapi.LinkPreviewTypeEmbeddedAnimationPlayer: // linkPreviewTypeEmbeddedAnimationPlayer#c45fddca +// case *tdapi.LinkPreviewTypeEmbeddedAudioPlayer: // linkPreviewTypeEmbeddedAudioPlayer#31e0dae6 +// case *tdapi.LinkPreviewTypeEmbeddedVideoPlayer: // linkPreviewTypeEmbeddedVideoPlayer#6ee015a3 // case *tdapi.LinkPreviewTypeInvoice: // linkPreviewTypeInvoice#d47f48da // case *tdapi.LinkPreviewTypeMessage: // linkPreviewTypeMessage#19f4c19e // case *tdapi.LinkPreviewTypePhoto: // linkPreviewTypePhoto#eeebbab0 @@ -5691,15 +6164,22 @@ func DecodeLinkPreviewType(buf *bin.Buffer) (LinkPreviewTypeClass, error) { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil + case LinkPreviewTypeEmbeddedAnimationPlayerTypeID: + // Decoding linkPreviewTypeEmbeddedAnimationPlayer#c45fddca. + v := LinkPreviewTypeEmbeddedAnimationPlayer{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) + } + return &v, nil case LinkPreviewTypeEmbeddedAudioPlayerTypeID: - // Decoding linkPreviewTypeEmbeddedAudioPlayer#2bb06106. + // Decoding linkPreviewTypeEmbeddedAudioPlayer#31e0dae6. v := LinkPreviewTypeEmbeddedAudioPlayer{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case LinkPreviewTypeEmbeddedVideoPlayerTypeID: - // Decoding linkPreviewTypeEmbeddedVideoPlayer#fd4c9719. + // Decoding linkPreviewTypeEmbeddedVideoPlayer#6ee015a3. v := LinkPreviewTypeEmbeddedVideoPlayer{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) @@ -5899,15 +6379,22 @@ func DecodeTDLibJSONLinkPreviewType(buf tdjson.Decoder) (LinkPreviewTypeClass, e return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil + case "linkPreviewTypeEmbeddedAnimationPlayer": + // Decoding linkPreviewTypeEmbeddedAnimationPlayer#c45fddca. + v := LinkPreviewTypeEmbeddedAnimationPlayer{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) + } + return &v, nil case "linkPreviewTypeEmbeddedAudioPlayer": - // Decoding linkPreviewTypeEmbeddedAudioPlayer#2bb06106. + // Decoding linkPreviewTypeEmbeddedAudioPlayer#31e0dae6. v := LinkPreviewTypeEmbeddedAudioPlayer{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) } return &v, nil case "linkPreviewTypeEmbeddedVideoPlayer": - // Decoding linkPreviewTypeEmbeddedVideoPlayer#fd4c9719. + // Decoding linkPreviewTypeEmbeddedVideoPlayer#6ee015a3. v := LinkPreviewTypeEmbeddedVideoPlayer{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) diff --git a/tdapi/tl_main_web_app_gen.go b/tdapi/tl_main_web_app_gen.go new file mode 100644 index 0000000000..83d1ff4574 --- /dev/null +++ b/tdapi/tl_main_web_app_gen.go @@ -0,0 +1,228 @@ +// 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{} +) + +// MainWebApp represents TL type `mainWebApp#4fb068f1`. +type MainWebApp struct { + // URL of the Web App to open + URL string + // True, if the Web App must always be opened in the compact mode instead of the + // full-size mode + IsCompact bool +} + +// MainWebAppTypeID is TL type id of MainWebApp. +const MainWebAppTypeID = 0x4fb068f1 + +// Ensuring interfaces in compile-time for MainWebApp. +var ( + _ bin.Encoder = &MainWebApp{} + _ bin.Decoder = &MainWebApp{} + _ bin.BareEncoder = &MainWebApp{} + _ bin.BareDecoder = &MainWebApp{} +) + +func (m *MainWebApp) Zero() bool { + if m == nil { + return true + } + if !(m.URL == "") { + return false + } + if !(m.IsCompact == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MainWebApp) String() string { + if m == nil { + return "MainWebApp(nil)" + } + type Alias MainWebApp + return fmt.Sprintf("MainWebApp%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MainWebApp) TypeID() uint32 { + return MainWebAppTypeID +} + +// TypeName returns name of type in TL schema. +func (*MainWebApp) TypeName() string { + return "mainWebApp" +} + +// TypeInfo returns info about TL type. +func (m *MainWebApp) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "mainWebApp", + ID: MainWebAppTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + { + Name: "IsCompact", + SchemaName: "is_compact", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MainWebApp) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode mainWebApp#4fb068f1 as nil") + } + b.PutID(MainWebAppTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MainWebApp) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode mainWebApp#4fb068f1 as nil") + } + b.PutString(m.URL) + b.PutBool(m.IsCompact) + return nil +} + +// Decode implements bin.Decoder. +func (m *MainWebApp) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode mainWebApp#4fb068f1 to nil") + } + if err := b.ConsumeID(MainWebAppTypeID); err != nil { + return fmt.Errorf("unable to decode mainWebApp#4fb068f1: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MainWebApp) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode mainWebApp#4fb068f1 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode mainWebApp#4fb068f1: field url: %w", err) + } + m.URL = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode mainWebApp#4fb068f1: field is_compact: %w", err) + } + m.IsCompact = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MainWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode mainWebApp#4fb068f1 as nil") + } + b.ObjStart() + b.PutID("mainWebApp") + b.Comma() + b.FieldStart("url") + b.PutString(m.URL) + b.Comma() + b.FieldStart("is_compact") + b.PutBool(m.IsCompact) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MainWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode mainWebApp#4fb068f1 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("mainWebApp"); err != nil { + return fmt.Errorf("unable to decode mainWebApp#4fb068f1: %w", err) + } + case "url": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode mainWebApp#4fb068f1: field url: %w", err) + } + m.URL = value + case "is_compact": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode mainWebApp#4fb068f1: field is_compact: %w", err) + } + m.IsCompact = value + default: + return b.Skip() + } + return nil + }) +} + +// GetURL returns value of URL field. +func (m *MainWebApp) GetURL() (value string) { + if m == nil { + return + } + return m.URL +} + +// GetIsCompact returns value of IsCompact field. +func (m *MainWebApp) GetIsCompact() (value bool) { + if m == nil { + return + } + return m.IsCompact +} diff --git a/tdapi/tl_message_content_gen.go b/tdapi/tl_message_content_gen.go index f452615989..aa317011b3 100644 --- a/tdapi/tl_message_content_gen.go +++ b/tdapi/tl_message_content_gen.go @@ -972,7 +972,7 @@ func (m *MessageDocument) GetCaption() (value FormattedText) { // MessagePaidMedia represents TL type `messagePaidMedia#3e5fd7c2`. type MessagePaidMedia struct { - // Number of stars needed to buy access to the media in the message + // Number of Telegram Stars needed to buy access to the media in the message StarCount int64 // Information about the media Media []PaidMediaClass @@ -11304,7 +11304,7 @@ func (m *MessagePaymentSuccessfulBot) GetProviderPaymentChargeID() (value string // MessagePaymentRefunded represents TL type `messagePaymentRefunded#11bcb8f3`. type MessagePaymentRefunded struct { - // Identifier of the previous owner of the Telegram stars that refunds them + // Identifier of the previous owner of the Telegram Stars that refunds them OwnerID MessageSenderClass // Currency for the price of the product Currency string @@ -11648,10 +11648,13 @@ func (m *MessagePaymentRefunded) GetProviderPaymentChargeID() (value string) { return m.ProviderPaymentChargeID } -// MessageGiftedPremium represents TL type `messageGiftedPremium#78d1d0a`. +// MessageGiftedPremium represents TL type `messageGiftedPremium#30dd808e`. type MessageGiftedPremium struct { - // The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous + // The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous or + // is outgoing GifterUserID int64 + // The identifier of a user that received Telegram Premium; 0 if the gift is incoming + ReceiverUserID int64 // Currency for the paid amount Currency string // The paid amount, in the smallest units of the currency @@ -11667,7 +11670,7 @@ type MessageGiftedPremium struct { } // MessageGiftedPremiumTypeID is TL type id of MessageGiftedPremium. -const MessageGiftedPremiumTypeID = 0x78d1d0a +const MessageGiftedPremiumTypeID = 0x30dd808e // construct implements constructor of MessageContentClass. func (m MessageGiftedPremium) construct() MessageContentClass { return &m } @@ -11689,6 +11692,9 @@ func (m *MessageGiftedPremium) Zero() bool { if !(m.GifterUserID == 0) { return false } + if !(m.ReceiverUserID == 0) { + return false + } if !(m.Currency == "") { return false } @@ -11747,6 +11753,10 @@ func (m *MessageGiftedPremium) TypeInfo() tdp.Type { Name: "GifterUserID", SchemaName: "gifter_user_id", }, + { + Name: "ReceiverUserID", + SchemaName: "receiver_user_id", + }, { Name: "Currency", SchemaName: "currency", @@ -11778,7 +11788,7 @@ func (m *MessageGiftedPremium) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageGiftedPremium) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageGiftedPremium#78d1d0a as nil") + return fmt.Errorf("can't encode messageGiftedPremium#30dd808e as nil") } b.PutID(MessageGiftedPremiumTypeID) return m.EncodeBare(b) @@ -11787,16 +11797,17 @@ func (m *MessageGiftedPremium) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageGiftedPremium) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageGiftedPremium#78d1d0a as nil") + return fmt.Errorf("can't encode messageGiftedPremium#30dd808e as nil") } b.PutInt53(m.GifterUserID) + b.PutInt53(m.ReceiverUserID) b.PutString(m.Currency) b.PutInt53(m.Amount) b.PutString(m.Cryptocurrency) b.PutLong(m.CryptocurrencyAmount) b.PutInt32(m.MonthCount) if err := m.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGiftedPremium#78d1d0a: field sticker: %w", err) + return fmt.Errorf("unable to encode messageGiftedPremium#30dd808e: field sticker: %w", err) } return nil } @@ -11804,10 +11815,10 @@ func (m *MessageGiftedPremium) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageGiftedPremium) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageGiftedPremium#78d1d0a to nil") + return fmt.Errorf("can't decode messageGiftedPremium#30dd808e to nil") } if err := b.ConsumeID(MessageGiftedPremiumTypeID); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: %w", err) } return m.DecodeBare(b) } @@ -11815,53 +11826,60 @@ func (m *MessageGiftedPremium) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageGiftedPremium) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageGiftedPremium#78d1d0a to nil") + return fmt.Errorf("can't decode messageGiftedPremium#30dd808e to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field gifter_user_id: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field gifter_user_id: %w", err) } m.GifterUserID = value } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field receiver_user_id: %w", err) + } + m.ReceiverUserID = value + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field currency: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field currency: %w", err) } m.Currency = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field amount: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field amount: %w", err) } m.Amount = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field cryptocurrency: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field cryptocurrency: %w", err) } m.Cryptocurrency = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field cryptocurrency_amount: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field cryptocurrency_amount: %w", err) } m.CryptocurrencyAmount = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field month_count: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field month_count: %w", err) } m.MonthCount = value } { if err := m.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field sticker: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field sticker: %w", err) } } return nil @@ -11870,7 +11888,7 @@ func (m *MessageGiftedPremium) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (m *MessageGiftedPremium) EncodeTDLibJSON(b tdjson.Encoder) error { if m == nil { - return fmt.Errorf("can't encode messageGiftedPremium#78d1d0a as nil") + return fmt.Errorf("can't encode messageGiftedPremium#30dd808e as nil") } b.ObjStart() b.PutID("messageGiftedPremium") @@ -11878,6 +11896,9 @@ func (m *MessageGiftedPremium) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("gifter_user_id") b.PutInt53(m.GifterUserID) b.Comma() + b.FieldStart("receiver_user_id") + b.PutInt53(m.ReceiverUserID) + b.Comma() b.FieldStart("currency") b.PutString(m.Currency) b.Comma() @@ -11895,7 +11916,7 @@ func (m *MessageGiftedPremium) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("sticker") if err := m.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGiftedPremium#78d1d0a: field sticker: %w", err) + return fmt.Errorf("unable to encode messageGiftedPremium#30dd808e: field sticker: %w", err) } b.Comma() b.StripComma() @@ -11906,54 +11927,60 @@ func (m *MessageGiftedPremium) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (m *MessageGiftedPremium) DecodeTDLibJSON(b tdjson.Decoder) error { if m == nil { - return fmt.Errorf("can't decode messageGiftedPremium#78d1d0a to nil") + return fmt.Errorf("can't decode messageGiftedPremium#30dd808e to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("messageGiftedPremium"); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: %w", err) } case "gifter_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field gifter_user_id: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field gifter_user_id: %w", err) } m.GifterUserID = value + case "receiver_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field receiver_user_id: %w", err) + } + m.ReceiverUserID = value case "currency": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field currency: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field currency: %w", err) } m.Currency = value case "amount": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field amount: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field amount: %w", err) } m.Amount = value case "cryptocurrency": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field cryptocurrency: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field cryptocurrency: %w", err) } m.Cryptocurrency = value case "cryptocurrency_amount": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field cryptocurrency_amount: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field cryptocurrency_amount: %w", err) } m.CryptocurrencyAmount = value case "month_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field month_count: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field month_count: %w", err) } m.MonthCount = value case "sticker": if err := m.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#78d1d0a: field sticker: %w", err) + return fmt.Errorf("unable to decode messageGiftedPremium#30dd808e: field sticker: %w", err) } default: return b.Skip() @@ -11970,6 +11997,14 @@ func (m *MessageGiftedPremium) GetGifterUserID() (value int64) { return m.GifterUserID } +// GetReceiverUserID returns value of ReceiverUserID field. +func (m *MessageGiftedPremium) GetReceiverUserID() (value int64) { + if m == nil { + return + } + return m.ReceiverUserID +} + // GetCurrency returns value of Currency field. func (m *MessageGiftedPremium) GetCurrency() (value string) { if m == nil { @@ -13668,6 +13703,445 @@ func (m *MessagePremiumGiveawayWinners) GetUnclaimedPrizeCount() (value int32) { return m.UnclaimedPrizeCount } +// MessageGiftedStars represents TL type `messageGiftedStars#41bdbea7`. +type MessageGiftedStars struct { + // The identifier of a user that gifted Telegram Stars; 0 if the gift was anonymous or is + // outgoing + GifterUserID int64 + // The identifier of a user that received Telegram Stars; 0 if the gift is incoming + ReceiverUserID int64 + // Currency for the paid amount + Currency string + // The paid amount, in the smallest units of the currency + Amount int64 + // Cryptocurrency used to pay for the gift; may be empty if none + Cryptocurrency string + // The paid amount, in the smallest units of the cryptocurrency; 0 if none + CryptocurrencyAmount int64 + // Number of Telegram Stars that were gifted + StarCount int64 + // Identifier of the transaction for Telegram Stars purchase; for receiver only + TransactionID string + // A sticker to be shown in the message; may be null if unknown + Sticker Sticker +} + +// MessageGiftedStarsTypeID is TL type id of MessageGiftedStars. +const MessageGiftedStarsTypeID = 0x41bdbea7 + +// construct implements constructor of MessageContentClass. +func (m MessageGiftedStars) construct() MessageContentClass { return &m } + +// Ensuring interfaces in compile-time for MessageGiftedStars. +var ( + _ bin.Encoder = &MessageGiftedStars{} + _ bin.Decoder = &MessageGiftedStars{} + _ bin.BareEncoder = &MessageGiftedStars{} + _ bin.BareDecoder = &MessageGiftedStars{} + + _ MessageContentClass = &MessageGiftedStars{} +) + +func (m *MessageGiftedStars) Zero() bool { + if m == nil { + return true + } + if !(m.GifterUserID == 0) { + return false + } + if !(m.ReceiverUserID == 0) { + return false + } + if !(m.Currency == "") { + return false + } + if !(m.Amount == 0) { + return false + } + if !(m.Cryptocurrency == "") { + return false + } + if !(m.CryptocurrencyAmount == 0) { + return false + } + if !(m.StarCount == 0) { + return false + } + if !(m.TransactionID == "") { + return false + } + if !(m.Sticker.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageGiftedStars) String() string { + if m == nil { + return "MessageGiftedStars(nil)" + } + type Alias MessageGiftedStars + return fmt.Sprintf("MessageGiftedStars%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageGiftedStars) TypeID() uint32 { + return MessageGiftedStarsTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageGiftedStars) TypeName() string { + return "messageGiftedStars" +} + +// TypeInfo returns info about TL type. +func (m *MessageGiftedStars) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageGiftedStars", + ID: MessageGiftedStarsTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GifterUserID", + SchemaName: "gifter_user_id", + }, + { + Name: "ReceiverUserID", + SchemaName: "receiver_user_id", + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + { + Name: "Cryptocurrency", + SchemaName: "cryptocurrency", + }, + { + Name: "CryptocurrencyAmount", + SchemaName: "cryptocurrency_amount", + }, + { + Name: "StarCount", + SchemaName: "star_count", + }, + { + Name: "TransactionID", + SchemaName: "transaction_id", + }, + { + Name: "Sticker", + SchemaName: "sticker", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageGiftedStars) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageGiftedStars#41bdbea7 as nil") + } + b.PutID(MessageGiftedStarsTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageGiftedStars) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageGiftedStars#41bdbea7 as nil") + } + b.PutInt53(m.GifterUserID) + b.PutInt53(m.ReceiverUserID) + b.PutString(m.Currency) + b.PutInt53(m.Amount) + b.PutString(m.Cryptocurrency) + b.PutLong(m.CryptocurrencyAmount) + b.PutInt53(m.StarCount) + b.PutString(m.TransactionID) + if err := m.Sticker.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageGiftedStars#41bdbea7: field sticker: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageGiftedStars) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageGiftedStars#41bdbea7 to nil") + } + if err := b.ConsumeID(MessageGiftedStarsTypeID); err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageGiftedStars) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageGiftedStars#41bdbea7 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field gifter_user_id: %w", err) + } + m.GifterUserID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field receiver_user_id: %w", err) + } + m.ReceiverUserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field currency: %w", err) + } + m.Currency = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field amount: %w", err) + } + m.Amount = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field cryptocurrency: %w", err) + } + m.Cryptocurrency = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field cryptocurrency_amount: %w", err) + } + m.CryptocurrencyAmount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field star_count: %w", err) + } + m.StarCount = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field transaction_id: %w", err) + } + m.TransactionID = value + } + { + if err := m.Sticker.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field sticker: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageGiftedStars) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageGiftedStars#41bdbea7 as nil") + } + b.ObjStart() + b.PutID("messageGiftedStars") + b.Comma() + b.FieldStart("gifter_user_id") + b.PutInt53(m.GifterUserID) + b.Comma() + b.FieldStart("receiver_user_id") + b.PutInt53(m.ReceiverUserID) + b.Comma() + b.FieldStart("currency") + b.PutString(m.Currency) + b.Comma() + b.FieldStart("amount") + b.PutInt53(m.Amount) + b.Comma() + b.FieldStart("cryptocurrency") + b.PutString(m.Cryptocurrency) + b.Comma() + b.FieldStart("cryptocurrency_amount") + b.PutLong(m.CryptocurrencyAmount) + b.Comma() + b.FieldStart("star_count") + b.PutInt53(m.StarCount) + b.Comma() + b.FieldStart("transaction_id") + b.PutString(m.TransactionID) + b.Comma() + b.FieldStart("sticker") + if err := m.Sticker.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode messageGiftedStars#41bdbea7: field sticker: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageGiftedStars) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageGiftedStars#41bdbea7 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageGiftedStars"); err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: %w", err) + } + case "gifter_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field gifter_user_id: %w", err) + } + m.GifterUserID = value + case "receiver_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field receiver_user_id: %w", err) + } + m.ReceiverUserID = value + case "currency": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field currency: %w", err) + } + m.Currency = value + case "amount": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field amount: %w", err) + } + m.Amount = value + case "cryptocurrency": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field cryptocurrency: %w", err) + } + m.Cryptocurrency = value + case "cryptocurrency_amount": + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field cryptocurrency_amount: %w", err) + } + m.CryptocurrencyAmount = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field star_count: %w", err) + } + m.StarCount = value + case "transaction_id": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field transaction_id: %w", err) + } + m.TransactionID = value + case "sticker": + if err := m.Sticker.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field sticker: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetGifterUserID returns value of GifterUserID field. +func (m *MessageGiftedStars) GetGifterUserID() (value int64) { + if m == nil { + return + } + return m.GifterUserID +} + +// GetReceiverUserID returns value of ReceiverUserID field. +func (m *MessageGiftedStars) GetReceiverUserID() (value int64) { + if m == nil { + return + } + return m.ReceiverUserID +} + +// GetCurrency returns value of Currency field. +func (m *MessageGiftedStars) GetCurrency() (value string) { + if m == nil { + return + } + return m.Currency +} + +// GetAmount returns value of Amount field. +func (m *MessageGiftedStars) GetAmount() (value int64) { + if m == nil { + return + } + return m.Amount +} + +// GetCryptocurrency returns value of Cryptocurrency field. +func (m *MessageGiftedStars) GetCryptocurrency() (value string) { + if m == nil { + return + } + return m.Cryptocurrency +} + +// GetCryptocurrencyAmount returns value of CryptocurrencyAmount field. +func (m *MessageGiftedStars) GetCryptocurrencyAmount() (value int64) { + if m == nil { + return + } + return m.CryptocurrencyAmount +} + +// GetStarCount returns value of StarCount field. +func (m *MessageGiftedStars) GetStarCount() (value int64) { + if m == nil { + return + } + return m.StarCount +} + +// GetTransactionID returns value of TransactionID field. +func (m *MessageGiftedStars) GetTransactionID() (value string) { + if m == nil { + return + } + return m.TransactionID +} + +// GetSticker returns value of Sticker field. +func (m *MessageGiftedStars) GetSticker() (value Sticker) { + if m == nil { + return + } + return m.Sticker +} + // MessageContactRegistered represents TL type `messageContactRegistered#a678fcff`. type MessageContactRegistered struct { } @@ -15649,12 +16123,13 @@ const MessageContentClassName = "MessageContent" // case *tdapi.MessagePaymentSuccessful: // messagePaymentSuccessful#53d93cdc // case *tdapi.MessagePaymentSuccessfulBot: // messagePaymentSuccessfulBot#68e13eb9 // case *tdapi.MessagePaymentRefunded: // messagePaymentRefunded#11bcb8f3 -// case *tdapi.MessageGiftedPremium: // messageGiftedPremium#78d1d0a +// case *tdapi.MessageGiftedPremium: // messageGiftedPremium#30dd808e // case *tdapi.MessagePremiumGiftCode: // messagePremiumGiftCode#26bd1bf3 // case *tdapi.MessagePremiumGiveawayCreated: // messagePremiumGiveawayCreated#270f2c44 // case *tdapi.MessagePremiumGiveaway: // messagePremiumGiveaway#4aa0d0b0 // case *tdapi.MessagePremiumGiveawayCompleted: // messagePremiumGiveawayCompleted#80533949 // case *tdapi.MessagePremiumGiveawayWinners: // messagePremiumGiveawayWinners#815d5f31 +// case *tdapi.MessageGiftedStars: // messageGiftedStars#41bdbea7 // case *tdapi.MessageContactRegistered: // messageContactRegistered#a678fcff // case *tdapi.MessageUsersShared: // messageUsersShared#7f1f4a22 // case *tdapi.MessageChatShared: // messageChatShared#aec6d961 @@ -16082,7 +16557,7 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { } return &v, nil case MessageGiftedPremiumTypeID: - // Decoding messageGiftedPremium#78d1d0a. + // Decoding messageGiftedPremium#30dd808e. v := MessageGiftedPremium{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) @@ -16123,6 +16598,13 @@ func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case MessageGiftedStarsTypeID: + // Decoding messageGiftedStars#41bdbea7. + v := MessageGiftedStars{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case MessageContactRegisteredTypeID: // Decoding messageContactRegistered#a678fcff. v := MessageContactRegistered{} @@ -16591,7 +17073,7 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err } return &v, nil case "messageGiftedPremium": - // Decoding messageGiftedPremium#78d1d0a. + // Decoding messageGiftedPremium#30dd808e. v := MessageGiftedPremium{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) @@ -16632,6 +17114,13 @@ func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, err return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) } return &v, nil + case "messageGiftedStars": + // Decoding messageGiftedStars#41bdbea7. + v := MessageGiftedStars{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) + } + return &v, nil case "messageContactRegistered": // Decoding messageContactRegistered#a678fcff. v := MessageContactRegistered{} diff --git a/tdapi/tl_message_gen.go b/tdapi/tl_message_gen.go index db03d3abb8..f603e8ddb0 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#bdf0da63`. +// Message represents TL type `message#dc764ddc`. type Message struct { // Message identifier; unique for the chat to which the message belongs ID int64 @@ -51,38 +51,8 @@ type Message struct { // True, if the message was sent because of a scheduled action by the message sender, for // example, as away, or greeting service message IsFromOffline bool - // True, if the message can be edited. For live location and poll messages this fields - // shows whether editMessageLiveLocation or stopPoll can be used with this message by the - // application - CanBeEdited bool - // True, if the message can be forwarded - CanBeForwarded bool - // True, if the message can be replied in another chat or topic - CanBeRepliedInAnotherChat bool // True, if content of the message can be saved locally or copied CanBeSaved bool - // True, if the message can be deleted only for the current user while other users will - // continue to see it - CanBeDeletedOnlyForSelf bool - // True, if the message can be deleted for all users - CanBeDeletedForAllUsers bool - // 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 information about the message thread is available through getMessageThread - // and getMessageThreadHistory - CanGetMessageThread bool - // True, if read date of the message can be received through getMessageReadDate - CanGetReadDate 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 link preview description through getMessageLink - CanGetMediaTimestampLinks bool - // True, if reactions on the message can be reported through reportMessageReactions - CanReportReactions bool // True, if media timestamp entities refers to a media in this message as opposed to a // media in the replied message HasTimestampedMedia bool @@ -150,7 +120,7 @@ type Message struct { } // MessageTypeID is TL type id of Message. -const MessageTypeID = 0xbdf0da63 +const MessageTypeID = 0xdc764ddc // Ensuring interfaces in compile-time for Message. var ( @@ -188,45 +158,9 @@ func (m *Message) Zero() bool { if !(m.IsFromOffline == false) { return false } - if !(m.CanBeEdited == false) { - return false - } - if !(m.CanBeForwarded == false) { - return false - } - if !(m.CanBeRepliedInAnotherChat == false) { - return false - } if !(m.CanBeSaved == false) { return false } - if !(m.CanBeDeletedOnlyForSelf == false) { - return false - } - if !(m.CanBeDeletedForAllUsers == false) { - return false - } - if !(m.CanGetAddedReactions == false) { - return false - } - if !(m.CanGetStatistics == false) { - return false - } - if !(m.CanGetMessageThread == false) { - return false - } - if !(m.CanGetReadDate == false) { - return false - } - if !(m.CanGetViewers == false) { - return false - } - if !(m.CanGetMediaTimestampLinks == false) { - return false - } - if !(m.CanReportReactions == false) { - return false - } if !(m.HasTimestampedMedia == false) { return false } @@ -373,58 +307,10 @@ func (m *Message) TypeInfo() tdp.Type { Name: "IsFromOffline", SchemaName: "is_from_offline", }, - { - Name: "CanBeEdited", - SchemaName: "can_be_edited", - }, - { - Name: "CanBeForwarded", - SchemaName: "can_be_forwarded", - }, - { - Name: "CanBeRepliedInAnotherChat", - SchemaName: "can_be_replied_in_another_chat", - }, { Name: "CanBeSaved", SchemaName: "can_be_saved", }, - { - Name: "CanBeDeletedOnlyForSelf", - SchemaName: "can_be_deleted_only_for_self", - }, - { - Name: "CanBeDeletedForAllUsers", - SchemaName: "can_be_deleted_for_all_users", - }, - { - Name: "CanGetAddedReactions", - SchemaName: "can_get_added_reactions", - }, - { - Name: "CanGetStatistics", - SchemaName: "can_get_statistics", - }, - { - Name: "CanGetMessageThread", - SchemaName: "can_get_message_thread", - }, - { - Name: "CanGetReadDate", - SchemaName: "can_get_read_date", - }, - { - Name: "CanGetViewers", - SchemaName: "can_get_viewers", - }, - { - Name: "CanGetMediaTimestampLinks", - SchemaName: "can_get_media_timestamp_links", - }, - { - Name: "CanReportReactions", - SchemaName: "can_report_reactions", - }, { Name: "HasTimestampedMedia", SchemaName: "has_timestamped_media", @@ -536,7 +422,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#bdf0da63 as nil") + return fmt.Errorf("can't encode message#dc764ddc as nil") } b.PutID(MessageTypeID) return m.EncodeBare(b) @@ -545,44 +431,32 @@ 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#bdf0da63 as nil") + return fmt.Errorf("can't encode message#dc764ddc as nil") } b.PutInt53(m.ID) if m.SenderID == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field sender_id is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field sender_id is nil") } if err := m.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field sender_id: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field sender_id: %w", err) } b.PutInt53(m.ChatID) if m.SendingState == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field sending_state is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field sending_state is nil") } if err := m.SendingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field sending_state: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field sending_state: %w", err) } if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field scheduling_state is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field scheduling_state is nil") } if err := m.SchedulingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field scheduling_state: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field scheduling_state: %w", err) } b.PutBool(m.IsOutgoing) b.PutBool(m.IsPinned) b.PutBool(m.IsFromOffline) - b.PutBool(m.CanBeEdited) - b.PutBool(m.CanBeForwarded) - b.PutBool(m.CanBeRepliedInAnotherChat) 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.CanGetReadDate) - b.PutBool(m.CanGetViewers) - b.PutBool(m.CanGetMediaTimestampLinks) - b.PutBool(m.CanReportReactions) b.PutBool(m.HasTimestampedMedia) b.PutBool(m.IsChannelPost) b.PutBool(m.IsTopicMessage) @@ -590,36 +464,36 @@ 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#bdf0da63: field forward_info: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field forward_info: %w", err) } if err := m.ImportInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field import_info: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field import_info: %w", err) } if err := m.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field interaction_info: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: 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#bdf0da63: field unread_reactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode bare message#dc764ddc: field unread_reactions element with index %d: %w", idx, err) } } if err := m.FactCheck.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field fact_check: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field fact_check: %w", err) } if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field reply_to is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field reply_to is nil") } if err := m.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field reply_to: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field reply_to: %w", err) } b.PutInt53(m.MessageThreadID) b.PutInt53(m.SavedMessagesTopicID) if m.SelfDestructType == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field self_destruct_type is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field self_destruct_type is nil") } if err := m.SelfDestructType.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field self_destruct_type: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field self_destruct_type: %w", err) } b.PutDouble(m.SelfDestructIn) b.PutDouble(m.AutoDeleteIn) @@ -631,16 +505,16 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { b.PutLong(m.EffectID) b.PutString(m.RestrictionReason) if m.Content == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field content is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field content is nil") } if err := m.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field content: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field content: %w", err) } if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field reply_markup is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field reply_markup is nil") } if err := m.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field reply_markup: %w", err) } return nil } @@ -648,10 +522,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#bdf0da63 to nil") + return fmt.Errorf("can't decode message#dc764ddc to nil") } if err := b.ConsumeID(MessageTypeID); err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: %w", err) } return m.DecodeBare(b) } @@ -659,216 +533,132 @@ 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#bdf0da63 to nil") + return fmt.Errorf("can't decode message#dc764ddc to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field id: %w", err) } m.ID = value } { value, err := DecodeMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field sender_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field sender_id: %w", err) } m.SenderID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field chat_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field chat_id: %w", err) } m.ChatID = value } { value, err := DecodeMessageSendingState(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field sending_state: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field sending_state: %w", err) } m.SendingState = value } { value, err := DecodeMessageSchedulingState(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field scheduling_state: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field scheduling_state: %w", err) } m.SchedulingState = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field is_outgoing: %w", err) } m.IsOutgoing = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field is_pinned: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field is_pinned: %w", err) } m.IsPinned = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field is_from_offline: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field is_from_offline: %w", err) } m.IsFromOffline = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_be_edited: %w", err) - } - m.CanBeEdited = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_be_forwarded: %w", err) - } - m.CanBeForwarded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_be_replied_in_another_chat: %w", err) - } - m.CanBeRepliedInAnotherChat = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field can_be_saved: %w", err) } m.CanBeSaved = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: 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#bdf0da63: 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#bdf0da63: field can_get_added_reactions: %w", err) - } - m.CanGetAddedReactions = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_get_statistics: %w", err) - } - m.CanGetStatistics = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_get_message_thread: %w", err) - } - m.CanGetMessageThread = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_get_read_date: %w", err) - } - m.CanGetReadDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_get_viewers: %w", err) - } - m.CanGetViewers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: 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#bdf0da63: field can_report_reactions: %w", err) - } - m.CanReportReactions = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field has_timestamped_media: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field has_timestamped_media: %w", err) } m.HasTimestampedMedia = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field is_channel_post: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field is_channel_post: %w", err) } m.IsChannelPost = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field is_topic_message: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field is_topic_message: %w", err) } m.IsTopicMessage = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field contains_unread_mention: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field contains_unread_mention: %w", err) } m.ContainsUnreadMention = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field date: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field date: %w", err) } m.Date = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field edit_date: %w", err) } m.EditDate = value } { if err := m.ForwardInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field forward_info: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field forward_info: %w", err) } } { if err := m.ImportInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field import_info: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field import_info: %w", err) } } { if err := m.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field interaction_info: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field interaction_info: %w", err) } } { headerLen, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field unread_reactions: %w", err) } if headerLen > 0 { @@ -877,118 +667,118 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value UnreadReaction if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare message#bdf0da63: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode bare message#dc764ddc: field unread_reactions: %w", err) } m.UnreadReactions = append(m.UnreadReactions, value) } } { if err := m.FactCheck.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field fact_check: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field fact_check: %w", err) } } { value, err := DecodeMessageReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field reply_to: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field reply_to: %w", err) } m.ReplyTo = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field message_thread_id: %w", err) } m.MessageThreadID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field saved_messages_topic_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field saved_messages_topic_id: %w", err) } m.SavedMessagesTopicID = value } { value, err := DecodeMessageSelfDestructType(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field self_destruct_type: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field self_destruct_type: %w", err) } m.SelfDestructType = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field self_destruct_in: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field self_destruct_in: %w", err) } m.SelfDestructIn = value } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field auto_delete_in: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field auto_delete_in: %w", err) } m.AutoDeleteIn = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field via_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field via_bot_user_id: %w", err) } m.ViaBotUserID = value } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field sender_business_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field sender_business_bot_user_id: %w", err) } m.SenderBusinessBotUserID = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field sender_boost_count: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field sender_boost_count: %w", err) } m.SenderBoostCount = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field author_signature: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field author_signature: %w", err) } m.AuthorSignature = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field media_album_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field media_album_id: %w", err) } m.MediaAlbumID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field effect_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field effect_id: %w", err) } m.EffectID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field restriction_reason: %w", err) } m.RestrictionReason = value } { value, err := DecodeMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field content: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field content: %w", err) } m.Content = value } { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field reply_markup: %w", err) } m.ReplyMarkup = value } @@ -998,7 +788,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#bdf0da63 as nil") + return fmt.Errorf("can't encode message#dc764ddc as nil") } b.ObjStart() b.PutID("message") @@ -1008,10 +798,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#bdf0da63: field sender_id is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field sender_id is nil") } if err := m.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field sender_id: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field sender_id: %w", err) } b.Comma() b.FieldStart("chat_id") @@ -1019,18 +809,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#bdf0da63: field sending_state is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field sending_state is nil") } if err := m.SendingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field sending_state: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field sending_state: %w", err) } b.Comma() b.FieldStart("scheduling_state") if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field scheduling_state is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field scheduling_state is nil") } if err := m.SchedulingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field scheduling_state: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field scheduling_state: %w", err) } b.Comma() b.FieldStart("is_outgoing") @@ -1042,45 +832,9 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("is_from_offline") b.PutBool(m.IsFromOffline) b.Comma() - b.FieldStart("can_be_edited") - b.PutBool(m.CanBeEdited) - b.Comma() - b.FieldStart("can_be_forwarded") - b.PutBool(m.CanBeForwarded) - b.Comma() - b.FieldStart("can_be_replied_in_another_chat") - b.PutBool(m.CanBeRepliedInAnotherChat) - b.Comma() b.FieldStart("can_be_saved") b.PutBool(m.CanBeSaved) b.Comma() - b.FieldStart("can_be_deleted_only_for_self") - b.PutBool(m.CanBeDeletedOnlyForSelf) - b.Comma() - 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() - b.FieldStart("can_get_message_thread") - b.PutBool(m.CanGetMessageThread) - b.Comma() - b.FieldStart("can_get_read_date") - b.PutBool(m.CanGetReadDate) - b.Comma() - b.FieldStart("can_get_viewers") - b.PutBool(m.CanGetViewers) - b.Comma() - b.FieldStart("can_get_media_timestamp_links") - b.PutBool(m.CanGetMediaTimestampLinks) - b.Comma() - b.FieldStart("can_report_reactions") - b.PutBool(m.CanReportReactions) - b.Comma() b.FieldStart("has_timestamped_media") b.PutBool(m.HasTimestampedMedia) b.Comma() @@ -1101,24 +855,24 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("forward_info") if err := m.ForwardInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field forward_info: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field forward_info: %w", err) } b.Comma() b.FieldStart("import_info") if err := m.ImportInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field import_info: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field import_info: %w", err) } b.Comma() b.FieldStart("interaction_info") if err := m.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field interaction_info: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: 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#bdf0da63: field unread_reactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode message#dc764ddc: field unread_reactions element with index %d: %w", idx, err) } b.Comma() } @@ -1127,15 +881,15 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("fact_check") if err := m.FactCheck.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field fact_check: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field fact_check: %w", err) } b.Comma() b.FieldStart("reply_to") if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field reply_to is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field reply_to is nil") } if err := m.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field reply_to: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field reply_to: %w", err) } b.Comma() b.FieldStart("message_thread_id") @@ -1146,10 +900,10 @@ func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("self_destruct_type") if m.SelfDestructType == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field self_destruct_type is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field self_destruct_type is nil") } if err := m.SelfDestructType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field self_destruct_type: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field self_destruct_type: %w", err) } b.Comma() b.FieldStart("self_destruct_in") @@ -1181,18 +935,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#bdf0da63: field content is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field content is nil") } if err := m.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field content: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field content: %w", err) } b.Comma() b.FieldStart("reply_markup") if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#bdf0da63: field reply_markup is nil") + return fmt.Errorf("unable to encode message#dc764ddc: field reply_markup is nil") } if err := m.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#bdf0da63: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#dc764ddc: field reply_markup: %w", err) } b.Comma() b.StripComma() @@ -1203,292 +957,220 @@ 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#bdf0da63 to nil") + return fmt.Errorf("can't decode message#dc764ddc 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#bdf0da63: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: %w", err) } case "id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field id: %w", err) } m.ID = value case "sender_id": value, err := DecodeTDLibJSONMessageSender(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field sender_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field chat_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field sending_state: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field scheduling_state: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field is_outgoing: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field is_pinned: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field is_pinned: %w", err) } m.IsPinned = value case "is_from_offline": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field is_from_offline: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field is_from_offline: %w", err) } m.IsFromOffline = value - case "can_be_edited": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: 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#bdf0da63: field can_be_forwarded: %w", err) - } - m.CanBeForwarded = value - case "can_be_replied_in_another_chat": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_be_replied_in_another_chat: %w", err) - } - m.CanBeRepliedInAnotherChat = value case "can_be_saved": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_be_saved: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: 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#bdf0da63: 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#bdf0da63: 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#bdf0da63: 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#bdf0da63: field can_get_message_thread: %w", err) - } - m.CanGetMessageThread = value - case "can_get_read_date": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_get_read_date: %w", err) - } - m.CanGetReadDate = value - case "can_get_viewers": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: 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#bdf0da63: field can_get_media_timestamp_links: %w", err) - } - m.CanGetMediaTimestampLinks = value - case "can_report_reactions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field can_report_reactions: %w", err) - } - m.CanReportReactions = value case "has_timestamped_media": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field has_timestamped_media: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field is_channel_post: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field is_channel_post: %w", err) } m.IsChannelPost = value case "is_topic_message": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field is_topic_message: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field is_topic_message: %w", err) } m.IsTopicMessage = value case "contains_unread_mention": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field contains_unread_mention: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field date: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field date: %w", err) } m.Date = value case "edit_date": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field forward_info: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field forward_info: %w", err) } case "import_info": if err := m.ImportInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field import_info: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field import_info: %w", err) } case "interaction_info": if err := m.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field interaction_info: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field unread_reactions: %w", err) } m.UnreadReactions = append(m.UnreadReactions, value) return nil }); err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field unread_reactions: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field unread_reactions: %w", err) } case "fact_check": if err := m.FactCheck.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field fact_check: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field fact_check: %w", err) } case "reply_to": value, err := DecodeTDLibJSONMessageReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field reply_to: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field reply_to: %w", err) } m.ReplyTo = value case "message_thread_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field message_thread_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field message_thread_id: %w", err) } m.MessageThreadID = value case "saved_messages_topic_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field saved_messages_topic_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field saved_messages_topic_id: %w", err) } m.SavedMessagesTopicID = value case "self_destruct_type": value, err := DecodeTDLibJSONMessageSelfDestructType(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field self_destruct_type: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field self_destruct_type: %w", err) } m.SelfDestructType = value case "self_destruct_in": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field self_destruct_in: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field self_destruct_in: %w", err) } m.SelfDestructIn = value case "auto_delete_in": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field auto_delete_in: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field auto_delete_in: %w", err) } m.AutoDeleteIn = value case "via_bot_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field via_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field via_bot_user_id: %w", err) } m.ViaBotUserID = value case "sender_business_bot_user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field sender_business_bot_user_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field sender_business_bot_user_id: %w", err) } m.SenderBusinessBotUserID = value case "sender_boost_count": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field sender_boost_count: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field sender_boost_count: %w", err) } m.SenderBoostCount = value case "author_signature": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field author_signature: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: 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#bdf0da63: field media_album_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field media_album_id: %w", err) } m.MediaAlbumID = value case "effect_id": value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field effect_id: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field effect_id: %w", err) } m.EffectID = value case "restriction_reason": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field restriction_reason: %w", err) } m.RestrictionReason = value case "content": value, err := DecodeTDLibJSONMessageContent(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field content: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field content: %w", err) } m.Content = value case "reply_markup": value, err := DecodeTDLibJSONReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#bdf0da63: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#dc764ddc: field reply_markup: %w", err) } m.ReplyMarkup = value default: @@ -1562,30 +1244,6 @@ func (m *Message) GetIsFromOffline() (value bool) { return m.IsFromOffline } -// GetCanBeEdited returns value of CanBeEdited field. -func (m *Message) GetCanBeEdited() (value bool) { - if m == nil { - return - } - return m.CanBeEdited -} - -// GetCanBeForwarded returns value of CanBeForwarded field. -func (m *Message) GetCanBeForwarded() (value bool) { - if m == nil { - return - } - return m.CanBeForwarded -} - -// GetCanBeRepliedInAnotherChat returns value of CanBeRepliedInAnotherChat field. -func (m *Message) GetCanBeRepliedInAnotherChat() (value bool) { - if m == nil { - return - } - return m.CanBeRepliedInAnotherChat -} - // GetCanBeSaved returns value of CanBeSaved field. func (m *Message) GetCanBeSaved() (value bool) { if m == nil { @@ -1594,78 +1252,6 @@ func (m *Message) GetCanBeSaved() (value bool) { return m.CanBeSaved } -// GetCanBeDeletedOnlyForSelf returns value of CanBeDeletedOnlyForSelf field. -func (m *Message) GetCanBeDeletedOnlyForSelf() (value bool) { - if m == nil { - return - } - return m.CanBeDeletedOnlyForSelf -} - -// GetCanBeDeletedForAllUsers returns value of CanBeDeletedForAllUsers field. -func (m *Message) GetCanBeDeletedForAllUsers() (value bool) { - if m == nil { - return - } - 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 { - return - } - return m.CanGetStatistics -} - -// GetCanGetMessageThread returns value of CanGetMessageThread field. -func (m *Message) GetCanGetMessageThread() (value bool) { - if m == nil { - return - } - return m.CanGetMessageThread -} - -// GetCanGetReadDate returns value of CanGetReadDate field. -func (m *Message) GetCanGetReadDate() (value bool) { - if m == nil { - return - } - return m.CanGetReadDate -} - -// GetCanGetViewers returns value of CanGetViewers field. -func (m *Message) GetCanGetViewers() (value bool) { - if m == nil { - return - } - return m.CanGetViewers -} - -// GetCanGetMediaTimestampLinks returns value of CanGetMediaTimestampLinks field. -func (m *Message) GetCanGetMediaTimestampLinks() (value bool) { - if m == nil { - return - } - return m.CanGetMediaTimestampLinks -} - -// GetCanReportReactions returns value of CanReportReactions field. -func (m *Message) GetCanReportReactions() (value bool) { - if m == nil { - return - } - return m.CanReportReactions -} - // GetHasTimestampedMedia returns value of HasTimestampedMedia field. func (m *Message) GetHasTimestampedMedia() (value bool) { if m == nil { diff --git a/tdapi/tl_message_properties_gen.go b/tdapi/tl_message_properties_gen.go new file mode 100644 index 0000000000..4837e6b4b7 --- /dev/null +++ b/tdapi/tl_message_properties_gen.go @@ -0,0 +1,1020 @@ +// 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{} +) + +// MessageProperties represents TL type `messageProperties#5ae4cb28`. +type MessageProperties struct { + // True, if the message can be deleted only for the current user while other users will + // continue to see it using the method deleteMessages with revoke == false + CanBeDeletedOnlyForSelf bool + // True, if the message can be deleted for all users using the method deleteMessages with + // revoke == true + CanBeDeletedForAllUsers bool + // True, if the message can be edited using the methods editMessageText, editMessageMedia + // editMessageCaption, or editMessageReplyMarkup. + CanBeEdited bool + // True, if the message can be forwarded using inputMessageForwarded or forwardMessages + CanBeForwarded bool + // True, if the message can be paid using inputInvoiceMessage + CanBePaid bool + // True, if the message can be pinned or unpinned in the chat using pinChatMessage or + // unpinChatMessage + CanBePinned bool + // True, if the message can be replied in the same chat and forum topic using + // inputMessageReplyToMessage + CanBeReplied bool + // True, if the message can be replied in another chat or forum topic using + // inputMessageReplyToExternalMessage + CanBeRepliedInAnotherChat bool + // True, if content of the message can be saved locally or copied using + // inputMessageForwarded or forwardMessages with copy options + CanBeSaved bool + // True, if the message can be shared in a story using inputStoryAreaTypeMessage + CanBeSharedInStory bool + // True, if scheduling state of the message can be edited + CanEditSchedulingState bool + // True, if the list of added reactions is available using getMessageAddedReactions + CanGetAddedReactions bool + // True, if code for message embedding can be received using getMessageEmbeddingCode + CanGetEmbeddingCode bool + // True, if a link can be generated for the message using getMessageLink + CanGetLink bool + // True, if media timestamp links can be generated for media timestamp entities in the + // message text, caption or link preview description using getMessageLink + CanGetMediaTimestampLinks bool + // True, if information about the message thread is available through getMessageThread + // and getMessageThreadHistory + CanGetMessageThread bool + // True, if read date of the message can be received through getMessageReadDate + CanGetReadDate bool + // True, if message statistics are available through getMessageStatistics and message + // forwards can be received using getMessagePublicForwards + CanGetStatistics bool + // True, if chat members already viewed the message can be received through + // getMessageViewers + CanGetViewers bool + // True, if speech can be recognized for the message through recognizeSpeech + CanRecognizeSpeech bool + // True, if the message can be reported using reportChat + CanReportChat bool + // True, if reactions on the message can be reported through reportMessageReactions + CanReportReactions bool + // True, if the message can be reported using reportSupergroupSpam + CanReportSupergroupSpam bool + // True, if fact check for the message can be changed through setMessageFactCheck + CanSetFactCheck bool + // True, if message statistics must be available from context menu of the message + NeedShowStatistics bool +} + +// MessagePropertiesTypeID is TL type id of MessageProperties. +const MessagePropertiesTypeID = 0x5ae4cb28 + +// Ensuring interfaces in compile-time for MessageProperties. +var ( + _ bin.Encoder = &MessageProperties{} + _ bin.Decoder = &MessageProperties{} + _ bin.BareEncoder = &MessageProperties{} + _ bin.BareDecoder = &MessageProperties{} +) + +func (m *MessageProperties) Zero() bool { + if m == nil { + return true + } + if !(m.CanBeDeletedOnlyForSelf == false) { + return false + } + if !(m.CanBeDeletedForAllUsers == false) { + return false + } + if !(m.CanBeEdited == false) { + return false + } + if !(m.CanBeForwarded == false) { + return false + } + if !(m.CanBePaid == false) { + return false + } + if !(m.CanBePinned == false) { + return false + } + if !(m.CanBeReplied == false) { + return false + } + if !(m.CanBeRepliedInAnotherChat == false) { + return false + } + if !(m.CanBeSaved == false) { + return false + } + if !(m.CanBeSharedInStory == false) { + return false + } + if !(m.CanEditSchedulingState == false) { + return false + } + if !(m.CanGetAddedReactions == false) { + return false + } + if !(m.CanGetEmbeddingCode == false) { + return false + } + if !(m.CanGetLink == false) { + return false + } + if !(m.CanGetMediaTimestampLinks == false) { + return false + } + if !(m.CanGetMessageThread == false) { + return false + } + if !(m.CanGetReadDate == false) { + return false + } + if !(m.CanGetStatistics == false) { + return false + } + if !(m.CanGetViewers == false) { + return false + } + if !(m.CanRecognizeSpeech == false) { + return false + } + if !(m.CanReportChat == false) { + return false + } + if !(m.CanReportReactions == false) { + return false + } + if !(m.CanReportSupergroupSpam == false) { + return false + } + if !(m.CanSetFactCheck == false) { + return false + } + if !(m.NeedShowStatistics == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageProperties) String() string { + if m == nil { + return "MessageProperties(nil)" + } + type Alias MessageProperties + return fmt.Sprintf("MessageProperties%+v", Alias(*m)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageProperties) TypeID() uint32 { + return MessagePropertiesTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageProperties) TypeName() string { + return "messageProperties" +} + +// TypeInfo returns info about TL type. +func (m *MessageProperties) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageProperties", + ID: MessagePropertiesTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CanBeDeletedOnlyForSelf", + SchemaName: "can_be_deleted_only_for_self", + }, + { + Name: "CanBeDeletedForAllUsers", + SchemaName: "can_be_deleted_for_all_users", + }, + { + Name: "CanBeEdited", + SchemaName: "can_be_edited", + }, + { + Name: "CanBeForwarded", + SchemaName: "can_be_forwarded", + }, + { + Name: "CanBePaid", + SchemaName: "can_be_paid", + }, + { + Name: "CanBePinned", + SchemaName: "can_be_pinned", + }, + { + Name: "CanBeReplied", + SchemaName: "can_be_replied", + }, + { + Name: "CanBeRepliedInAnotherChat", + SchemaName: "can_be_replied_in_another_chat", + }, + { + Name: "CanBeSaved", + SchemaName: "can_be_saved", + }, + { + Name: "CanBeSharedInStory", + SchemaName: "can_be_shared_in_story", + }, + { + Name: "CanEditSchedulingState", + SchemaName: "can_edit_scheduling_state", + }, + { + Name: "CanGetAddedReactions", + SchemaName: "can_get_added_reactions", + }, + { + Name: "CanGetEmbeddingCode", + SchemaName: "can_get_embedding_code", + }, + { + Name: "CanGetLink", + SchemaName: "can_get_link", + }, + { + Name: "CanGetMediaTimestampLinks", + SchemaName: "can_get_media_timestamp_links", + }, + { + Name: "CanGetMessageThread", + SchemaName: "can_get_message_thread", + }, + { + Name: "CanGetReadDate", + SchemaName: "can_get_read_date", + }, + { + Name: "CanGetStatistics", + SchemaName: "can_get_statistics", + }, + { + Name: "CanGetViewers", + SchemaName: "can_get_viewers", + }, + { + Name: "CanRecognizeSpeech", + SchemaName: "can_recognize_speech", + }, + { + Name: "CanReportChat", + SchemaName: "can_report_chat", + }, + { + Name: "CanReportReactions", + SchemaName: "can_report_reactions", + }, + { + Name: "CanReportSupergroupSpam", + SchemaName: "can_report_supergroup_spam", + }, + { + Name: "CanSetFactCheck", + SchemaName: "can_set_fact_check", + }, + { + Name: "NeedShowStatistics", + SchemaName: "need_show_statistics", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageProperties) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageProperties#5ae4cb28 as nil") + } + b.PutID(MessagePropertiesTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageProperties) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageProperties#5ae4cb28 as nil") + } + b.PutBool(m.CanBeDeletedOnlyForSelf) + b.PutBool(m.CanBeDeletedForAllUsers) + b.PutBool(m.CanBeEdited) + b.PutBool(m.CanBeForwarded) + b.PutBool(m.CanBePaid) + b.PutBool(m.CanBePinned) + b.PutBool(m.CanBeReplied) + b.PutBool(m.CanBeRepliedInAnotherChat) + b.PutBool(m.CanBeSaved) + b.PutBool(m.CanBeSharedInStory) + b.PutBool(m.CanEditSchedulingState) + b.PutBool(m.CanGetAddedReactions) + b.PutBool(m.CanGetEmbeddingCode) + b.PutBool(m.CanGetLink) + b.PutBool(m.CanGetMediaTimestampLinks) + b.PutBool(m.CanGetMessageThread) + b.PutBool(m.CanGetReadDate) + b.PutBool(m.CanGetStatistics) + b.PutBool(m.CanGetViewers) + b.PutBool(m.CanRecognizeSpeech) + b.PutBool(m.CanReportChat) + b.PutBool(m.CanReportReactions) + b.PutBool(m.CanReportSupergroupSpam) + b.PutBool(m.CanSetFactCheck) + b.PutBool(m.NeedShowStatistics) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageProperties) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageProperties#5ae4cb28 to nil") + } + if err := b.ConsumeID(MessagePropertiesTypeID); err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageProperties) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageProperties#5ae4cb28 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: 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 messageProperties#5ae4cb28: 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 messageProperties#5ae4cb28: field can_be_edited: %w", err) + } + m.CanBeEdited = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_forwarded: %w", err) + } + m.CanBeForwarded = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_paid: %w", err) + } + m.CanBePaid = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_pinned: %w", err) + } + m.CanBePinned = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_replied: %w", err) + } + m.CanBeReplied = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_replied_in_another_chat: %w", err) + } + m.CanBeRepliedInAnotherChat = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_saved: %w", err) + } + m.CanBeSaved = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_shared_in_story: %w", err) + } + m.CanBeSharedInStory = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_edit_scheduling_state: %w", err) + } + m.CanEditSchedulingState = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_added_reactions: %w", err) + } + m.CanGetAddedReactions = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_embedding_code: %w", err) + } + m.CanGetEmbeddingCode = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_link: %w", err) + } + m.CanGetLink = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_media_timestamp_links: %w", err) + } + m.CanGetMediaTimestampLinks = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_message_thread: %w", err) + } + m.CanGetMessageThread = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_read_date: %w", err) + } + m.CanGetReadDate = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_statistics: %w", err) + } + m.CanGetStatistics = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_viewers: %w", err) + } + m.CanGetViewers = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_recognize_speech: %w", err) + } + m.CanRecognizeSpeech = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_report_chat: %w", err) + } + m.CanReportChat = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_report_reactions: %w", err) + } + m.CanReportReactions = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_report_supergroup_spam: %w", err) + } + m.CanReportSupergroupSpam = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_set_fact_check: %w", err) + } + m.CanSetFactCheck = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field need_show_statistics: %w", err) + } + m.NeedShowStatistics = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (m *MessageProperties) EncodeTDLibJSON(b tdjson.Encoder) error { + if m == nil { + return fmt.Errorf("can't encode messageProperties#5ae4cb28 as nil") + } + b.ObjStart() + b.PutID("messageProperties") + b.Comma() + b.FieldStart("can_be_deleted_only_for_self") + b.PutBool(m.CanBeDeletedOnlyForSelf) + b.Comma() + b.FieldStart("can_be_deleted_for_all_users") + b.PutBool(m.CanBeDeletedForAllUsers) + b.Comma() + b.FieldStart("can_be_edited") + b.PutBool(m.CanBeEdited) + b.Comma() + b.FieldStart("can_be_forwarded") + b.PutBool(m.CanBeForwarded) + b.Comma() + b.FieldStart("can_be_paid") + b.PutBool(m.CanBePaid) + b.Comma() + b.FieldStart("can_be_pinned") + b.PutBool(m.CanBePinned) + b.Comma() + b.FieldStart("can_be_replied") + b.PutBool(m.CanBeReplied) + b.Comma() + b.FieldStart("can_be_replied_in_another_chat") + b.PutBool(m.CanBeRepliedInAnotherChat) + b.Comma() + b.FieldStart("can_be_saved") + b.PutBool(m.CanBeSaved) + b.Comma() + b.FieldStart("can_be_shared_in_story") + b.PutBool(m.CanBeSharedInStory) + b.Comma() + b.FieldStart("can_edit_scheduling_state") + b.PutBool(m.CanEditSchedulingState) + b.Comma() + b.FieldStart("can_get_added_reactions") + b.PutBool(m.CanGetAddedReactions) + b.Comma() + b.FieldStart("can_get_embedding_code") + b.PutBool(m.CanGetEmbeddingCode) + b.Comma() + b.FieldStart("can_get_link") + b.PutBool(m.CanGetLink) + b.Comma() + b.FieldStart("can_get_media_timestamp_links") + b.PutBool(m.CanGetMediaTimestampLinks) + b.Comma() + b.FieldStart("can_get_message_thread") + b.PutBool(m.CanGetMessageThread) + b.Comma() + b.FieldStart("can_get_read_date") + b.PutBool(m.CanGetReadDate) + b.Comma() + b.FieldStart("can_get_statistics") + b.PutBool(m.CanGetStatistics) + b.Comma() + b.FieldStart("can_get_viewers") + b.PutBool(m.CanGetViewers) + b.Comma() + b.FieldStart("can_recognize_speech") + b.PutBool(m.CanRecognizeSpeech) + b.Comma() + b.FieldStart("can_report_chat") + b.PutBool(m.CanReportChat) + b.Comma() + b.FieldStart("can_report_reactions") + b.PutBool(m.CanReportReactions) + b.Comma() + b.FieldStart("can_report_supergroup_spam") + b.PutBool(m.CanReportSupergroupSpam) + b.Comma() + b.FieldStart("can_set_fact_check") + b.PutBool(m.CanSetFactCheck) + b.Comma() + b.FieldStart("need_show_statistics") + b.PutBool(m.NeedShowStatistics) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (m *MessageProperties) DecodeTDLibJSON(b tdjson.Decoder) error { + if m == nil { + return fmt.Errorf("can't decode messageProperties#5ae4cb28 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("messageProperties"); err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: %w", err) + } + case "can_be_deleted_only_for_self": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: 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 messageProperties#5ae4cb28: field can_be_deleted_for_all_users: %w", err) + } + m.CanBeDeletedForAllUsers = value + case "can_be_edited": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: 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 messageProperties#5ae4cb28: field can_be_forwarded: %w", err) + } + m.CanBeForwarded = value + case "can_be_paid": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_paid: %w", err) + } + m.CanBePaid = value + case "can_be_pinned": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_pinned: %w", err) + } + m.CanBePinned = value + case "can_be_replied": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_replied: %w", err) + } + m.CanBeReplied = value + case "can_be_replied_in_another_chat": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_replied_in_another_chat: %w", err) + } + m.CanBeRepliedInAnotherChat = value + case "can_be_saved": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_saved: %w", err) + } + m.CanBeSaved = value + case "can_be_shared_in_story": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_be_shared_in_story: %w", err) + } + m.CanBeSharedInStory = value + case "can_edit_scheduling_state": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_edit_scheduling_state: %w", err) + } + m.CanEditSchedulingState = value + case "can_get_added_reactions": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_added_reactions: %w", err) + } + m.CanGetAddedReactions = value + case "can_get_embedding_code": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_embedding_code: %w", err) + } + m.CanGetEmbeddingCode = value + case "can_get_link": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_link: %w", err) + } + m.CanGetLink = value + case "can_get_media_timestamp_links": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_media_timestamp_links: %w", err) + } + m.CanGetMediaTimestampLinks = value + case "can_get_message_thread": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_message_thread: %w", err) + } + m.CanGetMessageThread = value + case "can_get_read_date": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_read_date: %w", err) + } + m.CanGetReadDate = value + case "can_get_statistics": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_statistics: %w", err) + } + m.CanGetStatistics = value + case "can_get_viewers": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_get_viewers: %w", err) + } + m.CanGetViewers = value + case "can_recognize_speech": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_recognize_speech: %w", err) + } + m.CanRecognizeSpeech = value + case "can_report_chat": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_report_chat: %w", err) + } + m.CanReportChat = value + case "can_report_reactions": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_report_reactions: %w", err) + } + m.CanReportReactions = value + case "can_report_supergroup_spam": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_report_supergroup_spam: %w", err) + } + m.CanReportSupergroupSpam = value + case "can_set_fact_check": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field can_set_fact_check: %w", err) + } + m.CanSetFactCheck = value + case "need_show_statistics": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageProperties#5ae4cb28: field need_show_statistics: %w", err) + } + m.NeedShowStatistics = value + default: + return b.Skip() + } + return nil + }) +} + +// GetCanBeDeletedOnlyForSelf returns value of CanBeDeletedOnlyForSelf field. +func (m *MessageProperties) GetCanBeDeletedOnlyForSelf() (value bool) { + if m == nil { + return + } + return m.CanBeDeletedOnlyForSelf +} + +// GetCanBeDeletedForAllUsers returns value of CanBeDeletedForAllUsers field. +func (m *MessageProperties) GetCanBeDeletedForAllUsers() (value bool) { + if m == nil { + return + } + return m.CanBeDeletedForAllUsers +} + +// GetCanBeEdited returns value of CanBeEdited field. +func (m *MessageProperties) GetCanBeEdited() (value bool) { + if m == nil { + return + } + return m.CanBeEdited +} + +// GetCanBeForwarded returns value of CanBeForwarded field. +func (m *MessageProperties) GetCanBeForwarded() (value bool) { + if m == nil { + return + } + return m.CanBeForwarded +} + +// GetCanBePaid returns value of CanBePaid field. +func (m *MessageProperties) GetCanBePaid() (value bool) { + if m == nil { + return + } + return m.CanBePaid +} + +// GetCanBePinned returns value of CanBePinned field. +func (m *MessageProperties) GetCanBePinned() (value bool) { + if m == nil { + return + } + return m.CanBePinned +} + +// GetCanBeReplied returns value of CanBeReplied field. +func (m *MessageProperties) GetCanBeReplied() (value bool) { + if m == nil { + return + } + return m.CanBeReplied +} + +// GetCanBeRepliedInAnotherChat returns value of CanBeRepliedInAnotherChat field. +func (m *MessageProperties) GetCanBeRepliedInAnotherChat() (value bool) { + if m == nil { + return + } + return m.CanBeRepliedInAnotherChat +} + +// GetCanBeSaved returns value of CanBeSaved field. +func (m *MessageProperties) GetCanBeSaved() (value bool) { + if m == nil { + return + } + return m.CanBeSaved +} + +// GetCanBeSharedInStory returns value of CanBeSharedInStory field. +func (m *MessageProperties) GetCanBeSharedInStory() (value bool) { + if m == nil { + return + } + return m.CanBeSharedInStory +} + +// GetCanEditSchedulingState returns value of CanEditSchedulingState field. +func (m *MessageProperties) GetCanEditSchedulingState() (value bool) { + if m == nil { + return + } + return m.CanEditSchedulingState +} + +// GetCanGetAddedReactions returns value of CanGetAddedReactions field. +func (m *MessageProperties) GetCanGetAddedReactions() (value bool) { + if m == nil { + return + } + return m.CanGetAddedReactions +} + +// GetCanGetEmbeddingCode returns value of CanGetEmbeddingCode field. +func (m *MessageProperties) GetCanGetEmbeddingCode() (value bool) { + if m == nil { + return + } + return m.CanGetEmbeddingCode +} + +// GetCanGetLink returns value of CanGetLink field. +func (m *MessageProperties) GetCanGetLink() (value bool) { + if m == nil { + return + } + return m.CanGetLink +} + +// GetCanGetMediaTimestampLinks returns value of CanGetMediaTimestampLinks field. +func (m *MessageProperties) GetCanGetMediaTimestampLinks() (value bool) { + if m == nil { + return + } + return m.CanGetMediaTimestampLinks +} + +// GetCanGetMessageThread returns value of CanGetMessageThread field. +func (m *MessageProperties) GetCanGetMessageThread() (value bool) { + if m == nil { + return + } + return m.CanGetMessageThread +} + +// GetCanGetReadDate returns value of CanGetReadDate field. +func (m *MessageProperties) GetCanGetReadDate() (value bool) { + if m == nil { + return + } + return m.CanGetReadDate +} + +// GetCanGetStatistics returns value of CanGetStatistics field. +func (m *MessageProperties) GetCanGetStatistics() (value bool) { + if m == nil { + return + } + return m.CanGetStatistics +} + +// GetCanGetViewers returns value of CanGetViewers field. +func (m *MessageProperties) GetCanGetViewers() (value bool) { + if m == nil { + return + } + return m.CanGetViewers +} + +// GetCanRecognizeSpeech returns value of CanRecognizeSpeech field. +func (m *MessageProperties) GetCanRecognizeSpeech() (value bool) { + if m == nil { + return + } + return m.CanRecognizeSpeech +} + +// GetCanReportChat returns value of CanReportChat field. +func (m *MessageProperties) GetCanReportChat() (value bool) { + if m == nil { + return + } + return m.CanReportChat +} + +// GetCanReportReactions returns value of CanReportReactions field. +func (m *MessageProperties) GetCanReportReactions() (value bool) { + if m == nil { + return + } + return m.CanReportReactions +} + +// GetCanReportSupergroupSpam returns value of CanReportSupergroupSpam field. +func (m *MessageProperties) GetCanReportSupergroupSpam() (value bool) { + if m == nil { + return + } + return m.CanReportSupergroupSpam +} + +// GetCanSetFactCheck returns value of CanSetFactCheck field. +func (m *MessageProperties) GetCanSetFactCheck() (value bool) { + if m == nil { + return + } + return m.CanSetFactCheck +} + +// GetNeedShowStatistics returns value of NeedShowStatistics field. +func (m *MessageProperties) GetNeedShowStatistics() (value bool) { + if m == nil { + return + } + return m.NeedShowStatistics +} diff --git a/tdapi/tl_message_sending_state_gen.go b/tdapi/tl_message_sending_state_gen.go index 8f5a85c071..2c79a62738 100644 --- a/tdapi/tl_message_sending_state_gen.go +++ b/tdapi/tl_message_sending_state_gen.go @@ -201,7 +201,8 @@ func (m *MessageSendingStatePending) GetSendingID() (value int32) { type MessageSendingStateFailed struct { // The cause of the message sending failure Error Error - // True, if the message can be re-sent + // True, if the message can be re-sent using resendMessages or + // readdQuickReplyShortcutMessages CanRetry bool // True, if the message can be re-sent only on behalf of a different sender NeedAnotherSender bool diff --git a/tdapi/tl_message_thread_info_gen.go b/tdapi/tl_message_thread_info_gen.go index 173510169f..4612a2ea3b 100644 --- a/tdapi/tl_message_thread_info_gen.go +++ b/tdapi/tl_message_thread_info_gen.go @@ -41,7 +41,7 @@ type MessageThreadInfo struct { ReplyInfo MessageReplyInfo // Approximate number of unread messages in the message thread UnreadMessageCount int32 - // The messages from which the thread starts. The messages are returned in a reverse + // The messages from which the thread starts. The messages are returned in reverse // chronological order (i.e., in order of decreasing message_id) Messages []Message // A draft of a message in the message thread; may be null if none diff --git a/tdapi/tl_open_web_app_gen.go b/tdapi/tl_open_web_app_gen.go index f68098f3e6..3834ab8ba2 100644 --- a/tdapi/tl_open_web_app_gen.go +++ b/tdapi/tl_open_web_app_gen.go @@ -43,7 +43,7 @@ type OpenWebAppRequest struct { URL string // Preferred Web App theme; pass null to use the default theme Theme ThemeParameters - // Short name of the application; 0-64 English letters, digits, and underscores + // Short name of the current application; 0-64 English letters, digits, and underscores ApplicationName string // If not 0, the message thread identifier in which the message will be sent MessageThreadID int64 diff --git a/tdapi/tl_payment_form_type_gen.go b/tdapi/tl_payment_form_type_gen.go index 4a8182ac7a..a102a3c871 100644 --- a/tdapi/tl_payment_form_type_gen.go +++ b/tdapi/tl_payment_form_type_gen.go @@ -504,7 +504,7 @@ func (p *PaymentFormTypeRegular) GetNeedPassword() (value bool) { // PaymentFormTypeStars represents TL type `paymentFormTypeStars#56b9d3d`. type PaymentFormTypeStars struct { - // Number of Telegram stars that will be paid + // Number of Telegram Stars that will be paid StarCount int64 } diff --git a/tdapi/tl_payment_receipt_type_gen.go b/tdapi/tl_payment_receipt_type_gen.go index 6f05b6dd1d..08e418ead3 100644 --- a/tdapi/tl_payment_receipt_type_gen.go +++ b/tdapi/tl_payment_receipt_type_gen.go @@ -369,7 +369,7 @@ func (p *PaymentReceiptTypeRegular) GetTipAmount() (value int64) { // PaymentReceiptTypeStars represents TL type `paymentReceiptTypeStars#1194074c`. type PaymentReceiptTypeStars struct { - // Number of Telegram stars that were paid + // Number of Telegram Stars that were paid StarCount int64 // Unique identifier of the transaction that can be used to dispute it TransactionID string diff --git a/tdapi/tl_push_message_content_gen.go b/tdapi/tl_push_message_content_gen.go index 6618630826..b3d19d42de 100644 --- a/tdapi/tl_push_message_content_gen.go +++ b/tdapi/tl_push_message_content_gen.go @@ -1998,7 +1998,8 @@ func (p *PushMessageContentLocation) GetIsPinned() (value bool) { // PushMessageContentPaidMedia represents TL type `pushMessageContentPaidMedia#b556e74a`. type PushMessageContentPaidMedia struct { - // Number of stars needed to buy access to the media in the message; 0 for pinned message + // Number of Telegram Stars needed to buy access to the media in the message; 0 for + // pinned message StarCount int64 // True, if the message is a pinned message with the specified content IsPinned bool diff --git a/tdapi/tl_recognize_speech_gen.go b/tdapi/tl_recognize_speech_gen.go index 4424831c5f..e1ca4ea0e7 100644 --- a/tdapi/tl_recognize_speech_gen.go +++ b/tdapi/tl_recognize_speech_gen.go @@ -35,7 +35,8 @@ var ( type RecognizeSpeechRequest struct { // Identifier of the chat to which the message belongs ChatID int64 - // Identifier of the message + // Identifier of the message. Use messageProperties.can_recognize_speech to check whether + // the message is suitable MessageID int64 } diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go index df36d1a9f1..fb120458b8 100644 --- a/tdapi/tl_registry_gen.go +++ b/tdapi/tl_registry_gen.go @@ -139,7 +139,7 @@ func TypesMap() map[uint32]string { ChatPhotoInfoTypeID: "chatPhotoInfo#10c2b4a6", UserTypeRegularTypeID: "userTypeRegular#dc51699b", UserTypeDeletedTypeID: "userTypeDeleted#94403d24", - UserTypeBotTypeID: "userTypeBot#ae30a83a", + UserTypeBotTypeID: "userTypeBot#8ba3cc26", UserTypeUnknownTypeID: "userTypeUnknown#d4d0613d", BotCommandTypeID: "botCommand#c27ac8c7", BotCommandsTypeID: "botCommands#4f9aa2c5", @@ -191,8 +191,9 @@ func TypesMap() map[uint32]string { StarTransactionPartnerGooglePlayTypeID: "starTransactionPartnerGooglePlay#f229f2a0", StarTransactionPartnerFragmentTypeID: "starTransactionPartnerFragment#da1849b5", StarTransactionPartnerTelegramAdsTypeID: "starTransactionPartnerTelegramAds#91f9c6b", - StarTransactionPartnerBotTypeID: "starTransactionPartnerBot#1bdcb459", + StarTransactionPartnerBotTypeID: "starTransactionPartnerBot#298ce3d9", StarTransactionPartnerChannelTypeID: "starTransactionPartnerChannel#44b29c29", + StarTransactionPartnerUserTypeID: "starTransactionPartnerUser#2cf89d66", StarTransactionPartnerUnsupportedTypeID: "starTransactionPartnerUnsupported#c4b20d73", StarTransactionTypeID: "starTransaction#ce1084a8", StarTransactionsTypeID: "starTransactions#306a010e", @@ -210,9 +211,10 @@ func TypesMap() map[uint32]string { EmojiStatusesTypeID: "emojiStatuses#eaeb9bdc", UsernamesTypeID: "usernames#bf343063", UserTypeID: "user#18552c62", - BotInfoTypeID: "botInfo#bfdb89a", + BotInfoTypeID: "botInfo#32ab8617", UserFullInfoTypeID: "userFullInfo#b61c9c5", UsersTypeID: "users#9d955a12", + FoundUsersTypeID: "foundUsers#c531e854", ChatAdministratorTypeID: "chatAdministrator#7277bd2c", ChatAdministratorsTypeID: "chatAdministrators#5141ca21", ChatMemberStatusCreatorTypeID: "chatMemberStatusCreator#f6764afe", @@ -298,7 +300,7 @@ func TypesMap() map[uint32]string { InputMessageReplyToExternalMessageTypeID: "inputMessageReplyToExternalMessage#892d232a", InputMessageReplyToStoryTypeID: "inputMessageReplyToStory#51aece78", FactCheckTypeID: "factCheck#c185f918", - MessageTypeID: "message#bdf0da63", + MessageTypeID: "message#dc764ddc", MessagesTypeID: "messages#b34c8c60", FoundMessagesTypeID: "foundMessages#2515f708", FoundChatMessagesTypeID: "foundChatMessages#4a25270c", @@ -408,6 +410,7 @@ func TypesMap() map[uint32]string { LoginURLInfoRequestConfirmationTypeID: "loginUrlInfoRequestConfirmation#7edb242f", FoundWebAppTypeID: "foundWebApp#eea8d01e", WebAppInfoTypeID: "webAppInfo#2efdb2e8", + MainWebAppTypeID: "mainWebApp#4fb068f1", MessageThreadInfoTypeID: "messageThreadInfo#683fd5ad", SavedMessagesTopicTypeMyNotesTypeID: "savedMessagesTopicTypeMyNotes#b38a41f5", SavedMessagesTopicTypeAuthorHiddenTypeID: "savedMessagesTopicTypeAuthorHidden#703c4195", @@ -489,8 +492,9 @@ func TypesMap() map[uint32]string { LinkPreviewTypeChannelBoostTypeID: "linkPreviewTypeChannelBoost#c6f40456", LinkPreviewTypeChatTypeID: "linkPreviewTypeChat#ae2fa122", LinkPreviewTypeDocumentTypeID: "linkPreviewTypeDocument#53b02747", - LinkPreviewTypeEmbeddedAudioPlayerTypeID: "linkPreviewTypeEmbeddedAudioPlayer#2bb06106", - LinkPreviewTypeEmbeddedVideoPlayerTypeID: "linkPreviewTypeEmbeddedVideoPlayer#fd4c9719", + LinkPreviewTypeEmbeddedAnimationPlayerTypeID: "linkPreviewTypeEmbeddedAnimationPlayer#c45fddca", + LinkPreviewTypeEmbeddedAudioPlayerTypeID: "linkPreviewTypeEmbeddedAudioPlayer#31e0dae6", + LinkPreviewTypeEmbeddedVideoPlayerTypeID: "linkPreviewTypeEmbeddedVideoPlayer#6ee015a3", LinkPreviewTypeInvoiceTypeID: "linkPreviewTypeInvoice#d47f48da", LinkPreviewTypeMessageTypeID: "linkPreviewTypeMessage#19f4c19e", LinkPreviewTypePhotoTypeID: "linkPreviewTypePhoto#eeebbab0", @@ -508,7 +512,7 @@ func TypesMap() map[uint32]string { LinkPreviewTypeVideoNoteTypeID: "linkPreviewTypeVideoNote#cf70db61", LinkPreviewTypeVoiceNoteTypeID: "linkPreviewTypeVoiceNote#d2d2cf2b", LinkPreviewTypeWebAppTypeID: "linkPreviewTypeWebApp#a62eef8a", - LinkPreviewTypeID: "linkPreview#d3d67eed", + LinkPreviewTypeID: "linkPreview#52a366d6", CountryInfoTypeID: "countryInfo#d9936dff", CountriesTypeID: "countries#94b50e0f", PhoneNumberInfoTypeID: "phoneNumberInfo#d2c398a1", @@ -677,12 +681,13 @@ func TypesMap() map[uint32]string { MessagePaymentSuccessfulTypeID: "messagePaymentSuccessful#53d93cdc", MessagePaymentSuccessfulBotTypeID: "messagePaymentSuccessfulBot#68e13eb9", MessagePaymentRefundedTypeID: "messagePaymentRefunded#11bcb8f3", - MessageGiftedPremiumTypeID: "messageGiftedPremium#78d1d0a", + MessageGiftedPremiumTypeID: "messageGiftedPremium#30dd808e", MessagePremiumGiftCodeTypeID: "messagePremiumGiftCode#26bd1bf3", MessagePremiumGiveawayCreatedTypeID: "messagePremiumGiveawayCreated#270f2c44", MessagePremiumGiveawayTypeID: "messagePremiumGiveaway#4aa0d0b0", MessagePremiumGiveawayCompletedTypeID: "messagePremiumGiveawayCompleted#80533949", MessagePremiumGiveawayWinnersTypeID: "messagePremiumGiveawayWinners#815d5f31", + MessageGiftedStarsTypeID: "messageGiftedStars#41bdbea7", MessageContactRegisteredTypeID: "messageContactRegistered#a678fcff", MessageUsersSharedTypeID: "messageUsersShared#7f1f4a22", MessageChatSharedTypeID: "messageChatShared#aec6d961", @@ -744,6 +749,7 @@ func TypesMap() map[uint32]string { InputMessagePollTypeID: "inputMessagePoll#9046c716", InputMessageStoryTypeID: "inputMessageStory#21099d63", InputMessageForwardedTypeID: "inputMessageForwarded#651a73f8", + MessagePropertiesTypeID: "messageProperties#5ae4cb28", SearchMessagesFilterEmptyTypeID: "searchMessagesFilterEmpty#cc2e1337", SearchMessagesFilterAnimationTypeID: "searchMessagesFilterAnimation#f6b800c5", SearchMessagesFilterAudioTypeID: "searchMessagesFilterAudio#33b5147b", @@ -798,12 +804,14 @@ func TypesMap() map[uint32]string { EmojiCategoryTypeRegularStickersTypeID: "emojiCategoryTypeRegularStickers#b04799d2", EmojiCategoryTypeEmojiStatusTypeID: "emojiCategoryTypeEmojiStatus#5254b347", EmojiCategoryTypeChatPhotoTypeID: "emojiCategoryTypeChatPhoto#3f200529", + CurrentWeatherTypeID: "currentWeather#eacea8c0", StoryAreaPositionTypeID: "storyAreaPosition#a49fec6c", StoryAreaTypeLocationTypeID: "storyAreaTypeLocation#a8b3caa3", StoryAreaTypeVenueTypeID: "storyAreaTypeVenue#18ae4d06", StoryAreaTypeSuggestedReactionTypeID: "storyAreaTypeSuggestedReaction#f95f927c", StoryAreaTypeMessageTypeID: "storyAreaTypeMessage#bfef76b4", StoryAreaTypeLinkTypeID: "storyAreaTypeLink#f8626185", + StoryAreaTypeWeatherTypeID: "storyAreaTypeWeather#a6587dbe", StoryAreaTypeID: "storyArea#c9ff075e", InputStoryAreaTypeLocationTypeID: "inputStoryAreaTypeLocation#aa8b3f39", InputStoryAreaTypeFoundVenueTypeID: "inputStoryAreaTypeFoundVenue#accda496", @@ -811,14 +819,15 @@ func TypesMap() map[uint32]string { InputStoryAreaTypeSuggestedReactionTypeID: "inputStoryAreaTypeSuggestedReaction#7d4751d3", InputStoryAreaTypeMessageTypeID: "inputStoryAreaTypeMessage#f01be457", InputStoryAreaTypeLinkTypeID: "inputStoryAreaTypeLink#53f31b48", + InputStoryAreaTypeWeatherTypeID: "inputStoryAreaTypeWeather#b7b7de9d", InputStoryAreaTypeID: "inputStoryArea#752ae7f", InputStoryAreasTypeID: "inputStoryAreas#b8ba29fe", - StoryVideoTypeID: "storyVideo#8588ba3", + StoryVideoTypeID: "storyVideo#562b0a45", StoryContentPhotoTypeID: "storyContentPhoto#d45f0050", StoryContentVideoTypeID: "storyContentVideo#b30162a6", StoryContentUnsupportedTypeID: "storyContentUnsupported#86c7f56e", InputStoryContentPhotoTypeID: "inputStoryContentPhoto#3286fbe0", - InputStoryContentVideoTypeID: "inputStoryContentVideo#d7383f99", + InputStoryContentVideoTypeID: "inputStoryContentVideo#cc1e4239", StoryListMainTypeID: "storyListMain#d7eeb3ff", StoryListArchiveTypeID: "storyListArchive#fd80a741", StoryOriginPublicStoryTypeID: "storyOriginPublicStory#2c379fbe", @@ -842,6 +851,9 @@ func TypesMap() map[uint32]string { PublicForwardMessageTypeID: "publicForwardMessage#317b3d2", PublicForwardStoryTypeID: "publicForwardStory#7fdf26af", PublicForwardsTypeID: "publicForwards#3ed29447", + BotMediaPreviewTypeID: "botMediaPreview#9eb59ce8", + BotMediaPreviewsTypeID: "botMediaPreviews#f1b8f27d", + BotMediaPreviewInfoTypeID: "botMediaPreviewInfo#e49169db", ChatBoostLevelFeaturesTypeID: "chatBoostLevelFeatures#f4b51914", ChatBoostFeaturesTypeID: "chatBoostFeatures#803214be", ChatBoostSourceGiftCodeTypeID: "chatBoostSourceGiftCode#fa2412ba", @@ -1092,9 +1104,11 @@ func TypesMap() map[uint32]string { StorePaymentPurposePremiumGiftCodesTypeID: "storePaymentPurposePremiumGiftCodes#9e11cf42", StorePaymentPurposePremiumGiveawayTypeID: "storePaymentPurposePremiumGiveaway#504790d9", StorePaymentPurposeStarsTypeID: "storePaymentPurposeStars#9480cf14", + StorePaymentPurposeGiftedStarsTypeID: "storePaymentPurposeGiftedStars#3544a624", TelegramPaymentPurposePremiumGiftCodesTypeID: "telegramPaymentPurposePremiumGiftCodes#91009cc", TelegramPaymentPurposePremiumGiveawayTypeID: "telegramPaymentPurposePremiumGiveaway#bfd4a227", TelegramPaymentPurposeStarsTypeID: "telegramPaymentPurposeStars#e273ee52", + TelegramPaymentPurposeGiftedStarsTypeID: "telegramPaymentPurposeGiftedStars#91b68a36", DeviceTokenFirebaseCloudMessagingTypeID: "deviceTokenFirebaseCloudMessaging#d0714a07", DeviceTokenApplePushTypeID: "deviceTokenApplePush#17196bc3", DeviceTokenApplePushVoIPTypeID: "deviceTokenApplePushVoIP#2ff045e9", @@ -1292,6 +1306,7 @@ func TypesMap() map[uint32]string { InternalLinkTypeInvoiceTypeID: "internalLinkTypeInvoice#f34c6dac", InternalLinkTypeLanguagePackTypeID: "internalLinkTypeLanguagePack#a9870d6c", InternalLinkTypeLanguageSettingsTypeID: "internalLinkTypeLanguageSettings#b019e6e6", + InternalLinkTypeMainWebAppTypeID: "internalLinkTypeMainWebApp#9c942666", InternalLinkTypeMessageTypeID: "internalLinkTypeMessage#3a535c52", InternalLinkTypeMessageDraftTypeID: "internalLinkTypeMessageDraft#276fbad5", InternalLinkTypePassportDataRequestTypeID: "internalLinkTypePassportDataRequest#c50fce81", @@ -1301,18 +1316,17 @@ func TypesMap() map[uint32]string { InternalLinkTypePremiumGiftCodeTypeID: "internalLinkTypePremiumGiftCode#de5c9892", InternalLinkTypePrivacyAndSecuritySettingsTypeID: "internalLinkTypePrivacyAndSecuritySettings#ad5f6acf", InternalLinkTypeProxyTypeID: "internalLinkTypeProxy#b1b12cea", - InternalLinkTypePublicChatTypeID: "internalLinkTypePublicChat#e5226d5e", + InternalLinkTypePublicChatTypeID: "internalLinkTypePublicChat#697a2d00", InternalLinkTypeQrCodeAuthenticationTypeID: "internalLinkTypeQrCodeAuthentication#bf121924", InternalLinkTypeRestorePurchasesTypeID: "internalLinkTypeRestorePurchases#24203483", InternalLinkTypeSettingsTypeID: "internalLinkTypeSettings#177545b4", - InternalLinkTypeSideMenuBotTypeID: "internalLinkTypeSideMenuBot#c45f0c16", InternalLinkTypeStickerSetTypeID: "internalLinkTypeStickerSet#a1464fa2", InternalLinkTypeStoryTypeID: "internalLinkTypeStory#57bce647", InternalLinkTypeThemeTypeID: "internalLinkTypeTheme#f405f807", InternalLinkTypeThemeSettingsTypeID: "internalLinkTypeThemeSettings#c14d3916", InternalLinkTypeUnknownDeepLinkTypeID: "internalLinkTypeUnknownDeepLink#2549d7db", InternalLinkTypeUnsupportedProxyTypeID: "internalLinkTypeUnsupportedProxy#de399f09", - InternalLinkTypeUserPhoneNumberTypeID: "internalLinkTypeUserPhoneNumber#77c08091", + InternalLinkTypeUserPhoneNumberTypeID: "internalLinkTypeUserPhoneNumber#104bbb08", InternalLinkTypeUserTokenTypeID: "internalLinkTypeUserToken#a8d7db59", InternalLinkTypeVideoChatTypeID: "internalLinkTypeVideoChat#8796f8b4", InternalLinkTypeWebAppTypeID: "internalLinkTypeWebApp#4c68bb0d", @@ -1374,6 +1388,7 @@ func TypesMap() map[uint32]string { TopChatCategoryGroupsTypeID: "topChatCategoryGroups#5b32d08e", TopChatCategoryChannelsTypeID: "topChatCategoryChannels#e22600e3", TopChatCategoryInlineBotsTypeID: "topChatCategoryInlineBots#1678eb7c", + TopChatCategoryWebAppBotsTypeID: "topChatCategoryWebAppBots#5f6d6fd", TopChatCategoryCallsTypeID: "topChatCategoryCalls#153b50dd", TopChatCategoryForwardChatsTypeID: "topChatCategoryForwardChats#6515b7d5", FoundPositionTypeID: "foundPosition#8f8adf88", @@ -1667,6 +1682,7 @@ func TypesMap() map[uint32]string { GetChatPinnedMessageRequestTypeID: "getChatPinnedMessage#15731ab0", GetCallbackQueryMessageRequestTypeID: "getCallbackQueryMessage#bd209172", GetMessagesRequestTypeID: "getMessages#d5dd28bf", + GetMessagePropertiesRequestTypeID: "getMessageProperties#2e18e1ab", GetMessageThreadRequestTypeID: "getMessageThread#7af23e3e", GetMessageReadDateRequestTypeID: "getMessageReadDate#a7850343", GetMessageViewersRequestTypeID: "getMessageViewers#a18f1ace", @@ -1775,6 +1791,7 @@ func TypesMap() map[uint32]string { EditBusinessMessageCaptionRequestTypeID: "editBusinessMessageCaption#c02142c3", EditBusinessMessageReplyMarkupRequestTypeID: "editBusinessMessageReplyMarkup#29d46c17", StopBusinessPollRequestTypeID: "stopBusinessPoll#bbeb2160", + SetBusinessMessageIsPinnedRequestTypeID: "setBusinessMessageIsPinned#ff14f5f0", CheckQuickReplyShortcutNameRequestTypeID: "checkQuickReplyShortcutName#7d3dd129", LoadQuickReplyShortcutsRequestTypeID: "loadQuickReplyShortcuts#c367b29d", SetQuickReplyShortcutNameRequestTypeID: "setQuickReplyShortcutName#b20f471", @@ -1836,8 +1853,10 @@ func TypesMap() map[uint32]string { ShareChatWithBotRequestTypeID: "shareChatWithBot#a6530ae2", GetInlineQueryResultsRequestTypeID: "getInlineQueryResults#79dcf86c", AnswerInlineQueryRequestTypeID: "answerInlineQuery#ac7cc5e6", + GetPopularWebAppBotsRequestTypeID: "getPopularWebAppBots#e8d04cb", SearchWebAppRequestTypeID: "searchWebApp#b5fc8a35", GetWebAppLinkURLRequestTypeID: "getWebAppLinkUrl#4f0ef3cc", + GetMainWebAppRequestTypeID: "getMainWebApp#be84329a", GetWebAppURLRequestTypeID: "getWebAppUrl#64c42cbe", SendWebAppDataRequestTypeID: "sendWebAppData#ab1fce0c", OpenWebAppRequestTypeID: "openWebApp#b02666b0", @@ -1948,11 +1967,13 @@ func TypesMap() map[uint32]string { ToggleChatIsPinnedRequestTypeID: "toggleChatIsPinned#a776263e", SetPinnedChatsRequestTypeID: "setPinnedChats#c6c6edf1", ReadChatListRequestTypeID: "readChatList#bd6498aa", + GetCurrentWeatherRequestTypeID: "getCurrentWeather#8ada9bc9", GetStoryRequestTypeID: "getStory#717b1c78", GetChatsToSendStoriesRequestTypeID: "getChatsToSendStories#22f9e3a4", CanSendStoryRequestTypeID: "canSendStory#b6e0216b", SendStoryRequestTypeID: "sendStory#e6ab3302", EditStoryRequestTypeID: "editStory#5e6a21b1", + EditStoryCoverRequestTypeID: "editStoryCover#ab2a0c4b", SetStoryPrivacySettingsRequestTypeID: "setStoryPrivacySettings#d8e94332", ToggleStoryIsPostedToChatPageRequestTypeID: "toggleStoryIsPostedToChatPage#ee0f4aff", DeleteStoryRequestTypeID: "deleteStory#9f35af16", @@ -2168,6 +2189,12 @@ func TypesMap() map[uint32]string { CanBotSendMessagesRequestTypeID: "canBotSendMessages#206d948c", AllowBotToSendMessagesRequestTypeID: "allowBotToSendMessages#69e9c58e", SendWebAppCustomRequestRequestTypeID: "sendWebAppCustomRequest#36ff5dc8", + GetBotMediaPreviewsRequestTypeID: "getBotMediaPreviews#22665458", + GetBotMediaPreviewInfoRequestTypeID: "getBotMediaPreviewInfo#50f60136", + AddBotMediaPreviewRequestTypeID: "addBotMediaPreview#504b852b", + EditBotMediaPreviewRequestTypeID: "editBotMediaPreview#86955d62", + ReorderBotMediaPreviewsRequestTypeID: "reorderBotMediaPreviews#89ea0cc6", + DeleteBotMediaPreviewsRequestTypeID: "deleteBotMediaPreviews#f7d259db", SetBotNameRequestTypeID: "setBotName#d295fa71", GetBotNameRequestTypeID: "getBotName#9a3f722c", SetBotProfilePhotoRequestTypeID: "setBotProfilePhoto#bd864b66", @@ -2324,6 +2351,7 @@ func TypesMap() map[uint32]string { LaunchPrepaidPremiumGiveawayRequestTypeID: "launchPrepaidPremiumGiveaway#5328fea1", GetPremiumGiveawayInfoRequestTypeID: "getPremiumGiveawayInfo#6adb7b97", GetStarPaymentOptionsRequestTypeID: "getStarPaymentOptions#6d930644", + GetStarGiftPaymentOptionsRequestTypeID: "getStarGiftPaymentOptions#e22760e3", GetStarTransactionsRequestTypeID: "getStarTransactions#eb1e109d", CanPurchaseFromStoreRequestTypeID: "canPurchaseFromStore#3caa9368", AssignAppStoreTransactionRequestTypeID: "assignAppStoreTransaction#86f30bb0", @@ -2540,6 +2568,7 @@ func NamesMap() map[string]uint32 { "starTransactionPartnerTelegramAds": StarTransactionPartnerTelegramAdsTypeID, "starTransactionPartnerBot": StarTransactionPartnerBotTypeID, "starTransactionPartnerChannel": StarTransactionPartnerChannelTypeID, + "starTransactionPartnerUser": StarTransactionPartnerUserTypeID, "starTransactionPartnerUnsupported": StarTransactionPartnerUnsupportedTypeID, "starTransaction": StarTransactionTypeID, "starTransactions": StarTransactionsTypeID, @@ -2560,6 +2589,7 @@ func NamesMap() map[string]uint32 { "botInfo": BotInfoTypeID, "userFullInfo": UserFullInfoTypeID, "users": UsersTypeID, + "foundUsers": FoundUsersTypeID, "chatAdministrator": ChatAdministratorTypeID, "chatAdministrators": ChatAdministratorsTypeID, "chatMemberStatusCreator": ChatMemberStatusCreatorTypeID, @@ -2755,6 +2785,7 @@ func NamesMap() map[string]uint32 { "loginUrlInfoRequestConfirmation": LoginURLInfoRequestConfirmationTypeID, "foundWebApp": FoundWebAppTypeID, "webAppInfo": WebAppInfoTypeID, + "mainWebApp": MainWebAppTypeID, "messageThreadInfo": MessageThreadInfoTypeID, "savedMessagesTopicTypeMyNotes": SavedMessagesTopicTypeMyNotesTypeID, "savedMessagesTopicTypeAuthorHidden": SavedMessagesTopicTypeAuthorHiddenTypeID, @@ -2836,6 +2867,7 @@ func NamesMap() map[string]uint32 { "linkPreviewTypeChannelBoost": LinkPreviewTypeChannelBoostTypeID, "linkPreviewTypeChat": LinkPreviewTypeChatTypeID, "linkPreviewTypeDocument": LinkPreviewTypeDocumentTypeID, + "linkPreviewTypeEmbeddedAnimationPlayer": LinkPreviewTypeEmbeddedAnimationPlayerTypeID, "linkPreviewTypeEmbeddedAudioPlayer": LinkPreviewTypeEmbeddedAudioPlayerTypeID, "linkPreviewTypeEmbeddedVideoPlayer": LinkPreviewTypeEmbeddedVideoPlayerTypeID, "linkPreviewTypeInvoice": LinkPreviewTypeInvoiceTypeID, @@ -3030,6 +3062,7 @@ func NamesMap() map[string]uint32 { "messagePremiumGiveaway": MessagePremiumGiveawayTypeID, "messagePremiumGiveawayCompleted": MessagePremiumGiveawayCompletedTypeID, "messagePremiumGiveawayWinners": MessagePremiumGiveawayWinnersTypeID, + "messageGiftedStars": MessageGiftedStarsTypeID, "messageContactRegistered": MessageContactRegisteredTypeID, "messageUsersShared": MessageUsersSharedTypeID, "messageChatShared": MessageChatSharedTypeID, @@ -3091,6 +3124,7 @@ func NamesMap() map[string]uint32 { "inputMessagePoll": InputMessagePollTypeID, "inputMessageStory": InputMessageStoryTypeID, "inputMessageForwarded": InputMessageForwardedTypeID, + "messageProperties": MessagePropertiesTypeID, "searchMessagesFilterEmpty": SearchMessagesFilterEmptyTypeID, "searchMessagesFilterAnimation": SearchMessagesFilterAnimationTypeID, "searchMessagesFilterAudio": SearchMessagesFilterAudioTypeID, @@ -3145,12 +3179,14 @@ func NamesMap() map[string]uint32 { "emojiCategoryTypeRegularStickers": EmojiCategoryTypeRegularStickersTypeID, "emojiCategoryTypeEmojiStatus": EmojiCategoryTypeEmojiStatusTypeID, "emojiCategoryTypeChatPhoto": EmojiCategoryTypeChatPhotoTypeID, + "currentWeather": CurrentWeatherTypeID, "storyAreaPosition": StoryAreaPositionTypeID, "storyAreaTypeLocation": StoryAreaTypeLocationTypeID, "storyAreaTypeVenue": StoryAreaTypeVenueTypeID, "storyAreaTypeSuggestedReaction": StoryAreaTypeSuggestedReactionTypeID, "storyAreaTypeMessage": StoryAreaTypeMessageTypeID, "storyAreaTypeLink": StoryAreaTypeLinkTypeID, + "storyAreaTypeWeather": StoryAreaTypeWeatherTypeID, "storyArea": StoryAreaTypeID, "inputStoryAreaTypeLocation": InputStoryAreaTypeLocationTypeID, "inputStoryAreaTypeFoundVenue": InputStoryAreaTypeFoundVenueTypeID, @@ -3158,6 +3194,7 @@ func NamesMap() map[string]uint32 { "inputStoryAreaTypeSuggestedReaction": InputStoryAreaTypeSuggestedReactionTypeID, "inputStoryAreaTypeMessage": InputStoryAreaTypeMessageTypeID, "inputStoryAreaTypeLink": InputStoryAreaTypeLinkTypeID, + "inputStoryAreaTypeWeather": InputStoryAreaTypeWeatherTypeID, "inputStoryArea": InputStoryAreaTypeID, "inputStoryAreas": InputStoryAreasTypeID, "storyVideo": StoryVideoTypeID, @@ -3189,6 +3226,9 @@ func NamesMap() map[string]uint32 { "publicForwardMessage": PublicForwardMessageTypeID, "publicForwardStory": PublicForwardStoryTypeID, "publicForwards": PublicForwardsTypeID, + "botMediaPreview": BotMediaPreviewTypeID, + "botMediaPreviews": BotMediaPreviewsTypeID, + "botMediaPreviewInfo": BotMediaPreviewInfoTypeID, "chatBoostLevelFeatures": ChatBoostLevelFeaturesTypeID, "chatBoostFeatures": ChatBoostFeaturesTypeID, "chatBoostSourceGiftCode": ChatBoostSourceGiftCodeTypeID, @@ -3439,9 +3479,11 @@ func NamesMap() map[string]uint32 { "storePaymentPurposePremiumGiftCodes": StorePaymentPurposePremiumGiftCodesTypeID, "storePaymentPurposePremiumGiveaway": StorePaymentPurposePremiumGiveawayTypeID, "storePaymentPurposeStars": StorePaymentPurposeStarsTypeID, + "storePaymentPurposeGiftedStars": StorePaymentPurposeGiftedStarsTypeID, "telegramPaymentPurposePremiumGiftCodes": TelegramPaymentPurposePremiumGiftCodesTypeID, "telegramPaymentPurposePremiumGiveaway": TelegramPaymentPurposePremiumGiveawayTypeID, "telegramPaymentPurposeStars": TelegramPaymentPurposeStarsTypeID, + "telegramPaymentPurposeGiftedStars": TelegramPaymentPurposeGiftedStarsTypeID, "deviceTokenFirebaseCloudMessaging": DeviceTokenFirebaseCloudMessagingTypeID, "deviceTokenApplePush": DeviceTokenApplePushTypeID, "deviceTokenApplePushVoIP": DeviceTokenApplePushVoIPTypeID, @@ -3639,6 +3681,7 @@ func NamesMap() map[string]uint32 { "internalLinkTypeInvoice": InternalLinkTypeInvoiceTypeID, "internalLinkTypeLanguagePack": InternalLinkTypeLanguagePackTypeID, "internalLinkTypeLanguageSettings": InternalLinkTypeLanguageSettingsTypeID, + "internalLinkTypeMainWebApp": InternalLinkTypeMainWebAppTypeID, "internalLinkTypeMessage": InternalLinkTypeMessageTypeID, "internalLinkTypeMessageDraft": InternalLinkTypeMessageDraftTypeID, "internalLinkTypePassportDataRequest": InternalLinkTypePassportDataRequestTypeID, @@ -3652,7 +3695,6 @@ func NamesMap() map[string]uint32 { "internalLinkTypeQrCodeAuthentication": InternalLinkTypeQrCodeAuthenticationTypeID, "internalLinkTypeRestorePurchases": InternalLinkTypeRestorePurchasesTypeID, "internalLinkTypeSettings": InternalLinkTypeSettingsTypeID, - "internalLinkTypeSideMenuBot": InternalLinkTypeSideMenuBotTypeID, "internalLinkTypeStickerSet": InternalLinkTypeStickerSetTypeID, "internalLinkTypeStory": InternalLinkTypeStoryTypeID, "internalLinkTypeTheme": InternalLinkTypeThemeTypeID, @@ -3721,6 +3763,7 @@ func NamesMap() map[string]uint32 { "topChatCategoryGroups": TopChatCategoryGroupsTypeID, "topChatCategoryChannels": TopChatCategoryChannelsTypeID, "topChatCategoryInlineBots": TopChatCategoryInlineBotsTypeID, + "topChatCategoryWebAppBots": TopChatCategoryWebAppBotsTypeID, "topChatCategoryCalls": TopChatCategoryCallsTypeID, "topChatCategoryForwardChats": TopChatCategoryForwardChatsTypeID, "foundPosition": FoundPositionTypeID, @@ -4014,6 +4057,7 @@ func NamesMap() map[string]uint32 { "getChatPinnedMessage": GetChatPinnedMessageRequestTypeID, "getCallbackQueryMessage": GetCallbackQueryMessageRequestTypeID, "getMessages": GetMessagesRequestTypeID, + "getMessageProperties": GetMessagePropertiesRequestTypeID, "getMessageThread": GetMessageThreadRequestTypeID, "getMessageReadDate": GetMessageReadDateRequestTypeID, "getMessageViewers": GetMessageViewersRequestTypeID, @@ -4122,6 +4166,7 @@ func NamesMap() map[string]uint32 { "editBusinessMessageCaption": EditBusinessMessageCaptionRequestTypeID, "editBusinessMessageReplyMarkup": EditBusinessMessageReplyMarkupRequestTypeID, "stopBusinessPoll": StopBusinessPollRequestTypeID, + "setBusinessMessageIsPinned": SetBusinessMessageIsPinnedRequestTypeID, "checkQuickReplyShortcutName": CheckQuickReplyShortcutNameRequestTypeID, "loadQuickReplyShortcuts": LoadQuickReplyShortcutsRequestTypeID, "setQuickReplyShortcutName": SetQuickReplyShortcutNameRequestTypeID, @@ -4183,8 +4228,10 @@ func NamesMap() map[string]uint32 { "shareChatWithBot": ShareChatWithBotRequestTypeID, "getInlineQueryResults": GetInlineQueryResultsRequestTypeID, "answerInlineQuery": AnswerInlineQueryRequestTypeID, + "getPopularWebAppBots": GetPopularWebAppBotsRequestTypeID, "searchWebApp": SearchWebAppRequestTypeID, "getWebAppLinkUrl": GetWebAppLinkURLRequestTypeID, + "getMainWebApp": GetMainWebAppRequestTypeID, "getWebAppUrl": GetWebAppURLRequestTypeID, "sendWebAppData": SendWebAppDataRequestTypeID, "openWebApp": OpenWebAppRequestTypeID, @@ -4295,11 +4342,13 @@ func NamesMap() map[string]uint32 { "toggleChatIsPinned": ToggleChatIsPinnedRequestTypeID, "setPinnedChats": SetPinnedChatsRequestTypeID, "readChatList": ReadChatListRequestTypeID, + "getCurrentWeather": GetCurrentWeatherRequestTypeID, "getStory": GetStoryRequestTypeID, "getChatsToSendStories": GetChatsToSendStoriesRequestTypeID, "canSendStory": CanSendStoryRequestTypeID, "sendStory": SendStoryRequestTypeID, "editStory": EditStoryRequestTypeID, + "editStoryCover": EditStoryCoverRequestTypeID, "setStoryPrivacySettings": SetStoryPrivacySettingsRequestTypeID, "toggleStoryIsPostedToChatPage": ToggleStoryIsPostedToChatPageRequestTypeID, "deleteStory": DeleteStoryRequestTypeID, @@ -4515,6 +4564,12 @@ func NamesMap() map[string]uint32 { "canBotSendMessages": CanBotSendMessagesRequestTypeID, "allowBotToSendMessages": AllowBotToSendMessagesRequestTypeID, "sendWebAppCustomRequest": SendWebAppCustomRequestRequestTypeID, + "getBotMediaPreviews": GetBotMediaPreviewsRequestTypeID, + "getBotMediaPreviewInfo": GetBotMediaPreviewInfoRequestTypeID, + "addBotMediaPreview": AddBotMediaPreviewRequestTypeID, + "editBotMediaPreview": EditBotMediaPreviewRequestTypeID, + "reorderBotMediaPreviews": ReorderBotMediaPreviewsRequestTypeID, + "deleteBotMediaPreviews": DeleteBotMediaPreviewsRequestTypeID, "setBotName": SetBotNameRequestTypeID, "getBotName": GetBotNameRequestTypeID, "setBotProfilePhoto": SetBotProfilePhotoRequestTypeID, @@ -4671,6 +4726,7 @@ func NamesMap() map[string]uint32 { "launchPrepaidPremiumGiveaway": LaunchPrepaidPremiumGiveawayRequestTypeID, "getPremiumGiveawayInfo": GetPremiumGiveawayInfoRequestTypeID, "getStarPaymentOptions": GetStarPaymentOptionsRequestTypeID, + "getStarGiftPaymentOptions": GetStarGiftPaymentOptionsRequestTypeID, "getStarTransactions": GetStarTransactionsRequestTypeID, "canPurchaseFromStore": CanPurchaseFromStoreRequestTypeID, "assignAppStoreTransaction": AssignAppStoreTransactionRequestTypeID, @@ -4887,6 +4943,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StarTransactionPartnerTelegramAdsTypeID: func() bin.Object { return &StarTransactionPartnerTelegramAds{} }, StarTransactionPartnerBotTypeID: func() bin.Object { return &StarTransactionPartnerBot{} }, StarTransactionPartnerChannelTypeID: func() bin.Object { return &StarTransactionPartnerChannel{} }, + StarTransactionPartnerUserTypeID: func() bin.Object { return &StarTransactionPartnerUser{} }, StarTransactionPartnerUnsupportedTypeID: func() bin.Object { return &StarTransactionPartnerUnsupported{} }, StarTransactionTypeID: func() bin.Object { return &StarTransaction{} }, StarTransactionsTypeID: func() bin.Object { return &StarTransactions{} }, @@ -4907,6 +4964,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { BotInfoTypeID: func() bin.Object { return &BotInfo{} }, UserFullInfoTypeID: func() bin.Object { return &UserFullInfo{} }, UsersTypeID: func() bin.Object { return &Users{} }, + FoundUsersTypeID: func() bin.Object { return &FoundUsers{} }, ChatAdministratorTypeID: func() bin.Object { return &ChatAdministrator{} }, ChatAdministratorsTypeID: func() bin.Object { return &ChatAdministrators{} }, ChatMemberStatusCreatorTypeID: func() bin.Object { return &ChatMemberStatusCreator{} }, @@ -5102,6 +5160,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { LoginURLInfoRequestConfirmationTypeID: func() bin.Object { return &LoginURLInfoRequestConfirmation{} }, FoundWebAppTypeID: func() bin.Object { return &FoundWebApp{} }, WebAppInfoTypeID: func() bin.Object { return &WebAppInfo{} }, + MainWebAppTypeID: func() bin.Object { return &MainWebApp{} }, MessageThreadInfoTypeID: func() bin.Object { return &MessageThreadInfo{} }, SavedMessagesTopicTypeMyNotesTypeID: func() bin.Object { return &SavedMessagesTopicTypeMyNotes{} }, SavedMessagesTopicTypeAuthorHiddenTypeID: func() bin.Object { return &SavedMessagesTopicTypeAuthorHidden{} }, @@ -5183,6 +5242,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { LinkPreviewTypeChannelBoostTypeID: func() bin.Object { return &LinkPreviewTypeChannelBoost{} }, LinkPreviewTypeChatTypeID: func() bin.Object { return &LinkPreviewTypeChat{} }, LinkPreviewTypeDocumentTypeID: func() bin.Object { return &LinkPreviewTypeDocument{} }, + LinkPreviewTypeEmbeddedAnimationPlayerTypeID: func() bin.Object { return &LinkPreviewTypeEmbeddedAnimationPlayer{} }, LinkPreviewTypeEmbeddedAudioPlayerTypeID: func() bin.Object { return &LinkPreviewTypeEmbeddedAudioPlayer{} }, LinkPreviewTypeEmbeddedVideoPlayerTypeID: func() bin.Object { return &LinkPreviewTypeEmbeddedVideoPlayer{} }, LinkPreviewTypeInvoiceTypeID: func() bin.Object { return &LinkPreviewTypeInvoice{} }, @@ -5377,6 +5437,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagePremiumGiveawayTypeID: func() bin.Object { return &MessagePremiumGiveaway{} }, MessagePremiumGiveawayCompletedTypeID: func() bin.Object { return &MessagePremiumGiveawayCompleted{} }, MessagePremiumGiveawayWinnersTypeID: func() bin.Object { return &MessagePremiumGiveawayWinners{} }, + MessageGiftedStarsTypeID: func() bin.Object { return &MessageGiftedStars{} }, MessageContactRegisteredTypeID: func() bin.Object { return &MessageContactRegistered{} }, MessageUsersSharedTypeID: func() bin.Object { return &MessageUsersShared{} }, MessageChatSharedTypeID: func() bin.Object { return &MessageChatShared{} }, @@ -5438,6 +5499,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputMessagePollTypeID: func() bin.Object { return &InputMessagePoll{} }, InputMessageStoryTypeID: func() bin.Object { return &InputMessageStory{} }, InputMessageForwardedTypeID: func() bin.Object { return &InputMessageForwarded{} }, + MessagePropertiesTypeID: func() bin.Object { return &MessageProperties{} }, SearchMessagesFilterEmptyTypeID: func() bin.Object { return &SearchMessagesFilterEmpty{} }, SearchMessagesFilterAnimationTypeID: func() bin.Object { return &SearchMessagesFilterAnimation{} }, SearchMessagesFilterAudioTypeID: func() bin.Object { return &SearchMessagesFilterAudio{} }, @@ -5492,12 +5554,14 @@ func TypesConstructorMap() map[uint32]func() bin.Object { EmojiCategoryTypeRegularStickersTypeID: func() bin.Object { return &EmojiCategoryTypeRegularStickers{} }, EmojiCategoryTypeEmojiStatusTypeID: func() bin.Object { return &EmojiCategoryTypeEmojiStatus{} }, EmojiCategoryTypeChatPhotoTypeID: func() bin.Object { return &EmojiCategoryTypeChatPhoto{} }, + CurrentWeatherTypeID: func() bin.Object { return &CurrentWeather{} }, StoryAreaPositionTypeID: func() bin.Object { return &StoryAreaPosition{} }, StoryAreaTypeLocationTypeID: func() bin.Object { return &StoryAreaTypeLocation{} }, StoryAreaTypeVenueTypeID: func() bin.Object { return &StoryAreaTypeVenue{} }, StoryAreaTypeSuggestedReactionTypeID: func() bin.Object { return &StoryAreaTypeSuggestedReaction{} }, StoryAreaTypeMessageTypeID: func() bin.Object { return &StoryAreaTypeMessage{} }, StoryAreaTypeLinkTypeID: func() bin.Object { return &StoryAreaTypeLink{} }, + StoryAreaTypeWeatherTypeID: func() bin.Object { return &StoryAreaTypeWeather{} }, StoryAreaTypeID: func() bin.Object { return &StoryArea{} }, InputStoryAreaTypeLocationTypeID: func() bin.Object { return &InputStoryAreaTypeLocation{} }, InputStoryAreaTypeFoundVenueTypeID: func() bin.Object { return &InputStoryAreaTypeFoundVenue{} }, @@ -5505,6 +5569,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputStoryAreaTypeSuggestedReactionTypeID: func() bin.Object { return &InputStoryAreaTypeSuggestedReaction{} }, InputStoryAreaTypeMessageTypeID: func() bin.Object { return &InputStoryAreaTypeMessage{} }, InputStoryAreaTypeLinkTypeID: func() bin.Object { return &InputStoryAreaTypeLink{} }, + InputStoryAreaTypeWeatherTypeID: func() bin.Object { return &InputStoryAreaTypeWeather{} }, InputStoryAreaTypeID: func() bin.Object { return &InputStoryArea{} }, InputStoryAreasTypeID: func() bin.Object { return &InputStoryAreas{} }, StoryVideoTypeID: func() bin.Object { return &StoryVideo{} }, @@ -5536,6 +5601,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PublicForwardMessageTypeID: func() bin.Object { return &PublicForwardMessage{} }, PublicForwardStoryTypeID: func() bin.Object { return &PublicForwardStory{} }, PublicForwardsTypeID: func() bin.Object { return &PublicForwards{} }, + BotMediaPreviewTypeID: func() bin.Object { return &BotMediaPreview{} }, + BotMediaPreviewsTypeID: func() bin.Object { return &BotMediaPreviews{} }, + BotMediaPreviewInfoTypeID: func() bin.Object { return &BotMediaPreviewInfo{} }, ChatBoostLevelFeaturesTypeID: func() bin.Object { return &ChatBoostLevelFeatures{} }, ChatBoostFeaturesTypeID: func() bin.Object { return &ChatBoostFeatures{} }, ChatBoostSourceGiftCodeTypeID: func() bin.Object { return &ChatBoostSourceGiftCode{} }, @@ -5786,9 +5854,11 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StorePaymentPurposePremiumGiftCodesTypeID: func() bin.Object { return &StorePaymentPurposePremiumGiftCodes{} }, StorePaymentPurposePremiumGiveawayTypeID: func() bin.Object { return &StorePaymentPurposePremiumGiveaway{} }, StorePaymentPurposeStarsTypeID: func() bin.Object { return &StorePaymentPurposeStars{} }, + StorePaymentPurposeGiftedStarsTypeID: func() bin.Object { return &StorePaymentPurposeGiftedStars{} }, TelegramPaymentPurposePremiumGiftCodesTypeID: func() bin.Object { return &TelegramPaymentPurposePremiumGiftCodes{} }, TelegramPaymentPurposePremiumGiveawayTypeID: func() bin.Object { return &TelegramPaymentPurposePremiumGiveaway{} }, TelegramPaymentPurposeStarsTypeID: func() bin.Object { return &TelegramPaymentPurposeStars{} }, + TelegramPaymentPurposeGiftedStarsTypeID: func() bin.Object { return &TelegramPaymentPurposeGiftedStars{} }, DeviceTokenFirebaseCloudMessagingTypeID: func() bin.Object { return &DeviceTokenFirebaseCloudMessaging{} }, DeviceTokenApplePushTypeID: func() bin.Object { return &DeviceTokenApplePush{} }, DeviceTokenApplePushVoIPTypeID: func() bin.Object { return &DeviceTokenApplePushVoIP{} }, @@ -5986,6 +6056,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InternalLinkTypeInvoiceTypeID: func() bin.Object { return &InternalLinkTypeInvoice{} }, InternalLinkTypeLanguagePackTypeID: func() bin.Object { return &InternalLinkTypeLanguagePack{} }, InternalLinkTypeLanguageSettingsTypeID: func() bin.Object { return &InternalLinkTypeLanguageSettings{} }, + InternalLinkTypeMainWebAppTypeID: func() bin.Object { return &InternalLinkTypeMainWebApp{} }, InternalLinkTypeMessageTypeID: func() bin.Object { return &InternalLinkTypeMessage{} }, InternalLinkTypeMessageDraftTypeID: func() bin.Object { return &InternalLinkTypeMessageDraft{} }, InternalLinkTypePassportDataRequestTypeID: func() bin.Object { return &InternalLinkTypePassportDataRequest{} }, @@ -5999,7 +6070,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InternalLinkTypeQrCodeAuthenticationTypeID: func() bin.Object { return &InternalLinkTypeQrCodeAuthentication{} }, InternalLinkTypeRestorePurchasesTypeID: func() bin.Object { return &InternalLinkTypeRestorePurchases{} }, InternalLinkTypeSettingsTypeID: func() bin.Object { return &InternalLinkTypeSettings{} }, - InternalLinkTypeSideMenuBotTypeID: func() bin.Object { return &InternalLinkTypeSideMenuBot{} }, InternalLinkTypeStickerSetTypeID: func() bin.Object { return &InternalLinkTypeStickerSet{} }, InternalLinkTypeStoryTypeID: func() bin.Object { return &InternalLinkTypeStory{} }, InternalLinkTypeThemeTypeID: func() bin.Object { return &InternalLinkTypeTheme{} }, @@ -6068,6 +6138,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { TopChatCategoryGroupsTypeID: func() bin.Object { return &TopChatCategoryGroups{} }, TopChatCategoryChannelsTypeID: func() bin.Object { return &TopChatCategoryChannels{} }, TopChatCategoryInlineBotsTypeID: func() bin.Object { return &TopChatCategoryInlineBots{} }, + TopChatCategoryWebAppBotsTypeID: func() bin.Object { return &TopChatCategoryWebAppBots{} }, TopChatCategoryCallsTypeID: func() bin.Object { return &TopChatCategoryCalls{} }, TopChatCategoryForwardChatsTypeID: func() bin.Object { return &TopChatCategoryForwardChats{} }, FoundPositionTypeID: func() bin.Object { return &FoundPosition{} }, @@ -6361,6 +6432,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { GetChatPinnedMessageRequestTypeID: func() bin.Object { return &GetChatPinnedMessageRequest{} }, GetCallbackQueryMessageRequestTypeID: func() bin.Object { return &GetCallbackQueryMessageRequest{} }, GetMessagesRequestTypeID: func() bin.Object { return &GetMessagesRequest{} }, + GetMessagePropertiesRequestTypeID: func() bin.Object { return &GetMessagePropertiesRequest{} }, GetMessageThreadRequestTypeID: func() bin.Object { return &GetMessageThreadRequest{} }, GetMessageReadDateRequestTypeID: func() bin.Object { return &GetMessageReadDateRequest{} }, GetMessageViewersRequestTypeID: func() bin.Object { return &GetMessageViewersRequest{} }, @@ -6469,6 +6541,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { EditBusinessMessageCaptionRequestTypeID: func() bin.Object { return &EditBusinessMessageCaptionRequest{} }, EditBusinessMessageReplyMarkupRequestTypeID: func() bin.Object { return &EditBusinessMessageReplyMarkupRequest{} }, StopBusinessPollRequestTypeID: func() bin.Object { return &StopBusinessPollRequest{} }, + SetBusinessMessageIsPinnedRequestTypeID: func() bin.Object { return &SetBusinessMessageIsPinnedRequest{} }, CheckQuickReplyShortcutNameRequestTypeID: func() bin.Object { return &CheckQuickReplyShortcutNameRequest{} }, LoadQuickReplyShortcutsRequestTypeID: func() bin.Object { return &LoadQuickReplyShortcutsRequest{} }, SetQuickReplyShortcutNameRequestTypeID: func() bin.Object { return &SetQuickReplyShortcutNameRequest{} }, @@ -6530,8 +6603,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ShareChatWithBotRequestTypeID: func() bin.Object { return &ShareChatWithBotRequest{} }, GetInlineQueryResultsRequestTypeID: func() bin.Object { return &GetInlineQueryResultsRequest{} }, AnswerInlineQueryRequestTypeID: func() bin.Object { return &AnswerInlineQueryRequest{} }, + GetPopularWebAppBotsRequestTypeID: func() bin.Object { return &GetPopularWebAppBotsRequest{} }, SearchWebAppRequestTypeID: func() bin.Object { return &SearchWebAppRequest{} }, GetWebAppLinkURLRequestTypeID: func() bin.Object { return &GetWebAppLinkURLRequest{} }, + GetMainWebAppRequestTypeID: func() bin.Object { return &GetMainWebAppRequest{} }, GetWebAppURLRequestTypeID: func() bin.Object { return &GetWebAppURLRequest{} }, SendWebAppDataRequestTypeID: func() bin.Object { return &SendWebAppDataRequest{} }, OpenWebAppRequestTypeID: func() bin.Object { return &OpenWebAppRequest{} }, @@ -6642,11 +6717,13 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ToggleChatIsPinnedRequestTypeID: func() bin.Object { return &ToggleChatIsPinnedRequest{} }, SetPinnedChatsRequestTypeID: func() bin.Object { return &SetPinnedChatsRequest{} }, ReadChatListRequestTypeID: func() bin.Object { return &ReadChatListRequest{} }, + GetCurrentWeatherRequestTypeID: func() bin.Object { return &GetCurrentWeatherRequest{} }, GetStoryRequestTypeID: func() bin.Object { return &GetStoryRequest{} }, GetChatsToSendStoriesRequestTypeID: func() bin.Object { return &GetChatsToSendStoriesRequest{} }, CanSendStoryRequestTypeID: func() bin.Object { return &CanSendStoryRequest{} }, SendStoryRequestTypeID: func() bin.Object { return &SendStoryRequest{} }, EditStoryRequestTypeID: func() bin.Object { return &EditStoryRequest{} }, + EditStoryCoverRequestTypeID: func() bin.Object { return &EditStoryCoverRequest{} }, SetStoryPrivacySettingsRequestTypeID: func() bin.Object { return &SetStoryPrivacySettingsRequest{} }, ToggleStoryIsPostedToChatPageRequestTypeID: func() bin.Object { return &ToggleStoryIsPostedToChatPageRequest{} }, DeleteStoryRequestTypeID: func() bin.Object { return &DeleteStoryRequest{} }, @@ -6862,6 +6939,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { CanBotSendMessagesRequestTypeID: func() bin.Object { return &CanBotSendMessagesRequest{} }, AllowBotToSendMessagesRequestTypeID: func() bin.Object { return &AllowBotToSendMessagesRequest{} }, SendWebAppCustomRequestRequestTypeID: func() bin.Object { return &SendWebAppCustomRequestRequest{} }, + GetBotMediaPreviewsRequestTypeID: func() bin.Object { return &GetBotMediaPreviewsRequest{} }, + GetBotMediaPreviewInfoRequestTypeID: func() bin.Object { return &GetBotMediaPreviewInfoRequest{} }, + AddBotMediaPreviewRequestTypeID: func() bin.Object { return &AddBotMediaPreviewRequest{} }, + EditBotMediaPreviewRequestTypeID: func() bin.Object { return &EditBotMediaPreviewRequest{} }, + ReorderBotMediaPreviewsRequestTypeID: func() bin.Object { return &ReorderBotMediaPreviewsRequest{} }, + DeleteBotMediaPreviewsRequestTypeID: func() bin.Object { return &DeleteBotMediaPreviewsRequest{} }, SetBotNameRequestTypeID: func() bin.Object { return &SetBotNameRequest{} }, GetBotNameRequestTypeID: func() bin.Object { return &GetBotNameRequest{} }, SetBotProfilePhotoRequestTypeID: func() bin.Object { return &SetBotProfilePhotoRequest{} }, @@ -7018,6 +7101,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { LaunchPrepaidPremiumGiveawayRequestTypeID: func() bin.Object { return &LaunchPrepaidPremiumGiveawayRequest{} }, GetPremiumGiveawayInfoRequestTypeID: func() bin.Object { return &GetPremiumGiveawayInfoRequest{} }, GetStarPaymentOptionsRequestTypeID: func() bin.Object { return &GetStarPaymentOptionsRequest{} }, + GetStarGiftPaymentOptionsRequestTypeID: func() bin.Object { return &GetStarGiftPaymentOptionsRequest{} }, GetStarTransactionsRequestTypeID: func() bin.Object { return &GetStarTransactionsRequest{} }, CanPurchaseFromStoreRequestTypeID: func() bin.Object { return &CanPurchaseFromStoreRequest{} }, AssignAppStoreTransactionRequestTypeID: func() bin.Object { return &AssignAppStoreTransactionRequest{} }, @@ -7577,6 +7661,7 @@ func ClassConstructorsMap() map[string][]uint32 { InputStoryAreaTypeSuggestedReactionTypeID, InputStoryAreaTypeMessageTypeID, InputStoryAreaTypeLinkTypeID, + InputStoryAreaTypeWeatherTypeID, }, InputStoryContentClassName: { InputStoryContentPhotoTypeID, @@ -7603,6 +7688,7 @@ func ClassConstructorsMap() map[string][]uint32 { InternalLinkTypeInvoiceTypeID, InternalLinkTypeLanguagePackTypeID, InternalLinkTypeLanguageSettingsTypeID, + InternalLinkTypeMainWebAppTypeID, InternalLinkTypeMessageTypeID, InternalLinkTypeMessageDraftTypeID, InternalLinkTypePassportDataRequestTypeID, @@ -7616,7 +7702,6 @@ func ClassConstructorsMap() map[string][]uint32 { InternalLinkTypeQrCodeAuthenticationTypeID, InternalLinkTypeRestorePurchasesTypeID, InternalLinkTypeSettingsTypeID, - InternalLinkTypeSideMenuBotTypeID, InternalLinkTypeStickerSetTypeID, InternalLinkTypeStoryTypeID, InternalLinkTypeThemeTypeID, @@ -7669,6 +7754,7 @@ func ClassConstructorsMap() map[string][]uint32 { LinkPreviewTypeChannelBoostTypeID, LinkPreviewTypeChatTypeID, LinkPreviewTypeDocumentTypeID, + LinkPreviewTypeEmbeddedAnimationPlayerTypeID, LinkPreviewTypeEmbeddedAudioPlayerTypeID, LinkPreviewTypeEmbeddedVideoPlayerTypeID, LinkPreviewTypeInvoiceTypeID, @@ -7766,6 +7852,7 @@ func ClassConstructorsMap() map[string][]uint32 { MessagePremiumGiveawayTypeID, MessagePremiumGiveawayCompletedTypeID, MessagePremiumGiveawayWinnersTypeID, + MessageGiftedStarsTypeID, MessageContactRegisteredTypeID, MessageUsersSharedTypeID, MessageChatSharedTypeID, @@ -8236,6 +8323,7 @@ func ClassConstructorsMap() map[string][]uint32 { StarTransactionPartnerTelegramAdsTypeID, StarTransactionPartnerBotTypeID, StarTransactionPartnerChannelTypeID, + StarTransactionPartnerUserTypeID, StarTransactionPartnerUnsupportedTypeID, }, StatisticalGraphClassName: { @@ -8264,6 +8352,7 @@ func ClassConstructorsMap() map[string][]uint32 { StorePaymentPurposePremiumGiftCodesTypeID, StorePaymentPurposePremiumGiveawayTypeID, StorePaymentPurposeStarsTypeID, + StorePaymentPurposeGiftedStarsTypeID, }, StoryAreaTypeClassName: { StoryAreaTypeLocationTypeID, @@ -8271,6 +8360,7 @@ func ClassConstructorsMap() map[string][]uint32 { StoryAreaTypeSuggestedReactionTypeID, StoryAreaTypeMessageTypeID, StoryAreaTypeLinkTypeID, + StoryAreaTypeWeatherTypeID, }, StoryContentClassName: { StoryContentPhotoTypeID, @@ -8335,6 +8425,7 @@ func ClassConstructorsMap() map[string][]uint32 { TelegramPaymentPurposePremiumGiftCodesTypeID, TelegramPaymentPurposePremiumGiveawayTypeID, TelegramPaymentPurposeStarsTypeID, + TelegramPaymentPurposeGiftedStarsTypeID, }, TextEntityTypeClassName: { TextEntityTypeMentionTypeID, @@ -8379,6 +8470,7 @@ func ClassConstructorsMap() map[string][]uint32 { TopChatCategoryGroupsTypeID, TopChatCategoryChannelsTypeID, TopChatCategoryInlineBotsTypeID, + TopChatCategoryWebAppBotsTypeID, TopChatCategoryCallsTypeID, TopChatCategoryForwardChatsTypeID, }, diff --git a/tdapi/tl_reorder_bot_media_previews_gen.go b/tdapi/tl_reorder_bot_media_previews_gen.go new file mode 100644 index 0000000000..b5cba55a21 --- /dev/null +++ b/tdapi/tl_reorder_bot_media_previews_gen.go @@ -0,0 +1,295 @@ +// 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{} +) + +// ReorderBotMediaPreviewsRequest represents TL type `reorderBotMediaPreviews#89ea0cc6`. +type ReorderBotMediaPreviewsRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserID int64 + // Language code of the media previews to reorder + LanguageCode string + // File identifiers of the media in the new order + FileIDs []int32 +} + +// ReorderBotMediaPreviewsRequestTypeID is TL type id of ReorderBotMediaPreviewsRequest. +const ReorderBotMediaPreviewsRequestTypeID = 0x89ea0cc6 + +// Ensuring interfaces in compile-time for ReorderBotMediaPreviewsRequest. +var ( + _ bin.Encoder = &ReorderBotMediaPreviewsRequest{} + _ bin.Decoder = &ReorderBotMediaPreviewsRequest{} + _ bin.BareEncoder = &ReorderBotMediaPreviewsRequest{} + _ bin.BareDecoder = &ReorderBotMediaPreviewsRequest{} +) + +func (r *ReorderBotMediaPreviewsRequest) Zero() bool { + if r == nil { + return true + } + if !(r.BotUserID == 0) { + return false + } + if !(r.LanguageCode == "") { + return false + } + if !(r.FileIDs == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *ReorderBotMediaPreviewsRequest) String() string { + if r == nil { + return "ReorderBotMediaPreviewsRequest(nil)" + } + type Alias ReorderBotMediaPreviewsRequest + return fmt.Sprintf("ReorderBotMediaPreviewsRequest%+v", Alias(*r)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ReorderBotMediaPreviewsRequest) TypeID() uint32 { + return ReorderBotMediaPreviewsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ReorderBotMediaPreviewsRequest) TypeName() string { + return "reorderBotMediaPreviews" +} + +// TypeInfo returns info about TL type. +func (r *ReorderBotMediaPreviewsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "reorderBotMediaPreviews", + ID: ReorderBotMediaPreviewsRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BotUserID", + SchemaName: "bot_user_id", + }, + { + Name: "LanguageCode", + SchemaName: "language_code", + }, + { + Name: "FileIDs", + SchemaName: "file_ids", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *ReorderBotMediaPreviewsRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reorderBotMediaPreviews#89ea0cc6 as nil") + } + b.PutID(ReorderBotMediaPreviewsRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *ReorderBotMediaPreviewsRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode reorderBotMediaPreviews#89ea0cc6 as nil") + } + b.PutInt53(r.BotUserID) + b.PutString(r.LanguageCode) + b.PutInt(len(r.FileIDs)) + for _, v := range r.FileIDs { + b.PutInt32(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (r *ReorderBotMediaPreviewsRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reorderBotMediaPreviews#89ea0cc6 to nil") + } + if err := b.ConsumeID(ReorderBotMediaPreviewsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *ReorderBotMediaPreviewsRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode reorderBotMediaPreviews#89ea0cc6 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field bot_user_id: %w", err) + } + r.BotUserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field language_code: %w", err) + } + r.LanguageCode = value + } + { + headerLen, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field file_ids: %w", err) + } + + if headerLen > 0 { + r.FileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field file_ids: %w", err) + } + r.FileIDs = append(r.FileIDs, value) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (r *ReorderBotMediaPreviewsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if r == nil { + return fmt.Errorf("can't encode reorderBotMediaPreviews#89ea0cc6 as nil") + } + b.ObjStart() + b.PutID("reorderBotMediaPreviews") + b.Comma() + b.FieldStart("bot_user_id") + b.PutInt53(r.BotUserID) + b.Comma() + b.FieldStart("language_code") + b.PutString(r.LanguageCode) + b.Comma() + b.FieldStart("file_ids") + b.ArrStart() + for _, v := range r.FileIDs { + b.PutInt32(v) + b.Comma() + } + b.StripComma() + b.ArrEnd() + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (r *ReorderBotMediaPreviewsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if r == nil { + return fmt.Errorf("can't decode reorderBotMediaPreviews#89ea0cc6 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("reorderBotMediaPreviews"); err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: %w", err) + } + case "bot_user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field bot_user_id: %w", err) + } + r.BotUserID = value + case "language_code": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field language_code: %w", err) + } + r.LanguageCode = value + case "file_ids": + if err := b.Arr(func(b tdjson.Decoder) error { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field file_ids: %w", err) + } + r.FileIDs = append(r.FileIDs, value) + return nil + }); err != nil { + return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field file_ids: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetBotUserID returns value of BotUserID field. +func (r *ReorderBotMediaPreviewsRequest) GetBotUserID() (value int64) { + if r == nil { + return + } + return r.BotUserID +} + +// GetLanguageCode returns value of LanguageCode field. +func (r *ReorderBotMediaPreviewsRequest) GetLanguageCode() (value string) { + if r == nil { + return + } + return r.LanguageCode +} + +// GetFileIDs returns value of FileIDs field. +func (r *ReorderBotMediaPreviewsRequest) GetFileIDs() (value []int32) { + if r == nil { + return + } + return r.FileIDs +} + +// ReorderBotMediaPreviews invokes method reorderBotMediaPreviews#89ea0cc6 returning error if any. +func (c *Client) ReorderBotMediaPreviews(ctx context.Context, request *ReorderBotMediaPreviewsRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_report_chat_gen.go b/tdapi/tl_report_chat_gen.go index d2db608740..6da0ab482d 100644 --- a/tdapi/tl_report_chat_gen.go +++ b/tdapi/tl_report_chat_gen.go @@ -35,7 +35,8 @@ var ( type ReportChatRequest struct { // Chat identifier ChatID int64 - // Identifiers of reported messages; may be empty to report the whole chat + // Identifiers of reported messages; may be empty to report the whole chat. Use + // messageProperties.can_be_reported to check whether the message can be reported MessageIDs []int64 // The reason for reporting the chat Reason ReportReasonClass diff --git a/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go b/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go index de73fdbfdd..4757c74d2a 100644 --- a/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go +++ b/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go @@ -35,7 +35,7 @@ var ( type ReportSupergroupAntiSpamFalsePositiveRequest struct { // Supergroup identifier SupergroupID int64 - // Identifier of the erroneously deleted message + // Identifier of the erroneously deleted message from chatEventMessageDeleted MessageID int64 } diff --git a/tdapi/tl_report_supergroup_spam_gen.go b/tdapi/tl_report_supergroup_spam_gen.go index 3d7ae5d13c..a619aebc54 100644 --- a/tdapi/tl_report_supergroup_spam_gen.go +++ b/tdapi/tl_report_supergroup_spam_gen.go @@ -35,7 +35,8 @@ var ( type ReportSupergroupSpamRequest struct { // Supergroup identifier SupergroupID int64 - // Identifiers of messages to report + // Identifiers of messages to report. Use messageProperties.can_be_reported to check + // whether the message can be reported MessageIDs []int64 } diff --git a/tdapi/tl_send_payment_form_gen.go b/tdapi/tl_send_payment_form_gen.go index c3df93f119..ded748dd72 100644 --- a/tdapi/tl_send_payment_form_gen.go +++ b/tdapi/tl_send_payment_form_gen.go @@ -41,7 +41,7 @@ type SendPaymentFormRequest struct { OrderInfoID string // Identifier of a chosen shipping option, if applicable ShippingOptionID string - // The credentials chosen by user for payment; pass null for a payment in Telegram stars + // The credentials chosen by user for payment; pass null for a payment in Telegram Stars Credentials InputCredentialsClass // Chosen by the user amount of tip in the smallest units of the currency TipAmount int64 diff --git a/tdapi/tl_set_business_message_is_pinned_gen.go b/tdapi/tl_set_business_message_is_pinned_gen.go new file mode 100644 index 0000000000..a7e4fa457b --- /dev/null +++ b/tdapi/tl_set_business_message_is_pinned_gen.go @@ -0,0 +1,305 @@ +// 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{} +) + +// SetBusinessMessageIsPinnedRequest represents TL type `setBusinessMessageIsPinned#ff14f5f0`. +type SetBusinessMessageIsPinnedRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionID string + // The chat the message belongs to + ChatID int64 + // Identifier of the message + MessageID int64 + // Pass true to pin the message, pass false to unpin it + IsPinned bool +} + +// SetBusinessMessageIsPinnedRequestTypeID is TL type id of SetBusinessMessageIsPinnedRequest. +const SetBusinessMessageIsPinnedRequestTypeID = 0xff14f5f0 + +// Ensuring interfaces in compile-time for SetBusinessMessageIsPinnedRequest. +var ( + _ bin.Encoder = &SetBusinessMessageIsPinnedRequest{} + _ bin.Decoder = &SetBusinessMessageIsPinnedRequest{} + _ bin.BareEncoder = &SetBusinessMessageIsPinnedRequest{} + _ bin.BareDecoder = &SetBusinessMessageIsPinnedRequest{} +) + +func (s *SetBusinessMessageIsPinnedRequest) Zero() bool { + if s == nil { + return true + } + if !(s.BusinessConnectionID == "") { + return false + } + if !(s.ChatID == 0) { + return false + } + if !(s.MessageID == 0) { + return false + } + if !(s.IsPinned == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *SetBusinessMessageIsPinnedRequest) String() string { + if s == nil { + return "SetBusinessMessageIsPinnedRequest(nil)" + } + type Alias SetBusinessMessageIsPinnedRequest + return fmt.Sprintf("SetBusinessMessageIsPinnedRequest%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*SetBusinessMessageIsPinnedRequest) TypeID() uint32 { + return SetBusinessMessageIsPinnedRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*SetBusinessMessageIsPinnedRequest) TypeName() string { + return "setBusinessMessageIsPinned" +} + +// TypeInfo returns info about TL type. +func (s *SetBusinessMessageIsPinnedRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "setBusinessMessageIsPinned", + ID: SetBusinessMessageIsPinnedRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BusinessConnectionID", + SchemaName: "business_connection_id", + }, + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "MessageID", + SchemaName: "message_id", + }, + { + Name: "IsPinned", + SchemaName: "is_pinned", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *SetBusinessMessageIsPinnedRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessMessageIsPinned#ff14f5f0 as nil") + } + b.PutID(SetBusinessMessageIsPinnedRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *SetBusinessMessageIsPinnedRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessMessageIsPinned#ff14f5f0 as nil") + } + b.PutString(s.BusinessConnectionID) + b.PutInt53(s.ChatID) + b.PutInt53(s.MessageID) + b.PutBool(s.IsPinned) + return nil +} + +// Decode implements bin.Decoder. +func (s *SetBusinessMessageIsPinnedRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessMessageIsPinned#ff14f5f0 to nil") + } + if err := b.ConsumeID(SetBusinessMessageIsPinnedRequestTypeID); err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *SetBusinessMessageIsPinnedRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessMessageIsPinned#ff14f5f0 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field business_connection_id: %w", err) + } + s.BusinessConnectionID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field chat_id: %w", err) + } + s.ChatID = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field message_id: %w", err) + } + s.MessageID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field is_pinned: %w", err) + } + s.IsPinned = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *SetBusinessMessageIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode setBusinessMessageIsPinned#ff14f5f0 as nil") + } + b.ObjStart() + b.PutID("setBusinessMessageIsPinned") + b.Comma() + b.FieldStart("business_connection_id") + b.PutString(s.BusinessConnectionID) + b.Comma() + b.FieldStart("chat_id") + b.PutInt53(s.ChatID) + b.Comma() + b.FieldStart("message_id") + b.PutInt53(s.MessageID) + b.Comma() + b.FieldStart("is_pinned") + b.PutBool(s.IsPinned) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *SetBusinessMessageIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode setBusinessMessageIsPinned#ff14f5f0 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("setBusinessMessageIsPinned"); err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: %w", err) + } + case "business_connection_id": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field business_connection_id: %w", err) + } + s.BusinessConnectionID = value + case "chat_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field chat_id: %w", err) + } + s.ChatID = value + case "message_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field message_id: %w", err) + } + s.MessageID = value + case "is_pinned": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field is_pinned: %w", err) + } + s.IsPinned = value + default: + return b.Skip() + } + return nil + }) +} + +// GetBusinessConnectionID returns value of BusinessConnectionID field. +func (s *SetBusinessMessageIsPinnedRequest) GetBusinessConnectionID() (value string) { + if s == nil { + return + } + return s.BusinessConnectionID +} + +// GetChatID returns value of ChatID field. +func (s *SetBusinessMessageIsPinnedRequest) GetChatID() (value int64) { + if s == nil { + return + } + return s.ChatID +} + +// GetMessageID returns value of MessageID field. +func (s *SetBusinessMessageIsPinnedRequest) GetMessageID() (value int64) { + if s == nil { + return + } + return s.MessageID +} + +// GetIsPinned returns value of IsPinned field. +func (s *SetBusinessMessageIsPinnedRequest) GetIsPinned() (value bool) { + if s == nil { + return + } + return s.IsPinned +} + +// SetBusinessMessageIsPinned invokes method setBusinessMessageIsPinned#ff14f5f0 returning error if any. +func (c *Client) SetBusinessMessageIsPinned(ctx context.Context, request *SetBusinessMessageIsPinnedRequest) error { + var ok Ok + + if err := c.rpc.Invoke(ctx, request, &ok); err != nil { + return err + } + return nil +} diff --git a/tdapi/tl_set_message_fact_check_gen.go b/tdapi/tl_set_message_fact_check_gen.go index a95d6c7aa9..9bb8ac1c87 100644 --- a/tdapi/tl_set_message_fact_check_gen.go +++ b/tdapi/tl_set_message_fact_check_gen.go @@ -35,9 +35,7 @@ var ( type SetMessageFactCheckRequest struct { // The channel chat the message belongs to ChatID int64 - // Identifier of the message. The message must be one of the following types: - // messageAnimation, messageAudio, messageDocument, messagePhoto, messageText, - // messageVideo + // Identifier of the message MessageID int64 // New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null // to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are diff --git a/tdapi/tl_star_payment_option_gen.go b/tdapi/tl_star_payment_option_gen.go index 902b7e1860..9f1062a3b2 100644 --- a/tdapi/tl_star_payment_option_gen.go +++ b/tdapi/tl_star_payment_option_gen.go @@ -37,7 +37,7 @@ type StarPaymentOption struct { Currency string // The amount to pay, in the smallest units of the currency Amount int64 - // Number of Telegram stars that will be purchased + // Number of Telegram Stars that will be purchased StarCount int64 // Identifier of the store product associated with the option; may be empty if none StoreProductID string diff --git a/tdapi/tl_star_revenue_statistics_gen.go b/tdapi/tl_star_revenue_statistics_gen.go index 4321d6875f..fc0f9e9dd3 100644 --- a/tdapi/tl_star_revenue_statistics_gen.go +++ b/tdapi/tl_star_revenue_statistics_gen.go @@ -35,9 +35,9 @@ var ( type StarRevenueStatistics struct { // A graph containing amount of revenue in a given day RevenueByDayGraph StatisticalGraphClass - // Telegram star revenue status + // Telegram Star revenue status Status StarRevenueStatus - // Current conversion rate of a Telegram star to USD + // Current conversion rate of a Telegram Star to USD UsdRate float64 } diff --git a/tdapi/tl_star_revenue_status_gen.go b/tdapi/tl_star_revenue_status_gen.go index 6761fb9525..3423111342 100644 --- a/tdapi/tl_star_revenue_status_gen.go +++ b/tdapi/tl_star_revenue_status_gen.go @@ -33,13 +33,13 @@ var ( // StarRevenueStatus represents TL type `starRevenueStatus#e85bd5fb`. type StarRevenueStatus struct { - // Total number of the stars earned + // Total number of Telegram Stars earned TotalCount int64 - // The number of Telegram stars that aren't withdrawn yet + // The number of Telegram Stars that aren't withdrawn yet CurrentCount int64 - // The number of Telegram stars that are available for withdrawal + // The number of Telegram Stars that are available for withdrawal AvailableCount int64 - // True, if Telegram stars can be withdrawn now or later + // True, if Telegram Stars can be withdrawn now or later WithdrawalEnabled bool // Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can // be started now diff --git a/tdapi/tl_star_transaction_gen.go b/tdapi/tl_star_transaction_gen.go index 9623474a16..b6302edc12 100644 --- a/tdapi/tl_star_transaction_gen.go +++ b/tdapi/tl_star_transaction_gen.go @@ -35,7 +35,7 @@ var ( type StarTransaction struct { // Unique identifier of the transaction ID string - // The amount of added owned Telegram stars; negative for outgoing transactions + // The amount of added owned Telegram Stars; negative for outgoing transactions StarCount int64 // True, if the transaction is a refund of a previous transaction IsRefund bool diff --git a/tdapi/tl_star_transaction_partner_gen.go b/tdapi/tl_star_transaction_partner_gen.go index d8279bb2d3..bf4f18a3e3 100644 --- a/tdapi/tl_star_transaction_partner_gen.go +++ b/tdapi/tl_star_transaction_partner_gen.go @@ -731,10 +731,10 @@ func (s *StarTransactionPartnerTelegramAds) DecodeTDLibJSON(b tdjson.Decoder) er }) } -// StarTransactionPartnerBot represents TL type `starTransactionPartnerBot#1bdcb459`. +// StarTransactionPartnerBot represents TL type `starTransactionPartnerBot#298ce3d9`. type StarTransactionPartnerBot struct { - // Identifier of the bot - BotUserID int64 + // Identifier of the bot for the user, or the user for the bot + UserID int64 // Information about the bought product; may be null if not applicable ProductInfo ProductInfo // Invoice payload; for bots only @@ -742,7 +742,7 @@ type StarTransactionPartnerBot struct { } // StarTransactionPartnerBotTypeID is TL type id of StarTransactionPartnerBot. -const StarTransactionPartnerBotTypeID = 0x1bdcb459 +const StarTransactionPartnerBotTypeID = 0x298ce3d9 // construct implements constructor of StarTransactionPartnerClass. func (s StarTransactionPartnerBot) construct() StarTransactionPartnerClass { return &s } @@ -761,7 +761,7 @@ func (s *StarTransactionPartnerBot) Zero() bool { if s == nil { return true } - if !(s.BotUserID == 0) { + if !(s.UserID == 0) { return false } if !(s.ProductInfo.Zero()) { @@ -807,8 +807,8 @@ func (s *StarTransactionPartnerBot) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "BotUserID", - SchemaName: "bot_user_id", + Name: "UserID", + SchemaName: "user_id", }, { Name: "ProductInfo", @@ -825,7 +825,7 @@ func (s *StarTransactionPartnerBot) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *StarTransactionPartnerBot) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starTransactionPartnerBot#1bdcb459 as nil") + return fmt.Errorf("can't encode starTransactionPartnerBot#298ce3d9 as nil") } b.PutID(StarTransactionPartnerBotTypeID) return s.EncodeBare(b) @@ -834,11 +834,11 @@ func (s *StarTransactionPartnerBot) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarTransactionPartnerBot) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starTransactionPartnerBot#1bdcb459 as nil") + return fmt.Errorf("can't encode starTransactionPartnerBot#298ce3d9 as nil") } - b.PutInt53(s.BotUserID) + b.PutInt53(s.UserID) if err := s.ProductInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionPartnerBot#1bdcb459: field product_info: %w", err) + return fmt.Errorf("unable to encode starTransactionPartnerBot#298ce3d9: field product_info: %w", err) } b.PutBytes(s.InvoicePayload) return nil @@ -847,10 +847,10 @@ func (s *StarTransactionPartnerBot) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *StarTransactionPartnerBot) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starTransactionPartnerBot#1bdcb459 to nil") + return fmt.Errorf("can't decode starTransactionPartnerBot#298ce3d9 to nil") } if err := b.ConsumeID(StarTransactionPartnerBotTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerBot#1bdcb459: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerBot#298ce3d9: %w", err) } return s.DecodeBare(b) } @@ -858,24 +858,24 @@ func (s *StarTransactionPartnerBot) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarTransactionPartnerBot) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starTransactionPartnerBot#1bdcb459 to nil") + return fmt.Errorf("can't decode starTransactionPartnerBot#298ce3d9 to nil") } { value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerBot#1bdcb459: field bot_user_id: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerBot#298ce3d9: field user_id: %w", err) } - s.BotUserID = value + s.UserID = value } { if err := s.ProductInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerBot#1bdcb459: field product_info: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerBot#298ce3d9: field product_info: %w", err) } } { value, err := b.Bytes() if err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerBot#1bdcb459: field invoice_payload: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerBot#298ce3d9: field invoice_payload: %w", err) } s.InvoicePayload = value } @@ -885,17 +885,17 @@ func (s *StarTransactionPartnerBot) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *StarTransactionPartnerBot) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode starTransactionPartnerBot#1bdcb459 as nil") + return fmt.Errorf("can't encode starTransactionPartnerBot#298ce3d9 as nil") } b.ObjStart() b.PutID("starTransactionPartnerBot") b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) + b.FieldStart("user_id") + b.PutInt53(s.UserID) b.Comma() b.FieldStart("product_info") if err := s.ProductInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionPartnerBot#1bdcb459: field product_info: %w", err) + return fmt.Errorf("unable to encode starTransactionPartnerBot#298ce3d9: field product_info: %w", err) } b.Comma() b.FieldStart("invoice_payload") @@ -909,29 +909,29 @@ func (s *StarTransactionPartnerBot) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *StarTransactionPartnerBot) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode starTransactionPartnerBot#1bdcb459 to nil") + return fmt.Errorf("can't decode starTransactionPartnerBot#298ce3d9 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("starTransactionPartnerBot"); err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerBot#1bdcb459: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerBot#298ce3d9: %w", err) } - case "bot_user_id": + case "user_id": value, err := b.Int53() if err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerBot#1bdcb459: field bot_user_id: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerBot#298ce3d9: field user_id: %w", err) } - s.BotUserID = value + s.UserID = value case "product_info": if err := s.ProductInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerBot#1bdcb459: field product_info: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerBot#298ce3d9: field product_info: %w", err) } case "invoice_payload": value, err := b.Bytes() if err != nil { - return fmt.Errorf("unable to decode starTransactionPartnerBot#1bdcb459: field invoice_payload: %w", err) + return fmt.Errorf("unable to decode starTransactionPartnerBot#298ce3d9: field invoice_payload: %w", err) } s.InvoicePayload = value default: @@ -941,12 +941,12 @@ func (s *StarTransactionPartnerBot) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// GetBotUserID returns value of BotUserID field. -func (s *StarTransactionPartnerBot) GetBotUserID() (value int64) { +// GetUserID returns value of UserID field. +func (s *StarTransactionPartnerBot) GetUserID() (value int64) { if s == nil { return } - return s.BotUserID + return s.UserID } // GetProductInfo returns value of ProductInfo field. @@ -1234,6 +1234,206 @@ func (s *StarTransactionPartnerChannel) GetMedia() (value []PaidMediaClass) { return s.Media } +// StarTransactionPartnerUser represents TL type `starTransactionPartnerUser#2cf89d66`. +type StarTransactionPartnerUser struct { + // Identifier of the user; 0 if the gift was anonymous + UserID int64 + // A sticker to be shown in the transaction information; may be null if unknown + Sticker Sticker +} + +// StarTransactionPartnerUserTypeID is TL type id of StarTransactionPartnerUser. +const StarTransactionPartnerUserTypeID = 0x2cf89d66 + +// construct implements constructor of StarTransactionPartnerClass. +func (s StarTransactionPartnerUser) construct() StarTransactionPartnerClass { return &s } + +// Ensuring interfaces in compile-time for StarTransactionPartnerUser. +var ( + _ bin.Encoder = &StarTransactionPartnerUser{} + _ bin.Decoder = &StarTransactionPartnerUser{} + _ bin.BareEncoder = &StarTransactionPartnerUser{} + _ bin.BareDecoder = &StarTransactionPartnerUser{} + + _ StarTransactionPartnerClass = &StarTransactionPartnerUser{} +) + +func (s *StarTransactionPartnerUser) Zero() bool { + if s == nil { + return true + } + if !(s.UserID == 0) { + return false + } + if !(s.Sticker.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarTransactionPartnerUser) String() string { + if s == nil { + return "StarTransactionPartnerUser(nil)" + } + type Alias StarTransactionPartnerUser + return fmt.Sprintf("StarTransactionPartnerUser%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarTransactionPartnerUser) TypeID() uint32 { + return StarTransactionPartnerUserTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarTransactionPartnerUser) TypeName() string { + return "starTransactionPartnerUser" +} + +// TypeInfo returns info about TL type. +func (s *StarTransactionPartnerUser) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starTransactionPartnerUser", + ID: StarTransactionPartnerUserTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Sticker", + SchemaName: "sticker", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarTransactionPartnerUser) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starTransactionPartnerUser#2cf89d66 as nil") + } + b.PutID(StarTransactionPartnerUserTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarTransactionPartnerUser) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starTransactionPartnerUser#2cf89d66 as nil") + } + b.PutInt53(s.UserID) + if err := s.Sticker.Encode(b); err != nil { + return fmt.Errorf("unable to encode starTransactionPartnerUser#2cf89d66: field sticker: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarTransactionPartnerUser) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starTransactionPartnerUser#2cf89d66 to nil") + } + if err := b.ConsumeID(StarTransactionPartnerUserTypeID); err != nil { + return fmt.Errorf("unable to decode starTransactionPartnerUser#2cf89d66: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarTransactionPartnerUser) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starTransactionPartnerUser#2cf89d66 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starTransactionPartnerUser#2cf89d66: field user_id: %w", err) + } + s.UserID = value + } + { + if err := s.Sticker.Decode(b); err != nil { + return fmt.Errorf("unable to decode starTransactionPartnerUser#2cf89d66: field sticker: %w", err) + } + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StarTransactionPartnerUser) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode starTransactionPartnerUser#2cf89d66 as nil") + } + b.ObjStart() + b.PutID("starTransactionPartnerUser") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(s.UserID) + b.Comma() + b.FieldStart("sticker") + if err := s.Sticker.EncodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to encode starTransactionPartnerUser#2cf89d66: field sticker: %w", err) + } + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StarTransactionPartnerUser) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode starTransactionPartnerUser#2cf89d66 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("starTransactionPartnerUser"); err != nil { + return fmt.Errorf("unable to decode starTransactionPartnerUser#2cf89d66: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode starTransactionPartnerUser#2cf89d66: field user_id: %w", err) + } + s.UserID = value + case "sticker": + if err := s.Sticker.DecodeTDLibJSON(b); err != nil { + return fmt.Errorf("unable to decode starTransactionPartnerUser#2cf89d66: field sticker: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + +// GetUserID returns value of UserID field. +func (s *StarTransactionPartnerUser) GetUserID() (value int64) { + if s == nil { + return + } + return s.UserID +} + +// GetSticker returns value of Sticker field. +func (s *StarTransactionPartnerUser) GetSticker() (value Sticker) { + if s == nil { + return + } + return s.Sticker +} + // StarTransactionPartnerUnsupported represents TL type `starTransactionPartnerUnsupported#c4b20d73`. type StarTransactionPartnerUnsupported struct { } @@ -1382,8 +1582,9 @@ const StarTransactionPartnerClassName = "StarTransactionPartner" // case *tdapi.StarTransactionPartnerGooglePlay: // starTransactionPartnerGooglePlay#f229f2a0 // case *tdapi.StarTransactionPartnerFragment: // starTransactionPartnerFragment#da1849b5 // case *tdapi.StarTransactionPartnerTelegramAds: // starTransactionPartnerTelegramAds#91f9c6b -// case *tdapi.StarTransactionPartnerBot: // starTransactionPartnerBot#1bdcb459 +// case *tdapi.StarTransactionPartnerBot: // starTransactionPartnerBot#298ce3d9 // case *tdapi.StarTransactionPartnerChannel: // starTransactionPartnerChannel#44b29c29 +// case *tdapi.StarTransactionPartnerUser: // starTransactionPartnerUser#2cf89d66 // case *tdapi.StarTransactionPartnerUnsupported: // starTransactionPartnerUnsupported#c4b20d73 // default: panic(v) // } @@ -1452,7 +1653,7 @@ func DecodeStarTransactionPartner(buf *bin.Buffer) (StarTransactionPartnerClass, } return &v, nil case StarTransactionPartnerBotTypeID: - // Decoding starTransactionPartnerBot#1bdcb459. + // Decoding starTransactionPartnerBot#298ce3d9. v := StarTransactionPartnerBot{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) @@ -1465,6 +1666,13 @@ func DecodeStarTransactionPartner(buf *bin.Buffer) (StarTransactionPartnerClass, return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) } return &v, nil + case StarTransactionPartnerUserTypeID: + // Decoding starTransactionPartnerUser#2cf89d66. + v := StarTransactionPartnerUser{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) + } + return &v, nil case StarTransactionPartnerUnsupportedTypeID: // Decoding starTransactionPartnerUnsupported#c4b20d73. v := StarTransactionPartnerUnsupported{} @@ -1520,7 +1728,7 @@ func DecodeTDLibJSONStarTransactionPartner(buf tdjson.Decoder) (StarTransactionP } return &v, nil case "starTransactionPartnerBot": - // Decoding starTransactionPartnerBot#1bdcb459. + // Decoding starTransactionPartnerBot#298ce3d9. v := StarTransactionPartnerBot{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) @@ -1533,6 +1741,13 @@ func DecodeTDLibJSONStarTransactionPartner(buf tdjson.Decoder) (StarTransactionP return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) } return &v, nil + case "starTransactionPartnerUser": + // Decoding starTransactionPartnerUser#2cf89d66. + v := StarTransactionPartnerUser{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarTransactionPartnerClass: %w", err) + } + return &v, nil case "starTransactionPartnerUnsupported": // Decoding starTransactionPartnerUnsupported#c4b20d73. v := StarTransactionPartnerUnsupported{} diff --git a/tdapi/tl_star_transactions_gen.go b/tdapi/tl_star_transactions_gen.go index 813e36daea..abc135536f 100644 --- a/tdapi/tl_star_transactions_gen.go +++ b/tdapi/tl_star_transactions_gen.go @@ -33,9 +33,9 @@ var ( // StarTransactions represents TL type `starTransactions#306a010e`. type StarTransactions struct { - // The amount of owned Telegram stars + // The amount of owned Telegram Stars StarCount int64 - // List of transactions with Telegram stars + // List of transactions with Telegram Stars Transactions []StarTransaction // The offset for the next request. If empty, then there are no more results NextOffset string diff --git a/tdapi/tl_stop_poll_gen.go b/tdapi/tl_stop_poll_gen.go index 4da21f5c92..91de2c8203 100644 --- a/tdapi/tl_stop_poll_gen.go +++ b/tdapi/tl_stop_poll_gen.go @@ -35,7 +35,8 @@ var ( type StopPollRequest struct { // Identifier of the chat to which the poll belongs ChatID int64 - // Identifier of the message containing the poll + // Identifier of the message containing the poll. Use messageProperties.can_be_edited to + // check whether the poll can be stopped MessageID int64 // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkupClass diff --git a/tdapi/tl_store_payment_purpose_gen.go b/tdapi/tl_store_payment_purpose_gen.go index e80f1cfa8a..7d1148e6cf 100644 --- a/tdapi/tl_store_payment_purpose_gen.go +++ b/tdapi/tl_store_payment_purpose_gen.go @@ -234,7 +234,7 @@ func (s *StorePaymentPurposePremiumSubscription) GetIsUpgrade() (value bool) { // StorePaymentPurposeGiftedPremium represents TL type `storePaymentPurposeGiftedPremium#7240c0d1`. type StorePaymentPurposeGiftedPremium struct { - // Identifier of the user to which Premium was gifted + // Identifier of the user to which Telegram Premium is gifted UserID int64 // ISO 4217 currency code of the payment currency Currency string @@ -1000,7 +1000,7 @@ type StorePaymentPurposeStars struct { Currency string // Paid amount, in the smallest units of the currency Amount int64 - // Number of bought stars + // Number of bought Telegram Stars StarCount int64 } @@ -1228,6 +1228,274 @@ func (s *StorePaymentPurposeStars) GetStarCount() (value int64) { return s.StarCount } +// StorePaymentPurposeGiftedStars represents TL type `storePaymentPurposeGiftedStars#3544a624`. +type StorePaymentPurposeGiftedStars struct { + // Identifier of the user to which Telegram Stars are gifted + UserID int64 + // ISO 4217 currency code of the payment currency + Currency string + // Paid amount, in the smallest units of the currency + Amount int64 + // Number of bought Telegram Stars + StarCount int64 +} + +// StorePaymentPurposeGiftedStarsTypeID is TL type id of StorePaymentPurposeGiftedStars. +const StorePaymentPurposeGiftedStarsTypeID = 0x3544a624 + +// construct implements constructor of StorePaymentPurposeClass. +func (s StorePaymentPurposeGiftedStars) construct() StorePaymentPurposeClass { return &s } + +// Ensuring interfaces in compile-time for StorePaymentPurposeGiftedStars. +var ( + _ bin.Encoder = &StorePaymentPurposeGiftedStars{} + _ bin.Decoder = &StorePaymentPurposeGiftedStars{} + _ bin.BareEncoder = &StorePaymentPurposeGiftedStars{} + _ bin.BareDecoder = &StorePaymentPurposeGiftedStars{} + + _ StorePaymentPurposeClass = &StorePaymentPurposeGiftedStars{} +) + +func (s *StorePaymentPurposeGiftedStars) Zero() bool { + if s == nil { + return true + } + if !(s.UserID == 0) { + return false + } + if !(s.Currency == "") { + return false + } + if !(s.Amount == 0) { + return false + } + if !(s.StarCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StorePaymentPurposeGiftedStars) String() string { + if s == nil { + return "StorePaymentPurposeGiftedStars(nil)" + } + type Alias StorePaymentPurposeGiftedStars + return fmt.Sprintf("StorePaymentPurposeGiftedStars%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StorePaymentPurposeGiftedStars) TypeID() uint32 { + return StorePaymentPurposeGiftedStarsTypeID +} + +// TypeName returns name of type in TL schema. +func (*StorePaymentPurposeGiftedStars) TypeName() string { + return "storePaymentPurposeGiftedStars" +} + +// TypeInfo returns info about TL type. +func (s *StorePaymentPurposeGiftedStars) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storePaymentPurposeGiftedStars", + ID: StorePaymentPurposeGiftedStarsTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + { + Name: "StarCount", + SchemaName: "star_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StorePaymentPurposeGiftedStars) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storePaymentPurposeGiftedStars#3544a624 as nil") + } + b.PutID(StorePaymentPurposeGiftedStarsTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StorePaymentPurposeGiftedStars) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storePaymentPurposeGiftedStars#3544a624 as nil") + } + b.PutInt53(s.UserID) + b.PutString(s.Currency) + b.PutInt53(s.Amount) + b.PutInt53(s.StarCount) + return nil +} + +// Decode implements bin.Decoder. +func (s *StorePaymentPurposeGiftedStars) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storePaymentPurposeGiftedStars#3544a624 to nil") + } + if err := b.ConsumeID(StorePaymentPurposeGiftedStarsTypeID); err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StorePaymentPurposeGiftedStars) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storePaymentPurposeGiftedStars#3544a624 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field user_id: %w", err) + } + s.UserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field currency: %w", err) + } + s.Currency = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field amount: %w", err) + } + s.Amount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field star_count: %w", err) + } + s.StarCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StorePaymentPurposeGiftedStars) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storePaymentPurposeGiftedStars#3544a624 as nil") + } + b.ObjStart() + b.PutID("storePaymentPurposeGiftedStars") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(s.UserID) + b.Comma() + b.FieldStart("currency") + b.PutString(s.Currency) + b.Comma() + b.FieldStart("amount") + b.PutInt53(s.Amount) + b.Comma() + b.FieldStart("star_count") + b.PutInt53(s.StarCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StorePaymentPurposeGiftedStars) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storePaymentPurposeGiftedStars#3544a624 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storePaymentPurposeGiftedStars"); err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field user_id: %w", err) + } + s.UserID = value + case "currency": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field currency: %w", err) + } + s.Currency = value + case "amount": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field amount: %w", err) + } + s.Amount = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field star_count: %w", err) + } + s.StarCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetUserID returns value of UserID field. +func (s *StorePaymentPurposeGiftedStars) GetUserID() (value int64) { + if s == nil { + return + } + return s.UserID +} + +// GetCurrency returns value of Currency field. +func (s *StorePaymentPurposeGiftedStars) GetCurrency() (value string) { + if s == nil { + return + } + return s.Currency +} + +// GetAmount returns value of Amount field. +func (s *StorePaymentPurposeGiftedStars) GetAmount() (value int64) { + if s == nil { + return + } + return s.Amount +} + +// GetStarCount returns value of StarCount field. +func (s *StorePaymentPurposeGiftedStars) GetStarCount() (value int64) { + if s == nil { + return + } + return s.StarCount +} + // StorePaymentPurposeClassName is schema name of StorePaymentPurposeClass. const StorePaymentPurposeClassName = "StorePaymentPurpose" @@ -1245,6 +1513,7 @@ const StorePaymentPurposeClassName = "StorePaymentPurpose" // case *tdapi.StorePaymentPurposePremiumGiftCodes: // storePaymentPurposePremiumGiftCodes#9e11cf42 // case *tdapi.StorePaymentPurposePremiumGiveaway: // storePaymentPurposePremiumGiveaway#504790d9 // case *tdapi.StorePaymentPurposeStars: // storePaymentPurposeStars#9480cf14 +// case *tdapi.StorePaymentPurposeGiftedStars: // storePaymentPurposeGiftedStars#3544a624 // default: panic(v) // } type StorePaymentPurposeClass interface { @@ -1311,6 +1580,13 @@ func DecodeStorePaymentPurpose(buf *bin.Buffer) (StorePaymentPurposeClass, error return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) } return &v, nil + case StorePaymentPurposeGiftedStarsTypeID: + // Decoding storePaymentPurposeGiftedStars#3544a624. + v := StorePaymentPurposeGiftedStars{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", bin.NewUnexpectedID(id)) } @@ -1358,6 +1634,13 @@ func DecodeTDLibJSONStorePaymentPurpose(buf tdjson.Decoder) (StorePaymentPurpose return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) } return &v, nil + case "storePaymentPurposeGiftedStars": + // Decoding storePaymentPurposeGiftedStars#3544a624. + v := StorePaymentPurposeGiftedStars{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_story_area_type_gen.go b/tdapi/tl_story_area_type_gen.go index 0ef08394f6..c025d7c9f6 100644 --- a/tdapi/tl_story_area_type_gen.go +++ b/tdapi/tl_story_area_type_gen.go @@ -1041,6 +1041,240 @@ func (s *StoryAreaTypeLink) GetURL() (value string) { return s.URL } +// StoryAreaTypeWeather represents TL type `storyAreaTypeWeather#a6587dbe`. +type StoryAreaTypeWeather struct { + // Temperature, in degree Celsius + Temperature float64 + // Emoji representing the weather + Emoji string + // A color of the area background in the ARGB format + BackgroundColor int32 +} + +// StoryAreaTypeWeatherTypeID is TL type id of StoryAreaTypeWeather. +const StoryAreaTypeWeatherTypeID = 0xa6587dbe + +// construct implements constructor of StoryAreaTypeClass. +func (s StoryAreaTypeWeather) construct() StoryAreaTypeClass { return &s } + +// Ensuring interfaces in compile-time for StoryAreaTypeWeather. +var ( + _ bin.Encoder = &StoryAreaTypeWeather{} + _ bin.Decoder = &StoryAreaTypeWeather{} + _ bin.BareEncoder = &StoryAreaTypeWeather{} + _ bin.BareDecoder = &StoryAreaTypeWeather{} + + _ StoryAreaTypeClass = &StoryAreaTypeWeather{} +) + +func (s *StoryAreaTypeWeather) Zero() bool { + if s == nil { + return true + } + if !(s.Temperature == 0) { + return false + } + if !(s.Emoji == "") { + return false + } + if !(s.BackgroundColor == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryAreaTypeWeather) String() string { + if s == nil { + return "StoryAreaTypeWeather(nil)" + } + type Alias StoryAreaTypeWeather + return fmt.Sprintf("StoryAreaTypeWeather%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryAreaTypeWeather) TypeID() uint32 { + return StoryAreaTypeWeatherTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryAreaTypeWeather) TypeName() string { + return "storyAreaTypeWeather" +} + +// TypeInfo returns info about TL type. +func (s *StoryAreaTypeWeather) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyAreaTypeWeather", + ID: StoryAreaTypeWeatherTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Temperature", + SchemaName: "temperature", + }, + { + Name: "Emoji", + SchemaName: "emoji", + }, + { + Name: "BackgroundColor", + SchemaName: "background_color", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryAreaTypeWeather) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyAreaTypeWeather#a6587dbe as nil") + } + b.PutID(StoryAreaTypeWeatherTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryAreaTypeWeather) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyAreaTypeWeather#a6587dbe as nil") + } + b.PutDouble(s.Temperature) + b.PutString(s.Emoji) + b.PutInt32(s.BackgroundColor) + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryAreaTypeWeather) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyAreaTypeWeather#a6587dbe to nil") + } + if err := b.ConsumeID(StoryAreaTypeWeatherTypeID); err != nil { + return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryAreaTypeWeather) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyAreaTypeWeather#a6587dbe to nil") + } + { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field temperature: %w", err) + } + s.Temperature = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field emoji: %w", err) + } + s.Emoji = value + } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field background_color: %w", err) + } + s.BackgroundColor = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (s *StoryAreaTypeWeather) EncodeTDLibJSON(b tdjson.Encoder) error { + if s == nil { + return fmt.Errorf("can't encode storyAreaTypeWeather#a6587dbe as nil") + } + b.ObjStart() + b.PutID("storyAreaTypeWeather") + b.Comma() + b.FieldStart("temperature") + b.PutDouble(s.Temperature) + b.Comma() + b.FieldStart("emoji") + b.PutString(s.Emoji) + b.Comma() + b.FieldStart("background_color") + b.PutInt32(s.BackgroundColor) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (s *StoryAreaTypeWeather) DecodeTDLibJSON(b tdjson.Decoder) error { + if s == nil { + return fmt.Errorf("can't decode storyAreaTypeWeather#a6587dbe to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("storyAreaTypeWeather"); err != nil { + return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: %w", err) + } + case "temperature": + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field temperature: %w", err) + } + s.Temperature = value + case "emoji": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field emoji: %w", err) + } + s.Emoji = value + case "background_color": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field background_color: %w", err) + } + s.BackgroundColor = value + default: + return b.Skip() + } + return nil + }) +} + +// GetTemperature returns value of Temperature field. +func (s *StoryAreaTypeWeather) GetTemperature() (value float64) { + if s == nil { + return + } + return s.Temperature +} + +// GetEmoji returns value of Emoji field. +func (s *StoryAreaTypeWeather) GetEmoji() (value string) { + if s == nil { + return + } + return s.Emoji +} + +// GetBackgroundColor returns value of BackgroundColor field. +func (s *StoryAreaTypeWeather) GetBackgroundColor() (value int32) { + if s == nil { + return + } + return s.BackgroundColor +} + // StoryAreaTypeClassName is schema name of StoryAreaTypeClass. const StoryAreaTypeClassName = "StoryAreaType" @@ -1058,6 +1292,7 @@ const StoryAreaTypeClassName = "StoryAreaType" // case *tdapi.StoryAreaTypeSuggestedReaction: // storyAreaTypeSuggestedReaction#f95f927c // case *tdapi.StoryAreaTypeMessage: // storyAreaTypeMessage#bfef76b4 // case *tdapi.StoryAreaTypeLink: // storyAreaTypeLink#f8626185 +// case *tdapi.StoryAreaTypeWeather: // storyAreaTypeWeather#a6587dbe // default: panic(v) // } type StoryAreaTypeClass interface { @@ -1124,6 +1359,13 @@ func DecodeStoryAreaType(buf *bin.Buffer) (StoryAreaTypeClass, error) { return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) } return &v, nil + case StoryAreaTypeWeatherTypeID: + // Decoding storyAreaTypeWeather#a6587dbe. + v := StoryAreaTypeWeather{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", bin.NewUnexpectedID(id)) } @@ -1171,6 +1413,13 @@ func DecodeTDLibJSONStoryAreaType(buf tdjson.Decoder) (StoryAreaTypeClass, error return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) } return &v, nil + case "storyAreaTypeWeather": + // Decoding storyAreaTypeWeather#a6587dbe. + v := StoryAreaTypeWeather{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_story_video_gen.go b/tdapi/tl_story_video_gen.go index 61caeffb45..68176be903 100644 --- a/tdapi/tl_story_video_gen.go +++ b/tdapi/tl_story_video_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StoryVideo represents TL type `storyVideo#8588ba3`. +// StoryVideo represents TL type `storyVideo#562b0a45`. type StoryVideo struct { // Duration of the video, in seconds Duration float64 @@ -50,12 +50,14 @@ type StoryVideo struct { Thumbnail Thumbnail // Size of file prefix, which is supposed to be preloaded, in bytes PreloadPrefixSize int32 + // Timestamp of the frame used as video thumbnail + CoverFrameTimestamp float64 // File containing the video Video File } // StoryVideoTypeID is TL type id of StoryVideo. -const StoryVideoTypeID = 0x8588ba3 +const StoryVideoTypeID = 0x562b0a45 // Ensuring interfaces in compile-time for StoryVideo. var ( @@ -93,6 +95,9 @@ func (s *StoryVideo) Zero() bool { if !(s.PreloadPrefixSize == 0) { return false } + if !(s.CoverFrameTimestamp == 0) { + return false + } if !(s.Video.Zero()) { return false } @@ -164,6 +169,10 @@ func (s *StoryVideo) TypeInfo() tdp.Type { Name: "PreloadPrefixSize", SchemaName: "preload_prefix_size", }, + { + Name: "CoverFrameTimestamp", + SchemaName: "cover_frame_timestamp", + }, { Name: "Video", SchemaName: "video", @@ -175,7 +184,7 @@ func (s *StoryVideo) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *StoryVideo) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode storyVideo#8588ba3 as nil") + return fmt.Errorf("can't encode storyVideo#562b0a45 as nil") } b.PutID(StoryVideoTypeID) return s.EncodeBare(b) @@ -184,7 +193,7 @@ func (s *StoryVideo) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StoryVideo) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode storyVideo#8588ba3 as nil") + return fmt.Errorf("can't encode storyVideo#562b0a45 as nil") } b.PutDouble(s.Duration) b.PutInt32(s.Width) @@ -192,14 +201,15 @@ func (s *StoryVideo) EncodeBare(b *bin.Buffer) error { b.PutBool(s.HasStickers) b.PutBool(s.IsAnimation) if err := s.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#8588ba3: field minithumbnail: %w", err) + return fmt.Errorf("unable to encode storyVideo#562b0a45: field minithumbnail: %w", err) } if err := s.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#8588ba3: field thumbnail: %w", err) + return fmt.Errorf("unable to encode storyVideo#562b0a45: field thumbnail: %w", err) } b.PutInt32(s.PreloadPrefixSize) + b.PutDouble(s.CoverFrameTimestamp) if err := s.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#8588ba3: field video: %w", err) + return fmt.Errorf("unable to encode storyVideo#562b0a45: field video: %w", err) } return nil } @@ -207,10 +217,10 @@ func (s *StoryVideo) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *StoryVideo) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode storyVideo#8588ba3 to nil") + return fmt.Errorf("can't decode storyVideo#562b0a45 to nil") } if err := b.ConsumeID(StoryVideoTypeID); err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: %w", err) } return s.DecodeBare(b) } @@ -218,63 +228,70 @@ func (s *StoryVideo) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StoryVideo) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode storyVideo#8588ba3 to nil") + return fmt.Errorf("can't decode storyVideo#562b0a45 to nil") } { value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field duration: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field duration: %w", err) } s.Duration = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field width: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field width: %w", err) } s.Width = value } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field height: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field height: %w", err) } s.Height = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field has_stickers: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field has_stickers: %w", err) } s.HasStickers = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field is_animation: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field is_animation: %w", err) } s.IsAnimation = value } { if err := s.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field minithumbnail: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field minithumbnail: %w", err) } } { if err := s.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field thumbnail: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field thumbnail: %w", err) } } { value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field preload_prefix_size: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field preload_prefix_size: %w", err) } s.PreloadPrefixSize = value } + { + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode storyVideo#562b0a45: field cover_frame_timestamp: %w", err) + } + s.CoverFrameTimestamp = value + } { if err := s.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field video: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field video: %w", err) } } return nil @@ -283,7 +300,7 @@ func (s *StoryVideo) DecodeBare(b *bin.Buffer) error { // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *StoryVideo) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { - return fmt.Errorf("can't encode storyVideo#8588ba3 as nil") + return fmt.Errorf("can't encode storyVideo#562b0a45 as nil") } b.ObjStart() b.PutID("storyVideo") @@ -305,20 +322,23 @@ func (s *StoryVideo) EncodeTDLibJSON(b tdjson.Encoder) error { b.Comma() b.FieldStart("minithumbnail") if err := s.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#8588ba3: field minithumbnail: %w", err) + return fmt.Errorf("unable to encode storyVideo#562b0a45: field minithumbnail: %w", err) } b.Comma() b.FieldStart("thumbnail") if err := s.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#8588ba3: field thumbnail: %w", err) + return fmt.Errorf("unable to encode storyVideo#562b0a45: field thumbnail: %w", err) } b.Comma() b.FieldStart("preload_prefix_size") b.PutInt32(s.PreloadPrefixSize) b.Comma() + b.FieldStart("cover_frame_timestamp") + b.PutDouble(s.CoverFrameTimestamp) + b.Comma() b.FieldStart("video") if err := s.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#8588ba3: field video: %w", err) + return fmt.Errorf("unable to encode storyVideo#562b0a45: field video: %w", err) } b.Comma() b.StripComma() @@ -329,62 +349,68 @@ func (s *StoryVideo) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *StoryVideo) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { - return fmt.Errorf("can't decode storyVideo#8588ba3 to nil") + return fmt.Errorf("can't decode storyVideo#562b0a45 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("storyVideo"); err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: %w", err) } case "duration": value, err := b.Double() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field duration: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field duration: %w", err) } s.Duration = value case "width": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field width: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field width: %w", err) } s.Width = value case "height": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field height: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field height: %w", err) } s.Height = value case "has_stickers": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field has_stickers: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field has_stickers: %w", err) } s.HasStickers = value case "is_animation": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field is_animation: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field is_animation: %w", err) } s.IsAnimation = value case "minithumbnail": if err := s.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field minithumbnail: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field minithumbnail: %w", err) } case "thumbnail": if err := s.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field thumbnail: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field thumbnail: %w", err) } case "preload_prefix_size": value, err := b.Int32() if err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field preload_prefix_size: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field preload_prefix_size: %w", err) } s.PreloadPrefixSize = value + case "cover_frame_timestamp": + value, err := b.Double() + if err != nil { + return fmt.Errorf("unable to decode storyVideo#562b0a45: field cover_frame_timestamp: %w", err) + } + s.CoverFrameTimestamp = value case "video": if err := s.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#8588ba3: field video: %w", err) + return fmt.Errorf("unable to decode storyVideo#562b0a45: field video: %w", err) } default: return b.Skip() @@ -457,6 +483,14 @@ func (s *StoryVideo) GetPreloadPrefixSize() (value int32) { return s.PreloadPrefixSize } +// GetCoverFrameTimestamp returns value of CoverFrameTimestamp field. +func (s *StoryVideo) GetCoverFrameTimestamp() (value float64) { + if s == nil { + return + } + return s.CoverFrameTimestamp +} + // GetVideo returns value of Video field. func (s *StoryVideo) GetVideo() (value File) { if s == nil { diff --git a/tdapi/tl_telegram_payment_purpose_gen.go b/tdapi/tl_telegram_payment_purpose_gen.go index 6927dae443..5ac4799145 100644 --- a/tdapi/tl_telegram_payment_purpose_gen.go +++ b/tdapi/tl_telegram_payment_purpose_gen.go @@ -667,7 +667,7 @@ type TelegramPaymentPurposeStars struct { Currency string // Paid amount, in the smallest units of the currency Amount int64 - // Number of bought stars + // Number of bought Telegram Stars StarCount int64 } @@ -895,6 +895,274 @@ func (t *TelegramPaymentPurposeStars) GetStarCount() (value int64) { return t.StarCount } +// TelegramPaymentPurposeGiftedStars represents TL type `telegramPaymentPurposeGiftedStars#91b68a36`. +type TelegramPaymentPurposeGiftedStars struct { + // Identifier of the user to which Telegram Stars are gifted + UserID int64 + // ISO 4217 currency code of the payment currency + Currency string + // Paid amount, in the smallest units of the currency + Amount int64 + // Number of bought Telegram Stars + StarCount int64 +} + +// TelegramPaymentPurposeGiftedStarsTypeID is TL type id of TelegramPaymentPurposeGiftedStars. +const TelegramPaymentPurposeGiftedStarsTypeID = 0x91b68a36 + +// construct implements constructor of TelegramPaymentPurposeClass. +func (t TelegramPaymentPurposeGiftedStars) construct() TelegramPaymentPurposeClass { return &t } + +// Ensuring interfaces in compile-time for TelegramPaymentPurposeGiftedStars. +var ( + _ bin.Encoder = &TelegramPaymentPurposeGiftedStars{} + _ bin.Decoder = &TelegramPaymentPurposeGiftedStars{} + _ bin.BareEncoder = &TelegramPaymentPurposeGiftedStars{} + _ bin.BareDecoder = &TelegramPaymentPurposeGiftedStars{} + + _ TelegramPaymentPurposeClass = &TelegramPaymentPurposeGiftedStars{} +) + +func (t *TelegramPaymentPurposeGiftedStars) Zero() bool { + if t == nil { + return true + } + if !(t.UserID == 0) { + return false + } + if !(t.Currency == "") { + return false + } + if !(t.Amount == 0) { + return false + } + if !(t.StarCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *TelegramPaymentPurposeGiftedStars) String() string { + if t == nil { + return "TelegramPaymentPurposeGiftedStars(nil)" + } + type Alias TelegramPaymentPurposeGiftedStars + return fmt.Sprintf("TelegramPaymentPurposeGiftedStars%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*TelegramPaymentPurposeGiftedStars) TypeID() uint32 { + return TelegramPaymentPurposeGiftedStarsTypeID +} + +// TypeName returns name of type in TL schema. +func (*TelegramPaymentPurposeGiftedStars) TypeName() string { + return "telegramPaymentPurposeGiftedStars" +} + +// TypeInfo returns info about TL type. +func (t *TelegramPaymentPurposeGiftedStars) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "telegramPaymentPurposeGiftedStars", + ID: TelegramPaymentPurposeGiftedStarsTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Currency", + SchemaName: "currency", + }, + { + Name: "Amount", + SchemaName: "amount", + }, + { + Name: "StarCount", + SchemaName: "star_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *TelegramPaymentPurposeGiftedStars) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode telegramPaymentPurposeGiftedStars#91b68a36 as nil") + } + b.PutID(TelegramPaymentPurposeGiftedStarsTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *TelegramPaymentPurposeGiftedStars) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode telegramPaymentPurposeGiftedStars#91b68a36 as nil") + } + b.PutInt53(t.UserID) + b.PutString(t.Currency) + b.PutInt53(t.Amount) + b.PutInt53(t.StarCount) + return nil +} + +// Decode implements bin.Decoder. +func (t *TelegramPaymentPurposeGiftedStars) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode telegramPaymentPurposeGiftedStars#91b68a36 to nil") + } + if err := b.ConsumeID(TelegramPaymentPurposeGiftedStarsTypeID); err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *TelegramPaymentPurposeGiftedStars) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode telegramPaymentPurposeGiftedStars#91b68a36 to nil") + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field user_id: %w", err) + } + t.UserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field currency: %w", err) + } + t.Currency = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field amount: %w", err) + } + t.Amount = value + } + { + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field star_count: %w", err) + } + t.StarCount = value + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *TelegramPaymentPurposeGiftedStars) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode telegramPaymentPurposeGiftedStars#91b68a36 as nil") + } + b.ObjStart() + b.PutID("telegramPaymentPurposeGiftedStars") + b.Comma() + b.FieldStart("user_id") + b.PutInt53(t.UserID) + b.Comma() + b.FieldStart("currency") + b.PutString(t.Currency) + b.Comma() + b.FieldStart("amount") + b.PutInt53(t.Amount) + b.Comma() + b.FieldStart("star_count") + b.PutInt53(t.StarCount) + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *TelegramPaymentPurposeGiftedStars) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode telegramPaymentPurposeGiftedStars#91b68a36 to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("telegramPaymentPurposeGiftedStars"); err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: %w", err) + } + case "user_id": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field user_id: %w", err) + } + t.UserID = value + case "currency": + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field currency: %w", err) + } + t.Currency = value + case "amount": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field amount: %w", err) + } + t.Amount = value + case "star_count": + value, err := b.Int53() + if err != nil { + return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field star_count: %w", err) + } + t.StarCount = value + default: + return b.Skip() + } + return nil + }) +} + +// GetUserID returns value of UserID field. +func (t *TelegramPaymentPurposeGiftedStars) GetUserID() (value int64) { + if t == nil { + return + } + return t.UserID +} + +// GetCurrency returns value of Currency field. +func (t *TelegramPaymentPurposeGiftedStars) GetCurrency() (value string) { + if t == nil { + return + } + return t.Currency +} + +// GetAmount returns value of Amount field. +func (t *TelegramPaymentPurposeGiftedStars) GetAmount() (value int64) { + if t == nil { + return + } + return t.Amount +} + +// GetStarCount returns value of StarCount field. +func (t *TelegramPaymentPurposeGiftedStars) GetStarCount() (value int64) { + if t == nil { + return + } + return t.StarCount +} + // TelegramPaymentPurposeClassName is schema name of TelegramPaymentPurposeClass. const TelegramPaymentPurposeClassName = "TelegramPaymentPurpose" @@ -910,6 +1178,7 @@ const TelegramPaymentPurposeClassName = "TelegramPaymentPurpose" // case *tdapi.TelegramPaymentPurposePremiumGiftCodes: // telegramPaymentPurposePremiumGiftCodes#91009cc // case *tdapi.TelegramPaymentPurposePremiumGiveaway: // telegramPaymentPurposePremiumGiveaway#bfd4a227 // case *tdapi.TelegramPaymentPurposeStars: // telegramPaymentPurposeStars#e273ee52 +// case *tdapi.TelegramPaymentPurposeGiftedStars: // telegramPaymentPurposeGiftedStars#91b68a36 // default: panic(v) // } type TelegramPaymentPurposeClass interface { @@ -967,6 +1236,13 @@ func DecodeTelegramPaymentPurpose(buf *bin.Buffer) (TelegramPaymentPurposeClass, return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) } return &v, nil + case TelegramPaymentPurposeGiftedStarsTypeID: + // Decoding telegramPaymentPurposeGiftedStars#91b68a36. + v := TelegramPaymentPurposeGiftedStars{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", bin.NewUnexpectedID(id)) } @@ -1000,6 +1276,13 @@ func DecodeTDLibJSONTelegramPaymentPurpose(buf tdjson.Decoder) (TelegramPaymentP return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) } return &v, nil + case "telegramPaymentPurposeGiftedStars": + // Decoding telegramPaymentPurposeGiftedStars#91b68a36. + v := TelegramPaymentPurposeGiftedStars{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", tdjson.NewUnexpectedID(id)) } diff --git a/tdapi/tl_top_chat_category_gen.go b/tdapi/tl_top_chat_category_gen.go index ef6f8dafc7..83a218ac43 100644 --- a/tdapi/tl_top_chat_category_gen.go +++ b/tdapi/tl_top_chat_category_gen.go @@ -686,6 +686,137 @@ func (t *TopChatCategoryInlineBots) DecodeTDLibJSON(b tdjson.Decoder) error { }) } +// TopChatCategoryWebAppBots represents TL type `topChatCategoryWebAppBots#5f6d6fd`. +type TopChatCategoryWebAppBots struct { +} + +// TopChatCategoryWebAppBotsTypeID is TL type id of TopChatCategoryWebAppBots. +const TopChatCategoryWebAppBotsTypeID = 0x5f6d6fd + +// construct implements constructor of TopChatCategoryClass. +func (t TopChatCategoryWebAppBots) construct() TopChatCategoryClass { return &t } + +// Ensuring interfaces in compile-time for TopChatCategoryWebAppBots. +var ( + _ bin.Encoder = &TopChatCategoryWebAppBots{} + _ bin.Decoder = &TopChatCategoryWebAppBots{} + _ bin.BareEncoder = &TopChatCategoryWebAppBots{} + _ bin.BareDecoder = &TopChatCategoryWebAppBots{} + + _ TopChatCategoryClass = &TopChatCategoryWebAppBots{} +) + +func (t *TopChatCategoryWebAppBots) Zero() bool { + if t == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (t *TopChatCategoryWebAppBots) String() string { + if t == nil { + return "TopChatCategoryWebAppBots(nil)" + } + type Alias TopChatCategoryWebAppBots + return fmt.Sprintf("TopChatCategoryWebAppBots%+v", Alias(*t)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*TopChatCategoryWebAppBots) TypeID() uint32 { + return TopChatCategoryWebAppBotsTypeID +} + +// TypeName returns name of type in TL schema. +func (*TopChatCategoryWebAppBots) TypeName() string { + return "topChatCategoryWebAppBots" +} + +// TypeInfo returns info about TL type. +func (t *TopChatCategoryWebAppBots) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "topChatCategoryWebAppBots", + ID: TopChatCategoryWebAppBotsTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (t *TopChatCategoryWebAppBots) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode topChatCategoryWebAppBots#5f6d6fd as nil") + } + b.PutID(TopChatCategoryWebAppBotsTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *TopChatCategoryWebAppBots) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode topChatCategoryWebAppBots#5f6d6fd as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (t *TopChatCategoryWebAppBots) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode topChatCategoryWebAppBots#5f6d6fd to nil") + } + if err := b.ConsumeID(TopChatCategoryWebAppBotsTypeID); err != nil { + return fmt.Errorf("unable to decode topChatCategoryWebAppBots#5f6d6fd: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *TopChatCategoryWebAppBots) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode topChatCategoryWebAppBots#5f6d6fd to nil") + } + return nil +} + +// EncodeTDLibJSON implements tdjson.TDLibEncoder. +func (t *TopChatCategoryWebAppBots) EncodeTDLibJSON(b tdjson.Encoder) error { + if t == nil { + return fmt.Errorf("can't encode topChatCategoryWebAppBots#5f6d6fd as nil") + } + b.ObjStart() + b.PutID("topChatCategoryWebAppBots") + b.Comma() + b.StripComma() + b.ObjEnd() + return nil +} + +// DecodeTDLibJSON implements tdjson.TDLibDecoder. +func (t *TopChatCategoryWebAppBots) DecodeTDLibJSON(b tdjson.Decoder) error { + if t == nil { + return fmt.Errorf("can't decode topChatCategoryWebAppBots#5f6d6fd to nil") + } + + return b.Obj(func(b tdjson.Decoder, key []byte) error { + switch string(key) { + case tdjson.TypeField: + if err := b.ConsumeID("topChatCategoryWebAppBots"); err != nil { + return fmt.Errorf("unable to decode topChatCategoryWebAppBots#5f6d6fd: %w", err) + } + default: + return b.Skip() + } + return nil + }) +} + // TopChatCategoryCalls represents TL type `topChatCategoryCalls#153b50dd`. type TopChatCategoryCalls struct { } @@ -965,6 +1096,7 @@ const TopChatCategoryClassName = "TopChatCategory" // case *tdapi.TopChatCategoryGroups: // topChatCategoryGroups#5b32d08e // case *tdapi.TopChatCategoryChannels: // topChatCategoryChannels#e22600e3 // case *tdapi.TopChatCategoryInlineBots: // topChatCategoryInlineBots#1678eb7c +// case *tdapi.TopChatCategoryWebAppBots: // topChatCategoryWebAppBots#5f6d6fd // case *tdapi.TopChatCategoryCalls: // topChatCategoryCalls#153b50dd // case *tdapi.TopChatCategoryForwardChats: // topChatCategoryForwardChats#6515b7d5 // default: panic(v) @@ -1033,6 +1165,13 @@ func DecodeTopChatCategory(buf *bin.Buffer) (TopChatCategoryClass, error) { return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) } return &v, nil + case TopChatCategoryWebAppBotsTypeID: + // Decoding topChatCategoryWebAppBots#5f6d6fd. + v := TopChatCategoryWebAppBots{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) + } + return &v, nil case TopChatCategoryCallsTypeID: // Decoding topChatCategoryCalls#153b50dd. v := TopChatCategoryCalls{} @@ -1094,6 +1233,13 @@ func DecodeTDLibJSONTopChatCategory(buf tdjson.Decoder) (TopChatCategoryClass, e return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) } return &v, nil + case "topChatCategoryWebAppBots": + // Decoding topChatCategoryWebAppBots#5f6d6fd. + v := TopChatCategoryWebAppBots{} + if err := v.DecodeTDLibJSON(buf); err != nil { + return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) + } + return &v, nil case "topChatCategoryCalls": // Decoding topChatCategoryCalls#153b50dd. v := TopChatCategoryCalls{} diff --git a/tdapi/tl_update_gen.go b/tdapi/tl_update_gen.go index b85db031a3..028451d27f 100644 --- a/tdapi/tl_update_gen.go +++ b/tdapi/tl_update_gen.go @@ -24854,7 +24854,7 @@ func (u *UpdateSavedMessagesTags) GetTags() (value SavedMessagesTags) { // UpdateOwnedStarCount represents TL type `updateOwnedStarCount#de995b79`. type UpdateOwnedStarCount struct { - // The new number of Telegram stars owned + // The new number of Telegram Stars owned StarCount int64 } @@ -25220,9 +25220,9 @@ func (u *UpdateChatRevenueAmount) GetRevenueAmount() (value ChatRevenueAmount) { // UpdateStarRevenueStatus represents TL type `updateStarRevenueStatus#ef4bfccb`. type UpdateStarRevenueStatus struct { - // Identifier of the owner of the Telegram stars + // Identifier of the owner of the Telegram Stars OwnerID MessageSenderClass - // New Telegram star revenue status + // New Telegram Star revenue status Status StarRevenueStatus } diff --git a/tdapi/tl_user_type_gen.go b/tdapi/tl_user_type_gen.go index 13fcd4af61..6477e16f06 100644 --- a/tdapi/tl_user_type_gen.go +++ b/tdapi/tl_user_type_gen.go @@ -293,7 +293,7 @@ func (u *UserTypeDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { }) } -// UserTypeBot represents TL type `userTypeBot#ae30a83a`. +// UserTypeBot represents TL type `userTypeBot#8ba3cc26`. type UserTypeBot struct { // True, if the bot is owned by the current user and can be edited using the methods // toggleBotUsernameIsActive, reorderBotActiveUsernames, setBotProfilePhoto, setBotName, @@ -305,6 +305,8 @@ type UserTypeBot struct { // those addressed to the bot. In private and channel chats a bot can always read all // messages CanReadAllGroupMessages bool + // True, if the bot has the main Web App + HasMainWebApp bool // True, if the bot supports inline queries IsInline bool // Placeholder for inline queries (displayed on the application input field) @@ -316,10 +318,12 @@ type UserTypeBot struct { CanConnectToBusiness bool // True, if the bot can be added to attachment or side menu CanBeAddedToAttachmentMenu bool + // The number of recently active users of the bot + ActiveUserCount int32 } // UserTypeBotTypeID is TL type id of UserTypeBot. -const UserTypeBotTypeID = 0xae30a83a +const UserTypeBotTypeID = 0x8ba3cc26 // construct implements constructor of UserTypeClass. func (u UserTypeBot) construct() UserTypeClass { return &u } @@ -347,6 +351,9 @@ func (u *UserTypeBot) Zero() bool { if !(u.CanReadAllGroupMessages == false) { return false } + if !(u.HasMainWebApp == false) { + return false + } if !(u.IsInline == false) { return false } @@ -362,6 +369,9 @@ func (u *UserTypeBot) Zero() bool { if !(u.CanBeAddedToAttachmentMenu == false) { return false } + if !(u.ActiveUserCount == 0) { + return false + } return true } @@ -410,6 +420,10 @@ func (u *UserTypeBot) TypeInfo() tdp.Type { Name: "CanReadAllGroupMessages", SchemaName: "can_read_all_group_messages", }, + { + Name: "HasMainWebApp", + SchemaName: "has_main_web_app", + }, { Name: "IsInline", SchemaName: "is_inline", @@ -430,6 +444,10 @@ func (u *UserTypeBot) TypeInfo() tdp.Type { Name: "CanBeAddedToAttachmentMenu", SchemaName: "can_be_added_to_attachment_menu", }, + { + Name: "ActiveUserCount", + SchemaName: "active_user_count", + }, } return typ } @@ -437,7 +455,7 @@ func (u *UserTypeBot) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (u *UserTypeBot) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userTypeBot#ae30a83a as nil") + return fmt.Errorf("can't encode userTypeBot#8ba3cc26 as nil") } b.PutID(UserTypeBotTypeID) return u.EncodeBare(b) @@ -446,26 +464,28 @@ func (u *UserTypeBot) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UserTypeBot) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode userTypeBot#ae30a83a as nil") + return fmt.Errorf("can't encode userTypeBot#8ba3cc26 as nil") } b.PutBool(u.CanBeEdited) b.PutBool(u.CanJoinGroups) b.PutBool(u.CanReadAllGroupMessages) + b.PutBool(u.HasMainWebApp) b.PutBool(u.IsInline) b.PutString(u.InlineQueryPlaceholder) b.PutBool(u.NeedLocation) b.PutBool(u.CanConnectToBusiness) b.PutBool(u.CanBeAddedToAttachmentMenu) + b.PutInt32(u.ActiveUserCount) return nil } // Decode implements bin.Decoder. func (u *UserTypeBot) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userTypeBot#ae30a83a to nil") + return fmt.Errorf("can't decode userTypeBot#8ba3cc26 to nil") } if err := b.ConsumeID(UserTypeBotTypeID); err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: %w", err) } return u.DecodeBare(b) } @@ -473,71 +493,85 @@ func (u *UserTypeBot) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UserTypeBot) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode userTypeBot#ae30a83a to nil") + return fmt.Errorf("can't decode userTypeBot#8ba3cc26 to nil") } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_be_edited: %w", err) } u.CanBeEdited = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_join_groups: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_join_groups: %w", err) } u.CanJoinGroups = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_read_all_group_messages: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_read_all_group_messages: %w", err) } u.CanReadAllGroupMessages = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field is_inline: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field has_main_web_app: %w", err) + } + u.HasMainWebApp = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field is_inline: %w", err) } u.IsInline = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field inline_query_placeholder: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field inline_query_placeholder: %w", err) } u.InlineQueryPlaceholder = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field need_location: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field need_location: %w", err) } u.NeedLocation = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_connect_to_business: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_connect_to_business: %w", err) } u.CanConnectToBusiness = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_be_added_to_attachment_menu: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_be_added_to_attachment_menu: %w", err) } u.CanBeAddedToAttachmentMenu = value } + { + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field active_user_count: %w", err) + } + u.ActiveUserCount = value + } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (u *UserTypeBot) EncodeTDLibJSON(b tdjson.Encoder) error { if u == nil { - return fmt.Errorf("can't encode userTypeBot#ae30a83a as nil") + return fmt.Errorf("can't encode userTypeBot#8ba3cc26 as nil") } b.ObjStart() b.PutID("userTypeBot") @@ -551,6 +585,9 @@ func (u *UserTypeBot) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("can_read_all_group_messages") b.PutBool(u.CanReadAllGroupMessages) b.Comma() + b.FieldStart("has_main_web_app") + b.PutBool(u.HasMainWebApp) + b.Comma() b.FieldStart("is_inline") b.PutBool(u.IsInline) b.Comma() @@ -566,6 +603,9 @@ func (u *UserTypeBot) EncodeTDLibJSON(b tdjson.Encoder) error { b.FieldStart("can_be_added_to_attachment_menu") b.PutBool(u.CanBeAddedToAttachmentMenu) b.Comma() + b.FieldStart("active_user_count") + b.PutInt32(u.ActiveUserCount) + b.Comma() b.StripComma() b.ObjEnd() return nil @@ -574,63 +614,75 @@ func (u *UserTypeBot) EncodeTDLibJSON(b tdjson.Encoder) error { // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (u *UserTypeBot) DecodeTDLibJSON(b tdjson.Decoder) error { if u == nil { - return fmt.Errorf("can't decode userTypeBot#ae30a83a to nil") + return fmt.Errorf("can't decode userTypeBot#8ba3cc26 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("userTypeBot"); err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: %w", err) } case "can_be_edited": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_be_edited: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_be_edited: %w", err) } u.CanBeEdited = value case "can_join_groups": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_join_groups: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_join_groups: %w", err) } u.CanJoinGroups = value case "can_read_all_group_messages": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_read_all_group_messages: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_read_all_group_messages: %w", err) } u.CanReadAllGroupMessages = value + case "has_main_web_app": + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field has_main_web_app: %w", err) + } + u.HasMainWebApp = value case "is_inline": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field is_inline: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field is_inline: %w", err) } u.IsInline = value case "inline_query_placeholder": value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field inline_query_placeholder: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field inline_query_placeholder: %w", err) } u.InlineQueryPlaceholder = value case "need_location": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field need_location: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field need_location: %w", err) } u.NeedLocation = value case "can_connect_to_business": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_connect_to_business: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_connect_to_business: %w", err) } u.CanConnectToBusiness = value case "can_be_added_to_attachment_menu": value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode userTypeBot#ae30a83a: field can_be_added_to_attachment_menu: %w", err) + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_be_added_to_attachment_menu: %w", err) } u.CanBeAddedToAttachmentMenu = value + case "active_user_count": + value, err := b.Int32() + if err != nil { + return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field active_user_count: %w", err) + } + u.ActiveUserCount = value default: return b.Skip() } @@ -662,6 +714,14 @@ func (u *UserTypeBot) GetCanReadAllGroupMessages() (value bool) { return u.CanReadAllGroupMessages } +// GetHasMainWebApp returns value of HasMainWebApp field. +func (u *UserTypeBot) GetHasMainWebApp() (value bool) { + if u == nil { + return + } + return u.HasMainWebApp +} + // GetIsInline returns value of IsInline field. func (u *UserTypeBot) GetIsInline() (value bool) { if u == nil { @@ -702,6 +762,14 @@ func (u *UserTypeBot) GetCanBeAddedToAttachmentMenu() (value bool) { return u.CanBeAddedToAttachmentMenu } +// GetActiveUserCount returns value of ActiveUserCount field. +func (u *UserTypeBot) GetActiveUserCount() (value int32) { + if u == nil { + return + } + return u.ActiveUserCount +} + // UserTypeUnknown represents TL type `userTypeUnknown#d4d0613d`. type UserTypeUnknown struct { } @@ -847,7 +915,7 @@ const UserTypeClassName = "UserType" // switch v := g.(type) { // case *tdapi.UserTypeRegular: // userTypeRegular#dc51699b // case *tdapi.UserTypeDeleted: // userTypeDeleted#94403d24 -// case *tdapi.UserTypeBot: // userTypeBot#ae30a83a +// case *tdapi.UserTypeBot: // userTypeBot#8ba3cc26 // case *tdapi.UserTypeUnknown: // userTypeUnknown#d4d0613d // default: panic(v) // } @@ -895,7 +963,7 @@ func DecodeUserType(buf *bin.Buffer) (UserTypeClass, error) { } return &v, nil case UserTypeBotTypeID: - // Decoding userTypeBot#ae30a83a. + // Decoding userTypeBot#8ba3cc26. v := UserTypeBot{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err) @@ -935,7 +1003,7 @@ func DecodeTDLibJSONUserType(buf tdjson.Decoder) (UserTypeClass, error) { } return &v, nil case "userTypeBot": - // Decoding userTypeBot#ae30a83a. + // Decoding userTypeBot#8ba3cc26. v := UserTypeBot{} if err := v.DecodeTDLibJSON(buf); err != nil { return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err)