From b3d3940f29ab71925ecb3c2e07946a23ecd4d09d Mon Sep 17 00:00:00 2001 From: GitHub Date: Mon, 18 Nov 2024 07:45:04 +0000 Subject: [PATCH] feat(schema): update Telegram to the latest layer --- _schema/tdesktop.tl | 60 ++- _schema/tdlib.tl | 62 ++- _schema/telegram.tl | 60 ++- tg/tl_bot_app_settings_gen.go | 392 ++++++++++++++++++ tg/tl_bot_app_settings_slices_gen.go | 35 ++ tg/tl_bot_info_gen.go | 96 +++-- tg/tl_bots_check_download_file_params_gen.go | 233 +++++++++++ ...s_check_download_file_params_slices_gen.go | 35 ++ ...toggle_user_emoji_status_permission_gen.go | 206 +++++++++ ...user_emoji_status_permission_slices_gen.go | 35 ++ tg/tl_bots_update_user_emoji_status_gen.go | 216 ++++++++++ ...ots_update_user_emoji_status_slices_gen.go | 35 ++ tg/tl_handlers_gen.go | 10 + tg/tl_input_privacy_key_gen.go | 109 +++++ tg/tl_input_privacy_rule_gen.go | 218 ++++++++++ tg/tl_invoice_gen.go | 82 +++- tg/tl_message_action_gen.go | 67 ++- ...essages_bot_prepared_inline_message_gen.go | 188 +++++++++ ..._bot_prepared_inline_message_slices_gen.go | 35 ++ ...essages_get_prepared_inline_message_gen.go | 205 +++++++++ ..._get_prepared_inline_message_slices_gen.go | 35 ++ tg/tl_messages_prepared_inline_message_gen.go | 320 ++++++++++++++ ...ages_prepared_inline_message_slices_gen.go | 35 ++ tg/tl_messages_request_app_web_view_gen.go | 35 ++ tg/tl_messages_request_main_web_view_gen.go | 35 ++ tg/tl_messages_request_simple_web_view_gen.go | 35 ++ tg/tl_messages_request_web_view_gen.go | 35 ++ ...ssages_save_prepared_inline_message_gen.go | 302 ++++++++++++++ ...save_prepared_inline_message_slices_gen.go | 35 ++ ...ments_bot_cancel_stars_subscription_gen.go | 328 +++++++++++++++ ...ot_cancel_stars_subscription_slices_gen.go | 35 ++ tg/tl_privacy_key_gen.go | 109 +++++ tg/tl_privacy_rule_gen.go | 218 ++++++++++ tg/tl_registry_gen.go | 65 ++- tg/tl_server_gen.go | 118 ++++++ tg/tl_star_gift_gen.go | 35 ++ tg/tl_stars_subscription_gen.go | 218 +++++++++- tg/tl_update_gen.go | 250 +++++++++++ tg/tl_update_slices_gen.go | 95 +++++ tg/tl_updates_classifier_gen.go | 2 + tg/tl_user_full_gen.go | 35 ++ tg/tl_web_view_result_url_gen.go | 35 ++ 42 files changed, 4659 insertions(+), 130 deletions(-) create mode 100644 tg/tl_bot_app_settings_gen.go create mode 100644 tg/tl_bot_app_settings_slices_gen.go create mode 100644 tg/tl_bots_check_download_file_params_gen.go create mode 100644 tg/tl_bots_check_download_file_params_slices_gen.go create mode 100644 tg/tl_bots_toggle_user_emoji_status_permission_gen.go create mode 100644 tg/tl_bots_toggle_user_emoji_status_permission_slices_gen.go create mode 100644 tg/tl_bots_update_user_emoji_status_gen.go create mode 100644 tg/tl_bots_update_user_emoji_status_slices_gen.go create mode 100644 tg/tl_messages_bot_prepared_inline_message_gen.go create mode 100644 tg/tl_messages_bot_prepared_inline_message_slices_gen.go create mode 100644 tg/tl_messages_get_prepared_inline_message_gen.go create mode 100644 tg/tl_messages_get_prepared_inline_message_slices_gen.go create mode 100644 tg/tl_messages_prepared_inline_message_gen.go create mode 100644 tg/tl_messages_prepared_inline_message_slices_gen.go create mode 100644 tg/tl_messages_save_prepared_inline_message_gen.go create mode 100644 tg/tl_messages_save_prepared_inline_message_slices_gen.go create mode 100644 tg/tl_payments_bot_cancel_stars_subscription_gen.go create mode 100644 tg/tl_payments_bot_cancel_stars_subscription_slices_gen.go diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index ce545b79ae..db34e695a5 100644 --- a/_schema/tdesktop.tl +++ b/_schema/tdesktop.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl -// Layer: 192 -// SHA256: 8de881afe6424446c01b781ba56351db3ae6853674140329dcea4bcf17bded31 +// Layer: 193 +// SHA256: 588d13327ad4d323f81aca924d229c272fb446dc723714d1d107e4699fcb2085 boolFalse#bc799737 = Bool; @@ -320,7 +320,7 @@ messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long c messageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction; -messageActionStarGift#9bb3ef44 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true gift:StarGift message:flags.1?TextWithEntities convert_stars:long = MessageAction; +messageActionStarGift#8557637 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long = MessageAction; dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; @@ -396,7 +396,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; +userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -752,6 +752,8 @@ updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Updat updatePaidReactionPrivacy#51ca7aec private:Bool = Update; +updateBotSubscriptionExpire#2d13c6ee user_id:long payload:string invoice_slug:string until_date:int qts:int = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -914,6 +916,8 @@ inputPrivacyKeyAbout#3823cc40 = InputPrivacyKey; inputPrivacyKeyBirthday#d65a11cc = InputPrivacyKey; +inputPrivacyKeyStarGiftsAutoSave#e1732341 = InputPrivacyKey; + privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; @@ -936,6 +940,8 @@ privacyKeyAbout#a486b761 = PrivacyKey; privacyKeyBirthday#2000a518 = PrivacyKey; +privacyKeyStarGiftsAutoSave#2ca4fdf8 = PrivacyKey; + inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; @@ -956,6 +962,10 @@ inputPrivacyValueAllowCloseFriends#2f453e49 = InputPrivacyRule; inputPrivacyValueAllowPremium#77cdc9f1 = InputPrivacyRule; +inputPrivacyValueAllowBots#5a4fcce5 = InputPrivacyRule; + +inputPrivacyValueDisallowBots#c4e57915 = InputPrivacyRule; + privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; @@ -976,6 +986,10 @@ privacyValueAllowCloseFriends#f7e8d89b = PrivacyRule; privacyValueAllowPremium#ece9814b = PrivacyRule; +privacyValueAllowBots#21461b5d = PrivacyRule; + +privacyValueDisallowBots#f6a5f82f = PrivacyRule; + account.privacyRules#50a04e45 rules:Vector chats:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; @@ -1070,7 +1084,7 @@ messages.stickerSetNotModified#d3f924eb = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; -botInfo#82437e74 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string = BotInfo; +botInfo#36607333 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string app_settings:flags.8?BotAppSettings = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; @@ -1484,7 +1498,7 @@ dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; -invoice#5db95a15 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector terms_url:flags.10?string = Invoice; +invoice#49ee584 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector terms_url:flags.10?string subscription_period:flags.11?int = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; @@ -2190,7 +2204,7 @@ attachMenuBots#3c4301c0 hash:long bots:Vector users:Vector attachMenuBotsBot#93bf667f bot:AttachMenuBot users:Vector = AttachMenuBotsBot; -webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true query_id:flags.0?long url:string = WebViewResult; +webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true fullscreen:flags.2?true query_id:flags.0?long url:string = WebViewResult; webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent; @@ -2704,7 +2718,7 @@ bots.previewInfo#ca71d64 media:Vector lang_codes:Vector starsSubscriptionPricing#5416d58 period:int amount:long = StarsSubscriptionPricing; -starsSubscription#538ecf18 flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string = StarsSubscription; +starsSubscription#2e6eab1a flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true bot_canceled:flags.7?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string title:flags.4?string photo:flags.5?WebDocument invoice_slug:flags.6?string = StarsSubscription; messageReactor#4ba3a95a flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer count:int = MessageReactor; @@ -2712,7 +2726,7 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; -starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift; +starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift; payments.starGiftsNotModified#a388a368 = payments.StarGifts; @@ -2730,6 +2744,12 @@ reportResultAddComment#6f09ac31 flags:# optional:flags.0?true option:bytes = Rep reportResultReported#8db33c4b = ReportResult; +messages.botPreparedInlineMessage#8ecf0511 id:string expire_date:int = messages.BotPreparedInlineMessage; + +messages.preparedInlineMessage#ff57708d query_id:long result:BotInlineResult peer_types:Vector cache_time:int users:Vector = messages.PreparedInlineMessage; + +botAppSettings#c99b1950 flags:# placeholder_path:flags.0?bytes background_color:flags.1?int background_dark_color:flags.2?int header_color:flags.3?int header_dark_color:flags.4?int = BotAppSettings; + ---functions--- @@ -3405,11 +3425,11 @@ messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot; messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool; -messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult; +messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult; messages.prolongWebView#b0d81a83 flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = Bool; -messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; +messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true fullscreen:flags.8?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent; @@ -3453,7 +3473,7 @@ messages.togglePeerTranslations#e47cb579 flags:# disabled:flags.0?true peer:Inpu messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; -messages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult; +messages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult; messages.setChatWallPaper#8ffacae1 flags:# for_both:flags.3?true revert:flags.4?true peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; @@ -3509,7 +3529,7 @@ messages.deleteFactCheck#d1da940c peer:InputPeer msg_id:int = Updates; messages.getFactCheck#b9cdc5ee peer:InputPeer msg_id:Vector = Vector; -messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; +messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; messages.sendPaidReaction#9dd6a67b flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?Bool = Updates; @@ -3525,6 +3545,10 @@ messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:b messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages; +messages.savePreparedInlineMessage#f21f7f2f flags:# result:InputBotInlineResult user_id:InputUser peer_types:flags.0?Vector = messages.BotPreparedInlineMessage; + +messages.getPreparedInlineMessage#857ebdb8 bot:InputUser id:string = messages.PreparedInlineMessage; + updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -3775,6 +3799,12 @@ bots.getPreviewInfo#423ab3ad bot:InputUser lang_code:string = bots.PreviewInfo; bots.getPreviewMedias#a2a5594d bot:InputUser = Vector; +bots.updateUserEmojiStatus#ed9f30c5 user_id:InputUser emoji_status:EmojiStatus = Bool; + +bots.toggleUserEmojiStatusPermission#6de6392 bot:InputUser enabled:Bool = Bool; + +bots.checkDownloadFileParams#50077589 bot:InputUser file_name:string url:string = Bool; + payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm; payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt; @@ -3843,6 +3873,8 @@ payments.saveStarGift#87acf08e flags:# unsave:flags.0?true user_id:InputUser msg payments.convertStarGift#421e027 user_id:InputUser msg_id:int = Bool; +payments.botCancelStarsSubscription#57f9ece6 flags:# restore:flags.0?true user_id:InputUser invoice_slug:flags.1?string charge_id:flags.2?string = Bool; + stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector software:flags.3?string = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; @@ -4059,4 +4091,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 192 +// LAYER 193 diff --git a/_schema/tdlib.tl b/_schema/tdlib.tl index 7136d694c2..88eb755109 100644 --- a/_schema/tdlib.tl +++ b/_schema/tdlib.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/tdlib/td/master/td/generate/scheme/telegram_api.tl -// Layer: 192 -// SHA256: a0ae469f520d1c291bf11b28ea23563f9308645cc158467e78e161106b17cfb1 +// Layer: 194 +// SHA256: 6042b82379650b0c118b359d30556485b5a25045412ca0b11854095c751febe5 int#a8509bda ? = Int; @@ -292,9 +292,9 @@ messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; -messageActionPaymentSentMe#8f31b327 flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; +messageActionPaymentSentMe#ffa00ccc flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge subscription_until_date:flags.4?int = MessageAction; -messageActionPaymentSent#96163f56 flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string = MessageAction; +messageActionPaymentSent#c624b16e flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string subscription_until_date:flags.4?int = MessageAction; messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; @@ -356,7 +356,7 @@ messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long c messageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction; -messageActionStarGift#9bb3ef44 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true gift:StarGift message:flags.1?TextWithEntities convert_stars:long = MessageAction; +messageActionStarGift#8557637 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long = MessageAction; dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; @@ -432,7 +432,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; +userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -950,6 +950,8 @@ inputPrivacyKeyAbout#3823cc40 = InputPrivacyKey; inputPrivacyKeyBirthday#d65a11cc = InputPrivacyKey; +inputPrivacyKeyStarGiftsAutoSave#e1732341 = InputPrivacyKey; + privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; @@ -972,6 +974,8 @@ privacyKeyAbout#a486b761 = PrivacyKey; privacyKeyBirthday#2000a518 = PrivacyKey; +privacyKeyStarGiftsAutoSave#2ca4fdf8 = PrivacyKey; + inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; @@ -992,6 +996,10 @@ inputPrivacyValueAllowCloseFriends#2f453e49 = InputPrivacyRule; inputPrivacyValueAllowPremium#77cdc9f1 = InputPrivacyRule; +inputPrivacyValueAllowBots#5a4fcce5 = InputPrivacyRule; + +inputPrivacyValueDisallowBots#c4e57915 = InputPrivacyRule; + privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; @@ -1012,6 +1020,10 @@ privacyValueAllowCloseFriends#f7e8d89b = PrivacyRule; privacyValueAllowPremium#ece9814b = PrivacyRule; +privacyValueAllowBots#21461b5d = PrivacyRule; + +privacyValueDisallowBots#f6a5f82f = PrivacyRule; + account.privacyRules#50a04e45 rules:Vector chats:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; @@ -1106,7 +1118,7 @@ messages.stickerSetNotModified#d3f924eb = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; -botInfo#82437e74 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string = BotInfo; +botInfo#36607333 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string app_settings:flags.8?BotAppSettings = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; @@ -1520,7 +1532,7 @@ dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; -invoice#5db95a15 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector terms_url:flags.10?string = Invoice; +invoice#49ee584 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector terms_url:flags.10?string subscription_period:flags.11?int = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; @@ -2226,7 +2238,7 @@ attachMenuBots#3c4301c0 hash:long bots:Vector users:Vector attachMenuBotsBot#93bf667f bot:AttachMenuBot users:Vector = AttachMenuBotsBot; -webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true query_id:flags.0?long url:string = WebViewResult; +webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true fullscreen:flags.2?true query_id:flags.0?long url:string = WebViewResult; webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent; @@ -2740,7 +2752,7 @@ bots.previewInfo#ca71d64 media:Vector lang_codes:Vector starsSubscriptionPricing#5416d58 period:int amount:long = StarsSubscriptionPricing; -starsSubscription#538ecf18 flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string = StarsSubscription; +starsSubscription#2e6eab1a flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true bot_canceled:flags.7?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string title:flags.4?string photo:flags.5?WebDocument invoice_slug:flags.6?string = StarsSubscription; messageReactor#4ba3a95a flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer count:int = MessageReactor; @@ -2748,7 +2760,7 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; -starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift; +starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift; payments.starGiftsNotModified#a388a368 = payments.StarGifts; @@ -2766,6 +2778,12 @@ reportResultAddComment#6f09ac31 flags:# optional:flags.0?true option:bytes = Rep reportResultReported#8db33c4b = ReportResult; +messages.botPreparedInlineMessage#8ecf0511 id:string expire_date:int = messages.BotPreparedInlineMessage; + +messages.preparedInlineMessage#ff57708d query_id:long result:BotInlineResult peer_types:Vector cache_time:int users:Vector = messages.PreparedInlineMessage; + +botAppSettings#c99b1950 flags:# placeholder_path:flags.0?bytes background_color:flags.1?int background_dark_color:flags.2?int header_color:flags.3?int header_dark_color:flags.4?int = BotAppSettings; + ---functions--- @@ -3441,11 +3459,11 @@ messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot; messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool; -messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult; +messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult; messages.prolongWebView#b0d81a83 flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = Bool; -messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; +messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true fullscreen:flags.8?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent; @@ -3489,7 +3507,7 @@ messages.togglePeerTranslations#e47cb579 flags:# disabled:flags.0?true peer:Inpu messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; -messages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult; +messages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult; messages.setChatWallPaper#8ffacae1 flags:# for_both:flags.3?true revert:flags.4?true peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; @@ -3545,7 +3563,7 @@ messages.deleteFactCheck#d1da940c peer:InputPeer msg_id:int = Updates; messages.getFactCheck#b9cdc5ee peer:InputPeer msg_id:Vector = Vector; -messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; +messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; messages.sendPaidReaction#9dd6a67b flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?Bool = Updates; @@ -3561,6 +3579,10 @@ messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:b messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages; +messages.savePreparedInlineMessage#f21f7f2f flags:# result:InputBotInlineResult user_id:InputUser peer_types:flags.0?Vector = messages.BotPreparedInlineMessage; + +messages.getPreparedInlineMessage#857ebdb8 bot:InputUser id:string = messages.PreparedInlineMessage; + updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -3811,6 +3833,12 @@ bots.getPreviewInfo#423ab3ad bot:InputUser lang_code:string = bots.PreviewInfo; bots.getPreviewMedias#a2a5594d bot:InputUser = Vector; +bots.updateUserEmojiStatus#ed9f30c5 user_id:InputUser emoji_status:EmojiStatus = Bool; + +bots.toggleUserEmojiStatusPermission#6de6392 bot:InputUser enabled:Bool = Bool; + +bots.checkDownloadFileParams#50077589 bot:InputUser file_name:string url:string = Bool; + payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm; payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt; @@ -3879,6 +3907,8 @@ payments.saveStarGift#87acf08e flags:# unsave:flags.0?true user_id:InputUser msg payments.convertStarGift#421e027 user_id:InputUser msg_id:int = Bool; +payments.botCancelStarsSubscription#6dfa0622 flags:# restore:flags.0?true user_id:InputUser charge_id:string = Bool; + stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector software:flags.3?string = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; @@ -4095,4 +4125,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 192 +// LAYER 194 diff --git a/_schema/telegram.tl b/_schema/telegram.tl index 7cc3353e14..4c905ff811 100644 --- a/_schema/telegram.tl +++ b/_schema/telegram.tl @@ -2,8 +2,8 @@ // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl // Merge: _schema/legacy.tl -// Layer: 192 -// SHA256: 8de881afe6424446c01b781ba56351db3ae6853674140329dcea4bcf17bded31 +// Layer: 193 +// SHA256: 588d13327ad4d323f81aca924d229c272fb446dc723714d1d107e4699fcb2085 boolFalse#bc799737 = Bool; @@ -321,7 +321,7 @@ messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long c messageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction; -messageActionStarGift#9bb3ef44 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true gift:StarGift message:flags.1?TextWithEntities convert_stars:long = MessageAction; +messageActionStarGift#8557637 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long = MessageAction; dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; @@ -397,7 +397,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; +userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -753,6 +753,8 @@ updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Updat updatePaidReactionPrivacy#51ca7aec private:Bool = Update; +updateBotSubscriptionExpire#2d13c6ee user_id:long payload:string invoice_slug:string until_date:int qts:int = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -915,6 +917,8 @@ inputPrivacyKeyAbout#3823cc40 = InputPrivacyKey; inputPrivacyKeyBirthday#d65a11cc = InputPrivacyKey; +inputPrivacyKeyStarGiftsAutoSave#e1732341 = InputPrivacyKey; + privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; @@ -937,6 +941,8 @@ privacyKeyAbout#a486b761 = PrivacyKey; privacyKeyBirthday#2000a518 = PrivacyKey; +privacyKeyStarGiftsAutoSave#2ca4fdf8 = PrivacyKey; + inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; @@ -957,6 +963,10 @@ inputPrivacyValueAllowCloseFriends#2f453e49 = InputPrivacyRule; inputPrivacyValueAllowPremium#77cdc9f1 = InputPrivacyRule; +inputPrivacyValueAllowBots#5a4fcce5 = InputPrivacyRule; + +inputPrivacyValueDisallowBots#c4e57915 = InputPrivacyRule; + privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; @@ -977,6 +987,10 @@ privacyValueAllowCloseFriends#f7e8d89b = PrivacyRule; privacyValueAllowPremium#ece9814b = PrivacyRule; +privacyValueAllowBots#21461b5d = PrivacyRule; + +privacyValueDisallowBots#f6a5f82f = PrivacyRule; + account.privacyRules#50a04e45 rules:Vector chats:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; @@ -1071,7 +1085,7 @@ messages.stickerSetNotModified#d3f924eb = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; -botInfo#82437e74 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string = BotInfo; +botInfo#36607333 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string app_settings:flags.8?BotAppSettings = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; @@ -1485,7 +1499,7 @@ dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; -invoice#5db95a15 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector terms_url:flags.10?string = Invoice; +invoice#49ee584 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector terms_url:flags.10?string subscription_period:flags.11?int = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; @@ -2191,7 +2205,7 @@ attachMenuBots#3c4301c0 hash:long bots:Vector users:Vector attachMenuBotsBot#93bf667f bot:AttachMenuBot users:Vector = AttachMenuBotsBot; -webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true query_id:flags.0?long url:string = WebViewResult; +webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true fullscreen:flags.2?true query_id:flags.0?long url:string = WebViewResult; webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent; @@ -2705,7 +2719,7 @@ bots.previewInfo#ca71d64 media:Vector lang_codes:Vector starsSubscriptionPricing#5416d58 period:int amount:long = StarsSubscriptionPricing; -starsSubscription#538ecf18 flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string = StarsSubscription; +starsSubscription#2e6eab1a flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true bot_canceled:flags.7?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string title:flags.4?string photo:flags.5?WebDocument invoice_slug:flags.6?string = StarsSubscription; messageReactor#4ba3a95a flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer count:int = MessageReactor; @@ -2713,7 +2727,7 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; -starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift; +starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift; payments.starGiftsNotModified#a388a368 = payments.StarGifts; @@ -2731,6 +2745,12 @@ reportResultAddComment#6f09ac31 flags:# optional:flags.0?true option:bytes = Rep reportResultReported#8db33c4b = ReportResult; +messages.botPreparedInlineMessage#8ecf0511 id:string expire_date:int = messages.BotPreparedInlineMessage; + +messages.preparedInlineMessage#ff57708d query_id:long result:BotInlineResult peer_types:Vector cache_time:int users:Vector = messages.PreparedInlineMessage; + +botAppSettings#c99b1950 flags:# placeholder_path:flags.0?bytes background_color:flags.1?int background_dark_color:flags.2?int header_color:flags.3?int header_dark_color:flags.4?int = BotAppSettings; + ---functions--- @@ -3406,11 +3426,11 @@ messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot; messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool; -messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult; +messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult; messages.prolongWebView#b0d81a83 flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = Bool; -messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; +messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true fullscreen:flags.8?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent; @@ -3454,7 +3474,7 @@ messages.togglePeerTranslations#e47cb579 flags:# disabled:flags.0?true peer:Inpu messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; -messages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult; +messages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult; messages.setChatWallPaper#8ffacae1 flags:# for_both:flags.3?true revert:flags.4?true peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; @@ -3510,7 +3530,7 @@ messages.deleteFactCheck#d1da940c peer:InputPeer msg_id:int = Updates; messages.getFactCheck#b9cdc5ee peer:InputPeer msg_id:Vector = Vector; -messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; +messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; messages.sendPaidReaction#9dd6a67b flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?Bool = Updates; @@ -3526,6 +3546,10 @@ messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:b messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages; +messages.savePreparedInlineMessage#f21f7f2f flags:# result:InputBotInlineResult user_id:InputUser peer_types:flags.0?Vector = messages.BotPreparedInlineMessage; + +messages.getPreparedInlineMessage#857ebdb8 bot:InputUser id:string = messages.PreparedInlineMessage; + updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -3776,6 +3800,12 @@ bots.getPreviewInfo#423ab3ad bot:InputUser lang_code:string = bots.PreviewInfo; bots.getPreviewMedias#a2a5594d bot:InputUser = Vector; +bots.updateUserEmojiStatus#ed9f30c5 user_id:InputUser emoji_status:EmojiStatus = Bool; + +bots.toggleUserEmojiStatusPermission#6de6392 bot:InputUser enabled:Bool = Bool; + +bots.checkDownloadFileParams#50077589 bot:InputUser file_name:string url:string = Bool; + payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm; payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt; @@ -3844,6 +3874,8 @@ payments.saveStarGift#87acf08e flags:# unsave:flags.0?true user_id:InputUser msg payments.convertStarGift#421e027 user_id:InputUser msg_id:int = Bool; +payments.botCancelStarsSubscription#57f9ece6 flags:# restore:flags.0?true user_id:InputUser invoice_slug:flags.1?string charge_id:flags.2?string = Bool; + stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector software:flags.3?string = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; @@ -4092,4 +4124,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 192 +// LAYER 193 diff --git a/tg/tl_bot_app_settings_gen.go b/tg/tl_bot_app_settings_gen.go new file mode 100644 index 0000000000..a103a08aa3 --- /dev/null +++ b/tg/tl_bot_app_settings_gen.go @@ -0,0 +1,392 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) + +// BotAppSettings represents TL type `botAppSettings#c99b1950`. +// +// See https://core.telegram.org/constructor/botAppSettings for reference. +type BotAppSettings struct { + // Flags field of BotAppSettings. + Flags bin.Fields + // PlaceholderPath field of BotAppSettings. + // + // Use SetPlaceholderPath and GetPlaceholderPath helpers. + PlaceholderPath []byte + // BackgroundColor field of BotAppSettings. + // + // Use SetBackgroundColor and GetBackgroundColor helpers. + BackgroundColor int + // BackgroundDarkColor field of BotAppSettings. + // + // Use SetBackgroundDarkColor and GetBackgroundDarkColor helpers. + BackgroundDarkColor int + // HeaderColor field of BotAppSettings. + // + // Use SetHeaderColor and GetHeaderColor helpers. + HeaderColor int + // HeaderDarkColor field of BotAppSettings. + // + // Use SetHeaderDarkColor and GetHeaderDarkColor helpers. + HeaderDarkColor int +} + +// BotAppSettingsTypeID is TL type id of BotAppSettings. +const BotAppSettingsTypeID = 0xc99b1950 + +// Ensuring interfaces in compile-time for BotAppSettings. +var ( + _ bin.Encoder = &BotAppSettings{} + _ bin.Decoder = &BotAppSettings{} + _ bin.BareEncoder = &BotAppSettings{} + _ bin.BareDecoder = &BotAppSettings{} +) + +func (b *BotAppSettings) Zero() bool { + if b == nil { + return true + } + if !(b.Flags.Zero()) { + return false + } + if !(b.PlaceholderPath == nil) { + return false + } + if !(b.BackgroundColor == 0) { + return false + } + if !(b.BackgroundDarkColor == 0) { + return false + } + if !(b.HeaderColor == 0) { + return false + } + if !(b.HeaderDarkColor == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *BotAppSettings) String() string { + if b == nil { + return "BotAppSettings(nil)" + } + type Alias BotAppSettings + return fmt.Sprintf("BotAppSettings%+v", Alias(*b)) +} + +// FillFrom fills BotAppSettings from given interface. +func (b *BotAppSettings) FillFrom(from interface { + GetPlaceholderPath() (value []byte, ok bool) + GetBackgroundColor() (value int, ok bool) + GetBackgroundDarkColor() (value int, ok bool) + GetHeaderColor() (value int, ok bool) + GetHeaderDarkColor() (value int, ok bool) +}) { + if val, ok := from.GetPlaceholderPath(); ok { + b.PlaceholderPath = val + } + + if val, ok := from.GetBackgroundColor(); ok { + b.BackgroundColor = val + } + + if val, ok := from.GetBackgroundDarkColor(); ok { + b.BackgroundDarkColor = val + } + + if val, ok := from.GetHeaderColor(); ok { + b.HeaderColor = val + } + + if val, ok := from.GetHeaderDarkColor(); ok { + b.HeaderDarkColor = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotAppSettings) TypeID() uint32 { + return BotAppSettingsTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotAppSettings) TypeName() string { + return "botAppSettings" +} + +// TypeInfo returns info about TL type. +func (b *BotAppSettings) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "botAppSettings", + ID: BotAppSettingsTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "PlaceholderPath", + SchemaName: "placeholder_path", + Null: !b.Flags.Has(0), + }, + { + Name: "BackgroundColor", + SchemaName: "background_color", + Null: !b.Flags.Has(1), + }, + { + Name: "BackgroundDarkColor", + SchemaName: "background_dark_color", + Null: !b.Flags.Has(2), + }, + { + Name: "HeaderColor", + SchemaName: "header_color", + Null: !b.Flags.Has(3), + }, + { + Name: "HeaderDarkColor", + SchemaName: "header_dark_color", + Null: !b.Flags.Has(4), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (b *BotAppSettings) SetFlags() { + if !(b.PlaceholderPath == nil) { + b.Flags.Set(0) + } + if !(b.BackgroundColor == 0) { + b.Flags.Set(1) + } + if !(b.BackgroundDarkColor == 0) { + b.Flags.Set(2) + } + if !(b.HeaderColor == 0) { + b.Flags.Set(3) + } + if !(b.HeaderDarkColor == 0) { + b.Flags.Set(4) + } +} + +// Encode implements bin.Encoder. +func (b *BotAppSettings) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botAppSettings#c99b1950 as nil") + } + buf.PutID(BotAppSettingsTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *BotAppSettings) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode botAppSettings#c99b1950 as nil") + } + b.SetFlags() + if err := b.Flags.Encode(buf); err != nil { + return fmt.Errorf("unable to encode botAppSettings#c99b1950: field flags: %w", err) + } + if b.Flags.Has(0) { + buf.PutBytes(b.PlaceholderPath) + } + if b.Flags.Has(1) { + buf.PutInt(b.BackgroundColor) + } + if b.Flags.Has(2) { + buf.PutInt(b.BackgroundDarkColor) + } + if b.Flags.Has(3) { + buf.PutInt(b.HeaderColor) + } + if b.Flags.Has(4) { + buf.PutInt(b.HeaderDarkColor) + } + return nil +} + +// Decode implements bin.Decoder. +func (b *BotAppSettings) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botAppSettings#c99b1950 to nil") + } + if err := buf.ConsumeID(BotAppSettingsTypeID); err != nil { + return fmt.Errorf("unable to decode botAppSettings#c99b1950: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *BotAppSettings) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode botAppSettings#c99b1950 to nil") + } + { + if err := b.Flags.Decode(buf); err != nil { + return fmt.Errorf("unable to decode botAppSettings#c99b1950: field flags: %w", err) + } + } + if b.Flags.Has(0) { + value, err := buf.Bytes() + if err != nil { + return fmt.Errorf("unable to decode botAppSettings#c99b1950: field placeholder_path: %w", err) + } + b.PlaceholderPath = value + } + if b.Flags.Has(1) { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode botAppSettings#c99b1950: field background_color: %w", err) + } + b.BackgroundColor = value + } + if b.Flags.Has(2) { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode botAppSettings#c99b1950: field background_dark_color: %w", err) + } + b.BackgroundDarkColor = value + } + if b.Flags.Has(3) { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode botAppSettings#c99b1950: field header_color: %w", err) + } + b.HeaderColor = value + } + if b.Flags.Has(4) { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode botAppSettings#c99b1950: field header_dark_color: %w", err) + } + b.HeaderDarkColor = value + } + return nil +} + +// SetPlaceholderPath sets value of PlaceholderPath conditional field. +func (b *BotAppSettings) SetPlaceholderPath(value []byte) { + b.Flags.Set(0) + b.PlaceholderPath = value +} + +// GetPlaceholderPath returns value of PlaceholderPath conditional field and +// boolean which is true if field was set. +func (b *BotAppSettings) GetPlaceholderPath() (value []byte, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(0) { + return value, false + } + return b.PlaceholderPath, true +} + +// SetBackgroundColor sets value of BackgroundColor conditional field. +func (b *BotAppSettings) SetBackgroundColor(value int) { + b.Flags.Set(1) + b.BackgroundColor = value +} + +// GetBackgroundColor returns value of BackgroundColor conditional field and +// boolean which is true if field was set. +func (b *BotAppSettings) GetBackgroundColor() (value int, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(1) { + return value, false + } + return b.BackgroundColor, true +} + +// SetBackgroundDarkColor sets value of BackgroundDarkColor conditional field. +func (b *BotAppSettings) SetBackgroundDarkColor(value int) { + b.Flags.Set(2) + b.BackgroundDarkColor = value +} + +// GetBackgroundDarkColor returns value of BackgroundDarkColor conditional field and +// boolean which is true if field was set. +func (b *BotAppSettings) GetBackgroundDarkColor() (value int, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(2) { + return value, false + } + return b.BackgroundDarkColor, true +} + +// SetHeaderColor sets value of HeaderColor conditional field. +func (b *BotAppSettings) SetHeaderColor(value int) { + b.Flags.Set(3) + b.HeaderColor = value +} + +// GetHeaderColor returns value of HeaderColor conditional field and +// boolean which is true if field was set. +func (b *BotAppSettings) GetHeaderColor() (value int, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(3) { + return value, false + } + return b.HeaderColor, true +} + +// SetHeaderDarkColor sets value of HeaderDarkColor conditional field. +func (b *BotAppSettings) SetHeaderDarkColor(value int) { + b.Flags.Set(4) + b.HeaderDarkColor = value +} + +// GetHeaderDarkColor returns value of HeaderDarkColor conditional field and +// boolean which is true if field was set. +func (b *BotAppSettings) GetHeaderDarkColor() (value int, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(4) { + return value, false + } + return b.HeaderDarkColor, true +} diff --git a/tg/tl_bot_app_settings_slices_gen.go b/tg/tl_bot_app_settings_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_bot_app_settings_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) diff --git a/tg/tl_bot_info_gen.go b/tg/tl_bot_info_gen.go index 6964aa3b42..a474295f7d 100644 --- a/tg/tl_bot_info_gen.go +++ b/tg/tl_bot_info_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// BotInfo represents TL type `botInfo#82437e74`. +// BotInfo represents TL type `botInfo#36607333`. // Info about bots (available bot commands, etc) // // See https://core.telegram.org/constructor/botInfo for reference. @@ -75,10 +75,14 @@ type BotInfo struct { // // Use SetPrivacyPolicyURL and GetPrivacyPolicyURL helpers. PrivacyPolicyURL string + // AppSettings field of BotInfo. + // + // Use SetAppSettings and GetAppSettings helpers. + AppSettings BotAppSettings } // BotInfoTypeID is TL type id of BotInfo. -const BotInfoTypeID = 0x82437e74 +const BotInfoTypeID = 0x36607333 // Ensuring interfaces in compile-time for BotInfo. var ( @@ -119,6 +123,9 @@ func (b *BotInfo) Zero() bool { if !(b.PrivacyPolicyURL == "") { return false } + if !(b.AppSettings.Zero()) { + return false + } return true } @@ -142,6 +149,7 @@ func (b *BotInfo) FillFrom(from interface { GetCommands() (value []BotCommand, ok bool) GetMenuButton() (value BotMenuButtonClass, ok bool) GetPrivacyPolicyURL() (value string, ok bool) + GetAppSettings() (value BotAppSettings, ok bool) }) { b.HasPreviewMedias = from.GetHasPreviewMedias() if val, ok := from.GetUserID(); ok { @@ -172,6 +180,10 @@ func (b *BotInfo) FillFrom(from interface { b.PrivacyPolicyURL = val } + if val, ok := from.GetAppSettings(); ok { + b.AppSettings = val + } + } // TypeID returns type id in TL schema. @@ -237,6 +249,11 @@ func (b *BotInfo) TypeInfo() tdp.Type { SchemaName: "privacy_policy_url", Null: !b.Flags.Has(7), }, + { + Name: "AppSettings", + SchemaName: "app_settings", + Null: !b.Flags.Has(8), + }, } return typ } @@ -267,12 +284,15 @@ func (b *BotInfo) SetFlags() { if !(b.PrivacyPolicyURL == "") { b.Flags.Set(7) } + if !(b.AppSettings.Zero()) { + b.Flags.Set(8) + } } // Encode implements bin.Encoder. func (b *BotInfo) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode botInfo#82437e74 as nil") + return fmt.Errorf("can't encode botInfo#36607333 as nil") } buf.PutID(BotInfoTypeID) return b.EncodeBare(buf) @@ -281,11 +301,11 @@ 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#82437e74 as nil") + return fmt.Errorf("can't encode botInfo#36607333 as nil") } b.SetFlags() if err := b.Flags.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#82437e74: field flags: %w", err) + return fmt.Errorf("unable to encode botInfo#36607333: field flags: %w", err) } if b.Flags.Has(0) { buf.PutLong(b.UserID) @@ -295,49 +315,54 @@ func (b *BotInfo) EncodeBare(buf *bin.Buffer) error { } if b.Flags.Has(4) { if b.DescriptionPhoto == nil { - return fmt.Errorf("unable to encode botInfo#82437e74: field description_photo is nil") + return fmt.Errorf("unable to encode botInfo#36607333: field description_photo is nil") } if err := b.DescriptionPhoto.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#82437e74: field description_photo: %w", err) + return fmt.Errorf("unable to encode botInfo#36607333: field description_photo: %w", err) } } if b.Flags.Has(5) { if b.DescriptionDocument == nil { - return fmt.Errorf("unable to encode botInfo#82437e74: field description_document is nil") + return fmt.Errorf("unable to encode botInfo#36607333: field description_document is nil") } if err := b.DescriptionDocument.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#82437e74: field description_document: %w", err) + return fmt.Errorf("unable to encode botInfo#36607333: field description_document: %w", err) } } if b.Flags.Has(2) { buf.PutVectorHeader(len(b.Commands)) for idx, v := range b.Commands { if err := v.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#82437e74: field commands element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode botInfo#36607333: field commands element with index %d: %w", idx, err) } } } if b.Flags.Has(3) { if b.MenuButton == nil { - return fmt.Errorf("unable to encode botInfo#82437e74: field menu_button is nil") + return fmt.Errorf("unable to encode botInfo#36607333: field menu_button is nil") } if err := b.MenuButton.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#82437e74: field menu_button: %w", err) + return fmt.Errorf("unable to encode botInfo#36607333: field menu_button: %w", err) } } if b.Flags.Has(7) { buf.PutString(b.PrivacyPolicyURL) } + if b.Flags.Has(8) { + if err := b.AppSettings.Encode(buf); err != nil { + return fmt.Errorf("unable to encode botInfo#36607333: field app_settings: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (b *BotInfo) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode botInfo#82437e74 to nil") + return fmt.Errorf("can't decode botInfo#36607333 to nil") } if err := buf.ConsumeID(BotInfoTypeID); err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: %w", err) } return b.DecodeBare(buf) } @@ -345,46 +370,46 @@ 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#82437e74 to nil") + return fmt.Errorf("can't decode botInfo#36607333 to nil") } { if err := b.Flags.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: field flags: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: field flags: %w", err) } } b.HasPreviewMedias = b.Flags.Has(6) if b.Flags.Has(0) { value, err := buf.Long() if err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: field user_id: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: field user_id: %w", err) } b.UserID = value } if b.Flags.Has(1) { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: field description: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: field description: %w", err) } b.Description = value } if b.Flags.Has(4) { value, err := DecodePhoto(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: field description_photo: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: field description_photo: %w", err) } b.DescriptionPhoto = value } if b.Flags.Has(5) { value, err := DecodeDocument(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: field description_document: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: field description_document: %w", err) } b.DescriptionDocument = value } if b.Flags.Has(2) { headerLen, err := buf.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: field commands: %w", err) } if headerLen > 0 { @@ -393,7 +418,7 @@ func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value BotCommand if err := value.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: field commands: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: field commands: %w", err) } b.Commands = append(b.Commands, value) } @@ -401,17 +426,22 @@ func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { if b.Flags.Has(3) { value, err := DecodeBotMenuButton(buf) if err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: field menu_button: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: field menu_button: %w", err) } b.MenuButton = value } if b.Flags.Has(7) { value, err := buf.String() if err != nil { - return fmt.Errorf("unable to decode botInfo#82437e74: field privacy_policy_url: %w", err) + return fmt.Errorf("unable to decode botInfo#36607333: field privacy_policy_url: %w", err) } b.PrivacyPolicyURL = value } + if b.Flags.Has(8) { + if err := b.AppSettings.Decode(buf); err != nil { + return fmt.Errorf("unable to decode botInfo#36607333: field app_settings: %w", err) + } + } return nil } @@ -560,6 +590,24 @@ func (b *BotInfo) GetPrivacyPolicyURL() (value string, ok bool) { return b.PrivacyPolicyURL, true } +// SetAppSettings sets value of AppSettings conditional field. +func (b *BotInfo) SetAppSettings(value BotAppSettings) { + b.Flags.Set(8) + b.AppSettings = value +} + +// GetAppSettings returns value of AppSettings conditional field and +// boolean which is true if field was set. +func (b *BotInfo) GetAppSettings() (value BotAppSettings, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(8) { + return value, false + } + return b.AppSettings, true +} + // GetDescriptionPhotoAsNotEmpty returns mapped value of DescriptionPhoto conditional field and // boolean which is true if field was set. func (b *BotInfo) GetDescriptionPhotoAsNotEmpty() (*Photo, bool) { diff --git a/tg/tl_bots_check_download_file_params_gen.go b/tg/tl_bots_check_download_file_params_gen.go new file mode 100644 index 0000000000..f101bbda2d --- /dev/null +++ b/tg/tl_bots_check_download_file_params_gen.go @@ -0,0 +1,233 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) + +// BotsCheckDownloadFileParamsRequest represents TL type `bots.checkDownloadFileParams#50077589`. +// +// See https://core.telegram.org/method/bots.checkDownloadFileParams for reference. +type BotsCheckDownloadFileParamsRequest struct { + // Bot field of BotsCheckDownloadFileParamsRequest. + Bot InputUserClass + // FileName field of BotsCheckDownloadFileParamsRequest. + FileName string + // URL field of BotsCheckDownloadFileParamsRequest. + URL string +} + +// BotsCheckDownloadFileParamsRequestTypeID is TL type id of BotsCheckDownloadFileParamsRequest. +const BotsCheckDownloadFileParamsRequestTypeID = 0x50077589 + +// Ensuring interfaces in compile-time for BotsCheckDownloadFileParamsRequest. +var ( + _ bin.Encoder = &BotsCheckDownloadFileParamsRequest{} + _ bin.Decoder = &BotsCheckDownloadFileParamsRequest{} + _ bin.BareEncoder = &BotsCheckDownloadFileParamsRequest{} + _ bin.BareDecoder = &BotsCheckDownloadFileParamsRequest{} +) + +func (c *BotsCheckDownloadFileParamsRequest) Zero() bool { + if c == nil { + return true + } + if !(c.Bot == nil) { + return false + } + if !(c.FileName == "") { + return false + } + if !(c.URL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *BotsCheckDownloadFileParamsRequest) String() string { + if c == nil { + return "BotsCheckDownloadFileParamsRequest(nil)" + } + type Alias BotsCheckDownloadFileParamsRequest + return fmt.Sprintf("BotsCheckDownloadFileParamsRequest%+v", Alias(*c)) +} + +// FillFrom fills BotsCheckDownloadFileParamsRequest from given interface. +func (c *BotsCheckDownloadFileParamsRequest) FillFrom(from interface { + GetBot() (value InputUserClass) + GetFileName() (value string) + GetURL() (value string) +}) { + c.Bot = from.GetBot() + c.FileName = from.GetFileName() + c.URL = from.GetURL() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsCheckDownloadFileParamsRequest) TypeID() uint32 { + return BotsCheckDownloadFileParamsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsCheckDownloadFileParamsRequest) TypeName() string { + return "bots.checkDownloadFileParams" +} + +// TypeInfo returns info about TL type. +func (c *BotsCheckDownloadFileParamsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.checkDownloadFileParams", + ID: BotsCheckDownloadFileParamsRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "FileName", + SchemaName: "file_name", + }, + { + Name: "URL", + SchemaName: "url", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *BotsCheckDownloadFileParamsRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode bots.checkDownloadFileParams#50077589 as nil") + } + b.PutID(BotsCheckDownloadFileParamsRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *BotsCheckDownloadFileParamsRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode bots.checkDownloadFileParams#50077589 as nil") + } + if c.Bot == nil { + return fmt.Errorf("unable to encode bots.checkDownloadFileParams#50077589: field bot is nil") + } + if err := c.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.checkDownloadFileParams#50077589: field bot: %w", err) + } + b.PutString(c.FileName) + b.PutString(c.URL) + return nil +} + +// Decode implements bin.Decoder. +func (c *BotsCheckDownloadFileParamsRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode bots.checkDownloadFileParams#50077589 to nil") + } + if err := b.ConsumeID(BotsCheckDownloadFileParamsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.checkDownloadFileParams#50077589: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *BotsCheckDownloadFileParamsRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode bots.checkDownloadFileParams#50077589 to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.checkDownloadFileParams#50077589: field bot: %w", err) + } + c.Bot = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.checkDownloadFileParams#50077589: field file_name: %w", err) + } + c.FileName = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode bots.checkDownloadFileParams#50077589: field url: %w", err) + } + c.URL = value + } + return nil +} + +// GetBot returns value of Bot field. +func (c *BotsCheckDownloadFileParamsRequest) GetBot() (value InputUserClass) { + if c == nil { + return + } + return c.Bot +} + +// GetFileName returns value of FileName field. +func (c *BotsCheckDownloadFileParamsRequest) GetFileName() (value string) { + if c == nil { + return + } + return c.FileName +} + +// GetURL returns value of URL field. +func (c *BotsCheckDownloadFileParamsRequest) GetURL() (value string) { + if c == nil { + return + } + return c.URL +} + +// BotsCheckDownloadFileParams invokes method bots.checkDownloadFileParams#50077589 returning error if any. +// +// See https://core.telegram.org/method/bots.checkDownloadFileParams for reference. +func (c *Client) BotsCheckDownloadFileParams(ctx context.Context, request *BotsCheckDownloadFileParamsRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_bots_check_download_file_params_slices_gen.go b/tg/tl_bots_check_download_file_params_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_bots_check_download_file_params_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) diff --git a/tg/tl_bots_toggle_user_emoji_status_permission_gen.go b/tg/tl_bots_toggle_user_emoji_status_permission_gen.go new file mode 100644 index 0000000000..fab1081e0b --- /dev/null +++ b/tg/tl_bots_toggle_user_emoji_status_permission_gen.go @@ -0,0 +1,206 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) + +// BotsToggleUserEmojiStatusPermissionRequest represents TL type `bots.toggleUserEmojiStatusPermission#6de6392`. +// +// See https://core.telegram.org/method/bots.toggleUserEmojiStatusPermission for reference. +type BotsToggleUserEmojiStatusPermissionRequest struct { + // Bot field of BotsToggleUserEmojiStatusPermissionRequest. + Bot InputUserClass + // Enabled field of BotsToggleUserEmojiStatusPermissionRequest. + Enabled bool +} + +// BotsToggleUserEmojiStatusPermissionRequestTypeID is TL type id of BotsToggleUserEmojiStatusPermissionRequest. +const BotsToggleUserEmojiStatusPermissionRequestTypeID = 0x6de6392 + +// Ensuring interfaces in compile-time for BotsToggleUserEmojiStatusPermissionRequest. +var ( + _ bin.Encoder = &BotsToggleUserEmojiStatusPermissionRequest{} + _ bin.Decoder = &BotsToggleUserEmojiStatusPermissionRequest{} + _ bin.BareEncoder = &BotsToggleUserEmojiStatusPermissionRequest{} + _ bin.BareDecoder = &BotsToggleUserEmojiStatusPermissionRequest{} +) + +func (t *BotsToggleUserEmojiStatusPermissionRequest) Zero() bool { + if t == nil { + return true + } + if !(t.Bot == nil) { + return false + } + if !(t.Enabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *BotsToggleUserEmojiStatusPermissionRequest) String() string { + if t == nil { + return "BotsToggleUserEmojiStatusPermissionRequest(nil)" + } + type Alias BotsToggleUserEmojiStatusPermissionRequest + return fmt.Sprintf("BotsToggleUserEmojiStatusPermissionRequest%+v", Alias(*t)) +} + +// FillFrom fills BotsToggleUserEmojiStatusPermissionRequest from given interface. +func (t *BotsToggleUserEmojiStatusPermissionRequest) FillFrom(from interface { + GetBot() (value InputUserClass) + GetEnabled() (value bool) +}) { + t.Bot = from.GetBot() + t.Enabled = from.GetEnabled() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsToggleUserEmojiStatusPermissionRequest) TypeID() uint32 { + return BotsToggleUserEmojiStatusPermissionRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsToggleUserEmojiStatusPermissionRequest) TypeName() string { + return "bots.toggleUserEmojiStatusPermission" +} + +// TypeInfo returns info about TL type. +func (t *BotsToggleUserEmojiStatusPermissionRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.toggleUserEmojiStatusPermission", + ID: BotsToggleUserEmojiStatusPermissionRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "Enabled", + SchemaName: "enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *BotsToggleUserEmojiStatusPermissionRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode bots.toggleUserEmojiStatusPermission#6de6392 as nil") + } + b.PutID(BotsToggleUserEmojiStatusPermissionRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *BotsToggleUserEmojiStatusPermissionRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode bots.toggleUserEmojiStatusPermission#6de6392 as nil") + } + if t.Bot == nil { + return fmt.Errorf("unable to encode bots.toggleUserEmojiStatusPermission#6de6392: field bot is nil") + } + if err := t.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.toggleUserEmojiStatusPermission#6de6392: field bot: %w", err) + } + b.PutBool(t.Enabled) + return nil +} + +// Decode implements bin.Decoder. +func (t *BotsToggleUserEmojiStatusPermissionRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode bots.toggleUserEmojiStatusPermission#6de6392 to nil") + } + if err := b.ConsumeID(BotsToggleUserEmojiStatusPermissionRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.toggleUserEmojiStatusPermission#6de6392: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *BotsToggleUserEmojiStatusPermissionRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode bots.toggleUserEmojiStatusPermission#6de6392 to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.toggleUserEmojiStatusPermission#6de6392: field bot: %w", err) + } + t.Bot = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode bots.toggleUserEmojiStatusPermission#6de6392: field enabled: %w", err) + } + t.Enabled = value + } + return nil +} + +// GetBot returns value of Bot field. +func (t *BotsToggleUserEmojiStatusPermissionRequest) GetBot() (value InputUserClass) { + if t == nil { + return + } + return t.Bot +} + +// GetEnabled returns value of Enabled field. +func (t *BotsToggleUserEmojiStatusPermissionRequest) GetEnabled() (value bool) { + if t == nil { + return + } + return t.Enabled +} + +// BotsToggleUserEmojiStatusPermission invokes method bots.toggleUserEmojiStatusPermission#6de6392 returning error if any. +// +// See https://core.telegram.org/method/bots.toggleUserEmojiStatusPermission for reference. +func (c *Client) BotsToggleUserEmojiStatusPermission(ctx context.Context, request *BotsToggleUserEmojiStatusPermissionRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_bots_toggle_user_emoji_status_permission_slices_gen.go b/tg/tl_bots_toggle_user_emoji_status_permission_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_bots_toggle_user_emoji_status_permission_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) diff --git a/tg/tl_bots_update_user_emoji_status_gen.go b/tg/tl_bots_update_user_emoji_status_gen.go new file mode 100644 index 0000000000..8169f1578d --- /dev/null +++ b/tg/tl_bots_update_user_emoji_status_gen.go @@ -0,0 +1,216 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) + +// BotsUpdateUserEmojiStatusRequest represents TL type `bots.updateUserEmojiStatus#ed9f30c5`. +// +// See https://core.telegram.org/method/bots.updateUserEmojiStatus for reference. +type BotsUpdateUserEmojiStatusRequest struct { + // UserID field of BotsUpdateUserEmojiStatusRequest. + UserID InputUserClass + // EmojiStatus field of BotsUpdateUserEmojiStatusRequest. + EmojiStatus EmojiStatusClass +} + +// BotsUpdateUserEmojiStatusRequestTypeID is TL type id of BotsUpdateUserEmojiStatusRequest. +const BotsUpdateUserEmojiStatusRequestTypeID = 0xed9f30c5 + +// Ensuring interfaces in compile-time for BotsUpdateUserEmojiStatusRequest. +var ( + _ bin.Encoder = &BotsUpdateUserEmojiStatusRequest{} + _ bin.Decoder = &BotsUpdateUserEmojiStatusRequest{} + _ bin.BareEncoder = &BotsUpdateUserEmojiStatusRequest{} + _ bin.BareDecoder = &BotsUpdateUserEmojiStatusRequest{} +) + +func (u *BotsUpdateUserEmojiStatusRequest) Zero() bool { + if u == nil { + return true + } + if !(u.UserID == nil) { + return false + } + if !(u.EmojiStatus == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *BotsUpdateUserEmojiStatusRequest) String() string { + if u == nil { + return "BotsUpdateUserEmojiStatusRequest(nil)" + } + type Alias BotsUpdateUserEmojiStatusRequest + return fmt.Sprintf("BotsUpdateUserEmojiStatusRequest%+v", Alias(*u)) +} + +// FillFrom fills BotsUpdateUserEmojiStatusRequest from given interface. +func (u *BotsUpdateUserEmojiStatusRequest) FillFrom(from interface { + GetUserID() (value InputUserClass) + GetEmojiStatus() (value EmojiStatusClass) +}) { + u.UserID = from.GetUserID() + u.EmojiStatus = from.GetEmojiStatus() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*BotsUpdateUserEmojiStatusRequest) TypeID() uint32 { + return BotsUpdateUserEmojiStatusRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*BotsUpdateUserEmojiStatusRequest) TypeName() string { + return "bots.updateUserEmojiStatus" +} + +// TypeInfo returns info about TL type. +func (u *BotsUpdateUserEmojiStatusRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "bots.updateUserEmojiStatus", + ID: BotsUpdateUserEmojiStatusRequestTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "EmojiStatus", + SchemaName: "emoji_status", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *BotsUpdateUserEmojiStatusRequest) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode bots.updateUserEmojiStatus#ed9f30c5 as nil") + } + b.PutID(BotsUpdateUserEmojiStatusRequestTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *BotsUpdateUserEmojiStatusRequest) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode bots.updateUserEmojiStatus#ed9f30c5 as nil") + } + if u.UserID == nil { + return fmt.Errorf("unable to encode bots.updateUserEmojiStatus#ed9f30c5: field user_id is nil") + } + if err := u.UserID.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.updateUserEmojiStatus#ed9f30c5: field user_id: %w", err) + } + if u.EmojiStatus == nil { + return fmt.Errorf("unable to encode bots.updateUserEmojiStatus#ed9f30c5: field emoji_status is nil") + } + if err := u.EmojiStatus.Encode(b); err != nil { + return fmt.Errorf("unable to encode bots.updateUserEmojiStatus#ed9f30c5: field emoji_status: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *BotsUpdateUserEmojiStatusRequest) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode bots.updateUserEmojiStatus#ed9f30c5 to nil") + } + if err := b.ConsumeID(BotsUpdateUserEmojiStatusRequestTypeID); err != nil { + return fmt.Errorf("unable to decode bots.updateUserEmojiStatus#ed9f30c5: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *BotsUpdateUserEmojiStatusRequest) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode bots.updateUserEmojiStatus#ed9f30c5 to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode bots.updateUserEmojiStatus#ed9f30c5: field user_id: %w", err) + } + u.UserID = value + } + { + value, err := DecodeEmojiStatus(b) + if err != nil { + return fmt.Errorf("unable to decode bots.updateUserEmojiStatus#ed9f30c5: field emoji_status: %w", err) + } + u.EmojiStatus = value + } + return nil +} + +// GetUserID returns value of UserID field. +func (u *BotsUpdateUserEmojiStatusRequest) GetUserID() (value InputUserClass) { + if u == nil { + return + } + return u.UserID +} + +// GetEmojiStatus returns value of EmojiStatus field. +func (u *BotsUpdateUserEmojiStatusRequest) GetEmojiStatus() (value EmojiStatusClass) { + if u == nil { + return + } + return u.EmojiStatus +} + +// GetEmojiStatusAsNotEmpty returns mapped value of EmojiStatus field. +func (u *BotsUpdateUserEmojiStatusRequest) GetEmojiStatusAsNotEmpty() (NotEmptyEmojiStatus, bool) { + return u.EmojiStatus.AsNotEmpty() +} + +// BotsUpdateUserEmojiStatus invokes method bots.updateUserEmojiStatus#ed9f30c5 returning error if any. +// +// See https://core.telegram.org/method/bots.updateUserEmojiStatus for reference. +func (c *Client) BotsUpdateUserEmojiStatus(ctx context.Context, request *BotsUpdateUserEmojiStatusRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_bots_update_user_emoji_status_slices_gen.go b/tg/tl_bots_update_user_emoji_status_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_bots_update_user_emoji_status_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) diff --git a/tg/tl_handlers_gen.go b/tg/tl_handlers_gen.go index 4579f781cc..1abb09997e 100644 --- a/tg/tl_handlers_gen.go +++ b/tg/tl_handlers_gen.go @@ -1515,3 +1515,13 @@ func (u UpdateDispatcher) OnPaidReactionPrivacy(handler PaidReactionPrivacyHandl return handler(ctx, e, update.(*UpdatePaidReactionPrivacy)) } } + +// BotSubscriptionExpireHandler is a BotSubscriptionExpire event handler. +type BotSubscriptionExpireHandler func(ctx context.Context, e Entities, update *UpdateBotSubscriptionExpire) error + +// OnBotSubscriptionExpire sets BotSubscriptionExpire handler. +func (u UpdateDispatcher) OnBotSubscriptionExpire(handler BotSubscriptionExpireHandler) { + u.handlers[UpdateBotSubscriptionExpireTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateBotSubscriptionExpire)) + } +} diff --git a/tg/tl_input_privacy_key_gen.go b/tg/tl_input_privacy_key_gen.go index 9c88ee8d24..7b042f976e 100644 --- a/tg/tl_input_privacy_key_gen.go +++ b/tg/tl_input_privacy_key_gen.go @@ -1172,6 +1172,107 @@ func (i *InputPrivacyKeyBirthday) DecodeBare(b *bin.Buffer) error { return nil } +// InputPrivacyKeyStarGiftsAutoSave represents TL type `inputPrivacyKeyStarGiftsAutoSave#e1732341`. +// +// See https://core.telegram.org/constructor/inputPrivacyKeyStarGiftsAutoSave for reference. +type InputPrivacyKeyStarGiftsAutoSave struct { +} + +// InputPrivacyKeyStarGiftsAutoSaveTypeID is TL type id of InputPrivacyKeyStarGiftsAutoSave. +const InputPrivacyKeyStarGiftsAutoSaveTypeID = 0xe1732341 + +// construct implements constructor of InputPrivacyKeyClass. +func (i InputPrivacyKeyStarGiftsAutoSave) construct() InputPrivacyKeyClass { return &i } + +// Ensuring interfaces in compile-time for InputPrivacyKeyStarGiftsAutoSave. +var ( + _ bin.Encoder = &InputPrivacyKeyStarGiftsAutoSave{} + _ bin.Decoder = &InputPrivacyKeyStarGiftsAutoSave{} + _ bin.BareEncoder = &InputPrivacyKeyStarGiftsAutoSave{} + _ bin.BareDecoder = &InputPrivacyKeyStarGiftsAutoSave{} + + _ InputPrivacyKeyClass = &InputPrivacyKeyStarGiftsAutoSave{} +) + +func (i *InputPrivacyKeyStarGiftsAutoSave) Zero() bool { + if i == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputPrivacyKeyStarGiftsAutoSave) String() string { + if i == nil { + return "InputPrivacyKeyStarGiftsAutoSave(nil)" + } + type Alias InputPrivacyKeyStarGiftsAutoSave + return fmt.Sprintf("InputPrivacyKeyStarGiftsAutoSave%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputPrivacyKeyStarGiftsAutoSave) TypeID() uint32 { + return InputPrivacyKeyStarGiftsAutoSaveTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputPrivacyKeyStarGiftsAutoSave) TypeName() string { + return "inputPrivacyKeyStarGiftsAutoSave" +} + +// TypeInfo returns info about TL type. +func (i *InputPrivacyKeyStarGiftsAutoSave) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputPrivacyKeyStarGiftsAutoSave", + ID: InputPrivacyKeyStarGiftsAutoSaveTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (i *InputPrivacyKeyStarGiftsAutoSave) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPrivacyKeyStarGiftsAutoSave#e1732341 as nil") + } + b.PutID(InputPrivacyKeyStarGiftsAutoSaveTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputPrivacyKeyStarGiftsAutoSave) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPrivacyKeyStarGiftsAutoSave#e1732341 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (i *InputPrivacyKeyStarGiftsAutoSave) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPrivacyKeyStarGiftsAutoSave#e1732341 to nil") + } + if err := b.ConsumeID(InputPrivacyKeyStarGiftsAutoSaveTypeID); err != nil { + return fmt.Errorf("unable to decode inputPrivacyKeyStarGiftsAutoSave#e1732341: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputPrivacyKeyStarGiftsAutoSave) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPrivacyKeyStarGiftsAutoSave#e1732341 to nil") + } + return nil +} + // InputPrivacyKeyClassName is schema name of InputPrivacyKeyClass. const InputPrivacyKeyClassName = "InputPrivacyKey" @@ -1197,6 +1298,7 @@ const InputPrivacyKeyClassName = "InputPrivacyKey" // case *tg.InputPrivacyKeyVoiceMessages: // inputPrivacyKeyVoiceMessages#aee69d68 // case *tg.InputPrivacyKeyAbout: // inputPrivacyKeyAbout#3823cc40 // case *tg.InputPrivacyKeyBirthday: // inputPrivacyKeyBirthday#d65a11cc +// case *tg.InputPrivacyKeyStarGiftsAutoSave: // inputPrivacyKeyStarGiftsAutoSave#e1732341 // default: panic(v) // } type InputPrivacyKeyClass interface { @@ -1302,6 +1404,13 @@ func DecodeInputPrivacyKey(buf *bin.Buffer) (InputPrivacyKeyClass, error) { return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err) } return &v, nil + case InputPrivacyKeyStarGiftsAutoSaveTypeID: + // Decoding inputPrivacyKeyStarGiftsAutoSave#e1732341. + v := InputPrivacyKeyStarGiftsAutoSave{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_input_privacy_rule_gen.go b/tg/tl_input_privacy_rule_gen.go index a63d7fb2e3..67bc189015 100644 --- a/tg/tl_input_privacy_rule_gen.go +++ b/tg/tl_input_privacy_rule_gen.go @@ -1263,6 +1263,208 @@ func (i *InputPrivacyValueAllowPremium) DecodeBare(b *bin.Buffer) error { return nil } +// InputPrivacyValueAllowBots represents TL type `inputPrivacyValueAllowBots#5a4fcce5`. +// +// See https://core.telegram.org/constructor/inputPrivacyValueAllowBots for reference. +type InputPrivacyValueAllowBots struct { +} + +// InputPrivacyValueAllowBotsTypeID is TL type id of InputPrivacyValueAllowBots. +const InputPrivacyValueAllowBotsTypeID = 0x5a4fcce5 + +// construct implements constructor of InputPrivacyRuleClass. +func (i InputPrivacyValueAllowBots) construct() InputPrivacyRuleClass { return &i } + +// Ensuring interfaces in compile-time for InputPrivacyValueAllowBots. +var ( + _ bin.Encoder = &InputPrivacyValueAllowBots{} + _ bin.Decoder = &InputPrivacyValueAllowBots{} + _ bin.BareEncoder = &InputPrivacyValueAllowBots{} + _ bin.BareDecoder = &InputPrivacyValueAllowBots{} + + _ InputPrivacyRuleClass = &InputPrivacyValueAllowBots{} +) + +func (i *InputPrivacyValueAllowBots) Zero() bool { + if i == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputPrivacyValueAllowBots) String() string { + if i == nil { + return "InputPrivacyValueAllowBots(nil)" + } + type Alias InputPrivacyValueAllowBots + return fmt.Sprintf("InputPrivacyValueAllowBots%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputPrivacyValueAllowBots) TypeID() uint32 { + return InputPrivacyValueAllowBotsTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputPrivacyValueAllowBots) TypeName() string { + return "inputPrivacyValueAllowBots" +} + +// TypeInfo returns info about TL type. +func (i *InputPrivacyValueAllowBots) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputPrivacyValueAllowBots", + ID: InputPrivacyValueAllowBotsTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (i *InputPrivacyValueAllowBots) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPrivacyValueAllowBots#5a4fcce5 as nil") + } + b.PutID(InputPrivacyValueAllowBotsTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputPrivacyValueAllowBots) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPrivacyValueAllowBots#5a4fcce5 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (i *InputPrivacyValueAllowBots) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPrivacyValueAllowBots#5a4fcce5 to nil") + } + if err := b.ConsumeID(InputPrivacyValueAllowBotsTypeID); err != nil { + return fmt.Errorf("unable to decode inputPrivacyValueAllowBots#5a4fcce5: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputPrivacyValueAllowBots) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPrivacyValueAllowBots#5a4fcce5 to nil") + } + return nil +} + +// InputPrivacyValueDisallowBots represents TL type `inputPrivacyValueDisallowBots#c4e57915`. +// +// See https://core.telegram.org/constructor/inputPrivacyValueDisallowBots for reference. +type InputPrivacyValueDisallowBots struct { +} + +// InputPrivacyValueDisallowBotsTypeID is TL type id of InputPrivacyValueDisallowBots. +const InputPrivacyValueDisallowBotsTypeID = 0xc4e57915 + +// construct implements constructor of InputPrivacyRuleClass. +func (i InputPrivacyValueDisallowBots) construct() InputPrivacyRuleClass { return &i } + +// Ensuring interfaces in compile-time for InputPrivacyValueDisallowBots. +var ( + _ bin.Encoder = &InputPrivacyValueDisallowBots{} + _ bin.Decoder = &InputPrivacyValueDisallowBots{} + _ bin.BareEncoder = &InputPrivacyValueDisallowBots{} + _ bin.BareDecoder = &InputPrivacyValueDisallowBots{} + + _ InputPrivacyRuleClass = &InputPrivacyValueDisallowBots{} +) + +func (i *InputPrivacyValueDisallowBots) Zero() bool { + if i == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputPrivacyValueDisallowBots) String() string { + if i == nil { + return "InputPrivacyValueDisallowBots(nil)" + } + type Alias InputPrivacyValueDisallowBots + return fmt.Sprintf("InputPrivacyValueDisallowBots%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputPrivacyValueDisallowBots) TypeID() uint32 { + return InputPrivacyValueDisallowBotsTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputPrivacyValueDisallowBots) TypeName() string { + return "inputPrivacyValueDisallowBots" +} + +// TypeInfo returns info about TL type. +func (i *InputPrivacyValueDisallowBots) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputPrivacyValueDisallowBots", + ID: InputPrivacyValueDisallowBotsTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (i *InputPrivacyValueDisallowBots) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPrivacyValueDisallowBots#c4e57915 as nil") + } + b.PutID(InputPrivacyValueDisallowBotsTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputPrivacyValueDisallowBots) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPrivacyValueDisallowBots#c4e57915 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (i *InputPrivacyValueDisallowBots) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPrivacyValueDisallowBots#c4e57915 to nil") + } + if err := b.ConsumeID(InputPrivacyValueDisallowBotsTypeID); err != nil { + return fmt.Errorf("unable to decode inputPrivacyValueDisallowBots#c4e57915: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputPrivacyValueDisallowBots) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPrivacyValueDisallowBots#c4e57915 to nil") + } + return nil +} + // InputPrivacyRuleClassName is schema name of InputPrivacyRuleClass. const InputPrivacyRuleClassName = "InputPrivacyRule" @@ -1287,6 +1489,8 @@ const InputPrivacyRuleClassName = "InputPrivacyRule" // case *tg.InputPrivacyValueDisallowChatParticipants: // inputPrivacyValueDisallowChatParticipants#e94f0f86 // case *tg.InputPrivacyValueAllowCloseFriends: // inputPrivacyValueAllowCloseFriends#2f453e49 // case *tg.InputPrivacyValueAllowPremium: // inputPrivacyValueAllowPremium#77cdc9f1 +// case *tg.InputPrivacyValueAllowBots: // inputPrivacyValueAllowBots#5a4fcce5 +// case *tg.InputPrivacyValueDisallowBots: // inputPrivacyValueDisallowBots#c4e57915 // default: panic(v) // } type InputPrivacyRuleClass interface { @@ -1385,6 +1589,20 @@ func DecodeInputPrivacyRule(buf *bin.Buffer) (InputPrivacyRuleClass, error) { return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", err) } return &v, nil + case InputPrivacyValueAllowBotsTypeID: + // Decoding inputPrivacyValueAllowBots#5a4fcce5. + v := InputPrivacyValueAllowBots{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", err) + } + return &v, nil + case InputPrivacyValueDisallowBotsTypeID: + // Decoding inputPrivacyValueDisallowBots#c4e57915. + v := InputPrivacyValueDisallowBots{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_invoice_gen.go b/tg/tl_invoice_gen.go index 99967e9cbc..28e45f8b5b 100644 --- a/tg/tl_invoice_gen.go +++ b/tg/tl_invoice_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// Invoice represents TL type `invoice#5db95a15`. +// Invoice represents TL type `invoice#49ee584`. // Invoice // // See https://core.telegram.org/constructor/invoice for reference. @@ -89,10 +89,14 @@ type Invoice struct { // // Use SetTermsURL and GetTermsURL helpers. TermsURL string + // SubscriptionPeriod field of Invoice. + // + // Use SetSubscriptionPeriod and GetSubscriptionPeriod helpers. + SubscriptionPeriod int } // InvoiceTypeID is TL type id of Invoice. -const InvoiceTypeID = 0x5db95a15 +const InvoiceTypeID = 0x49ee584 // Ensuring interfaces in compile-time for Invoice. var ( @@ -151,6 +155,9 @@ func (i *Invoice) Zero() bool { if !(i.TermsURL == "") { return false } + if !(i.SubscriptionPeriod == 0) { + return false + } return true } @@ -180,6 +187,7 @@ func (i *Invoice) FillFrom(from interface { GetMaxTipAmount() (value int64, ok bool) GetSuggestedTipAmounts() (value []int64, ok bool) GetTermsURL() (value string, ok bool) + GetSubscriptionPeriod() (value int, ok bool) }) { i.Test = from.GetTest() i.NameRequested = from.GetNameRequested() @@ -204,6 +212,10 @@ func (i *Invoice) FillFrom(from interface { i.TermsURL = val } + if val, ok := from.GetSubscriptionPeriod(); ok { + i.SubscriptionPeriod = val + } + } // TypeID returns type id in TL schema. @@ -297,6 +309,11 @@ func (i *Invoice) TypeInfo() tdp.Type { SchemaName: "terms_url", Null: !i.Flags.Has(10), }, + { + Name: "SubscriptionPeriod", + SchemaName: "subscription_period", + Null: !i.Flags.Has(11), + }, } return typ } @@ -339,12 +356,15 @@ func (i *Invoice) SetFlags() { if !(i.TermsURL == "") { i.Flags.Set(10) } + if !(i.SubscriptionPeriod == 0) { + i.Flags.Set(11) + } } // Encode implements bin.Encoder. func (i *Invoice) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode invoice#5db95a15 as nil") + return fmt.Errorf("can't encode invoice#49ee584 as nil") } b.PutID(InvoiceTypeID) return i.EncodeBare(b) @@ -353,17 +373,17 @@ func (i *Invoice) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *Invoice) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode invoice#5db95a15 as nil") + return fmt.Errorf("can't encode invoice#49ee584 as nil") } i.SetFlags() if err := i.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode invoice#5db95a15: field flags: %w", err) + return fmt.Errorf("unable to encode invoice#49ee584: field flags: %w", err) } b.PutString(i.Currency) b.PutVectorHeader(len(i.Prices)) for idx, v := range i.Prices { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode invoice#5db95a15: field prices element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode invoice#49ee584: field prices element with index %d: %w", idx, err) } } if i.Flags.Has(8) { @@ -378,16 +398,19 @@ func (i *Invoice) EncodeBare(b *bin.Buffer) error { if i.Flags.Has(10) { b.PutString(i.TermsURL) } + if i.Flags.Has(11) { + b.PutInt(i.SubscriptionPeriod) + } return nil } // Decode implements bin.Decoder. func (i *Invoice) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode invoice#5db95a15 to nil") + return fmt.Errorf("can't decode invoice#49ee584 to nil") } if err := b.ConsumeID(InvoiceTypeID); err != nil { - return fmt.Errorf("unable to decode invoice#5db95a15: %w", err) + return fmt.Errorf("unable to decode invoice#49ee584: %w", err) } return i.DecodeBare(b) } @@ -395,11 +418,11 @@ func (i *Invoice) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *Invoice) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode invoice#5db95a15 to nil") + return fmt.Errorf("can't decode invoice#49ee584 to nil") } { if err := i.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode invoice#5db95a15: field flags: %w", err) + return fmt.Errorf("unable to decode invoice#49ee584: field flags: %w", err) } } i.Test = i.Flags.Has(0) @@ -414,14 +437,14 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode invoice#5db95a15: field currency: %w", err) + return fmt.Errorf("unable to decode invoice#49ee584: field currency: %w", err) } i.Currency = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode invoice#5db95a15: field prices: %w", err) + return fmt.Errorf("unable to decode invoice#49ee584: field prices: %w", err) } if headerLen > 0 { @@ -430,7 +453,7 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value LabeledPrice if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode invoice#5db95a15: field prices: %w", err) + return fmt.Errorf("unable to decode invoice#49ee584: field prices: %w", err) } i.Prices = append(i.Prices, value) } @@ -438,14 +461,14 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { if i.Flags.Has(8) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode invoice#5db95a15: field max_tip_amount: %w", err) + return fmt.Errorf("unable to decode invoice#49ee584: field max_tip_amount: %w", err) } i.MaxTipAmount = value } if i.Flags.Has(8) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode invoice#5db95a15: field suggested_tip_amounts: %w", err) + return fmt.Errorf("unable to decode invoice#49ee584: field suggested_tip_amounts: %w", err) } if headerLen > 0 { @@ -454,7 +477,7 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode invoice#5db95a15: field suggested_tip_amounts: %w", err) + return fmt.Errorf("unable to decode invoice#49ee584: field suggested_tip_amounts: %w", err) } i.SuggestedTipAmounts = append(i.SuggestedTipAmounts, value) } @@ -462,10 +485,17 @@ func (i *Invoice) DecodeBare(b *bin.Buffer) error { if i.Flags.Has(10) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode invoice#5db95a15: field terms_url: %w", err) + return fmt.Errorf("unable to decode invoice#49ee584: field terms_url: %w", err) } i.TermsURL = value } + if i.Flags.Has(11) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode invoice#49ee584: field subscription_period: %w", err) + } + i.SubscriptionPeriod = value + } return nil } @@ -709,3 +739,21 @@ func (i *Invoice) GetTermsURL() (value string, ok bool) { } return i.TermsURL, true } + +// SetSubscriptionPeriod sets value of SubscriptionPeriod conditional field. +func (i *Invoice) SetSubscriptionPeriod(value int) { + i.Flags.Set(11) + i.SubscriptionPeriod = value +} + +// GetSubscriptionPeriod returns value of SubscriptionPeriod conditional field and +// boolean which is true if field was set. +func (i *Invoice) GetSubscriptionPeriod() (value int, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(11) { + return value, false + } + return i.SubscriptionPeriod, true +} diff --git a/tg/tl_message_action_gen.go b/tg/tl_message_action_gen.go index 91ba31610a..d58e26b241 100644 --- a/tg/tl_message_action_gen.go +++ b/tg/tl_message_action_gen.go @@ -9186,7 +9186,7 @@ func (m *MessageActionPrizeStars) GetGiveawayMsgID() (value int) { return m.GiveawayMsgID } -// MessageActionStarGift represents TL type `messageActionStarGift#9bb3ef44`. +// MessageActionStarGift represents TL type `messageActionStarGift#8557637`. // // See https://core.telegram.org/constructor/messageActionStarGift for reference. type MessageActionStarGift struct { @@ -9205,11 +9205,13 @@ type MessageActionStarGift struct { // Use SetMessage and GetMessage helpers. Message TextWithEntities // ConvertStars field of MessageActionStarGift. + // + // Use SetConvertStars and GetConvertStars helpers. ConvertStars int64 } // MessageActionStarGiftTypeID is TL type id of MessageActionStarGift. -const MessageActionStarGiftTypeID = 0x9bb3ef44 +const MessageActionStarGiftTypeID = 0x8557637 // construct implements constructor of MessageActionClass. func (m MessageActionStarGift) construct() MessageActionClass { return &m } @@ -9269,7 +9271,7 @@ func (m *MessageActionStarGift) FillFrom(from interface { GetConverted() (value bool) GetGift() (value StarGift) GetMessage() (value TextWithEntities, ok bool) - GetConvertStars() (value int64) + GetConvertStars() (value int64, ok bool) }) { m.NameHidden = from.GetNameHidden() m.Saved = from.GetSaved() @@ -9279,7 +9281,10 @@ func (m *MessageActionStarGift) FillFrom(from interface { m.Message = val } - m.ConvertStars = from.GetConvertStars() + if val, ok := from.GetConvertStars(); ok { + m.ConvertStars = val + } + } // TypeID returns type id in TL schema. @@ -9332,6 +9337,7 @@ func (m *MessageActionStarGift) TypeInfo() tdp.Type { { Name: "ConvertStars", SchemaName: "convert_stars", + Null: !m.Flags.Has(4), }, } return typ @@ -9351,12 +9357,15 @@ func (m *MessageActionStarGift) SetFlags() { if !(m.Message.Zero()) { m.Flags.Set(1) } + if !(m.ConvertStars == 0) { + m.Flags.Set(4) + } } // Encode implements bin.Encoder. func (m *MessageActionStarGift) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionStarGift#9bb3ef44 as nil") + return fmt.Errorf("can't encode messageActionStarGift#8557637 as nil") } b.PutID(MessageActionStarGiftTypeID) return m.EncodeBare(b) @@ -9365,31 +9374,33 @@ func (m *MessageActionStarGift) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionStarGift) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionStarGift#9bb3ef44 as nil") + return fmt.Errorf("can't encode messageActionStarGift#8557637 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGift#9bb3ef44: field flags: %w", err) + return fmt.Errorf("unable to encode messageActionStarGift#8557637: field flags: %w", err) } if err := m.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGift#9bb3ef44: field gift: %w", err) + return fmt.Errorf("unable to encode messageActionStarGift#8557637: field gift: %w", err) } if m.Flags.Has(1) { if err := m.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGift#9bb3ef44: field message: %w", err) + return fmt.Errorf("unable to encode messageActionStarGift#8557637: field message: %w", err) } } - b.PutLong(m.ConvertStars) + if m.Flags.Has(4) { + b.PutLong(m.ConvertStars) + } return nil } // Decode implements bin.Decoder. func (m *MessageActionStarGift) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionStarGift#9bb3ef44 to nil") + return fmt.Errorf("can't decode messageActionStarGift#8557637 to nil") } if err := b.ConsumeID(MessageActionStarGiftTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#9bb3ef44: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#8557637: %w", err) } return m.DecodeBare(b) } @@ -9397,11 +9408,11 @@ func (m *MessageActionStarGift) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionStarGift) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionStarGift#9bb3ef44 to nil") + return fmt.Errorf("can't decode messageActionStarGift#8557637 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#9bb3ef44: field flags: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#8557637: field flags: %w", err) } } m.NameHidden = m.Flags.Has(0) @@ -9409,18 +9420,18 @@ func (m *MessageActionStarGift) DecodeBare(b *bin.Buffer) error { m.Converted = m.Flags.Has(3) { if err := m.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#9bb3ef44: field gift: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#8557637: field gift: %w", err) } } if m.Flags.Has(1) { if err := m.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#9bb3ef44: field message: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#8557637: field message: %w", err) } } - { + if m.Flags.Has(4) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#9bb3ef44: field convert_stars: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#8557637: field convert_stars: %w", err) } m.ConvertStars = value } @@ -9510,12 +9521,22 @@ func (m *MessageActionStarGift) GetMessage() (value TextWithEntities, ok bool) { return m.Message, true } -// GetConvertStars returns value of ConvertStars field. -func (m *MessageActionStarGift) GetConvertStars() (value int64) { +// SetConvertStars sets value of ConvertStars conditional field. +func (m *MessageActionStarGift) SetConvertStars(value int64) { + m.Flags.Set(4) + m.ConvertStars = value +} + +// GetConvertStars returns value of ConvertStars conditional field and +// boolean which is true if field was set. +func (m *MessageActionStarGift) GetConvertStars() (value int64, ok bool) { if m == nil { return } - return m.ConvertStars + if !m.Flags.Has(4) { + return value, false + } + return m.ConvertStars, true } // MessageActionClassName is schema name of MessageActionClass. @@ -9578,7 +9599,7 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionPaymentRefunded: // messageActionPaymentRefunded#41b3e202 // case *tg.MessageActionGiftStars: // messageActionGiftStars#45d5b021 // case *tg.MessageActionPrizeStars: // messageActionPrizeStars#b00c47a2 -// case *tg.MessageActionStarGift: // messageActionStarGift#9bb3ef44 +// case *tg.MessageActionStarGift: // messageActionStarGift#8557637 // default: panic(v) // } type MessageActionClass interface { @@ -9930,7 +9951,7 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionStarGiftTypeID: - // Decoding messageActionStarGift#9bb3ef44. + // Decoding messageActionStarGift#8557637. v := MessageActionStarGift{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) diff --git a/tg/tl_messages_bot_prepared_inline_message_gen.go b/tg/tl_messages_bot_prepared_inline_message_gen.go new file mode 100644 index 0000000000..9586b02cc4 --- /dev/null +++ b/tg/tl_messages_bot_prepared_inline_message_gen.go @@ -0,0 +1,188 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) + +// MessagesBotPreparedInlineMessage represents TL type `messages.botPreparedInlineMessage#8ecf0511`. +// +// See https://core.telegram.org/constructor/messages.botPreparedInlineMessage for reference. +type MessagesBotPreparedInlineMessage struct { + // ID field of MessagesBotPreparedInlineMessage. + ID string + // ExpireDate field of MessagesBotPreparedInlineMessage. + ExpireDate int +} + +// MessagesBotPreparedInlineMessageTypeID is TL type id of MessagesBotPreparedInlineMessage. +const MessagesBotPreparedInlineMessageTypeID = 0x8ecf0511 + +// Ensuring interfaces in compile-time for MessagesBotPreparedInlineMessage. +var ( + _ bin.Encoder = &MessagesBotPreparedInlineMessage{} + _ bin.Decoder = &MessagesBotPreparedInlineMessage{} + _ bin.BareEncoder = &MessagesBotPreparedInlineMessage{} + _ bin.BareDecoder = &MessagesBotPreparedInlineMessage{} +) + +func (b *MessagesBotPreparedInlineMessage) Zero() bool { + if b == nil { + return true + } + if !(b.ID == "") { + return false + } + if !(b.ExpireDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *MessagesBotPreparedInlineMessage) String() string { + if b == nil { + return "MessagesBotPreparedInlineMessage(nil)" + } + type Alias MessagesBotPreparedInlineMessage + return fmt.Sprintf("MessagesBotPreparedInlineMessage%+v", Alias(*b)) +} + +// FillFrom fills MessagesBotPreparedInlineMessage from given interface. +func (b *MessagesBotPreparedInlineMessage) FillFrom(from interface { + GetID() (value string) + GetExpireDate() (value int) +}) { + b.ID = from.GetID() + b.ExpireDate = from.GetExpireDate() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesBotPreparedInlineMessage) TypeID() uint32 { + return MessagesBotPreparedInlineMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesBotPreparedInlineMessage) TypeName() string { + return "messages.botPreparedInlineMessage" +} + +// TypeInfo returns info about TL type. +func (b *MessagesBotPreparedInlineMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.botPreparedInlineMessage", + ID: MessagesBotPreparedInlineMessageTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "ExpireDate", + SchemaName: "expire_date", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (b *MessagesBotPreparedInlineMessage) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode messages.botPreparedInlineMessage#8ecf0511 as nil") + } + buf.PutID(MessagesBotPreparedInlineMessageTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *MessagesBotPreparedInlineMessage) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode messages.botPreparedInlineMessage#8ecf0511 as nil") + } + buf.PutString(b.ID) + buf.PutInt(b.ExpireDate) + return nil +} + +// Decode implements bin.Decoder. +func (b *MessagesBotPreparedInlineMessage) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode messages.botPreparedInlineMessage#8ecf0511 to nil") + } + if err := buf.ConsumeID(MessagesBotPreparedInlineMessageTypeID); err != nil { + return fmt.Errorf("unable to decode messages.botPreparedInlineMessage#8ecf0511: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *MessagesBotPreparedInlineMessage) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode messages.botPreparedInlineMessage#8ecf0511 to nil") + } + { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode messages.botPreparedInlineMessage#8ecf0511: field id: %w", err) + } + b.ID = value + } + { + value, err := buf.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.botPreparedInlineMessage#8ecf0511: field expire_date: %w", err) + } + b.ExpireDate = value + } + return nil +} + +// GetID returns value of ID field. +func (b *MessagesBotPreparedInlineMessage) GetID() (value string) { + if b == nil { + return + } + return b.ID +} + +// GetExpireDate returns value of ExpireDate field. +func (b *MessagesBotPreparedInlineMessage) GetExpireDate() (value int) { + if b == nil { + return + } + return b.ExpireDate +} diff --git a/tg/tl_messages_bot_prepared_inline_message_slices_gen.go b/tg/tl_messages_bot_prepared_inline_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_bot_prepared_inline_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) diff --git a/tg/tl_messages_get_prepared_inline_message_gen.go b/tg/tl_messages_get_prepared_inline_message_gen.go new file mode 100644 index 0000000000..d1eb58dbb8 --- /dev/null +++ b/tg/tl_messages_get_prepared_inline_message_gen.go @@ -0,0 +1,205 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) + +// MessagesGetPreparedInlineMessageRequest represents TL type `messages.getPreparedInlineMessage#857ebdb8`. +// +// See https://core.telegram.org/method/messages.getPreparedInlineMessage for reference. +type MessagesGetPreparedInlineMessageRequest struct { + // Bot field of MessagesGetPreparedInlineMessageRequest. + Bot InputUserClass + // ID field of MessagesGetPreparedInlineMessageRequest. + ID string +} + +// MessagesGetPreparedInlineMessageRequestTypeID is TL type id of MessagesGetPreparedInlineMessageRequest. +const MessagesGetPreparedInlineMessageRequestTypeID = 0x857ebdb8 + +// Ensuring interfaces in compile-time for MessagesGetPreparedInlineMessageRequest. +var ( + _ bin.Encoder = &MessagesGetPreparedInlineMessageRequest{} + _ bin.Decoder = &MessagesGetPreparedInlineMessageRequest{} + _ bin.BareEncoder = &MessagesGetPreparedInlineMessageRequest{} + _ bin.BareDecoder = &MessagesGetPreparedInlineMessageRequest{} +) + +func (g *MessagesGetPreparedInlineMessageRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Bot == nil) { + return false + } + if !(g.ID == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *MessagesGetPreparedInlineMessageRequest) String() string { + if g == nil { + return "MessagesGetPreparedInlineMessageRequest(nil)" + } + type Alias MessagesGetPreparedInlineMessageRequest + return fmt.Sprintf("MessagesGetPreparedInlineMessageRequest%+v", Alias(*g)) +} + +// FillFrom fills MessagesGetPreparedInlineMessageRequest from given interface. +func (g *MessagesGetPreparedInlineMessageRequest) FillFrom(from interface { + GetBot() (value InputUserClass) + GetID() (value string) +}) { + g.Bot = from.GetBot() + g.ID = from.GetID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesGetPreparedInlineMessageRequest) TypeID() uint32 { + return MessagesGetPreparedInlineMessageRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesGetPreparedInlineMessageRequest) TypeName() string { + return "messages.getPreparedInlineMessage" +} + +// TypeInfo returns info about TL type. +func (g *MessagesGetPreparedInlineMessageRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.getPreparedInlineMessage", + ID: MessagesGetPreparedInlineMessageRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Bot", + SchemaName: "bot", + }, + { + Name: "ID", + SchemaName: "id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *MessagesGetPreparedInlineMessageRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getPreparedInlineMessage#857ebdb8 as nil") + } + b.PutID(MessagesGetPreparedInlineMessageRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *MessagesGetPreparedInlineMessageRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getPreparedInlineMessage#857ebdb8 as nil") + } + if g.Bot == nil { + return fmt.Errorf("unable to encode messages.getPreparedInlineMessage#857ebdb8: field bot is nil") + } + if err := g.Bot.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.getPreparedInlineMessage#857ebdb8: field bot: %w", err) + } + b.PutString(g.ID) + return nil +} + +// Decode implements bin.Decoder. +func (g *MessagesGetPreparedInlineMessageRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getPreparedInlineMessage#857ebdb8 to nil") + } + if err := b.ConsumeID(MessagesGetPreparedInlineMessageRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.getPreparedInlineMessage#857ebdb8: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *MessagesGetPreparedInlineMessageRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getPreparedInlineMessage#857ebdb8 to nil") + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode messages.getPreparedInlineMessage#857ebdb8: field bot: %w", err) + } + g.Bot = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.getPreparedInlineMessage#857ebdb8: field id: %w", err) + } + g.ID = value + } + return nil +} + +// GetBot returns value of Bot field. +func (g *MessagesGetPreparedInlineMessageRequest) GetBot() (value InputUserClass) { + if g == nil { + return + } + return g.Bot +} + +// GetID returns value of ID field. +func (g *MessagesGetPreparedInlineMessageRequest) GetID() (value string) { + if g == nil { + return + } + return g.ID +} + +// MessagesGetPreparedInlineMessage invokes method messages.getPreparedInlineMessage#857ebdb8 returning error if any. +// +// See https://core.telegram.org/method/messages.getPreparedInlineMessage for reference. +func (c *Client) MessagesGetPreparedInlineMessage(ctx context.Context, request *MessagesGetPreparedInlineMessageRequest) (*MessagesPreparedInlineMessage, error) { + var result MessagesPreparedInlineMessage + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_messages_get_prepared_inline_message_slices_gen.go b/tg/tl_messages_get_prepared_inline_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_get_prepared_inline_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) diff --git a/tg/tl_messages_prepared_inline_message_gen.go b/tg/tl_messages_prepared_inline_message_gen.go new file mode 100644 index 0000000000..32bedeb6d5 --- /dev/null +++ b/tg/tl_messages_prepared_inline_message_gen.go @@ -0,0 +1,320 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) + +// MessagesPreparedInlineMessage represents TL type `messages.preparedInlineMessage#ff57708d`. +// +// See https://core.telegram.org/constructor/messages.preparedInlineMessage for reference. +type MessagesPreparedInlineMessage struct { + // QueryID field of MessagesPreparedInlineMessage. + QueryID int64 + // Result field of MessagesPreparedInlineMessage. + Result BotInlineResultClass + // PeerTypes field of MessagesPreparedInlineMessage. + PeerTypes []InlineQueryPeerTypeClass + // CacheTime field of MessagesPreparedInlineMessage. + CacheTime int + // Users field of MessagesPreparedInlineMessage. + Users []UserClass +} + +// MessagesPreparedInlineMessageTypeID is TL type id of MessagesPreparedInlineMessage. +const MessagesPreparedInlineMessageTypeID = 0xff57708d + +// Ensuring interfaces in compile-time for MessagesPreparedInlineMessage. +var ( + _ bin.Encoder = &MessagesPreparedInlineMessage{} + _ bin.Decoder = &MessagesPreparedInlineMessage{} + _ bin.BareEncoder = &MessagesPreparedInlineMessage{} + _ bin.BareDecoder = &MessagesPreparedInlineMessage{} +) + +func (p *MessagesPreparedInlineMessage) Zero() bool { + if p == nil { + return true + } + if !(p.QueryID == 0) { + return false + } + if !(p.Result == nil) { + return false + } + if !(p.PeerTypes == nil) { + return false + } + if !(p.CacheTime == 0) { + return false + } + if !(p.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *MessagesPreparedInlineMessage) String() string { + if p == nil { + return "MessagesPreparedInlineMessage(nil)" + } + type Alias MessagesPreparedInlineMessage + return fmt.Sprintf("MessagesPreparedInlineMessage%+v", Alias(*p)) +} + +// FillFrom fills MessagesPreparedInlineMessage from given interface. +func (p *MessagesPreparedInlineMessage) FillFrom(from interface { + GetQueryID() (value int64) + GetResult() (value BotInlineResultClass) + GetPeerTypes() (value []InlineQueryPeerTypeClass) + GetCacheTime() (value int) + GetUsers() (value []UserClass) +}) { + p.QueryID = from.GetQueryID() + p.Result = from.GetResult() + p.PeerTypes = from.GetPeerTypes() + p.CacheTime = from.GetCacheTime() + p.Users = from.GetUsers() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesPreparedInlineMessage) TypeID() uint32 { + return MessagesPreparedInlineMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesPreparedInlineMessage) TypeName() string { + return "messages.preparedInlineMessage" +} + +// TypeInfo returns info about TL type. +func (p *MessagesPreparedInlineMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.preparedInlineMessage", + ID: MessagesPreparedInlineMessageTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "QueryID", + SchemaName: "query_id", + }, + { + Name: "Result", + SchemaName: "result", + }, + { + Name: "PeerTypes", + SchemaName: "peer_types", + }, + { + Name: "CacheTime", + SchemaName: "cache_time", + }, + { + Name: "Users", + SchemaName: "users", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *MessagesPreparedInlineMessage) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode messages.preparedInlineMessage#ff57708d as nil") + } + b.PutID(MessagesPreparedInlineMessageTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *MessagesPreparedInlineMessage) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode messages.preparedInlineMessage#ff57708d as nil") + } + b.PutLong(p.QueryID) + if p.Result == nil { + return fmt.Errorf("unable to encode messages.preparedInlineMessage#ff57708d: field result is nil") + } + if err := p.Result.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.preparedInlineMessage#ff57708d: field result: %w", err) + } + b.PutVectorHeader(len(p.PeerTypes)) + for idx, v := range p.PeerTypes { + if v == nil { + return fmt.Errorf("unable to encode messages.preparedInlineMessage#ff57708d: field peer_types element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.preparedInlineMessage#ff57708d: field peer_types element with index %d: %w", idx, err) + } + } + b.PutInt(p.CacheTime) + b.PutVectorHeader(len(p.Users)) + for idx, v := range p.Users { + if v == nil { + return fmt.Errorf("unable to encode messages.preparedInlineMessage#ff57708d: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.preparedInlineMessage#ff57708d: field users element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (p *MessagesPreparedInlineMessage) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode messages.preparedInlineMessage#ff57708d to nil") + } + if err := b.ConsumeID(MessagesPreparedInlineMessageTypeID); err != nil { + return fmt.Errorf("unable to decode messages.preparedInlineMessage#ff57708d: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *MessagesPreparedInlineMessage) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode messages.preparedInlineMessage#ff57708d to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.preparedInlineMessage#ff57708d: field query_id: %w", err) + } + p.QueryID = value + } + { + value, err := DecodeBotInlineResult(b) + if err != nil { + return fmt.Errorf("unable to decode messages.preparedInlineMessage#ff57708d: field result: %w", err) + } + p.Result = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.preparedInlineMessage#ff57708d: field peer_types: %w", err) + } + + if headerLen > 0 { + p.PeerTypes = make([]InlineQueryPeerTypeClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInlineQueryPeerType(b) + if err != nil { + return fmt.Errorf("unable to decode messages.preparedInlineMessage#ff57708d: field peer_types: %w", err) + } + p.PeerTypes = append(p.PeerTypes, value) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.preparedInlineMessage#ff57708d: field cache_time: %w", err) + } + p.CacheTime = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.preparedInlineMessage#ff57708d: field users: %w", err) + } + + if headerLen > 0 { + p.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeUser(b) + if err != nil { + return fmt.Errorf("unable to decode messages.preparedInlineMessage#ff57708d: field users: %w", err) + } + p.Users = append(p.Users, value) + } + } + return nil +} + +// GetQueryID returns value of QueryID field. +func (p *MessagesPreparedInlineMessage) GetQueryID() (value int64) { + if p == nil { + return + } + return p.QueryID +} + +// GetResult returns value of Result field. +func (p *MessagesPreparedInlineMessage) GetResult() (value BotInlineResultClass) { + if p == nil { + return + } + return p.Result +} + +// GetPeerTypes returns value of PeerTypes field. +func (p *MessagesPreparedInlineMessage) GetPeerTypes() (value []InlineQueryPeerTypeClass) { + if p == nil { + return + } + return p.PeerTypes +} + +// GetCacheTime returns value of CacheTime field. +func (p *MessagesPreparedInlineMessage) GetCacheTime() (value int) { + if p == nil { + return + } + return p.CacheTime +} + +// GetUsers returns value of Users field. +func (p *MessagesPreparedInlineMessage) GetUsers() (value []UserClass) { + if p == nil { + return + } + return p.Users +} + +// MapPeerTypes returns field PeerTypes wrapped in InlineQueryPeerTypeClassArray helper. +func (p *MessagesPreparedInlineMessage) MapPeerTypes() (value InlineQueryPeerTypeClassArray) { + return InlineQueryPeerTypeClassArray(p.PeerTypes) +} + +// MapUsers returns field Users wrapped in UserClassArray helper. +func (p *MessagesPreparedInlineMessage) MapUsers() (value UserClassArray) { + return UserClassArray(p.Users) +} diff --git a/tg/tl_messages_prepared_inline_message_slices_gen.go b/tg/tl_messages_prepared_inline_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_prepared_inline_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) diff --git a/tg/tl_messages_request_app_web_view_gen.go b/tg/tl_messages_request_app_web_view_gen.go index 97542e8e28..b701700e69 100644 --- a/tg/tl_messages_request_app_web_view_gen.go +++ b/tg/tl_messages_request_app_web_view_gen.go @@ -62,6 +62,8 @@ type MessagesRequestAppWebViewRequest struct { // Links: // 1) https://core.telegram.org/api/links#direct-mini-app-links Compact bool + // Fullscreen field of MessagesRequestAppWebViewRequest. + Fullscreen bool // If the client has clicked on the link in a Telegram chat, pass the chat's peer // information; otherwise pass the bot's peer information, instead. Peer InputPeerClass @@ -115,6 +117,9 @@ func (r *MessagesRequestAppWebViewRequest) Zero() bool { if !(r.Compact == false) { return false } + if !(r.Fullscreen == false) { + return false + } if !(r.Peer == nil) { return false } @@ -147,6 +152,7 @@ func (r *MessagesRequestAppWebViewRequest) String() string { func (r *MessagesRequestAppWebViewRequest) FillFrom(from interface { GetWriteAllowed() (value bool) GetCompact() (value bool) + GetFullscreen() (value bool) GetPeer() (value InputPeerClass) GetApp() (value InputBotAppClass) GetStartParam() (value string, ok bool) @@ -155,6 +161,7 @@ func (r *MessagesRequestAppWebViewRequest) FillFrom(from interface { }) { r.WriteAllowed = from.GetWriteAllowed() r.Compact = from.GetCompact() + r.Fullscreen = from.GetFullscreen() r.Peer = from.GetPeer() r.App = from.GetApp() if val, ok := from.GetStartParam(); ok { @@ -201,6 +208,11 @@ func (r *MessagesRequestAppWebViewRequest) TypeInfo() tdp.Type { SchemaName: "compact", Null: !r.Flags.Has(7), }, + { + Name: "Fullscreen", + SchemaName: "fullscreen", + Null: !r.Flags.Has(8), + }, { Name: "Peer", SchemaName: "peer", @@ -235,6 +247,9 @@ func (r *MessagesRequestAppWebViewRequest) SetFlags() { if !(r.Compact == false) { r.Flags.Set(7) } + if !(r.Fullscreen == false) { + r.Flags.Set(8) + } if !(r.StartParam == "") { r.Flags.Set(1) } @@ -308,6 +323,7 @@ func (r *MessagesRequestAppWebViewRequest) DecodeBare(b *bin.Buffer) error { } r.WriteAllowed = r.Flags.Has(0) r.Compact = r.Flags.Has(7) + r.Fullscreen = r.Flags.Has(8) { value, err := DecodeInputPeer(b) if err != nil { @@ -382,6 +398,25 @@ func (r *MessagesRequestAppWebViewRequest) GetCompact() (value bool) { return r.Flags.Has(7) } +// SetFullscreen sets value of Fullscreen conditional field. +func (r *MessagesRequestAppWebViewRequest) SetFullscreen(value bool) { + if value { + r.Flags.Set(8) + r.Fullscreen = true + } else { + r.Flags.Unset(8) + r.Fullscreen = false + } +} + +// GetFullscreen returns value of Fullscreen conditional field. +func (r *MessagesRequestAppWebViewRequest) GetFullscreen() (value bool) { + if r == nil { + return + } + return r.Flags.Has(8) +} + // GetPeer returns value of Peer field. func (r *MessagesRequestAppWebViewRequest) GetPeer() (value InputPeerClass) { if r == nil { diff --git a/tg/tl_messages_request_main_web_view_gen.go b/tg/tl_messages_request_main_web_view_gen.go index b3c654930a..d3ebf64b4f 100644 --- a/tg/tl_messages_request_main_web_view_gen.go +++ b/tg/tl_messages_request_main_web_view_gen.go @@ -50,6 +50,8 @@ type MessagesRequestMainWebViewRequest struct { // Links: // 1) https://core.telegram.org/api/links#main-mini-app-links Compact bool + // Fullscreen field of MessagesRequestMainWebViewRequest. + Fullscreen bool // Currently open chat, may be inputPeerEmpty¹ if no chat is currently open. // // Links: @@ -96,6 +98,9 @@ func (r *MessagesRequestMainWebViewRequest) Zero() bool { if !(r.Compact == false) { return false } + if !(r.Fullscreen == false) { + return false + } if !(r.Peer == nil) { return false } @@ -127,6 +132,7 @@ func (r *MessagesRequestMainWebViewRequest) String() string { // FillFrom fills MessagesRequestMainWebViewRequest from given interface. func (r *MessagesRequestMainWebViewRequest) FillFrom(from interface { GetCompact() (value bool) + GetFullscreen() (value bool) GetPeer() (value InputPeerClass) GetBot() (value InputUserClass) GetStartParam() (value string, ok bool) @@ -134,6 +140,7 @@ func (r *MessagesRequestMainWebViewRequest) FillFrom(from interface { GetPlatform() (value string) }) { r.Compact = from.GetCompact() + r.Fullscreen = from.GetFullscreen() r.Peer = from.GetPeer() r.Bot = from.GetBot() if val, ok := from.GetStartParam(); ok { @@ -175,6 +182,11 @@ func (r *MessagesRequestMainWebViewRequest) TypeInfo() tdp.Type { SchemaName: "compact", Null: !r.Flags.Has(7), }, + { + Name: "Fullscreen", + SchemaName: "fullscreen", + Null: !r.Flags.Has(8), + }, { Name: "Peer", SchemaName: "peer", @@ -206,6 +218,9 @@ func (r *MessagesRequestMainWebViewRequest) SetFlags() { if !(r.Compact == false) { r.Flags.Set(7) } + if !(r.Fullscreen == false) { + r.Flags.Set(8) + } if !(r.StartParam == "") { r.Flags.Set(1) } @@ -278,6 +293,7 @@ func (r *MessagesRequestMainWebViewRequest) DecodeBare(b *bin.Buffer) error { } } r.Compact = r.Flags.Has(7) + r.Fullscreen = r.Flags.Has(8) { value, err := DecodeInputPeer(b) if err != nil { @@ -333,6 +349,25 @@ func (r *MessagesRequestMainWebViewRequest) GetCompact() (value bool) { return r.Flags.Has(7) } +// SetFullscreen sets value of Fullscreen conditional field. +func (r *MessagesRequestMainWebViewRequest) SetFullscreen(value bool) { + if value { + r.Flags.Set(8) + r.Fullscreen = true + } else { + r.Flags.Unset(8) + r.Fullscreen = false + } +} + +// GetFullscreen returns value of Fullscreen conditional field. +func (r *MessagesRequestMainWebViewRequest) GetFullscreen() (value bool) { + if r == nil { + return + } + return r.Flags.Has(8) +} + // GetPeer returns value of Peer field. func (r *MessagesRequestMainWebViewRequest) GetPeer() (value InputPeerClass) { if r == nil { diff --git a/tg/tl_messages_request_simple_web_view_gen.go b/tg/tl_messages_request_simple_web_view_gen.go index a32c04ae68..91e1e60128 100644 --- a/tg/tl_messages_request_simple_web_view_gen.go +++ b/tg/tl_messages_request_simple_web_view_gen.go @@ -57,6 +57,8 @@ type MessagesRequestSimpleWebViewRequest struct { FromSideMenu bool // Deprecated. Compact bool + // Fullscreen field of MessagesRequestSimpleWebViewRequest. + Fullscreen bool // Bot that owns the mini app Bot InputUserClass // Web app URL, if opening from a keyboard button or inline result @@ -105,6 +107,9 @@ func (r *MessagesRequestSimpleWebViewRequest) Zero() bool { if !(r.Compact == false) { return false } + if !(r.Fullscreen == false) { + return false + } if !(r.Bot == nil) { return false } @@ -138,6 +143,7 @@ func (r *MessagesRequestSimpleWebViewRequest) FillFrom(from interface { GetFromSwitchWebview() (value bool) GetFromSideMenu() (value bool) GetCompact() (value bool) + GetFullscreen() (value bool) GetBot() (value InputUserClass) GetURL() (value string, ok bool) GetStartParam() (value string, ok bool) @@ -147,6 +153,7 @@ func (r *MessagesRequestSimpleWebViewRequest) FillFrom(from interface { r.FromSwitchWebview = from.GetFromSwitchWebview() r.FromSideMenu = from.GetFromSideMenu() r.Compact = from.GetCompact() + r.Fullscreen = from.GetFullscreen() r.Bot = from.GetBot() if val, ok := from.GetURL(); ok { r.URL = val @@ -201,6 +208,11 @@ func (r *MessagesRequestSimpleWebViewRequest) TypeInfo() tdp.Type { SchemaName: "compact", Null: !r.Flags.Has(7), }, + { + Name: "Fullscreen", + SchemaName: "fullscreen", + Null: !r.Flags.Has(8), + }, { Name: "Bot", SchemaName: "bot", @@ -239,6 +251,9 @@ func (r *MessagesRequestSimpleWebViewRequest) SetFlags() { if !(r.Compact == false) { r.Flags.Set(7) } + if !(r.Fullscreen == false) { + r.Flags.Set(8) + } if !(r.URL == "") { r.Flags.Set(3) } @@ -313,6 +328,7 @@ func (r *MessagesRequestSimpleWebViewRequest) DecodeBare(b *bin.Buffer) error { r.FromSwitchWebview = r.Flags.Has(1) r.FromSideMenu = r.Flags.Has(2) r.Compact = r.Flags.Has(7) + r.Fullscreen = r.Flags.Has(8) { value, err := DecodeInputUser(b) if err != nil { @@ -406,6 +422,25 @@ func (r *MessagesRequestSimpleWebViewRequest) GetCompact() (value bool) { return r.Flags.Has(7) } +// SetFullscreen sets value of Fullscreen conditional field. +func (r *MessagesRequestSimpleWebViewRequest) SetFullscreen(value bool) { + if value { + r.Flags.Set(8) + r.Fullscreen = true + } else { + r.Flags.Unset(8) + r.Fullscreen = false + } +} + +// GetFullscreen returns value of Fullscreen conditional field. +func (r *MessagesRequestSimpleWebViewRequest) GetFullscreen() (value bool) { + if r == nil { + return + } + return r.Flags.Has(8) +} + // GetBot returns value of Bot field. func (r *MessagesRequestSimpleWebViewRequest) GetBot() (value InputUserClass) { if r == nil { diff --git a/tg/tl_messages_request_web_view_gen.go b/tg/tl_messages_request_web_view_gen.go index d57be1657b..319970fa71 100644 --- a/tg/tl_messages_request_web_view_gen.go +++ b/tg/tl_messages_request_web_view_gen.go @@ -66,6 +66,8 @@ type MessagesRequestWebViewRequest struct { // Links: // 1) https://core.telegram.org/api/links#bot-attachment-or-side-menu-links Compact bool + // Fullscreen field of MessagesRequestWebViewRequest. + Fullscreen bool // Dialog where the web app is being opened, and where the resulting message will be sent // (see the docs for more info »¹). // @@ -144,6 +146,9 @@ func (r *MessagesRequestWebViewRequest) Zero() bool { if !(r.Compact == false) { return false } + if !(r.Fullscreen == false) { + return false + } if !(r.Peer == nil) { return false } @@ -186,6 +191,7 @@ func (r *MessagesRequestWebViewRequest) FillFrom(from interface { GetFromBotMenu() (value bool) GetSilent() (value bool) GetCompact() (value bool) + GetFullscreen() (value bool) GetPeer() (value InputPeerClass) GetBot() (value InputUserClass) GetURL() (value string, ok bool) @@ -198,6 +204,7 @@ func (r *MessagesRequestWebViewRequest) FillFrom(from interface { r.FromBotMenu = from.GetFromBotMenu() r.Silent = from.GetSilent() r.Compact = from.GetCompact() + r.Fullscreen = from.GetFullscreen() r.Peer = from.GetPeer() r.Bot = from.GetBot() if val, ok := from.GetURL(); ok { @@ -261,6 +268,11 @@ func (r *MessagesRequestWebViewRequest) TypeInfo() tdp.Type { SchemaName: "compact", Null: !r.Flags.Has(7), }, + { + Name: "Fullscreen", + SchemaName: "fullscreen", + Null: !r.Flags.Has(8), + }, { Name: "Peer", SchemaName: "peer", @@ -313,6 +325,9 @@ func (r *MessagesRequestWebViewRequest) SetFlags() { if !(r.Compact == false) { r.Flags.Set(7) } + if !(r.Fullscreen == false) { + r.Flags.Set(8) + } if !(r.URL == "") { r.Flags.Set(1) } @@ -415,6 +430,7 @@ func (r *MessagesRequestWebViewRequest) DecodeBare(b *bin.Buffer) error { r.FromBotMenu = r.Flags.Has(4) r.Silent = r.Flags.Has(5) r.Compact = r.Flags.Has(7) + r.Fullscreen = r.Flags.Has(8) { value, err := DecodeInputPeer(b) if err != nil { @@ -529,6 +545,25 @@ func (r *MessagesRequestWebViewRequest) GetCompact() (value bool) { return r.Flags.Has(7) } +// SetFullscreen sets value of Fullscreen conditional field. +func (r *MessagesRequestWebViewRequest) SetFullscreen(value bool) { + if value { + r.Flags.Set(8) + r.Fullscreen = true + } else { + r.Flags.Unset(8) + r.Fullscreen = false + } +} + +// GetFullscreen returns value of Fullscreen conditional field. +func (r *MessagesRequestWebViewRequest) GetFullscreen() (value bool) { + if r == nil { + return + } + return r.Flags.Has(8) +} + // GetPeer returns value of Peer field. func (r *MessagesRequestWebViewRequest) GetPeer() (value InputPeerClass) { if r == nil { diff --git a/tg/tl_messages_save_prepared_inline_message_gen.go b/tg/tl_messages_save_prepared_inline_message_gen.go new file mode 100644 index 0000000000..08cf60376b --- /dev/null +++ b/tg/tl_messages_save_prepared_inline_message_gen.go @@ -0,0 +1,302 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) + +// MessagesSavePreparedInlineMessageRequest represents TL type `messages.savePreparedInlineMessage#f21f7f2f`. +// +// See https://core.telegram.org/method/messages.savePreparedInlineMessage for reference. +type MessagesSavePreparedInlineMessageRequest struct { + // Flags field of MessagesSavePreparedInlineMessageRequest. + Flags bin.Fields + // Result field of MessagesSavePreparedInlineMessageRequest. + Result InputBotInlineResultClass + // UserID field of MessagesSavePreparedInlineMessageRequest. + UserID InputUserClass + // PeerTypes field of MessagesSavePreparedInlineMessageRequest. + // + // Use SetPeerTypes and GetPeerTypes helpers. + PeerTypes []InlineQueryPeerTypeClass +} + +// MessagesSavePreparedInlineMessageRequestTypeID is TL type id of MessagesSavePreparedInlineMessageRequest. +const MessagesSavePreparedInlineMessageRequestTypeID = 0xf21f7f2f + +// Ensuring interfaces in compile-time for MessagesSavePreparedInlineMessageRequest. +var ( + _ bin.Encoder = &MessagesSavePreparedInlineMessageRequest{} + _ bin.Decoder = &MessagesSavePreparedInlineMessageRequest{} + _ bin.BareEncoder = &MessagesSavePreparedInlineMessageRequest{} + _ bin.BareDecoder = &MessagesSavePreparedInlineMessageRequest{} +) + +func (s *MessagesSavePreparedInlineMessageRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Result == nil) { + return false + } + if !(s.UserID == nil) { + return false + } + if !(s.PeerTypes == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *MessagesSavePreparedInlineMessageRequest) String() string { + if s == nil { + return "MessagesSavePreparedInlineMessageRequest(nil)" + } + type Alias MessagesSavePreparedInlineMessageRequest + return fmt.Sprintf("MessagesSavePreparedInlineMessageRequest%+v", Alias(*s)) +} + +// FillFrom fills MessagesSavePreparedInlineMessageRequest from given interface. +func (s *MessagesSavePreparedInlineMessageRequest) FillFrom(from interface { + GetResult() (value InputBotInlineResultClass) + GetUserID() (value InputUserClass) + GetPeerTypes() (value []InlineQueryPeerTypeClass, ok bool) +}) { + s.Result = from.GetResult() + s.UserID = from.GetUserID() + if val, ok := from.GetPeerTypes(); ok { + s.PeerTypes = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesSavePreparedInlineMessageRequest) TypeID() uint32 { + return MessagesSavePreparedInlineMessageRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesSavePreparedInlineMessageRequest) TypeName() string { + return "messages.savePreparedInlineMessage" +} + +// TypeInfo returns info about TL type. +func (s *MessagesSavePreparedInlineMessageRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.savePreparedInlineMessage", + ID: MessagesSavePreparedInlineMessageRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Result", + SchemaName: "result", + }, + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "PeerTypes", + SchemaName: "peer_types", + Null: !s.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *MessagesSavePreparedInlineMessageRequest) SetFlags() { + if !(s.PeerTypes == nil) { + s.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (s *MessagesSavePreparedInlineMessageRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.savePreparedInlineMessage#f21f7f2f as nil") + } + b.PutID(MessagesSavePreparedInlineMessageRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *MessagesSavePreparedInlineMessageRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.savePreparedInlineMessage#f21f7f2f as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.savePreparedInlineMessage#f21f7f2f: field flags: %w", err) + } + if s.Result == nil { + return fmt.Errorf("unable to encode messages.savePreparedInlineMessage#f21f7f2f: field result is nil") + } + if err := s.Result.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.savePreparedInlineMessage#f21f7f2f: field result: %w", err) + } + if s.UserID == nil { + return fmt.Errorf("unable to encode messages.savePreparedInlineMessage#f21f7f2f: field user_id is nil") + } + if err := s.UserID.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.savePreparedInlineMessage#f21f7f2f: field user_id: %w", err) + } + if s.Flags.Has(0) { + b.PutVectorHeader(len(s.PeerTypes)) + for idx, v := range s.PeerTypes { + if v == nil { + return fmt.Errorf("unable to encode messages.savePreparedInlineMessage#f21f7f2f: field peer_types element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.savePreparedInlineMessage#f21f7f2f: field peer_types element with index %d: %w", idx, err) + } + } + } + return nil +} + +// Decode implements bin.Decoder. +func (s *MessagesSavePreparedInlineMessageRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.savePreparedInlineMessage#f21f7f2f to nil") + } + if err := b.ConsumeID(MessagesSavePreparedInlineMessageRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.savePreparedInlineMessage#f21f7f2f: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *MessagesSavePreparedInlineMessageRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.savePreparedInlineMessage#f21f7f2f to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.savePreparedInlineMessage#f21f7f2f: field flags: %w", err) + } + } + { + value, err := DecodeInputBotInlineResult(b) + if err != nil { + return fmt.Errorf("unable to decode messages.savePreparedInlineMessage#f21f7f2f: field result: %w", err) + } + s.Result = value + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode messages.savePreparedInlineMessage#f21f7f2f: field user_id: %w", err) + } + s.UserID = value + } + if s.Flags.Has(0) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.savePreparedInlineMessage#f21f7f2f: field peer_types: %w", err) + } + + if headerLen > 0 { + s.PeerTypes = make([]InlineQueryPeerTypeClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInlineQueryPeerType(b) + if err != nil { + return fmt.Errorf("unable to decode messages.savePreparedInlineMessage#f21f7f2f: field peer_types: %w", err) + } + s.PeerTypes = append(s.PeerTypes, value) + } + } + return nil +} + +// GetResult returns value of Result field. +func (s *MessagesSavePreparedInlineMessageRequest) GetResult() (value InputBotInlineResultClass) { + if s == nil { + return + } + return s.Result +} + +// GetUserID returns value of UserID field. +func (s *MessagesSavePreparedInlineMessageRequest) GetUserID() (value InputUserClass) { + if s == nil { + return + } + return s.UserID +} + +// SetPeerTypes sets value of PeerTypes conditional field. +func (s *MessagesSavePreparedInlineMessageRequest) SetPeerTypes(value []InlineQueryPeerTypeClass) { + s.Flags.Set(0) + s.PeerTypes = value +} + +// GetPeerTypes returns value of PeerTypes conditional field and +// boolean which is true if field was set. +func (s *MessagesSavePreparedInlineMessageRequest) GetPeerTypes() (value []InlineQueryPeerTypeClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(0) { + return value, false + } + return s.PeerTypes, true +} + +// MapPeerTypes returns field PeerTypes wrapped in InlineQueryPeerTypeClassArray helper. +func (s *MessagesSavePreparedInlineMessageRequest) MapPeerTypes() (value InlineQueryPeerTypeClassArray, ok bool) { + if !s.Flags.Has(0) { + return value, false + } + return InlineQueryPeerTypeClassArray(s.PeerTypes), true +} + +// MessagesSavePreparedInlineMessage invokes method messages.savePreparedInlineMessage#f21f7f2f returning error if any. +// +// See https://core.telegram.org/method/messages.savePreparedInlineMessage for reference. +func (c *Client) MessagesSavePreparedInlineMessage(ctx context.Context, request *MessagesSavePreparedInlineMessageRequest) (*MessagesBotPreparedInlineMessage, error) { + var result MessagesBotPreparedInlineMessage + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_messages_save_prepared_inline_message_slices_gen.go b/tg/tl_messages_save_prepared_inline_message_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_save_prepared_inline_message_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) diff --git a/tg/tl_payments_bot_cancel_stars_subscription_gen.go b/tg/tl_payments_bot_cancel_stars_subscription_gen.go new file mode 100644 index 0000000000..aa2eb5908a --- /dev/null +++ b/tg/tl_payments_bot_cancel_stars_subscription_gen.go @@ -0,0 +1,328 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) + +// PaymentsBotCancelStarsSubscriptionRequest represents TL type `payments.botCancelStarsSubscription#57f9ece6`. +// +// See https://core.telegram.org/method/payments.botCancelStarsSubscription for reference. +type PaymentsBotCancelStarsSubscriptionRequest struct { + // Flags field of PaymentsBotCancelStarsSubscriptionRequest. + Flags bin.Fields + // Restore field of PaymentsBotCancelStarsSubscriptionRequest. + Restore bool + // UserID field of PaymentsBotCancelStarsSubscriptionRequest. + UserID InputUserClass + // InvoiceSlug field of PaymentsBotCancelStarsSubscriptionRequest. + // + // Use SetInvoiceSlug and GetInvoiceSlug helpers. + InvoiceSlug string + // ChargeID field of PaymentsBotCancelStarsSubscriptionRequest. + // + // Use SetChargeID and GetChargeID helpers. + ChargeID string +} + +// PaymentsBotCancelStarsSubscriptionRequestTypeID is TL type id of PaymentsBotCancelStarsSubscriptionRequest. +const PaymentsBotCancelStarsSubscriptionRequestTypeID = 0x57f9ece6 + +// Ensuring interfaces in compile-time for PaymentsBotCancelStarsSubscriptionRequest. +var ( + _ bin.Encoder = &PaymentsBotCancelStarsSubscriptionRequest{} + _ bin.Decoder = &PaymentsBotCancelStarsSubscriptionRequest{} + _ bin.BareEncoder = &PaymentsBotCancelStarsSubscriptionRequest{} + _ bin.BareDecoder = &PaymentsBotCancelStarsSubscriptionRequest{} +) + +func (b *PaymentsBotCancelStarsSubscriptionRequest) Zero() bool { + if b == nil { + return true + } + if !(b.Flags.Zero()) { + return false + } + if !(b.Restore == false) { + return false + } + if !(b.UserID == nil) { + return false + } + if !(b.InvoiceSlug == "") { + return false + } + if !(b.ChargeID == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (b *PaymentsBotCancelStarsSubscriptionRequest) String() string { + if b == nil { + return "PaymentsBotCancelStarsSubscriptionRequest(nil)" + } + type Alias PaymentsBotCancelStarsSubscriptionRequest + return fmt.Sprintf("PaymentsBotCancelStarsSubscriptionRequest%+v", Alias(*b)) +} + +// FillFrom fills PaymentsBotCancelStarsSubscriptionRequest from given interface. +func (b *PaymentsBotCancelStarsSubscriptionRequest) FillFrom(from interface { + GetRestore() (value bool) + GetUserID() (value InputUserClass) + GetInvoiceSlug() (value string, ok bool) + GetChargeID() (value string, ok bool) +}) { + b.Restore = from.GetRestore() + b.UserID = from.GetUserID() + if val, ok := from.GetInvoiceSlug(); ok { + b.InvoiceSlug = val + } + + if val, ok := from.GetChargeID(); ok { + b.ChargeID = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsBotCancelStarsSubscriptionRequest) TypeID() uint32 { + return PaymentsBotCancelStarsSubscriptionRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsBotCancelStarsSubscriptionRequest) TypeName() string { + return "payments.botCancelStarsSubscription" +} + +// TypeInfo returns info about TL type. +func (b *PaymentsBotCancelStarsSubscriptionRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.botCancelStarsSubscription", + ID: PaymentsBotCancelStarsSubscriptionRequestTypeID, + } + if b == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Restore", + SchemaName: "restore", + Null: !b.Flags.Has(0), + }, + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "InvoiceSlug", + SchemaName: "invoice_slug", + Null: !b.Flags.Has(1), + }, + { + Name: "ChargeID", + SchemaName: "charge_id", + Null: !b.Flags.Has(2), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (b *PaymentsBotCancelStarsSubscriptionRequest) SetFlags() { + if !(b.Restore == false) { + b.Flags.Set(0) + } + if !(b.InvoiceSlug == "") { + b.Flags.Set(1) + } + if !(b.ChargeID == "") { + b.Flags.Set(2) + } +} + +// Encode implements bin.Encoder. +func (b *PaymentsBotCancelStarsSubscriptionRequest) Encode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode payments.botCancelStarsSubscription#57f9ece6 as nil") + } + buf.PutID(PaymentsBotCancelStarsSubscriptionRequestTypeID) + return b.EncodeBare(buf) +} + +// EncodeBare implements bin.BareEncoder. +func (b *PaymentsBotCancelStarsSubscriptionRequest) EncodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't encode payments.botCancelStarsSubscription#57f9ece6 as nil") + } + b.SetFlags() + if err := b.Flags.Encode(buf); err != nil { + return fmt.Errorf("unable to encode payments.botCancelStarsSubscription#57f9ece6: field flags: %w", err) + } + if b.UserID == nil { + return fmt.Errorf("unable to encode payments.botCancelStarsSubscription#57f9ece6: field user_id is nil") + } + if err := b.UserID.Encode(buf); err != nil { + return fmt.Errorf("unable to encode payments.botCancelStarsSubscription#57f9ece6: field user_id: %w", err) + } + if b.Flags.Has(1) { + buf.PutString(b.InvoiceSlug) + } + if b.Flags.Has(2) { + buf.PutString(b.ChargeID) + } + return nil +} + +// Decode implements bin.Decoder. +func (b *PaymentsBotCancelStarsSubscriptionRequest) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode payments.botCancelStarsSubscription#57f9ece6 to nil") + } + if err := buf.ConsumeID(PaymentsBotCancelStarsSubscriptionRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.botCancelStarsSubscription#57f9ece6: %w", err) + } + return b.DecodeBare(buf) +} + +// DecodeBare implements bin.BareDecoder. +func (b *PaymentsBotCancelStarsSubscriptionRequest) DecodeBare(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("can't decode payments.botCancelStarsSubscription#57f9ece6 to nil") + } + { + if err := b.Flags.Decode(buf); err != nil { + return fmt.Errorf("unable to decode payments.botCancelStarsSubscription#57f9ece6: field flags: %w", err) + } + } + b.Restore = b.Flags.Has(0) + { + value, err := DecodeInputUser(buf) + if err != nil { + return fmt.Errorf("unable to decode payments.botCancelStarsSubscription#57f9ece6: field user_id: %w", err) + } + b.UserID = value + } + if b.Flags.Has(1) { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode payments.botCancelStarsSubscription#57f9ece6: field invoice_slug: %w", err) + } + b.InvoiceSlug = value + } + if b.Flags.Has(2) { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode payments.botCancelStarsSubscription#57f9ece6: field charge_id: %w", err) + } + b.ChargeID = value + } + return nil +} + +// SetRestore sets value of Restore conditional field. +func (b *PaymentsBotCancelStarsSubscriptionRequest) SetRestore(value bool) { + if value { + b.Flags.Set(0) + b.Restore = true + } else { + b.Flags.Unset(0) + b.Restore = false + } +} + +// GetRestore returns value of Restore conditional field. +func (b *PaymentsBotCancelStarsSubscriptionRequest) GetRestore() (value bool) { + if b == nil { + return + } + return b.Flags.Has(0) +} + +// GetUserID returns value of UserID field. +func (b *PaymentsBotCancelStarsSubscriptionRequest) GetUserID() (value InputUserClass) { + if b == nil { + return + } + return b.UserID +} + +// SetInvoiceSlug sets value of InvoiceSlug conditional field. +func (b *PaymentsBotCancelStarsSubscriptionRequest) SetInvoiceSlug(value string) { + b.Flags.Set(1) + b.InvoiceSlug = value +} + +// GetInvoiceSlug returns value of InvoiceSlug conditional field and +// boolean which is true if field was set. +func (b *PaymentsBotCancelStarsSubscriptionRequest) GetInvoiceSlug() (value string, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(1) { + return value, false + } + return b.InvoiceSlug, true +} + +// SetChargeID sets value of ChargeID conditional field. +func (b *PaymentsBotCancelStarsSubscriptionRequest) SetChargeID(value string) { + b.Flags.Set(2) + b.ChargeID = value +} + +// GetChargeID returns value of ChargeID conditional field and +// boolean which is true if field was set. +func (b *PaymentsBotCancelStarsSubscriptionRequest) GetChargeID() (value string, ok bool) { + if b == nil { + return + } + if !b.Flags.Has(2) { + return value, false + } + return b.ChargeID, true +} + +// PaymentsBotCancelStarsSubscription invokes method payments.botCancelStarsSubscription#57f9ece6 returning error if any. +// +// See https://core.telegram.org/method/payments.botCancelStarsSubscription for reference. +func (c *Client) PaymentsBotCancelStarsSubscription(ctx context.Context, request *PaymentsBotCancelStarsSubscriptionRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_payments_bot_cancel_stars_subscription_slices_gen.go b/tg/tl_payments_bot_cancel_stars_subscription_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_payments_bot_cancel_stars_subscription_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +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{} +) diff --git a/tg/tl_privacy_key_gen.go b/tg/tl_privacy_key_gen.go index 36cf9dc922..74ca91e8a0 100644 --- a/tg/tl_privacy_key_gen.go +++ b/tg/tl_privacy_key_gen.go @@ -1169,6 +1169,107 @@ func (p *PrivacyKeyBirthday) DecodeBare(b *bin.Buffer) error { return nil } +// PrivacyKeyStarGiftsAutoSave represents TL type `privacyKeyStarGiftsAutoSave#2ca4fdf8`. +// +// See https://core.telegram.org/constructor/privacyKeyStarGiftsAutoSave for reference. +type PrivacyKeyStarGiftsAutoSave struct { +} + +// PrivacyKeyStarGiftsAutoSaveTypeID is TL type id of PrivacyKeyStarGiftsAutoSave. +const PrivacyKeyStarGiftsAutoSaveTypeID = 0x2ca4fdf8 + +// construct implements constructor of PrivacyKeyClass. +func (p PrivacyKeyStarGiftsAutoSave) construct() PrivacyKeyClass { return &p } + +// Ensuring interfaces in compile-time for PrivacyKeyStarGiftsAutoSave. +var ( + _ bin.Encoder = &PrivacyKeyStarGiftsAutoSave{} + _ bin.Decoder = &PrivacyKeyStarGiftsAutoSave{} + _ bin.BareEncoder = &PrivacyKeyStarGiftsAutoSave{} + _ bin.BareDecoder = &PrivacyKeyStarGiftsAutoSave{} + + _ PrivacyKeyClass = &PrivacyKeyStarGiftsAutoSave{} +) + +func (p *PrivacyKeyStarGiftsAutoSave) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PrivacyKeyStarGiftsAutoSave) String() string { + if p == nil { + return "PrivacyKeyStarGiftsAutoSave(nil)" + } + type Alias PrivacyKeyStarGiftsAutoSave + return fmt.Sprintf("PrivacyKeyStarGiftsAutoSave%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PrivacyKeyStarGiftsAutoSave) TypeID() uint32 { + return PrivacyKeyStarGiftsAutoSaveTypeID +} + +// TypeName returns name of type in TL schema. +func (*PrivacyKeyStarGiftsAutoSave) TypeName() string { + return "privacyKeyStarGiftsAutoSave" +} + +// TypeInfo returns info about TL type. +func (p *PrivacyKeyStarGiftsAutoSave) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "privacyKeyStarGiftsAutoSave", + ID: PrivacyKeyStarGiftsAutoSaveTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PrivacyKeyStarGiftsAutoSave) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode privacyKeyStarGiftsAutoSave#2ca4fdf8 as nil") + } + b.PutID(PrivacyKeyStarGiftsAutoSaveTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PrivacyKeyStarGiftsAutoSave) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode privacyKeyStarGiftsAutoSave#2ca4fdf8 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PrivacyKeyStarGiftsAutoSave) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode privacyKeyStarGiftsAutoSave#2ca4fdf8 to nil") + } + if err := b.ConsumeID(PrivacyKeyStarGiftsAutoSaveTypeID); err != nil { + return fmt.Errorf("unable to decode privacyKeyStarGiftsAutoSave#2ca4fdf8: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PrivacyKeyStarGiftsAutoSave) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode privacyKeyStarGiftsAutoSave#2ca4fdf8 to nil") + } + return nil +} + // PrivacyKeyClassName is schema name of PrivacyKeyClass. const PrivacyKeyClassName = "PrivacyKey" @@ -1194,6 +1295,7 @@ const PrivacyKeyClassName = "PrivacyKey" // case *tg.PrivacyKeyVoiceMessages: // privacyKeyVoiceMessages#697f414 // case *tg.PrivacyKeyAbout: // privacyKeyAbout#a486b761 // case *tg.PrivacyKeyBirthday: // privacyKeyBirthday#2000a518 +// case *tg.PrivacyKeyStarGiftsAutoSave: // privacyKeyStarGiftsAutoSave#2ca4fdf8 // default: panic(v) // } type PrivacyKeyClass interface { @@ -1299,6 +1401,13 @@ func DecodePrivacyKey(buf *bin.Buffer) (PrivacyKeyClass, error) { return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err) } return &v, nil + case PrivacyKeyStarGiftsAutoSaveTypeID: + // Decoding privacyKeyStarGiftsAutoSave#2ca4fdf8. + v := PrivacyKeyStarGiftsAutoSave{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PrivacyKeyClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_privacy_rule_gen.go b/tg/tl_privacy_rule_gen.go index cbf9f6c3be..656de16434 100644 --- a/tg/tl_privacy_rule_gen.go +++ b/tg/tl_privacy_rule_gen.go @@ -1243,6 +1243,208 @@ func (p *PrivacyValueAllowPremium) DecodeBare(b *bin.Buffer) error { return nil } +// PrivacyValueAllowBots represents TL type `privacyValueAllowBots#21461b5d`. +// +// See https://core.telegram.org/constructor/privacyValueAllowBots for reference. +type PrivacyValueAllowBots struct { +} + +// PrivacyValueAllowBotsTypeID is TL type id of PrivacyValueAllowBots. +const PrivacyValueAllowBotsTypeID = 0x21461b5d + +// construct implements constructor of PrivacyRuleClass. +func (p PrivacyValueAllowBots) construct() PrivacyRuleClass { return &p } + +// Ensuring interfaces in compile-time for PrivacyValueAllowBots. +var ( + _ bin.Encoder = &PrivacyValueAllowBots{} + _ bin.Decoder = &PrivacyValueAllowBots{} + _ bin.BareEncoder = &PrivacyValueAllowBots{} + _ bin.BareDecoder = &PrivacyValueAllowBots{} + + _ PrivacyRuleClass = &PrivacyValueAllowBots{} +) + +func (p *PrivacyValueAllowBots) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PrivacyValueAllowBots) String() string { + if p == nil { + return "PrivacyValueAllowBots(nil)" + } + type Alias PrivacyValueAllowBots + return fmt.Sprintf("PrivacyValueAllowBots%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PrivacyValueAllowBots) TypeID() uint32 { + return PrivacyValueAllowBotsTypeID +} + +// TypeName returns name of type in TL schema. +func (*PrivacyValueAllowBots) TypeName() string { + return "privacyValueAllowBots" +} + +// TypeInfo returns info about TL type. +func (p *PrivacyValueAllowBots) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "privacyValueAllowBots", + ID: PrivacyValueAllowBotsTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PrivacyValueAllowBots) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode privacyValueAllowBots#21461b5d as nil") + } + b.PutID(PrivacyValueAllowBotsTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PrivacyValueAllowBots) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode privacyValueAllowBots#21461b5d as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PrivacyValueAllowBots) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode privacyValueAllowBots#21461b5d to nil") + } + if err := b.ConsumeID(PrivacyValueAllowBotsTypeID); err != nil { + return fmt.Errorf("unable to decode privacyValueAllowBots#21461b5d: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PrivacyValueAllowBots) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode privacyValueAllowBots#21461b5d to nil") + } + return nil +} + +// PrivacyValueDisallowBots represents TL type `privacyValueDisallowBots#f6a5f82f`. +// +// See https://core.telegram.org/constructor/privacyValueDisallowBots for reference. +type PrivacyValueDisallowBots struct { +} + +// PrivacyValueDisallowBotsTypeID is TL type id of PrivacyValueDisallowBots. +const PrivacyValueDisallowBotsTypeID = 0xf6a5f82f + +// construct implements constructor of PrivacyRuleClass. +func (p PrivacyValueDisallowBots) construct() PrivacyRuleClass { return &p } + +// Ensuring interfaces in compile-time for PrivacyValueDisallowBots. +var ( + _ bin.Encoder = &PrivacyValueDisallowBots{} + _ bin.Decoder = &PrivacyValueDisallowBots{} + _ bin.BareEncoder = &PrivacyValueDisallowBots{} + _ bin.BareDecoder = &PrivacyValueDisallowBots{} + + _ PrivacyRuleClass = &PrivacyValueDisallowBots{} +) + +func (p *PrivacyValueDisallowBots) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *PrivacyValueDisallowBots) String() string { + if p == nil { + return "PrivacyValueDisallowBots(nil)" + } + type Alias PrivacyValueDisallowBots + return fmt.Sprintf("PrivacyValueDisallowBots%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PrivacyValueDisallowBots) TypeID() uint32 { + return PrivacyValueDisallowBotsTypeID +} + +// TypeName returns name of type in TL schema. +func (*PrivacyValueDisallowBots) TypeName() string { + return "privacyValueDisallowBots" +} + +// TypeInfo returns info about TL type. +func (p *PrivacyValueDisallowBots) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "privacyValueDisallowBots", + ID: PrivacyValueDisallowBotsTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *PrivacyValueDisallowBots) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode privacyValueDisallowBots#f6a5f82f as nil") + } + b.PutID(PrivacyValueDisallowBotsTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PrivacyValueDisallowBots) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode privacyValueDisallowBots#f6a5f82f as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PrivacyValueDisallowBots) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode privacyValueDisallowBots#f6a5f82f to nil") + } + if err := b.ConsumeID(PrivacyValueDisallowBotsTypeID); err != nil { + return fmt.Errorf("unable to decode privacyValueDisallowBots#f6a5f82f: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PrivacyValueDisallowBots) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode privacyValueDisallowBots#f6a5f82f to nil") + } + return nil +} + // PrivacyRuleClassName is schema name of PrivacyRuleClass. const PrivacyRuleClassName = "PrivacyRule" @@ -1267,6 +1469,8 @@ const PrivacyRuleClassName = "PrivacyRule" // case *tg.PrivacyValueDisallowChatParticipants: // privacyValueDisallowChatParticipants#41c87565 // case *tg.PrivacyValueAllowCloseFriends: // privacyValueAllowCloseFriends#f7e8d89b // case *tg.PrivacyValueAllowPremium: // privacyValueAllowPremium#ece9814b +// case *tg.PrivacyValueAllowBots: // privacyValueAllowBots#21461b5d +// case *tg.PrivacyValueDisallowBots: // privacyValueDisallowBots#f6a5f82f // default: panic(v) // } type PrivacyRuleClass interface { @@ -1381,6 +1585,20 @@ func DecodePrivacyRule(buf *bin.Buffer) (PrivacyRuleClass, error) { return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", err) } return &v, nil + case PrivacyValueAllowBotsTypeID: + // Decoding privacyValueAllowBots#21461b5d. + v := PrivacyValueAllowBots{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", err) + } + return &v, nil + case PrivacyValueDisallowBotsTypeID: + // Decoding privacyValueDisallowBots#f6a5f82f. + v := PrivacyValueDisallowBots{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index bcf2f93b84..85aaabf850 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 192 +const Layer = 193 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -195,7 +195,7 @@ func TypesMap() map[uint32]string { MessageActionPaymentRefundedTypeID: "messageActionPaymentRefunded#41b3e202", MessageActionGiftStarsTypeID: "messageActionGiftStars#45d5b021", MessageActionPrizeStarsTypeID: "messageActionPrizeStars#b00c47a2", - MessageActionStarGiftTypeID: "messageActionStarGift#9bb3ef44", + MessageActionStarGiftTypeID: "messageActionStarGift#8557637", DialogTypeID: "dialog#d58a08c6", DialogFolderTypeID: "dialogFolder#71bd134c", PhotoEmptyTypeID: "photoEmpty#2331b22d", @@ -411,6 +411,7 @@ func TypesMap() map[uint32]string { UpdateStarsRevenueStatusTypeID: "updateStarsRevenueStatus#a584b019", UpdateBotPurchasedPaidMediaTypeID: "updateBotPurchasedPaidMedia#283bd312", UpdatePaidReactionPrivacyTypeID: "updatePaidReactionPrivacy#51ca7aec", + UpdateBotSubscriptionExpireTypeID: "updateBotSubscriptionExpire#2d13c6ee", UpdatesStateTypeID: "updates.state#a56c2a3e", UpdatesDifferenceEmptyTypeID: "updates.differenceEmpty#5d75a138", UpdatesDifferenceTypeID: "updates.difference#f49ca0", @@ -492,6 +493,7 @@ func TypesMap() map[uint32]string { InputPrivacyKeyVoiceMessagesTypeID: "inputPrivacyKeyVoiceMessages#aee69d68", InputPrivacyKeyAboutTypeID: "inputPrivacyKeyAbout#3823cc40", InputPrivacyKeyBirthdayTypeID: "inputPrivacyKeyBirthday#d65a11cc", + InputPrivacyKeyStarGiftsAutoSaveTypeID: "inputPrivacyKeyStarGiftsAutoSave#e1732341", PrivacyKeyStatusTimestampTypeID: "privacyKeyStatusTimestamp#bc2eab30", PrivacyKeyChatInviteTypeID: "privacyKeyChatInvite#500e6dfa", PrivacyKeyPhoneCallTypeID: "privacyKeyPhoneCall#3d662b7b", @@ -503,6 +505,7 @@ func TypesMap() map[uint32]string { PrivacyKeyVoiceMessagesTypeID: "privacyKeyVoiceMessages#697f414", PrivacyKeyAboutTypeID: "privacyKeyAbout#a486b761", PrivacyKeyBirthdayTypeID: "privacyKeyBirthday#2000a518", + PrivacyKeyStarGiftsAutoSaveTypeID: "privacyKeyStarGiftsAutoSave#2ca4fdf8", InputPrivacyValueAllowContactsTypeID: "inputPrivacyValueAllowContacts#d09e07b", InputPrivacyValueAllowAllTypeID: "inputPrivacyValueAllowAll#184b35ce", InputPrivacyValueAllowUsersTypeID: "inputPrivacyValueAllowUsers#131cc67f", @@ -513,6 +516,8 @@ func TypesMap() map[uint32]string { InputPrivacyValueDisallowChatParticipantsTypeID: "inputPrivacyValueDisallowChatParticipants#e94f0f86", InputPrivacyValueAllowCloseFriendsTypeID: "inputPrivacyValueAllowCloseFriends#2f453e49", InputPrivacyValueAllowPremiumTypeID: "inputPrivacyValueAllowPremium#77cdc9f1", + InputPrivacyValueAllowBotsTypeID: "inputPrivacyValueAllowBots#5a4fcce5", + InputPrivacyValueDisallowBotsTypeID: "inputPrivacyValueDisallowBots#c4e57915", PrivacyValueAllowContactsTypeID: "privacyValueAllowContacts#fffe1bac", PrivacyValueAllowAllTypeID: "privacyValueAllowAll#65427b82", PrivacyValueAllowUsersTypeID: "privacyValueAllowUsers#b8905fb2", @@ -523,6 +528,8 @@ func TypesMap() map[uint32]string { PrivacyValueDisallowChatParticipantsTypeID: "privacyValueDisallowChatParticipants#41c87565", PrivacyValueAllowCloseFriendsTypeID: "privacyValueAllowCloseFriends#f7e8d89b", PrivacyValueAllowPremiumTypeID: "privacyValueAllowPremium#ece9814b", + PrivacyValueAllowBotsTypeID: "privacyValueAllowBots#21461b5d", + PrivacyValueDisallowBotsTypeID: "privacyValueDisallowBots#f6a5f82f", AccountPrivacyRulesTypeID: "account.privacyRules#50a04e45", AccountDaysTTLTypeID: "accountDaysTTL#b8d0afdf", DocumentAttributeImageSizeTypeID: "documentAttributeImageSize#6c37c15c", @@ -570,7 +577,7 @@ func TypesMap() map[uint32]string { MessagesStickerSetTypeID: "messages.stickerSet#6e153f16", MessagesStickerSetNotModifiedTypeID: "messages.stickerSetNotModified#d3f924eb", BotCommandTypeID: "botCommand#c27ac8c7", - BotInfoTypeID: "botInfo#82437e74", + BotInfoTypeID: "botInfo#36607333", KeyboardButtonTypeID: "keyboardButton#a2fa4880", KeyboardButtonURLTypeID: "keyboardButtonUrl#258aff05", KeyboardButtonCallbackTypeID: "keyboardButtonCallback#35bbdb6b", @@ -777,7 +784,7 @@ func TypesMap() map[uint32]string { PhoneCallDiscardReasonBusyTypeID: "phoneCallDiscardReasonBusy#faf7e8c9", DataJSONTypeID: "dataJSON#7d748d04", LabeledPriceTypeID: "labeledPrice#cb296bf8", - InvoiceTypeID: "invoice#5db95a15", + InvoiceTypeID: "invoice#49ee584", PaymentChargeTypeID: "paymentCharge#ea02c27e", PostAddressTypeID: "postAddress#1e8caaeb", PaymentRequestedInfoTypeID: "paymentRequestedInfo#909c3f94", @@ -1387,7 +1394,7 @@ func TypesMap() map[uint32]string { BotPreviewMediaTypeID: "botPreviewMedia#23e91ba3", BotsPreviewInfoTypeID: "bots.previewInfo#ca71d64", StarsSubscriptionPricingTypeID: "starsSubscriptionPricing#5416d58", - StarsSubscriptionTypeID: "starsSubscription#538ecf18", + StarsSubscriptionTypeID: "starsSubscription#2e6eab1a", MessageReactorTypeID: "messageReactor#4ba3a95a", StarsGiveawayOptionTypeID: "starsGiveawayOption#94ce852a", StarsGiveawayWinnersOptionTypeID: "starsGiveawayWinnersOption#54236209", @@ -1400,6 +1407,9 @@ func TypesMap() map[uint32]string { ReportResultChooseOptionTypeID: "reportResultChooseOption#f0e4e0b6", ReportResultAddCommentTypeID: "reportResultAddComment#6f09ac31", ReportResultReportedTypeID: "reportResultReported#8db33c4b", + MessagesBotPreparedInlineMessageTypeID: "messages.botPreparedInlineMessage#8ecf0511", + MessagesPreparedInlineMessageTypeID: "messages.preparedInlineMessage#ff57708d", + BotAppSettingsTypeID: "botAppSettings#c99b1950", InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d", InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0", InitConnectionRequestTypeID: "initConnection#c1cd5ea9", @@ -1796,6 +1806,8 @@ func TypesMap() map[uint32]string { MessagesClickSponsoredMessageRequestTypeID: "messages.clickSponsoredMessage#f093465", MessagesReportSponsoredMessageRequestTypeID: "messages.reportSponsoredMessage#1af3dbb8", MessagesGetSponsoredMessagesRequestTypeID: "messages.getSponsoredMessages#9bd2f439", + MessagesSavePreparedInlineMessageRequestTypeID: "messages.savePreparedInlineMessage#f21f7f2f", + MessagesGetPreparedInlineMessageRequestTypeID: "messages.getPreparedInlineMessage#857ebdb8", UpdatesGetStateRequestTypeID: "updates.getState#edd4882a", UpdatesGetDifferenceRequestTypeID: "updates.getDifference#19c2f763", UpdatesGetChannelDifferenceRequestTypeID: "updates.getChannelDifference#3173d78", @@ -1921,6 +1933,9 @@ func TypesMap() map[uint32]string { BotsReorderPreviewMediasRequestTypeID: "bots.reorderPreviewMedias#b627f3aa", BotsGetPreviewInfoRequestTypeID: "bots.getPreviewInfo#423ab3ad", BotsGetPreviewMediasRequestTypeID: "bots.getPreviewMedias#a2a5594d", + BotsUpdateUserEmojiStatusRequestTypeID: "bots.updateUserEmojiStatus#ed9f30c5", + BotsToggleUserEmojiStatusPermissionRequestTypeID: "bots.toggleUserEmojiStatusPermission#6de6392", + BotsCheckDownloadFileParamsRequestTypeID: "bots.checkDownloadFileParams#50077589", PaymentsGetPaymentFormRequestTypeID: "payments.getPaymentForm#37148dbb", PaymentsGetPaymentReceiptRequestTypeID: "payments.getPaymentReceipt#2478d1cc", PaymentsValidateRequestedInfoRequestTypeID: "payments.validateRequestedInfo#b6c8f12b", @@ -1955,6 +1970,7 @@ func TypesMap() map[uint32]string { PaymentsGetUserStarGiftsRequestTypeID: "payments.getUserStarGifts#5e72c7e1", PaymentsSaveStarGiftRequestTypeID: "payments.saveStarGift#87acf08e", PaymentsConvertStarGiftRequestTypeID: "payments.convertStarGift#421e027", + PaymentsBotCancelStarsSubscriptionRequestTypeID: "payments.botCancelStarsSubscription#57f9ece6", StickersCreateStickerSetRequestTypeID: "stickers.createStickerSet#9021ab67", StickersRemoveStickerFromSetRequestTypeID: "stickers.removeStickerFromSet#f7760f51", StickersChangeStickerPositionRequestTypeID: "stickers.changeStickerPosition#ffb6d4ca", @@ -2456,6 +2472,7 @@ func NamesMap() map[string]uint32 { "updateStarsRevenueStatus": UpdateStarsRevenueStatusTypeID, "updateBotPurchasedPaidMedia": UpdateBotPurchasedPaidMediaTypeID, "updatePaidReactionPrivacy": UpdatePaidReactionPrivacyTypeID, + "updateBotSubscriptionExpire": UpdateBotSubscriptionExpireTypeID, "updates.state": UpdatesStateTypeID, "updates.differenceEmpty": UpdatesDifferenceEmptyTypeID, "updates.difference": UpdatesDifferenceTypeID, @@ -2537,6 +2554,7 @@ func NamesMap() map[string]uint32 { "inputPrivacyKeyVoiceMessages": InputPrivacyKeyVoiceMessagesTypeID, "inputPrivacyKeyAbout": InputPrivacyKeyAboutTypeID, "inputPrivacyKeyBirthday": InputPrivacyKeyBirthdayTypeID, + "inputPrivacyKeyStarGiftsAutoSave": InputPrivacyKeyStarGiftsAutoSaveTypeID, "privacyKeyStatusTimestamp": PrivacyKeyStatusTimestampTypeID, "privacyKeyChatInvite": PrivacyKeyChatInviteTypeID, "privacyKeyPhoneCall": PrivacyKeyPhoneCallTypeID, @@ -2548,6 +2566,7 @@ func NamesMap() map[string]uint32 { "privacyKeyVoiceMessages": PrivacyKeyVoiceMessagesTypeID, "privacyKeyAbout": PrivacyKeyAboutTypeID, "privacyKeyBirthday": PrivacyKeyBirthdayTypeID, + "privacyKeyStarGiftsAutoSave": PrivacyKeyStarGiftsAutoSaveTypeID, "inputPrivacyValueAllowContacts": InputPrivacyValueAllowContactsTypeID, "inputPrivacyValueAllowAll": InputPrivacyValueAllowAllTypeID, "inputPrivacyValueAllowUsers": InputPrivacyValueAllowUsersTypeID, @@ -2558,6 +2577,8 @@ func NamesMap() map[string]uint32 { "inputPrivacyValueDisallowChatParticipants": InputPrivacyValueDisallowChatParticipantsTypeID, "inputPrivacyValueAllowCloseFriends": InputPrivacyValueAllowCloseFriendsTypeID, "inputPrivacyValueAllowPremium": InputPrivacyValueAllowPremiumTypeID, + "inputPrivacyValueAllowBots": InputPrivacyValueAllowBotsTypeID, + "inputPrivacyValueDisallowBots": InputPrivacyValueDisallowBotsTypeID, "privacyValueAllowContacts": PrivacyValueAllowContactsTypeID, "privacyValueAllowAll": PrivacyValueAllowAllTypeID, "privacyValueAllowUsers": PrivacyValueAllowUsersTypeID, @@ -2568,6 +2589,8 @@ func NamesMap() map[string]uint32 { "privacyValueDisallowChatParticipants": PrivacyValueDisallowChatParticipantsTypeID, "privacyValueAllowCloseFriends": PrivacyValueAllowCloseFriendsTypeID, "privacyValueAllowPremium": PrivacyValueAllowPremiumTypeID, + "privacyValueAllowBots": PrivacyValueAllowBotsTypeID, + "privacyValueDisallowBots": PrivacyValueDisallowBotsTypeID, "account.privacyRules": AccountPrivacyRulesTypeID, "accountDaysTTL": AccountDaysTTLTypeID, "documentAttributeImageSize": DocumentAttributeImageSizeTypeID, @@ -3445,6 +3468,9 @@ func NamesMap() map[string]uint32 { "reportResultChooseOption": ReportResultChooseOptionTypeID, "reportResultAddComment": ReportResultAddCommentTypeID, "reportResultReported": ReportResultReportedTypeID, + "messages.botPreparedInlineMessage": MessagesBotPreparedInlineMessageTypeID, + "messages.preparedInlineMessage": MessagesPreparedInlineMessageTypeID, + "botAppSettings": BotAppSettingsTypeID, "invokeAfterMsg": InvokeAfterMsgRequestTypeID, "invokeAfterMsgs": InvokeAfterMsgsRequestTypeID, "initConnection": InitConnectionRequestTypeID, @@ -3841,6 +3867,8 @@ func NamesMap() map[string]uint32 { "messages.clickSponsoredMessage": MessagesClickSponsoredMessageRequestTypeID, "messages.reportSponsoredMessage": MessagesReportSponsoredMessageRequestTypeID, "messages.getSponsoredMessages": MessagesGetSponsoredMessagesRequestTypeID, + "messages.savePreparedInlineMessage": MessagesSavePreparedInlineMessageRequestTypeID, + "messages.getPreparedInlineMessage": MessagesGetPreparedInlineMessageRequestTypeID, "updates.getState": UpdatesGetStateRequestTypeID, "updates.getDifference": UpdatesGetDifferenceRequestTypeID, "updates.getChannelDifference": UpdatesGetChannelDifferenceRequestTypeID, @@ -3966,6 +3994,9 @@ func NamesMap() map[string]uint32 { "bots.reorderPreviewMedias": BotsReorderPreviewMediasRequestTypeID, "bots.getPreviewInfo": BotsGetPreviewInfoRequestTypeID, "bots.getPreviewMedias": BotsGetPreviewMediasRequestTypeID, + "bots.updateUserEmojiStatus": BotsUpdateUserEmojiStatusRequestTypeID, + "bots.toggleUserEmojiStatusPermission": BotsToggleUserEmojiStatusPermissionRequestTypeID, + "bots.checkDownloadFileParams": BotsCheckDownloadFileParamsRequestTypeID, "payments.getPaymentForm": PaymentsGetPaymentFormRequestTypeID, "payments.getPaymentReceipt": PaymentsGetPaymentReceiptRequestTypeID, "payments.validateRequestedInfo": PaymentsValidateRequestedInfoRequestTypeID, @@ -4000,6 +4031,7 @@ func NamesMap() map[string]uint32 { "payments.getUserStarGifts": PaymentsGetUserStarGiftsRequestTypeID, "payments.saveStarGift": PaymentsSaveStarGiftRequestTypeID, "payments.convertStarGift": PaymentsConvertStarGiftRequestTypeID, + "payments.botCancelStarsSubscription": PaymentsBotCancelStarsSubscriptionRequestTypeID, "stickers.createStickerSet": StickersCreateStickerSetRequestTypeID, "stickers.removeStickerFromSet": StickersRemoveStickerFromSetRequestTypeID, "stickers.changeStickerPosition": StickersChangeStickerPositionRequestTypeID, @@ -4501,6 +4533,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateStarsRevenueStatusTypeID: func() bin.Object { return &UpdateStarsRevenueStatus{} }, UpdateBotPurchasedPaidMediaTypeID: func() bin.Object { return &UpdateBotPurchasedPaidMedia{} }, UpdatePaidReactionPrivacyTypeID: func() bin.Object { return &UpdatePaidReactionPrivacy{} }, + UpdateBotSubscriptionExpireTypeID: func() bin.Object { return &UpdateBotSubscriptionExpire{} }, UpdatesStateTypeID: func() bin.Object { return &UpdatesState{} }, UpdatesDifferenceEmptyTypeID: func() bin.Object { return &UpdatesDifferenceEmpty{} }, UpdatesDifferenceTypeID: func() bin.Object { return &UpdatesDifference{} }, @@ -4582,6 +4615,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputPrivacyKeyVoiceMessagesTypeID: func() bin.Object { return &InputPrivacyKeyVoiceMessages{} }, InputPrivacyKeyAboutTypeID: func() bin.Object { return &InputPrivacyKeyAbout{} }, InputPrivacyKeyBirthdayTypeID: func() bin.Object { return &InputPrivacyKeyBirthday{} }, + InputPrivacyKeyStarGiftsAutoSaveTypeID: func() bin.Object { return &InputPrivacyKeyStarGiftsAutoSave{} }, PrivacyKeyStatusTimestampTypeID: func() bin.Object { return &PrivacyKeyStatusTimestamp{} }, PrivacyKeyChatInviteTypeID: func() bin.Object { return &PrivacyKeyChatInvite{} }, PrivacyKeyPhoneCallTypeID: func() bin.Object { return &PrivacyKeyPhoneCall{} }, @@ -4593,6 +4627,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PrivacyKeyVoiceMessagesTypeID: func() bin.Object { return &PrivacyKeyVoiceMessages{} }, PrivacyKeyAboutTypeID: func() bin.Object { return &PrivacyKeyAbout{} }, PrivacyKeyBirthdayTypeID: func() bin.Object { return &PrivacyKeyBirthday{} }, + PrivacyKeyStarGiftsAutoSaveTypeID: func() bin.Object { return &PrivacyKeyStarGiftsAutoSave{} }, InputPrivacyValueAllowContactsTypeID: func() bin.Object { return &InputPrivacyValueAllowContacts{} }, InputPrivacyValueAllowAllTypeID: func() bin.Object { return &InputPrivacyValueAllowAll{} }, InputPrivacyValueAllowUsersTypeID: func() bin.Object { return &InputPrivacyValueAllowUsers{} }, @@ -4603,6 +4638,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputPrivacyValueDisallowChatParticipantsTypeID: func() bin.Object { return &InputPrivacyValueDisallowChatParticipants{} }, InputPrivacyValueAllowCloseFriendsTypeID: func() bin.Object { return &InputPrivacyValueAllowCloseFriends{} }, InputPrivacyValueAllowPremiumTypeID: func() bin.Object { return &InputPrivacyValueAllowPremium{} }, + InputPrivacyValueAllowBotsTypeID: func() bin.Object { return &InputPrivacyValueAllowBots{} }, + InputPrivacyValueDisallowBotsTypeID: func() bin.Object { return &InputPrivacyValueDisallowBots{} }, PrivacyValueAllowContactsTypeID: func() bin.Object { return &PrivacyValueAllowContacts{} }, PrivacyValueAllowAllTypeID: func() bin.Object { return &PrivacyValueAllowAll{} }, PrivacyValueAllowUsersTypeID: func() bin.Object { return &PrivacyValueAllowUsers{} }, @@ -4613,6 +4650,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PrivacyValueDisallowChatParticipantsTypeID: func() bin.Object { return &PrivacyValueDisallowChatParticipants{} }, PrivacyValueAllowCloseFriendsTypeID: func() bin.Object { return &PrivacyValueAllowCloseFriends{} }, PrivacyValueAllowPremiumTypeID: func() bin.Object { return &PrivacyValueAllowPremium{} }, + PrivacyValueAllowBotsTypeID: func() bin.Object { return &PrivacyValueAllowBots{} }, + PrivacyValueDisallowBotsTypeID: func() bin.Object { return &PrivacyValueDisallowBots{} }, AccountPrivacyRulesTypeID: func() bin.Object { return &AccountPrivacyRules{} }, AccountDaysTTLTypeID: func() bin.Object { return &AccountDaysTTL{} }, DocumentAttributeImageSizeTypeID: func() bin.Object { return &DocumentAttributeImageSize{} }, @@ -5490,6 +5529,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ReportResultChooseOptionTypeID: func() bin.Object { return &ReportResultChooseOption{} }, ReportResultAddCommentTypeID: func() bin.Object { return &ReportResultAddComment{} }, ReportResultReportedTypeID: func() bin.Object { return &ReportResultReported{} }, + MessagesBotPreparedInlineMessageTypeID: func() bin.Object { return &MessagesBotPreparedInlineMessage{} }, + MessagesPreparedInlineMessageTypeID: func() bin.Object { return &MessagesPreparedInlineMessage{} }, + BotAppSettingsTypeID: func() bin.Object { return &BotAppSettings{} }, InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} }, InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} }, InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} }, @@ -5886,6 +5928,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagesClickSponsoredMessageRequestTypeID: func() bin.Object { return &MessagesClickSponsoredMessageRequest{} }, MessagesReportSponsoredMessageRequestTypeID: func() bin.Object { return &MessagesReportSponsoredMessageRequest{} }, MessagesGetSponsoredMessagesRequestTypeID: func() bin.Object { return &MessagesGetSponsoredMessagesRequest{} }, + MessagesSavePreparedInlineMessageRequestTypeID: func() bin.Object { return &MessagesSavePreparedInlineMessageRequest{} }, + MessagesGetPreparedInlineMessageRequestTypeID: func() bin.Object { return &MessagesGetPreparedInlineMessageRequest{} }, UpdatesGetStateRequestTypeID: func() bin.Object { return &UpdatesGetStateRequest{} }, UpdatesGetDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetDifferenceRequest{} }, UpdatesGetChannelDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} }, @@ -6011,6 +6055,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { BotsReorderPreviewMediasRequestTypeID: func() bin.Object { return &BotsReorderPreviewMediasRequest{} }, BotsGetPreviewInfoRequestTypeID: func() bin.Object { return &BotsGetPreviewInfoRequest{} }, BotsGetPreviewMediasRequestTypeID: func() bin.Object { return &BotsGetPreviewMediasRequest{} }, + BotsUpdateUserEmojiStatusRequestTypeID: func() bin.Object { return &BotsUpdateUserEmojiStatusRequest{} }, + BotsToggleUserEmojiStatusPermissionRequestTypeID: func() bin.Object { return &BotsToggleUserEmojiStatusPermissionRequest{} }, + BotsCheckDownloadFileParamsRequestTypeID: func() bin.Object { return &BotsCheckDownloadFileParamsRequest{} }, PaymentsGetPaymentFormRequestTypeID: func() bin.Object { return &PaymentsGetPaymentFormRequest{} }, PaymentsGetPaymentReceiptRequestTypeID: func() bin.Object { return &PaymentsGetPaymentReceiptRequest{} }, PaymentsValidateRequestedInfoRequestTypeID: func() bin.Object { return &PaymentsValidateRequestedInfoRequest{} }, @@ -6045,6 +6092,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PaymentsGetUserStarGiftsRequestTypeID: func() bin.Object { return &PaymentsGetUserStarGiftsRequest{} }, PaymentsSaveStarGiftRequestTypeID: func() bin.Object { return &PaymentsSaveStarGiftRequest{} }, PaymentsConvertStarGiftRequestTypeID: func() bin.Object { return &PaymentsConvertStarGiftRequest{} }, + PaymentsBotCancelStarsSubscriptionRequestTypeID: func() bin.Object { return &PaymentsBotCancelStarsSubscriptionRequest{} }, StickersCreateStickerSetRequestTypeID: func() bin.Object { return &StickersCreateStickerSetRequest{} }, StickersRemoveStickerFromSetRequestTypeID: func() bin.Object { return &StickersRemoveStickerFromSetRequest{} }, StickersChangeStickerPositionRequestTypeID: func() bin.Object { return &StickersChangeStickerPositionRequest{} }, @@ -6736,6 +6784,7 @@ func ClassConstructorsMap() map[string][]uint32 { InputPrivacyKeyVoiceMessagesTypeID, InputPrivacyKeyAboutTypeID, InputPrivacyKeyBirthdayTypeID, + InputPrivacyKeyStarGiftsAutoSaveTypeID, }, InputPrivacyRuleClassName: { InputPrivacyValueAllowContactsTypeID, @@ -6748,6 +6797,8 @@ func ClassConstructorsMap() map[string][]uint32 { InputPrivacyValueDisallowChatParticipantsTypeID, InputPrivacyValueAllowCloseFriendsTypeID, InputPrivacyValueAllowPremiumTypeID, + InputPrivacyValueAllowBotsTypeID, + InputPrivacyValueDisallowBotsTypeID, }, InputQuickReplyShortcutClassName: { InputQuickReplyShortcutTypeID, @@ -7214,6 +7265,7 @@ func ClassConstructorsMap() map[string][]uint32 { PrivacyKeyVoiceMessagesTypeID, PrivacyKeyAboutTypeID, PrivacyKeyBirthdayTypeID, + PrivacyKeyStarGiftsAutoSaveTypeID, }, PrivacyRuleClassName: { PrivacyValueAllowContactsTypeID, @@ -7226,6 +7278,8 @@ func ClassConstructorsMap() map[string][]uint32 { PrivacyValueDisallowChatParticipantsTypeID, PrivacyValueAllowCloseFriendsTypeID, PrivacyValueAllowPremiumTypeID, + PrivacyValueAllowBotsTypeID, + PrivacyValueDisallowBotsTypeID, }, PublicForwardClassName: { PublicForwardMessageTypeID, @@ -7572,6 +7626,7 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateStarsRevenueStatusTypeID, UpdateBotPurchasedPaidMediaTypeID, UpdatePaidReactionPrivacyTypeID, + UpdateBotSubscriptionExpireTypeID, }, UpdatesChannelDifferenceClassName: { UpdatesChannelDifferenceEmptyTypeID, diff --git a/tg/tl_server_gen.go b/tg/tl_server_gen.go index d509e75777..72d3ad0c16 100644 --- a/tg/tl_server_gen.go +++ b/tg/tl_server_gen.go @@ -7119,6 +7119,40 @@ func (s *ServerDispatcher) OnMessagesGetSponsoredMessages(f func(ctx context.Con s.handlers[MessagesGetSponsoredMessagesRequestTypeID] = handler } +func (s *ServerDispatcher) OnMessagesSavePreparedInlineMessage(f func(ctx context.Context, request *MessagesSavePreparedInlineMessageRequest) (*MessagesBotPreparedInlineMessage, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesSavePreparedInlineMessageRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[MessagesSavePreparedInlineMessageRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesGetPreparedInlineMessage(f func(ctx context.Context, request *MessagesGetPreparedInlineMessageRequest) (*MessagesPreparedInlineMessage, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesGetPreparedInlineMessageRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[MessagesGetPreparedInlineMessageRequestTypeID] = handler +} + func (s *ServerDispatcher) OnUpdatesGetState(f func(ctx context.Context) (*UpdatesState, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request UpdatesGetStateRequest @@ -9372,6 +9406,69 @@ func (s *ServerDispatcher) OnBotsGetPreviewMedias(f func(ctx context.Context, bo s.handlers[BotsGetPreviewMediasRequestTypeID] = handler } +func (s *ServerDispatcher) OnBotsUpdateUserEmojiStatus(f func(ctx context.Context, request *BotsUpdateUserEmojiStatusRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsUpdateUserEmojiStatusRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[BotsUpdateUserEmojiStatusRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnBotsToggleUserEmojiStatusPermission(f func(ctx context.Context, request *BotsToggleUserEmojiStatusPermissionRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsToggleUserEmojiStatusPermissionRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[BotsToggleUserEmojiStatusPermissionRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnBotsCheckDownloadFileParams(f func(ctx context.Context, request *BotsCheckDownloadFileParamsRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request BotsCheckDownloadFileParamsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[BotsCheckDownloadFileParamsRequestTypeID] = handler +} + func (s *ServerDispatcher) OnPaymentsGetPaymentForm(f func(ctx context.Context, request *PaymentsGetPaymentFormRequest) (PaymentsPaymentFormClass, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request PaymentsGetPaymentFormRequest @@ -9974,6 +10071,27 @@ func (s *ServerDispatcher) OnPaymentsConvertStarGift(f func(ctx context.Context, s.handlers[PaymentsConvertStarGiftRequestTypeID] = handler } +func (s *ServerDispatcher) OnPaymentsBotCancelStarsSubscription(f func(ctx context.Context, request *PaymentsBotCancelStarsSubscriptionRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsBotCancelStarsSubscriptionRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[PaymentsBotCancelStarsSubscriptionRequestTypeID] = handler +} + func (s *ServerDispatcher) OnStickersCreateStickerSet(f func(ctx context.Context, request *StickersCreateStickerSetRequest) (MessagesStickerSetClass, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request StickersCreateStickerSetRequest diff --git a/tg/tl_star_gift_gen.go b/tg/tl_star_gift_gen.go index db06266ce0..514c9406aa 100644 --- a/tg/tl_star_gift_gen.go +++ b/tg/tl_star_gift_gen.go @@ -41,6 +41,8 @@ type StarGift struct { Limited bool // SoldOut field of StarGift. SoldOut bool + // Birthday field of StarGift. + Birthday bool // ID field of StarGift. ID int64 // Sticker field of StarGift. @@ -91,6 +93,9 @@ func (s *StarGift) Zero() bool { if !(s.SoldOut == false) { return false } + if !(s.Birthday == false) { + return false + } if !(s.ID == 0) { return false } @@ -132,6 +137,7 @@ func (s *StarGift) String() string { func (s *StarGift) FillFrom(from interface { GetLimited() (value bool) GetSoldOut() (value bool) + GetBirthday() (value bool) GetID() (value int64) GetSticker() (value DocumentClass) GetStars() (value int64) @@ -143,6 +149,7 @@ func (s *StarGift) FillFrom(from interface { }) { s.Limited = from.GetLimited() s.SoldOut = from.GetSoldOut() + s.Birthday = from.GetBirthday() s.ID = from.GetID() s.Sticker = from.GetSticker() s.Stars = from.GetStars() @@ -198,6 +205,11 @@ func (s *StarGift) TypeInfo() tdp.Type { SchemaName: "sold_out", Null: !s.Flags.Has(1), }, + { + Name: "Birthday", + SchemaName: "birthday", + Null: !s.Flags.Has(2), + }, { Name: "ID", SchemaName: "id", @@ -246,6 +258,9 @@ func (s *StarGift) SetFlags() { if !(s.SoldOut == false) { s.Flags.Set(1) } + if !(s.Birthday == false) { + s.Flags.Set(2) + } if !(s.AvailabilityRemains == 0) { s.Flags.Set(0) } @@ -325,6 +340,7 @@ func (s *StarGift) DecodeBare(b *bin.Buffer) error { } s.Limited = s.Flags.Has(0) s.SoldOut = s.Flags.Has(1) + s.Birthday = s.Flags.Has(2) { value, err := b.Long() if err != nil { @@ -422,6 +438,25 @@ func (s *StarGift) GetSoldOut() (value bool) { return s.Flags.Has(1) } +// SetBirthday sets value of Birthday conditional field. +func (s *StarGift) SetBirthday(value bool) { + if value { + s.Flags.Set(2) + s.Birthday = true + } else { + s.Flags.Unset(2) + s.Birthday = false + } +} + +// GetBirthday returns value of Birthday conditional field. +func (s *StarGift) GetBirthday() (value bool) { + if s == nil { + return + } + return s.Flags.Has(2) +} + // GetID returns value of ID field. func (s *StarGift) GetID() (value int64) { if s == nil { diff --git a/tg/tl_stars_subscription_gen.go b/tg/tl_stars_subscription_gen.go index 9add3acbb3..9c968b64d7 100644 --- a/tg/tl_stars_subscription_gen.go +++ b/tg/tl_stars_subscription_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StarsSubscription represents TL type `starsSubscription#538ecf18`. +// StarsSubscription represents TL type `starsSubscription#2e6eab1a`. // // See https://core.telegram.org/constructor/starsSubscription for reference. type StarsSubscription struct { @@ -43,6 +43,8 @@ type StarsSubscription struct { CanRefulfill bool // MissingBalance field of StarsSubscription. MissingBalance bool + // BotCanceled field of StarsSubscription. + BotCanceled bool // ID field of StarsSubscription. ID string // Peer field of StarsSubscription. @@ -55,10 +57,22 @@ type StarsSubscription struct { // // Use SetChatInviteHash and GetChatInviteHash helpers. ChatInviteHash string + // Title field of StarsSubscription. + // + // Use SetTitle and GetTitle helpers. + Title string + // Photo field of StarsSubscription. + // + // Use SetPhoto and GetPhoto helpers. + Photo WebDocumentClass + // InvoiceSlug field of StarsSubscription. + // + // Use SetInvoiceSlug and GetInvoiceSlug helpers. + InvoiceSlug string } // StarsSubscriptionTypeID is TL type id of StarsSubscription. -const StarsSubscriptionTypeID = 0x538ecf18 +const StarsSubscriptionTypeID = 0x2e6eab1a // Ensuring interfaces in compile-time for StarsSubscription. var ( @@ -84,6 +98,9 @@ func (s *StarsSubscription) Zero() bool { if !(s.MissingBalance == false) { return false } + if !(s.BotCanceled == false) { + return false + } if !(s.ID == "") { return false } @@ -99,6 +116,15 @@ func (s *StarsSubscription) Zero() bool { if !(s.ChatInviteHash == "") { return false } + if !(s.Title == "") { + return false + } + if !(s.Photo == nil) { + return false + } + if !(s.InvoiceSlug == "") { + return false + } return true } @@ -117,15 +143,20 @@ func (s *StarsSubscription) FillFrom(from interface { GetCanceled() (value bool) GetCanRefulfill() (value bool) GetMissingBalance() (value bool) + GetBotCanceled() (value bool) GetID() (value string) GetPeer() (value PeerClass) GetUntilDate() (value int) GetPricing() (value StarsSubscriptionPricing) GetChatInviteHash() (value string, ok bool) + GetTitle() (value string, ok bool) + GetPhoto() (value WebDocumentClass, ok bool) + GetInvoiceSlug() (value string, ok bool) }) { s.Canceled = from.GetCanceled() s.CanRefulfill = from.GetCanRefulfill() s.MissingBalance = from.GetMissingBalance() + s.BotCanceled = from.GetBotCanceled() s.ID = from.GetID() s.Peer = from.GetPeer() s.UntilDate = from.GetUntilDate() @@ -134,6 +165,18 @@ func (s *StarsSubscription) FillFrom(from interface { s.ChatInviteHash = val } + if val, ok := from.GetTitle(); ok { + s.Title = val + } + + if val, ok := from.GetPhoto(); ok { + s.Photo = val + } + + if val, ok := from.GetInvoiceSlug(); ok { + s.InvoiceSlug = val + } + } // TypeID returns type id in TL schema. @@ -174,6 +217,11 @@ func (s *StarsSubscription) TypeInfo() tdp.Type { SchemaName: "missing_balance", Null: !s.Flags.Has(2), }, + { + Name: "BotCanceled", + SchemaName: "bot_canceled", + Null: !s.Flags.Has(7), + }, { Name: "ID", SchemaName: "id", @@ -195,6 +243,21 @@ func (s *StarsSubscription) TypeInfo() tdp.Type { SchemaName: "chat_invite_hash", Null: !s.Flags.Has(3), }, + { + Name: "Title", + SchemaName: "title", + Null: !s.Flags.Has(4), + }, + { + Name: "Photo", + SchemaName: "photo", + Null: !s.Flags.Has(5), + }, + { + Name: "InvoiceSlug", + SchemaName: "invoice_slug", + Null: !s.Flags.Has(6), + }, } return typ } @@ -210,15 +273,27 @@ func (s *StarsSubscription) SetFlags() { if !(s.MissingBalance == false) { s.Flags.Set(2) } + if !(s.BotCanceled == false) { + s.Flags.Set(7) + } if !(s.ChatInviteHash == "") { s.Flags.Set(3) } + if !(s.Title == "") { + s.Flags.Set(4) + } + if !(s.Photo == nil) { + s.Flags.Set(5) + } + if !(s.InvoiceSlug == "") { + s.Flags.Set(6) + } } // Encode implements bin.Encoder. func (s *StarsSubscription) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starsSubscription#538ecf18 as nil") + return fmt.Errorf("can't encode starsSubscription#2e6eab1a as nil") } b.PutID(StarsSubscriptionTypeID) return s.EncodeBare(b) @@ -227,36 +302,50 @@ func (s *StarsSubscription) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarsSubscription) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starsSubscription#538ecf18 as nil") + return fmt.Errorf("can't encode starsSubscription#2e6eab1a as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsSubscription#538ecf18: field flags: %w", err) + return fmt.Errorf("unable to encode starsSubscription#2e6eab1a: field flags: %w", err) } b.PutString(s.ID) if s.Peer == nil { - return fmt.Errorf("unable to encode starsSubscription#538ecf18: field peer is nil") + return fmt.Errorf("unable to encode starsSubscription#2e6eab1a: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsSubscription#538ecf18: field peer: %w", err) + return fmt.Errorf("unable to encode starsSubscription#2e6eab1a: field peer: %w", err) } b.PutInt(s.UntilDate) if err := s.Pricing.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsSubscription#538ecf18: field pricing: %w", err) + return fmt.Errorf("unable to encode starsSubscription#2e6eab1a: field pricing: %w", err) } if s.Flags.Has(3) { b.PutString(s.ChatInviteHash) } + if s.Flags.Has(4) { + b.PutString(s.Title) + } + if s.Flags.Has(5) { + if s.Photo == nil { + return fmt.Errorf("unable to encode starsSubscription#2e6eab1a: field photo is nil") + } + if err := s.Photo.Encode(b); err != nil { + return fmt.Errorf("unable to encode starsSubscription#2e6eab1a: field photo: %w", err) + } + } + if s.Flags.Has(6) { + b.PutString(s.InvoiceSlug) + } return nil } // Decode implements bin.Decoder. func (s *StarsSubscription) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starsSubscription#538ecf18 to nil") + return fmt.Errorf("can't decode starsSubscription#2e6eab1a to nil") } if err := b.ConsumeID(StarsSubscriptionTypeID); err != nil { - return fmt.Errorf("unable to decode starsSubscription#538ecf18: %w", err) + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: %w", err) } return s.DecodeBare(b) } @@ -264,49 +353,71 @@ func (s *StarsSubscription) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarsSubscription) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starsSubscription#538ecf18 to nil") + return fmt.Errorf("can't decode starsSubscription#2e6eab1a to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode starsSubscription#538ecf18: field flags: %w", err) + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: field flags: %w", err) } } s.Canceled = s.Flags.Has(0) s.CanRefulfill = s.Flags.Has(1) s.MissingBalance = s.Flags.Has(2) + s.BotCanceled = s.Flags.Has(7) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starsSubscription#538ecf18: field id: %w", err) + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: field id: %w", err) } s.ID = value } { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode starsSubscription#538ecf18: field peer: %w", err) + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: field peer: %w", err) } s.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starsSubscription#538ecf18: field until_date: %w", err) + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: field until_date: %w", err) } s.UntilDate = value } { if err := s.Pricing.Decode(b); err != nil { - return fmt.Errorf("unable to decode starsSubscription#538ecf18: field pricing: %w", err) + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: field pricing: %w", err) } } if s.Flags.Has(3) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starsSubscription#538ecf18: field chat_invite_hash: %w", err) + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: field chat_invite_hash: %w", err) } s.ChatInviteHash = value } + if s.Flags.Has(4) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: field title: %w", err) + } + s.Title = value + } + if s.Flags.Has(5) { + value, err := DecodeWebDocument(b) + if err != nil { + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: field photo: %w", err) + } + s.Photo = value + } + if s.Flags.Has(6) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starsSubscription#2e6eab1a: field invoice_slug: %w", err) + } + s.InvoiceSlug = value + } return nil } @@ -367,6 +478,25 @@ func (s *StarsSubscription) GetMissingBalance() (value bool) { return s.Flags.Has(2) } +// SetBotCanceled sets value of BotCanceled conditional field. +func (s *StarsSubscription) SetBotCanceled(value bool) { + if value { + s.Flags.Set(7) + s.BotCanceled = true + } else { + s.Flags.Unset(7) + s.BotCanceled = false + } +} + +// GetBotCanceled returns value of BotCanceled conditional field. +func (s *StarsSubscription) GetBotCanceled() (value bool) { + if s == nil { + return + } + return s.Flags.Has(7) +} + // GetID returns value of ID field. func (s *StarsSubscription) GetID() (value string) { if s == nil { @@ -416,3 +546,57 @@ func (s *StarsSubscription) GetChatInviteHash() (value string, ok bool) { } return s.ChatInviteHash, true } + +// SetTitle sets value of Title conditional field. +func (s *StarsSubscription) SetTitle(value string) { + s.Flags.Set(4) + s.Title = value +} + +// GetTitle returns value of Title conditional field and +// boolean which is true if field was set. +func (s *StarsSubscription) GetTitle() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(4) { + return value, false + } + return s.Title, true +} + +// SetPhoto sets value of Photo conditional field. +func (s *StarsSubscription) SetPhoto(value WebDocumentClass) { + s.Flags.Set(5) + s.Photo = value +} + +// GetPhoto returns value of Photo conditional field and +// boolean which is true if field was set. +func (s *StarsSubscription) GetPhoto() (value WebDocumentClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(5) { + return value, false + } + return s.Photo, true +} + +// SetInvoiceSlug sets value of InvoiceSlug conditional field. +func (s *StarsSubscription) SetInvoiceSlug(value string) { + s.Flags.Set(6) + s.InvoiceSlug = value +} + +// GetInvoiceSlug returns value of InvoiceSlug conditional field and +// boolean which is true if field was set. +func (s *StarsSubscription) GetInvoiceSlug() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(6) { + return value, false + } + return s.InvoiceSlug, true +} diff --git a/tg/tl_update_gen.go b/tg/tl_update_gen.go index 61a3015adf..c01d0ac0cd 100644 --- a/tg/tl_update_gen.go +++ b/tg/tl_update_gen.go @@ -28546,6 +28546,248 @@ func (u *UpdatePaidReactionPrivacy) GetPrivate() (value bool) { return u.Private } +// UpdateBotSubscriptionExpire represents TL type `updateBotSubscriptionExpire#2d13c6ee`. +// +// See https://core.telegram.org/constructor/updateBotSubscriptionExpire for reference. +type UpdateBotSubscriptionExpire struct { + // UserID field of UpdateBotSubscriptionExpire. + UserID int64 + // Payload field of UpdateBotSubscriptionExpire. + Payload string + // InvoiceSlug field of UpdateBotSubscriptionExpire. + InvoiceSlug string + // UntilDate field of UpdateBotSubscriptionExpire. + UntilDate int + // Qts field of UpdateBotSubscriptionExpire. + Qts int +} + +// UpdateBotSubscriptionExpireTypeID is TL type id of UpdateBotSubscriptionExpire. +const UpdateBotSubscriptionExpireTypeID = 0x2d13c6ee + +// construct implements constructor of UpdateClass. +func (u UpdateBotSubscriptionExpire) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateBotSubscriptionExpire. +var ( + _ bin.Encoder = &UpdateBotSubscriptionExpire{} + _ bin.Decoder = &UpdateBotSubscriptionExpire{} + _ bin.BareEncoder = &UpdateBotSubscriptionExpire{} + _ bin.BareDecoder = &UpdateBotSubscriptionExpire{} + + _ UpdateClass = &UpdateBotSubscriptionExpire{} +) + +func (u *UpdateBotSubscriptionExpire) Zero() bool { + if u == nil { + return true + } + if !(u.UserID == 0) { + return false + } + if !(u.Payload == "") { + return false + } + if !(u.InvoiceSlug == "") { + return false + } + if !(u.UntilDate == 0) { + return false + } + if !(u.Qts == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateBotSubscriptionExpire) String() string { + if u == nil { + return "UpdateBotSubscriptionExpire(nil)" + } + type Alias UpdateBotSubscriptionExpire + return fmt.Sprintf("UpdateBotSubscriptionExpire%+v", Alias(*u)) +} + +// FillFrom fills UpdateBotSubscriptionExpire from given interface. +func (u *UpdateBotSubscriptionExpire) FillFrom(from interface { + GetUserID() (value int64) + GetPayload() (value string) + GetInvoiceSlug() (value string) + GetUntilDate() (value int) + GetQts() (value int) +}) { + u.UserID = from.GetUserID() + u.Payload = from.GetPayload() + u.InvoiceSlug = from.GetInvoiceSlug() + u.UntilDate = from.GetUntilDate() + u.Qts = from.GetQts() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateBotSubscriptionExpire) TypeID() uint32 { + return UpdateBotSubscriptionExpireTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateBotSubscriptionExpire) TypeName() string { + return "updateBotSubscriptionExpire" +} + +// TypeInfo returns info about TL type. +func (u *UpdateBotSubscriptionExpire) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateBotSubscriptionExpire", + ID: UpdateBotSubscriptionExpireTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Payload", + SchemaName: "payload", + }, + { + Name: "InvoiceSlug", + SchemaName: "invoice_slug", + }, + { + Name: "UntilDate", + SchemaName: "until_date", + }, + { + Name: "Qts", + SchemaName: "qts", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateBotSubscriptionExpire) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotSubscriptionExpire#2d13c6ee as nil") + } + b.PutID(UpdateBotSubscriptionExpireTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateBotSubscriptionExpire) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotSubscriptionExpire#2d13c6ee as nil") + } + b.PutLong(u.UserID) + b.PutString(u.Payload) + b.PutString(u.InvoiceSlug) + b.PutInt(u.UntilDate) + b.PutInt(u.Qts) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateBotSubscriptionExpire) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotSubscriptionExpire#2d13c6ee to nil") + } + if err := b.ConsumeID(UpdateBotSubscriptionExpireTypeID); err != nil { + return fmt.Errorf("unable to decode updateBotSubscriptionExpire#2d13c6ee: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateBotSubscriptionExpire) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotSubscriptionExpire#2d13c6ee to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode updateBotSubscriptionExpire#2d13c6ee: field user_id: %w", err) + } + u.UserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateBotSubscriptionExpire#2d13c6ee: field payload: %w", err) + } + u.Payload = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateBotSubscriptionExpire#2d13c6ee: field invoice_slug: %w", err) + } + u.InvoiceSlug = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotSubscriptionExpire#2d13c6ee: field until_date: %w", err) + } + u.UntilDate = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotSubscriptionExpire#2d13c6ee: field qts: %w", err) + } + u.Qts = value + } + return nil +} + +// GetUserID returns value of UserID field. +func (u *UpdateBotSubscriptionExpire) GetUserID() (value int64) { + if u == nil { + return + } + return u.UserID +} + +// GetPayload returns value of Payload field. +func (u *UpdateBotSubscriptionExpire) GetPayload() (value string) { + if u == nil { + return + } + return u.Payload +} + +// GetInvoiceSlug returns value of InvoiceSlug field. +func (u *UpdateBotSubscriptionExpire) GetInvoiceSlug() (value string) { + if u == nil { + return + } + return u.InvoiceSlug +} + +// GetUntilDate returns value of UntilDate field. +func (u *UpdateBotSubscriptionExpire) GetUntilDate() (value int) { + if u == nil { + return + } + return u.UntilDate +} + +// GetQts returns value of Qts field. +func (u *UpdateBotSubscriptionExpire) GetQts() (value int) { + if u == nil { + return + } + return u.Qts +} + // UpdateClassName is schema name of UpdateClass. const UpdateClassName = "Update" @@ -28701,6 +28943,7 @@ const UpdateClassName = "Update" // case *tg.UpdateStarsRevenueStatus: // updateStarsRevenueStatus#a584b019 // case *tg.UpdateBotPurchasedPaidMedia: // updateBotPurchasedPaidMedia#283bd312 // case *tg.UpdatePaidReactionPrivacy: // updatePaidReactionPrivacy#51ca7aec +// case *tg.UpdateBotSubscriptionExpire: // updateBotSubscriptionExpire#2d13c6ee // default: panic(v) // } type UpdateClass interface { @@ -29716,6 +29959,13 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateBotSubscriptionExpireTypeID: + // Decoding updateBotSubscriptionExpire#2d13c6ee. + v := UpdateBotSubscriptionExpire{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode UpdateClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_update_slices_gen.go b/tg/tl_update_slices_gen.go index 2586f5041e..9b4e738fc3 100644 --- a/tg/tl_update_slices_gen.go +++ b/tg/tl_update_slices_gen.go @@ -1741,6 +1741,19 @@ func (s UpdateClassArray) AsUpdatePaidReactionPrivacy() (to UpdatePaidReactionPr return to } +// AsUpdateBotSubscriptionExpire returns copy with only UpdateBotSubscriptionExpire constructors. +func (s UpdateClassArray) AsUpdateBotSubscriptionExpire() (to UpdateBotSubscriptionExpireArray) { + for _, elem := range s { + value, ok := elem.(*UpdateBotSubscriptionExpire) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // UpdateNewMessageArray is adapter for slice of UpdateNewMessage. type UpdateNewMessageArray []UpdateNewMessage @@ -12256,3 +12269,85 @@ func (s *UpdatePaidReactionPrivacyArray) Pop() (v UpdatePaidReactionPrivacy, ok return v, true } + +// UpdateBotSubscriptionExpireArray is adapter for slice of UpdateBotSubscriptionExpire. +type UpdateBotSubscriptionExpireArray []UpdateBotSubscriptionExpire + +// Sort sorts slice of UpdateBotSubscriptionExpire. +func (s UpdateBotSubscriptionExpireArray) Sort(less func(a, b UpdateBotSubscriptionExpire) bool) UpdateBotSubscriptionExpireArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateBotSubscriptionExpire. +func (s UpdateBotSubscriptionExpireArray) SortStable(less func(a, b UpdateBotSubscriptionExpire) bool) UpdateBotSubscriptionExpireArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateBotSubscriptionExpire. +func (s UpdateBotSubscriptionExpireArray) Retain(keep func(x UpdateBotSubscriptionExpire) bool) UpdateBotSubscriptionExpireArray { + n := 0 + for _, x := range s { + if keep(x) { + s[n] = x + n++ + } + } + s = s[:n] + + return s +} + +// First returns first element of slice (if exists). +func (s UpdateBotSubscriptionExpireArray) First() (v UpdateBotSubscriptionExpire, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateBotSubscriptionExpireArray) Last() (v UpdateBotSubscriptionExpire, ok bool) { + if len(s) < 1 { + return + } + return s[len(s)-1], true +} + +// PopFirst returns first element of slice (if exists) and deletes it. +func (s *UpdateBotSubscriptionExpireArray) PopFirst() (v UpdateBotSubscriptionExpire, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[0] + + // Delete by index from SliceTricks. + copy(a[0:], a[1:]) + var zero UpdateBotSubscriptionExpire + a[len(a)-1] = zero + a = a[:len(a)-1] + *s = a + + return v, true +} + +// Pop returns last element of slice (if exists) and deletes it. +func (s *UpdateBotSubscriptionExpireArray) Pop() (v UpdateBotSubscriptionExpire, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_updates_classifier_gen.go b/tg/tl_updates_classifier_gen.go index 7d887f6675..b2aac6294a 100644 --- a/tg/tl_updates_classifier_gen.go +++ b/tg/tl_updates_classifier_gen.go @@ -86,6 +86,8 @@ func IsQtsUpdate(u UpdateClass) (qts int, ok bool) { return u.Qts, true case *UpdateBotPurchasedPaidMedia: return u.Qts, true + case *UpdateBotSubscriptionExpire: + return u.Qts, true } return diff --git a/tg/tl_user_full_gen.go b/tg/tl_user_full_gen.go index edf5527528..dede340365 100644 --- a/tg/tl_user_full_gen.go +++ b/tg/tl_user_full_gen.go @@ -121,6 +121,8 @@ type UserFull struct { SponsoredEnabled bool // CanViewRevenue field of UserFull. CanViewRevenue bool + // BotCanManageEmojiStatus field of UserFull. + BotCanManageEmojiStatus bool // User ID ID int64 // Bio of the user @@ -344,6 +346,9 @@ func (u *UserFull) Zero() bool { if !(u.CanViewRevenue == false) { return false } + if !(u.BotCanManageEmojiStatus == false) { + return false + } if !(u.ID == 0) { return false } @@ -458,6 +463,7 @@ func (u *UserFull) FillFrom(from interface { GetReadDatesPrivate() (value bool) GetSponsoredEnabled() (value bool) GetCanViewRevenue() (value bool) + GetBotCanManageEmojiStatus() (value bool) GetID() (value int64) GetAbout() (value string, ok bool) GetSettings() (value PeerSettings) @@ -502,6 +508,7 @@ func (u *UserFull) FillFrom(from interface { u.ReadDatesPrivate = from.GetReadDatesPrivate() u.SponsoredEnabled = from.GetSponsoredEnabled() u.CanViewRevenue = from.GetCanViewRevenue() + u.BotCanManageEmojiStatus = from.GetBotCanManageEmojiStatus() u.ID = from.GetID() if val, ok := from.GetAbout(); ok { u.About = val @@ -702,6 +709,11 @@ func (u *UserFull) TypeInfo() tdp.Type { SchemaName: "can_view_revenue", Null: !u.Flags2.Has(9), }, + { + Name: "BotCanManageEmojiStatus", + SchemaName: "bot_can_manage_emoji_status", + Null: !u.Flags2.Has(10), + }, { Name: "ID", SchemaName: "id", @@ -889,6 +901,9 @@ func (u *UserFull) SetFlags() { if !(u.CanViewRevenue == false) { u.Flags2.Set(9) } + if !(u.BotCanManageEmojiStatus == false) { + u.Flags2.Set(10) + } if !(u.About == "") { u.Flags.Set(1) } @@ -1153,6 +1168,7 @@ func (u *UserFull) DecodeBare(b *bin.Buffer) error { } u.SponsoredEnabled = u.Flags2.Has(7) u.CanViewRevenue = u.Flags2.Has(9) + u.BotCanManageEmojiStatus = u.Flags2.Has(10) { value, err := b.Long() if err != nil { @@ -1623,6 +1639,25 @@ func (u *UserFull) GetCanViewRevenue() (value bool) { return u.Flags2.Has(9) } +// SetBotCanManageEmojiStatus sets value of BotCanManageEmojiStatus conditional field. +func (u *UserFull) SetBotCanManageEmojiStatus(value bool) { + if value { + u.Flags2.Set(10) + u.BotCanManageEmojiStatus = true + } else { + u.Flags2.Unset(10) + u.BotCanManageEmojiStatus = false + } +} + +// GetBotCanManageEmojiStatus returns value of BotCanManageEmojiStatus conditional field. +func (u *UserFull) GetBotCanManageEmojiStatus() (value bool) { + if u == nil { + return + } + return u.Flags2.Has(10) +} + // GetID returns value of ID field. func (u *UserFull) GetID() (value int64) { if u == nil { diff --git a/tg/tl_web_view_result_url_gen.go b/tg/tl_web_view_result_url_gen.go index bc11ea9684..8d04f8db01 100644 --- a/tg/tl_web_view_result_url_gen.go +++ b/tg/tl_web_view_result_url_gen.go @@ -43,6 +43,8 @@ type WebViewResultURL struct { Flags bin.Fields // If set, the app must be opened in fullsize mode instead of compact mode. Fullsize bool + // Fullscreen field of WebViewResultURL. + Fullscreen bool // Webview session ID (only returned by inline button mini apps¹, menu button mini // apps², attachment menu mini apps³). // @@ -78,6 +80,9 @@ func (w *WebViewResultURL) Zero() bool { if !(w.Fullsize == false) { return false } + if !(w.Fullscreen == false) { + return false + } if !(w.QueryID == 0) { return false } @@ -100,10 +105,12 @@ func (w *WebViewResultURL) String() string { // FillFrom fills WebViewResultURL from given interface. func (w *WebViewResultURL) FillFrom(from interface { GetFullsize() (value bool) + GetFullscreen() (value bool) GetQueryID() (value int64, ok bool) GetURL() (value string) }) { w.Fullsize = from.GetFullsize() + w.Fullscreen = from.GetFullscreen() if val, ok := from.GetQueryID(); ok { w.QueryID = val } @@ -139,6 +146,11 @@ func (w *WebViewResultURL) TypeInfo() tdp.Type { SchemaName: "fullsize", Null: !w.Flags.Has(1), }, + { + Name: "Fullscreen", + SchemaName: "fullscreen", + Null: !w.Flags.Has(2), + }, { Name: "QueryID", SchemaName: "query_id", @@ -157,6 +169,9 @@ func (w *WebViewResultURL) SetFlags() { if !(w.Fullsize == false) { w.Flags.Set(1) } + if !(w.Fullscreen == false) { + w.Flags.Set(2) + } if !(w.QueryID == 0) { w.Flags.Set(0) } @@ -209,6 +224,7 @@ func (w *WebViewResultURL) DecodeBare(b *bin.Buffer) error { } } w.Fullsize = w.Flags.Has(1) + w.Fullscreen = w.Flags.Has(2) if w.Flags.Has(0) { value, err := b.Long() if err != nil { @@ -245,6 +261,25 @@ func (w *WebViewResultURL) GetFullsize() (value bool) { return w.Flags.Has(1) } +// SetFullscreen sets value of Fullscreen conditional field. +func (w *WebViewResultURL) SetFullscreen(value bool) { + if value { + w.Flags.Set(2) + w.Fullscreen = true + } else { + w.Flags.Unset(2) + w.Fullscreen = false + } +} + +// GetFullscreen returns value of Fullscreen conditional field. +func (w *WebViewResultURL) GetFullscreen() (value bool) { + if w == nil { + return + } + return w.Flags.Has(2) +} + // SetQueryID sets value of QueryID conditional field. func (w *WebViewResultURL) SetQueryID(value int64) { w.Flags.Set(0)