diff --git a/pkg/gotd/_schema/tdesktop.tl b/pkg/gotd/_schema/tdesktop.tl index 0632c011..48451f33 100644 --- a/pkg/gotd/_schema/tdesktop.tl +++ b/pkg/gotd/_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: 218 -// SHA256: 33b36383ad43d41e6b592791311ca0d65a06cf2d3ef9d607a6e187cddac7f14b +// Layer: 223 +// SHA256: efb4626bec87841fc0736a74e02bfd4e8bfbff001cab309246195af4897e6602 boolFalse#bc799737 = Bool; @@ -82,6 +82,8 @@ inputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User; +user#31774388 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true bot_forum_can_manage_topics:flags2.17?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; @@ -170,17 +172,17 @@ chatForbidden#6592a1a7 id:long title:string = Chat; channel#1c32b11c flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true autotranslation:flags2.15?true broadcast_messages_allowed:flags2.16?true monoforum:flags2.17?true forum_tabs:flags2.19?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?RecentStory color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification_icon:flags2.13?long send_paid_messages_stars:flags2.14?long linked_monoforum_id:flags2.18?long = Chat; -channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; +channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true monoforum:flags.10?true id:long access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull; channelFull#e4e0b29d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true paid_messages_available:flags2.20?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int send_paid_messages_stars:flags2.21?long main_tab:flags2.22?ProfileTab = ChatFull; -chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; +chatParticipant#38e79fde flags:# user_id:long inviter_id:long date:int rank:flags.0?string = ChatParticipant; -chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant; +chatParticipantCreator#e1f867b8 flags:# user_id:long rank:flags.0?string = ChatParticipant; -chatParticipantAdmin#a0933f5b user_id:long inviter_id:long date:int = ChatParticipant; +chatParticipantAdmin#360d5d2 flags:# user_id:long inviter_id:long date:int rank:flags.0?string = ChatParticipant; chatParticipantsForbidden#8763d3e1 flags:# chat_id:long self_participant:flags.0?ChatParticipant = ChatParticipants; @@ -192,7 +194,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#b92f76cf flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true paid_suggested_post_stars:flags2.8?true paid_suggested_post_ton:flags2.9?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int paid_message_stars:flags2.6?long suggested_post:flags2.7?SuggestedPost schedule_repeat_period:flags2.10?int = Message; +message#3ae56482 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true paid_suggested_post_stars:flags2.8?true paid_suggested_post_ton:flags2.9?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int from_rank:flags2.12?string peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int paid_message_stars:flags2.6?long suggested_post:flags2.7?SuggestedPost schedule_repeat_period:flags2.10?int summary_from_language:flags2.11?string = Message; messageService#7a800e0a flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true reactions_are_possible:flags.9?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer saved_peer_id:flags.28?Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction reactions:flags.20?MessageReactions ttl_period:flags.25?int = Message; @@ -220,7 +222,7 @@ messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; -messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; +messageMediaDice#8cbec07 flags:# value:int emoticon:string game_outcome:flags.0?messages.EmojiGameOutcome = MessageMedia; messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; @@ -326,9 +328,9 @@ 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#db596550 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true prepaid_upgrade:flags.13?true upgrade_separate:flags.16?true auction_acquired:flags.17?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long prepaid_upgrade_hash:flags.14?string gift_msg_id:flags.15?int to_id:flags.18?Peer = MessageAction; +messageActionStarGift#ea2c31d3 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true prepaid_upgrade:flags.13?true upgrade_separate:flags.16?true auction_acquired:flags.17?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long prepaid_upgrade_hash:flags.14?string gift_msg_id:flags.15?int to_id:flags.18?Peer gift_num:flags.19?int = MessageAction; -messageActionStarGiftUnique#95728543 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true prepaid_upgrade:flags.11?true assigned:flags.13?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long resale_amount:flags.8?StarsAmount can_transfer_at:flags.9?int can_resell_at:flags.10?int drop_original_details_stars:flags.12?long = MessageAction; +messageActionStarGiftUnique#e6c31522 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true prepaid_upgrade:flags.11?true assigned:flags.13?true from_offer:flags.14?true craft:flags.16?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long resale_amount:flags.8?StarsAmount can_transfer_at:flags.9?int can_resell_at:flags.10?int drop_original_details_stars:flags.12?long can_craft_at:flags.15?int = MessageAction; messageActionPaidMessagesRefunded#ac1f1fcd count:int stars:long = MessageAction; @@ -350,6 +352,18 @@ messageActionGiftTon#a8a3c699 flags:# currency:string amount:long crypto_currenc messageActionSuggestBirthday#2c8f2a25 birthday:Birthday = MessageAction; +messageActionStarGiftPurchaseOffer#774278d4 flags:# accepted:flags.0?true declined:flags.1?true gift:StarGift price:StarsAmount expires_at:int = MessageAction; + +messageActionStarGiftPurchaseOfferDeclined#73ada76b flags:# expired:flags.0?true gift:StarGift price:StarsAmount = MessageAction; + +messageActionNewCreatorPending#b07ed085 new_creator_id:long = MessageAction; + +messageActionChangeCreator#e188503b new_creator_id:long = MessageAction; + +messageActionNoForwardsToggle#bf7d6572 prev_value:Bool new_value:Bool = MessageAction; + +messageActionNoForwardsRequest#3e2793ba flags:# expired:flags.0?true prev_value:Bool new_value:Bool = MessageAction; + dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -426,7 +440,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#a02bc13e 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 display_gifts_button:flags2.16?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:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights 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 starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities = UserFull; +userFull#a02bc13e 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 display_gifts_button:flags2.16?true noforwards_my_enabled:flags2.23?true noforwards_peer_enabled:flags2.24?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:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights 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 starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -800,6 +814,12 @@ updateStarGiftAuctionState#48e246c2 gift_id:long state:StarGiftAuctionState = Up updateStarGiftAuctionUserState#dc58f31e gift_id:long user_state:StarGiftAuctionUserState = Update; +updateEmojiGameInfo#fb9c547a info:messages.EmojiGameInfo = Update; + +updateStarGiftCraftFail#ac072444 = Update; + +updateChatParticipantRank#bd8367b9 chat_id:long user_id:long rank:string version: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; @@ -1144,41 +1164,41 @@ botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#4d8a0299 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 verifier_settings:flags.9?BotVerifierSettings = BotInfo; -keyboardButton#a2fa4880 text:string = KeyboardButton; +keyboardButton#7d170cff flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; +keyboardButtonUrl#d80c25ec flags:# style:flags.10?KeyboardButtonStyle text:string url:string = KeyboardButton; -keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton; +keyboardButtonCallback#e62bc960 flags:# requires_password:flags.0?true style:flags.10?KeyboardButtonStyle text:string data:bytes = KeyboardButton; -keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; +keyboardButtonRequestPhone#417efd8f flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; +keyboardButtonRequestGeoLocation#aa40f94d flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonSwitchInline#93b9fbb5 flags:# same_peer:flags.0?true text:string query:string peer_types:flags.1?Vector = KeyboardButton; +keyboardButtonSwitchInline#991399fc flags:# same_peer:flags.0?true style:flags.10?KeyboardButtonStyle text:string query:string peer_types:flags.1?Vector = KeyboardButton; -keyboardButtonGame#50f41ccf text:string = KeyboardButton; +keyboardButtonGame#89c590f9 flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonBuy#afd93fbb text:string = KeyboardButton; +keyboardButtonBuy#3fa53905 flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; +keyboardButtonUrlAuth#f51006f9 flags:# style:flags.10?KeyboardButtonStyle text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; -inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; +inputKeyboardButtonUrlAuth#68013e72 flags:# request_write_access:flags.0?true style:flags.10?KeyboardButtonStyle text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; -keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton; +keyboardButtonRequestPoll#7a11d782 flags:# style:flags.10?KeyboardButtonStyle quiz:flags.0?Bool text:string = KeyboardButton; -inputKeyboardButtonUserProfile#e988037b text:string user_id:InputUser = KeyboardButton; +inputKeyboardButtonUserProfile#7d5e07c7 flags:# style:flags.10?KeyboardButtonStyle text:string user_id:InputUser = KeyboardButton; -keyboardButtonUserProfile#308660c1 text:string user_id:long = KeyboardButton; +keyboardButtonUserProfile#c0fd5d09 flags:# style:flags.10?KeyboardButtonStyle text:string user_id:long = KeyboardButton; -keyboardButtonWebView#13767230 text:string url:string = KeyboardButton; +keyboardButtonWebView#e846b1a0 flags:# style:flags.10?KeyboardButtonStyle text:string url:string = KeyboardButton; -keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton; +keyboardButtonSimpleWebView#e15c4370 flags:# style:flags.10?KeyboardButtonStyle text:string url:string = KeyboardButton; -keyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; +keyboardButtonRequestPeer#5b0f15f5 flags:# style:flags.10?KeyboardButtonStyle text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; -inputKeyboardButtonRequestPeer#c9662d05 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; +inputKeyboardButtonRequestPeer#2b78156 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true style:flags.10?KeyboardButtonStyle text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; -keyboardButtonCopy#75d2698e text:string copy_text:string = KeyboardButton; +keyboardButtonCopy#bcc4af10 flags:# style:flags.10?KeyboardButtonStyle text:string copy_text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -1232,6 +1252,8 @@ messageEntityCustomEmoji#c8cf05f8 offset:int length:int document_id:long = Messa messageEntityBlockquote#f1ccaaac flags:# collapsed:flags.0?true offset:int length:int = MessageEntity; +messageEntityFormattedDate#904ac7c7 flags:# relative:flags.0?true short_time:flags.1?true long_time:flags.2?true short_date:flags.3?true long_date:flags.4?true day_of_week:flags.5?true offset:int length:int date:int = MessageEntity; + inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#f35aec28 channel_id:long access_hash:long = InputChannel; @@ -1252,15 +1274,15 @@ channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; -channelParticipant#cb397619 flags:# user_id:long date:int subscription_until_date:flags.0?int = ChannelParticipant; +channelParticipant#1bd54456 flags:# user_id:long date:int subscription_until_date:flags.0?int rank:flags.2?string = ChannelParticipant; -channelParticipantSelf#4f607bef flags:# via_request:flags.0?true user_id:long inviter_id:long date:int subscription_until_date:flags.1?int = ChannelParticipant; +channelParticipantSelf#a9478a1a flags:# via_request:flags.0?true user_id:long inviter_id:long date:int subscription_until_date:flags.1?int rank:flags.2?string = ChannelParticipant; channelParticipantCreator#2fe601d3 flags:# user_id:long admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant; channelParticipantAdmin#34c3bb53 flags:# can_edit:flags.0?true self:flags.1?true user_id:long inviter_id:flags.1?long promoted_by:long date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant; -channelParticipantBanned#6df8014e flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights = ChannelParticipant; +channelParticipantBanned#d5f0ad91 flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights rank:flags.2?string = ChannelParticipant; channelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant; @@ -1756,11 +1778,13 @@ channelAdminLogEventActionParticipantSubExtend#64642db3 prev_participant:Channel channelAdminLogEventActionToggleAutotranslation#c517f77e new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantEditRank#5806b4ec user_id:long prev_rank:string new_rank:string = ChannelAdminLogEventAction; + channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; -channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true = ChannelAdminLogEventsFilter; +channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true edit_rank:flags.19?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; @@ -1968,9 +1992,9 @@ chatOnlines#f041e250 onlines:int = ChatOnlines; statsURL#47a971e0 url:string = StatsURL; -chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true manage_direct_messages:flags.17?true = ChatAdminRights; +chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true manage_direct_messages:flags.17?true manage_ranks:flags.18?true = ChatAdminRights; -chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true until_date:int = ChatBannedRights; +chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true edit_rank:flags.26?true until_date:int = ChatBannedRights; inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper; @@ -2008,9 +2032,9 @@ folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer; messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter; -urlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult; +urlAuthResultRequest#f8f8eb1e flags:# request_write_access:flags.0?true request_phone_number:flags.1?true match_codes_first:flags.5?true bot:User domain:string browser:flags.2?string platform:flags.2?string ip:flags.2?string region:flags.2?string match_codes:flags.3?Vector user_id_hint:flags.4?long = UrlAuthResult; -urlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult; +urlAuthResultAccepted#623a8fa0 flags:# url:flags.0?string = UrlAuthResult; urlAuthResultDefault#a9d6db1f = UrlAuthResult; @@ -2068,7 +2092,7 @@ webPageAttributeUniqueStarGift#cf6f6db8 gift:StarGift = WebPageAttribute; webPageAttributeStarGiftCollection#31cad303 icons:Vector = WebPageAttribute; -webPageAttributeStarGiftAuction#34986ab gift:StarGift end_date:int center_color:int edge_color:int text_color:int = WebPageAttribute; +webPageAttributeStarGiftAuction#1c641c2 gift:StarGift end_date:int = WebPageAttribute; messages.votesList#4899484e flags:# count:int votes:Vector chats:Vector users:Vector next_offset:flags.0?string = messages.VotesList; @@ -2784,7 +2808,7 @@ starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#13659eb0 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true business_transfer:flags.21?true stargift_resale:flags.22?true posts_search:flags.24?true stargift_prepaid_upgrade:flags.25?true stargift_drop_original_details:flags.26?true phonegroup_message:flags.27?true stargift_auction_bid:flags.28?true id:string amount:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount paid_messages:flags.19?int premium_gift_months:flags.20?int ads_proceeds_from_date:flags.23?int ads_proceeds_to_date:flags.23?int = StarsTransaction; +starsTransaction#13659eb0 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true business_transfer:flags.21?true stargift_resale:flags.22?true posts_search:flags.24?true stargift_prepaid_upgrade:flags.25?true stargift_drop_original_details:flags.26?true phonegroup_message:flags.27?true stargift_auction_bid:flags.28?true offer:flags.29?true id:string amount:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount paid_messages:flags.19?int premium_gift_months:flags.20?int ads_proceeds_from_date:flags.23?int ads_proceeds_to_date:flags.23?int = StarsTransaction; payments.starsStatus#6c9ce8ed flags:# balance:StarsAmount subscriptions:flags.1?Vector subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; @@ -2822,9 +2846,9 @@ 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#1b9a4d7f flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true require_premium:flags.7?true limited_per_user:flags.8?true peer_color_available:flags.10?true auction:flags.11?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string released_by:flags.6?Peer per_user_total:flags.8?int per_user_remains:flags.8?int locked_until_date:flags.9?int auction_slug:flags.11?string gifts_per_round:flags.11?int = StarGift; +starGift#313a9547 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true require_premium:flags.7?true limited_per_user:flags.8?true peer_color_available:flags.10?true auction:flags.11?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string released_by:flags.6?Peer per_user_total:flags.8?int per_user_remains:flags.8?int locked_until_date:flags.9?int auction_slug:flags.11?string gifts_per_round:flags.11?int auction_start_date:flags.11?int upgrade_variants:flags.12?int background:flags.13?StarGiftBackground = StarGift; -starGiftUnique#b0bf741b flags:# require_premium:flags.6?true resale_ton_only:flags.7?true theme_available:flags.9?true id:long gift_id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector availability_issued:int availability_total:int gift_address:flags.3?string resell_amount:flags.4?Vector released_by:flags.5?Peer value_amount:flags.8?long value_currency:flags.8?string theme_peer:flags.10?Peer peer_color:flags.11?PeerColor host_id:flags.12?Peer = StarGift; +starGiftUnique#85f0a9cd flags:# require_premium:flags.6?true resale_ton_only:flags.7?true theme_available:flags.9?true burned:flags.14?true crafted:flags.15?true id:long gift_id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector availability_issued:int availability_total:int gift_address:flags.3?string resell_amount:flags.4?Vector released_by:flags.5?Peer value_amount:flags.8?long value_currency:flags.8?string value_usd_amount:flags.8?long theme_peer:flags.10?Peer peer_color:flags.11?PeerColor host_id:flags.12?Peer offer_min_stars:flags.13?int craft_chance_permille:flags.16?int = StarGift; payments.starGiftsNotModified#a388a368 = payments.StarGifts; @@ -2864,11 +2888,11 @@ botVerifierSettings#b0cd6617 flags:# can_modify_custom_description:flags.1?true botVerification#f93cd45c bot_id:long icon:long description:string = BotVerification; -starGiftAttributeModel#39d99013 name:string document:Document rarity_permille:int = StarGiftAttribute; +starGiftAttributeModel#565251e2 flags:# crafted:flags.0?true name:string document:Document rarity:StarGiftAttributeRarity = StarGiftAttribute; -starGiftAttributePattern#13acff19 name:string document:Document rarity_permille:int = StarGiftAttribute; +starGiftAttributePattern#4e7085ea name:string document:Document rarity:StarGiftAttributeRarity = StarGiftAttribute; -starGiftAttributeBackdrop#d93d859c name:string backdrop_id:int center_color:int edge_color:int pattern_color:int text_color:int rarity_permille:int = StarGiftAttribute; +starGiftAttributeBackdrop#9f2504e4 name:string backdrop_id:int center_color:int edge_color:int pattern_color:int text_color:int rarity:StarGiftAttributeRarity = StarGiftAttribute; starGiftAttributeOriginalDetails#e0bff26c flags:# sender_id:flags.0?Peer recipient_id:Peer date:int message:flags.1?TextWithEntities = StarGiftAttribute; @@ -2882,7 +2906,7 @@ payments.uniqueStarGift#416c56e8 gift:StarGift chats:Vector users:Vector users:Vector = messages.WebPagePreview; -savedStarGift#8983a452 flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true pinned_to_top:flags.12?true upgrade_separate:flags.17?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long can_transfer_at:flags.13?int can_resell_at:flags.14?int collection_id:flags.15?Vector prepaid_upgrade_hash:flags.16?string drop_original_details_stars:flags.18?long = SavedStarGift; +savedStarGift#41df43fc flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true pinned_to_top:flags.12?true upgrade_separate:flags.17?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long can_transfer_at:flags.13?int can_resell_at:flags.14?int collection_id:flags.15?Vector prepaid_upgrade_hash:flags.16?string drop_original_details_stars:flags.18?long gift_num:flags.19?int can_craft_at:flags.20?int = SavedStarGift; payments.savedStarGifts#95f389b1 flags:# count:int chat_notifications_enabled:flags.1?Bool gifts:Vector next_offset:flags.0?string chats:Vector users:Vector = payments.SavedStarGifts; @@ -2996,7 +3020,7 @@ starGiftUpgradePrice#99ea331d date:int upgrade_stars:long = StarGiftUpgradePrice groupCallMessage#1a8afc7e flags:# from_admin:flags.1?true id:int from_id:Peer date:int message:TextWithEntities paid_message_stars:flags.0?long = GroupCallMessage; -groupCallDonor#ee430c85 flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer stars:long = GroupCallDonor; +groupCallDonor#ee430c85 flags:# top:flags.0?true my:flags.1?true peer_id:flags.3?Peer stars:long = GroupCallDonor; phone.groupCallStars#9d1dbd26 total_stars:long top_donors:Vector chats:Vector users:Vector = phone.GroupCallStars; @@ -3006,15 +3030,15 @@ auctionBidLevel#310240cc pos:int amount:long date:int = AuctionBidLevel; starGiftAuctionStateNotModified#fe333952 = StarGiftAuctionState; -starGiftAuctionState#5db04f4b version:int start_date:int end_date:int min_bid_amount:long bid_levels:Vector top_bidders:Vector next_round_at:int gifts_left:int current_round:int total_rounds:int = StarGiftAuctionState; +starGiftAuctionState#771a4e66 version:int start_date:int end_date:int min_bid_amount:long bid_levels:Vector top_bidders:Vector next_round_at:int last_gift_num:int gifts_left:int current_round:int total_rounds:int rounds:Vector = StarGiftAuctionState; -starGiftAuctionStateFinished#7d967c3a start_date:int end_date:int average_price:long = StarGiftAuctionState; +starGiftAuctionStateFinished#972dabbf flags:# start_date:int end_date:int average_price:long listed_count:flags.0?int fragment_listed_count:flags.1?int fragment_listed_url:flags.1?string = StarGiftAuctionState; starGiftAuctionUserState#2eeed1c4 flags:# returned:flags.1?true bid_amount:flags.0?long bid_date:flags.0?int min_bid_amount:flags.0?long bid_peer:flags.0?Peer acquired_count:int = StarGiftAuctionUserState; -payments.starGiftAuctionState#e98e474 gift:StarGift state:StarGiftAuctionState user_state:StarGiftAuctionUserState timeout:int users:Vector = payments.StarGiftAuctionState; +payments.starGiftAuctionState#6b39f4ec gift:StarGift state:StarGiftAuctionState user_state:StarGiftAuctionUserState timeout:int users:Vector chats:Vector = payments.StarGiftAuctionState; -starGiftAuctionAcquiredGift#ab60e20b flags:# name_hidden:flags.0?true peer:Peer date:int bid_amount:long round:int pos:int message:flags.1?TextWithEntities = StarGiftAuctionAcquiredGift; +starGiftAuctionAcquiredGift#42b00348 flags:# name_hidden:flags.0?true peer:Peer date:int bid_amount:long round:int pos:int message:flags.1?TextWithEntities gift_num:flags.2?int = StarGiftAuctionAcquiredGift; payments.starGiftAuctionAcquiredGifts#7d5bd1f0 gifts:Vector users:Vector chats:Vector = payments.StarGiftAuctionAcquiredGifts; @@ -3022,12 +3046,54 @@ starGiftActiveAuctionState#d31bc45d gift:StarGift state:StarGiftAuctionState use payments.starGiftActiveAuctionsNotModified#db33dad0 = payments.StarGiftActiveAuctions; -payments.starGiftActiveAuctions#97f187d8 auctions:Vector users:Vector = payments.StarGiftActiveAuctions; +payments.starGiftActiveAuctions#aef6abbc auctions:Vector users:Vector chats:Vector = payments.StarGiftActiveAuctions; inputStarGiftAuction#2e16c98 gift_id:long = InputStarGiftAuction; inputStarGiftAuctionSlug#7ab58308 slug:string = InputStarGiftAuction; +passkey#98613ebf flags:# id:string name:string date:int software_emoji_id:flags.0?long last_usage_date:flags.1?int = Passkey; + +account.passkeys#f8e0aa1c passkeys:Vector = account.Passkeys; + +account.passkeyRegistrationOptions#e16b5ce1 options:DataJSON = account.PasskeyRegistrationOptions; + +auth.passkeyLoginOptions#e2037789 options:DataJSON = auth.PasskeyLoginOptions; + +inputPasskeyResponseRegister#3e63935c client_data:DataJSON attestation_data:bytes = InputPasskeyResponse; + +inputPasskeyResponseLogin#c31fc14a client_data:DataJSON authenticator_data:bytes signature:bytes user_handle:string = InputPasskeyResponse; + +inputPasskeyCredentialPublicKey#3c27b78f id:string raw_id:string response:InputPasskeyResponse = InputPasskeyCredential; + +inputPasskeyCredentialFirebasePNV#5b1ccb28 pnv_token:string = InputPasskeyCredential; + +starGiftBackground#aff56398 center_color:int edge_color:int text_color:int = StarGiftBackground; + +starGiftAuctionRound#3aae0528 num:int duration:int = StarGiftAuctionRound; + +starGiftAuctionRoundExtendable#aa021e5 num:int duration:int extend_top:int extend_window:int = StarGiftAuctionRound; + +payments.starGiftUpgradeAttributes#46c6e36f attributes:Vector = payments.StarGiftUpgradeAttributes; + +messages.emojiGameOutcome#da2ad647 seed:bytes stake_ton_amount:long ton_amount:long = messages.EmojiGameOutcome; + +messages.emojiGameUnavailable#59e65335 = messages.EmojiGameInfo; + +messages.emojiGameDiceInfo#44e56023 flags:# game_hash:string prev_stake:long current_streak:int params:Vector plays_left:flags.0?int = messages.EmojiGameInfo; + +starGiftAttributeRarity#36437737 permille:int = StarGiftAttributeRarity; + +starGiftAttributeRarityUncommon#dbce6389 = StarGiftAttributeRarity; + +starGiftAttributeRarityRare#f08d516b = StarGiftAttributeRarity; + +starGiftAttributeRarityEpic#78fbf3a8 = StarGiftAttributeRarity; + +starGiftAttributeRarityLegendary#cef7e7a8 = StarGiftAttributeRarity; + +keyboardButtonStyle#4fdd3430 flags:# bg_primary:flags.0?true bg_danger:flags.1?true bg_success:flags.2?true icon:flags.3?long = KeyboardButtonStyle; + ---functions--- @@ -3101,6 +3167,10 @@ auth.reportMissingCode#cb9deff6 phone_number:string phone_code_hash:string mnc:s auth.checkPaidAuth#56e59f9c phone_number:string phone_code_hash:string form_id:long = auth.SentCode; +auth.initPasskeyLogin#518ad0b7 api_id:int api_hash:string = auth.PasskeyLoginOptions; + +auth.finishPasskeyLogin#9857ad07 flags:# credential:InputPasskeyCredential from_dc_id:flags.0?int from_auth_key_id:flags.0?long = auth.Authorization; + account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector = Bool; @@ -3339,6 +3409,14 @@ account.getSavedMusicIds#e09d5faf hash:long = account.SavedMusicIds; account.getUniqueGiftChatThemes#e42ce9c9 offset:string limit:int hash:long = account.ChatThemes; +account.initPasskeyRegistration#429547e8 = account.PasskeyRegistrationOptions; + +account.registerPasskey#55b41fd6 credential:InputPasskeyCredential = Passkey; + +account.getPasskeys#ea1f0c52 = account.Passkeys; + +account.deletePasskey#f5b5563f id:string = Bool; + users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -3431,7 +3509,7 @@ messages.sendMessage#545cd15a flags:# no_webpage:flags.1?true silent:flags.5?tru messages.sendMedia#330e77f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int schedule_repeat_period:flags.24?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long allow_paid_stars:flags.21?long suggested_post:flags.22?SuggestedPost = Updates; -messages.forwardMessages#41d41ade flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int reply_to:flags.22?InputReplyTo schedule_date:flags.10?int schedule_repeat_period:flags.24?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut video_timestamp:flags.20?int allow_paid_stars:flags.21?long suggested_post:flags.23?SuggestedPost = Updates; +messages.forwardMessages#13704a7c flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int reply_to:flags.22?InputReplyTo schedule_date:flags.10?int schedule_repeat_period:flags.24?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long video_timestamp:flags.20?int allow_paid_stars:flags.21?long suggested_post:flags.23?SuggestedPost = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; @@ -3623,9 +3701,9 @@ messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL; messages.getSearchCounters#1bbcf300 flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer top_msg_id:flags.0?int filters:Vector = Vector; -messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.requestUrlAuth#894cc99c flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string in_app_origin:flags.3?string = UrlAuthResult; -messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.acceptUrlAuth#67a3f0de flags:# write_allowed:flags.0?true share_phone_number:flags.3?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string match_code:flags.4?string = UrlAuthResult; messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool; @@ -3701,7 +3779,7 @@ messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPe messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates; -messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates; +messages.toggleNoForwards#b2081a35 flags:# peer:InputPeer enabled:Bool request_msg_id:flags.0?int = Updates; messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool; @@ -3883,6 +3961,20 @@ messages.createForumTopic#2f98c3d5 flags:# title_missing:flags.4?true peer:Input messages.deleteTopicHistory#d2816f10 peer:InputPeer top_msg_id:int = messages.AffectedHistory; +messages.getEmojiGameInfo#fb7e8ca7 = messages.EmojiGameInfo; + +messages.summarizeText#9d4104e2 flags:# peer:InputPeer id:int to_lang:flags.0?string = TextWithEntities; + +messages.editChatCreator#f743b857 peer:InputPeer user_id:InputUser password:InputCheckPasswordSRP = Updates; + +messages.getFutureChatCreatorAfterLeave#3b7d0ea6 peer:InputPeer = User; + +messages.editChatParticipantRank#a00f32b0 peer:InputPeer participant:InputPeer rank:string = Updates; + +messages.declineUrlAuth#35436bbc url:string = Bool; + +messages.checkUrlAuthMatchCode#c9a47b0b url:string match_code:string = Bool; + 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; @@ -3983,7 +4075,7 @@ channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true forum:flags.5?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates; -channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates; +channels.editAdmin#9a98ad68 flags:# channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:flags.0?string = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; @@ -4025,8 +4117,6 @@ channels.getGroupsForDiscussion#f5dad378 = messages.Chats; channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool; -channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates; - channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool; channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates; @@ -4239,7 +4329,7 @@ payments.toggleStarGiftsPinnedToTop#1513e7b0 peer:InputPeer stargift:Vector offset:string limit:int = payments.ResaleStarGifts; +payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true for_craft:flags.4?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector offset:string limit:int = payments.ResaleStarGifts; payments.updateStarGiftPrice#edbe6ccb stargift:InputSavedStarGift resell_amount:StarsAmount = Updates; @@ -4263,6 +4353,16 @@ payments.getStarGiftAuctionAcquiredGifts#6ba2cbec gift_id:long = payments.StarGi payments.getStarGiftActiveAuctions#a5d0514d hash:long = payments.StarGiftActiveAuctions; +payments.resolveStarGiftOffer#e9ce781c flags:# decline:flags.0?true offer_msg_id:int = Updates; + +payments.sendStarGiftOffer#8fb86b41 flags:# peer:InputPeer slug:string price:StarsAmount duration:int random_id:long allow_paid_stars:flags.0?long = Updates; + +payments.getStarGiftUpgradeAttributes#6d038b58 gift_id:long = payments.StarGiftUpgradeAttributes; + +payments.getCraftStarGifts#fd05dd00 gift_id:long offset:string limit:int = payments.SavedStarGifts; + +payments.craftStarGift#b0f9684f stargift:Vector = Updates; + 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; @@ -4511,4 +4611,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 218 +// LAYER 223 diff --git a/pkg/gotd/_schema/tdlib.tl b/pkg/gotd/_schema/tdlib.tl index c23d398f..d3f3bc6c 100644 --- a/pkg/gotd/_schema/tdlib.tl +++ b/pkg/gotd/_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: 217 -// SHA256: 1ed022fa4fa0b92427239e620cc59e925cf85d9c9e6bfedf36119f3aff613193 +// Layer: 223 +// SHA256: a1cb9dd036f150b2b1d5000d5dd6ff07e3a7a1c2ecb37304eb81501712c1ac51 int#a8509bda ? = Int; @@ -122,6 +122,8 @@ inputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User; +user#31774388 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true bot_forum_can_manage_topics:flags2.17?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; @@ -210,17 +212,17 @@ chatForbidden#6592a1a7 id:long title:string = Chat; channel#1c32b11c flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true autotranslation:flags2.15?true broadcast_messages_allowed:flags2.16?true monoforum:flags2.17?true forum_tabs:flags2.19?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?RecentStory color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification_icon:flags2.13?long send_paid_messages_stars:flags2.14?long linked_monoforum_id:flags2.18?long = Chat; -channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; +channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true monoforum:flags.10?true id:long access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull; channelFull#e4e0b29d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true paid_messages_available:flags2.20?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int send_paid_messages_stars:flags2.21?long main_tab:flags2.22?ProfileTab = ChatFull; -chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; +chatParticipant#38e79fde flags:# user_id:long inviter_id:long date:int rank:flags.0?string = ChatParticipant; -chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant; +chatParticipantCreator#e1f867b8 flags:# user_id:long rank:flags.0?string = ChatParticipant; -chatParticipantAdmin#a0933f5b user_id:long inviter_id:long date:int = ChatParticipant; +chatParticipantAdmin#360d5d2 flags:# user_id:long inviter_id:long date:int rank:flags.0?string = ChatParticipant; chatParticipantsForbidden#8763d3e1 flags:# chat_id:long self_participant:flags.0?ChatParticipant = ChatParticipants; @@ -232,7 +234,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#b92f76cf flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true paid_suggested_post_stars:flags2.8?true paid_suggested_post_ton:flags2.9?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int paid_message_stars:flags2.6?long suggested_post:flags2.7?SuggestedPost schedule_repeat_period:flags2.10?int = Message; +message#3ae56482 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true paid_suggested_post_stars:flags2.8?true paid_suggested_post_ton:flags2.9?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int from_rank:flags2.12?string peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int paid_message_stars:flags2.6?long suggested_post:flags2.7?SuggestedPost schedule_repeat_period:flags2.10?int summary_from_language:flags2.11?string = Message; messageService#7a800e0a flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true reactions_are_possible:flags.9?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer saved_peer_id:flags.28?Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction reactions:flags.20?MessageReactions ttl_period:flags.25?int = Message; @@ -260,7 +262,7 @@ messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; -messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; +messageMediaDice#8cbec07 flags:# value:int emoticon:string game_outcome:flags.0?messages.EmojiGameOutcome = MessageMedia; messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; @@ -366,9 +368,9 @@ 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#f24de7fa flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true prepaid_upgrade:flags.13?true upgrade_separate:flags.16?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long prepaid_upgrade_hash:flags.14?string gift_msg_id:flags.15?int = MessageAction; +messageActionStarGift#ea2c31d3 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true prepaid_upgrade:flags.13?true upgrade_separate:flags.16?true auction_acquired:flags.17?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long prepaid_upgrade_hash:flags.14?string gift_msg_id:flags.15?int to_id:flags.18?Peer gift_num:flags.19?int = MessageAction; -messageActionStarGiftUnique#95728543 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true prepaid_upgrade:flags.11?true assigned:flags.13?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long resale_amount:flags.8?StarsAmount can_transfer_at:flags.9?int can_resell_at:flags.10?int drop_original_details_stars:flags.12?long = MessageAction; +messageActionStarGiftUnique#e6c31522 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true prepaid_upgrade:flags.11?true assigned:flags.13?true from_offer:flags.14?true craft:flags.16?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long resale_amount:flags.8?StarsAmount can_transfer_at:flags.9?int can_resell_at:flags.10?int drop_original_details_stars:flags.12?long can_craft_at:flags.15?int = MessageAction; messageActionPaidMessagesRefunded#ac1f1fcd count:int stars:long = MessageAction; @@ -390,6 +392,18 @@ messageActionGiftTon#a8a3c699 flags:# currency:string amount:long crypto_currenc messageActionSuggestBirthday#2c8f2a25 birthday:Birthday = MessageAction; +messageActionStarGiftPurchaseOffer#774278d4 flags:# accepted:flags.0?true declined:flags.1?true gift:StarGift price:StarsAmount expires_at:int = MessageAction; + +messageActionStarGiftPurchaseOfferDeclined#73ada76b flags:# expired:flags.0?true gift:StarGift price:StarsAmount = MessageAction; + +messageActionNewCreatorPending#b07ed085 new_creator_id:long = MessageAction; + +messageActionChangeCreator#e188503b new_creator_id:long = MessageAction; + +messageActionNoForwardsToggle#bf7d6572 prev_value:Bool new_value:Bool = MessageAction; + +messageActionNoForwardsRequest#3e2793ba flags:# expired:flags.0?true prev_value:Bool new_value:Bool = MessageAction; + dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -466,7 +480,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#a02bc13e 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 display_gifts_button:flags2.16?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:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights 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 starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities = UserFull; +userFull#a02bc13e 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 display_gifts_button:flags2.16?true noforwards_my_enabled:flags2.23?true noforwards_peer_enabled:flags2.24?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:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights 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 starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -836,6 +850,16 @@ updatePinnedForumTopics#def143d0 flags:# peer:Peer order:flags.0?Vector = U updateDeleteGroupCallMessages#3e85e92c call:InputGroupCall messages:Vector = Update; +updateStarGiftAuctionState#48e246c2 gift_id:long state:StarGiftAuctionState = Update; + +updateStarGiftAuctionUserState#dc58f31e gift_id:long user_state:StarGiftAuctionUserState = Update; + +updateEmojiGameInfo#fb9c547a info:messages.EmojiGameInfo = Update; + +updateStarGiftCraftFail#ac072444 = Update; + +updateChatParticipantRank#bd8367b9 chat_id:long user_id:long rank:string version: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; @@ -1180,41 +1204,41 @@ botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#4d8a0299 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 verifier_settings:flags.9?BotVerifierSettings = BotInfo; -keyboardButton#a2fa4880 text:string = KeyboardButton; +keyboardButton#7d170cff flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; +keyboardButtonUrl#d80c25ec flags:# style:flags.10?KeyboardButtonStyle text:string url:string = KeyboardButton; -keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton; +keyboardButtonCallback#e62bc960 flags:# requires_password:flags.0?true style:flags.10?KeyboardButtonStyle text:string data:bytes = KeyboardButton; -keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; +keyboardButtonRequestPhone#417efd8f flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; +keyboardButtonRequestGeoLocation#aa40f94d flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonSwitchInline#93b9fbb5 flags:# same_peer:flags.0?true text:string query:string peer_types:flags.1?Vector = KeyboardButton; +keyboardButtonSwitchInline#991399fc flags:# same_peer:flags.0?true style:flags.10?KeyboardButtonStyle text:string query:string peer_types:flags.1?Vector = KeyboardButton; -keyboardButtonGame#50f41ccf text:string = KeyboardButton; +keyboardButtonGame#89c590f9 flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonBuy#afd93fbb text:string = KeyboardButton; +keyboardButtonBuy#3fa53905 flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; +keyboardButtonUrlAuth#f51006f9 flags:# style:flags.10?KeyboardButtonStyle text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; -inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; +inputKeyboardButtonUrlAuth#68013e72 flags:# request_write_access:flags.0?true style:flags.10?KeyboardButtonStyle text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; -keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton; +keyboardButtonRequestPoll#7a11d782 flags:# style:flags.10?KeyboardButtonStyle quiz:flags.0?Bool text:string = KeyboardButton; -inputKeyboardButtonUserProfile#e988037b text:string user_id:InputUser = KeyboardButton; +inputKeyboardButtonUserProfile#7d5e07c7 flags:# style:flags.10?KeyboardButtonStyle text:string user_id:InputUser = KeyboardButton; -keyboardButtonUserProfile#308660c1 text:string user_id:long = KeyboardButton; +keyboardButtonUserProfile#c0fd5d09 flags:# style:flags.10?KeyboardButtonStyle text:string user_id:long = KeyboardButton; -keyboardButtonWebView#13767230 text:string url:string = KeyboardButton; +keyboardButtonWebView#e846b1a0 flags:# style:flags.10?KeyboardButtonStyle text:string url:string = KeyboardButton; -keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton; +keyboardButtonSimpleWebView#e15c4370 flags:# style:flags.10?KeyboardButtonStyle text:string url:string = KeyboardButton; -keyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; +keyboardButtonRequestPeer#5b0f15f5 flags:# style:flags.10?KeyboardButtonStyle text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; -inputKeyboardButtonRequestPeer#c9662d05 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; +inputKeyboardButtonRequestPeer#2b78156 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true style:flags.10?KeyboardButtonStyle text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; -keyboardButtonCopy#75d2698e text:string copy_text:string = KeyboardButton; +keyboardButtonCopy#bcc4af10 flags:# style:flags.10?KeyboardButtonStyle text:string copy_text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -1268,6 +1292,8 @@ messageEntityCustomEmoji#c8cf05f8 offset:int length:int document_id:long = Messa messageEntityBlockquote#f1ccaaac flags:# collapsed:flags.0?true offset:int length:int = MessageEntity; +messageEntityFormattedDate#904ac7c7 flags:# relative:flags.0?true short_time:flags.1?true long_time:flags.2?true short_date:flags.3?true long_date:flags.4?true day_of_week:flags.5?true offset:int length:int date:int = MessageEntity; + inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#f35aec28 channel_id:long access_hash:long = InputChannel; @@ -1288,15 +1314,15 @@ channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; -channelParticipant#cb397619 flags:# user_id:long date:int subscription_until_date:flags.0?int = ChannelParticipant; +channelParticipant#1bd54456 flags:# user_id:long date:int subscription_until_date:flags.0?int rank:flags.2?string = ChannelParticipant; -channelParticipantSelf#4f607bef flags:# via_request:flags.0?true user_id:long inviter_id:long date:int subscription_until_date:flags.1?int = ChannelParticipant; +channelParticipantSelf#a9478a1a flags:# via_request:flags.0?true user_id:long inviter_id:long date:int subscription_until_date:flags.1?int rank:flags.2?string = ChannelParticipant; channelParticipantCreator#2fe601d3 flags:# user_id:long admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant; channelParticipantAdmin#34c3bb53 flags:# can_edit:flags.0?true self:flags.1?true user_id:long inviter_id:flags.1?long promoted_by:long date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant; -channelParticipantBanned#6df8014e flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights = ChannelParticipant; +channelParticipantBanned#d5f0ad91 flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights rank:flags.2?string = ChannelParticipant; channelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant; @@ -1792,11 +1818,13 @@ channelAdminLogEventActionParticipantSubExtend#64642db3 prev_participant:Channel channelAdminLogEventActionToggleAutotranslation#c517f77e new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantEditRank#5806b4ec user_id:long prev_rank:string new_rank:string = ChannelAdminLogEventAction; + channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; -channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true = ChannelAdminLogEventsFilter; +channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true edit_rank:flags.19?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; @@ -2004,9 +2032,9 @@ chatOnlines#f041e250 onlines:int = ChatOnlines; statsURL#47a971e0 url:string = StatsURL; -chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true manage_direct_messages:flags.17?true = ChatAdminRights; +chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true manage_direct_messages:flags.17?true manage_ranks:flags.18?true = ChatAdminRights; -chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true until_date:int = ChatBannedRights; +chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true edit_rank:flags.26?true until_date:int = ChatBannedRights; inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper; @@ -2044,9 +2072,9 @@ folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer; messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter; -urlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult; +urlAuthResultRequest#f8f8eb1e flags:# request_write_access:flags.0?true request_phone_number:flags.1?true match_codes_first:flags.5?true bot:User domain:string browser:flags.2?string platform:flags.2?string ip:flags.2?string region:flags.2?string match_codes:flags.3?Vector user_id_hint:flags.4?long = UrlAuthResult; -urlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult; +urlAuthResultAccepted#623a8fa0 flags:# url:flags.0?string = UrlAuthResult; urlAuthResultDefault#a9d6db1f = UrlAuthResult; @@ -2104,6 +2132,8 @@ webPageAttributeUniqueStarGift#cf6f6db8 gift:StarGift = WebPageAttribute; webPageAttributeStarGiftCollection#31cad303 icons:Vector = WebPageAttribute; +webPageAttributeStarGiftAuction#1c641c2 gift:StarGift end_date:int = WebPageAttribute; + messages.votesList#4899484e flags:# count:int votes:Vector chats:Vector users:Vector next_offset:flags.0?string = messages.VotesList; bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl; @@ -2382,6 +2412,8 @@ inputInvoicePremiumAuthCode#3e77f614 purpose:InputStorePaymentPurpose = InputInv inputInvoiceStarGiftDropOriginalDetails#923d8d1 stargift:InputSavedStarGift = InputInvoice; +inputInvoiceStarGiftAuctionBid#1ecafa10 flags:# hide_name:flags.0?true update_bid:flags.2?true peer:flags.3?InputPeer gift_id:long bid_amount:long message:flags.1?TextWithEntities = InputInvoice; + payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice; messages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio; @@ -2816,7 +2848,7 @@ starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#13659eb0 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true business_transfer:flags.21?true stargift_resale:flags.22?true posts_search:flags.24?true stargift_prepaid_upgrade:flags.25?true stargift_drop_original_details:flags.26?true phonegroup_message:flags.27?true id:string amount:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount paid_messages:flags.19?int premium_gift_months:flags.20?int ads_proceeds_from_date:flags.23?int ads_proceeds_to_date:flags.23?int = StarsTransaction; +starsTransaction#13659eb0 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true business_transfer:flags.21?true stargift_resale:flags.22?true posts_search:flags.24?true stargift_prepaid_upgrade:flags.25?true stargift_drop_original_details:flags.26?true phonegroup_message:flags.27?true stargift_auction_bid:flags.28?true offer:flags.29?true id:string amount:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount paid_messages:flags.19?int premium_gift_months:flags.20?int ads_proceeds_from_date:flags.23?int ads_proceeds_to_date:flags.23?int = StarsTransaction; payments.starsStatus#6c9ce8ed flags:# balance:StarsAmount subscriptions:flags.1?Vector subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; @@ -2854,9 +2886,9 @@ 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#80ac53c3 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true require_premium:flags.7?true limited_per_user:flags.8?true peer_color_available:flags.10?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string released_by:flags.6?Peer per_user_total:flags.8?int per_user_remains:flags.8?int locked_until_date:flags.9?int = StarGift; +starGift#313a9547 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true require_premium:flags.7?true limited_per_user:flags.8?true peer_color_available:flags.10?true auction:flags.11?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string released_by:flags.6?Peer per_user_total:flags.8?int per_user_remains:flags.8?int locked_until_date:flags.9?int auction_slug:flags.11?string gifts_per_round:flags.11?int auction_start_date:flags.11?int upgrade_variants:flags.12?int background:flags.13?StarGiftBackground = StarGift; -starGiftUnique#b0bf741b flags:# require_premium:flags.6?true resale_ton_only:flags.7?true theme_available:flags.9?true id:long gift_id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector availability_issued:int availability_total:int gift_address:flags.3?string resell_amount:flags.4?Vector released_by:flags.5?Peer value_amount:flags.8?long value_currency:flags.8?string theme_peer:flags.10?Peer peer_color:flags.11?PeerColor host_id:flags.12?Peer = StarGift; +starGiftUnique#85f0a9cd flags:# require_premium:flags.6?true resale_ton_only:flags.7?true theme_available:flags.9?true burned:flags.14?true crafted:flags.15?true id:long gift_id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector availability_issued:int availability_total:int gift_address:flags.3?string resell_amount:flags.4?Vector released_by:flags.5?Peer value_amount:flags.8?long value_currency:flags.8?string value_usd_amount:flags.8?long theme_peer:flags.10?Peer peer_color:flags.11?PeerColor host_id:flags.12?Peer offer_min_stars:flags.13?int craft_chance_permille:flags.16?int = StarGift; payments.starGiftsNotModified#a388a368 = payments.StarGifts; @@ -2896,11 +2928,11 @@ botVerifierSettings#b0cd6617 flags:# can_modify_custom_description:flags.1?true botVerification#f93cd45c bot_id:long icon:long description:string = BotVerification; -starGiftAttributeModel#39d99013 name:string document:Document rarity_permille:int = StarGiftAttribute; +starGiftAttributeModel#565251e2 flags:# crafted:flags.0?true name:string document:Document rarity:StarGiftAttributeRarity = StarGiftAttribute; -starGiftAttributePattern#13acff19 name:string document:Document rarity_permille:int = StarGiftAttribute; +starGiftAttributePattern#4e7085ea name:string document:Document rarity:StarGiftAttributeRarity = StarGiftAttribute; -starGiftAttributeBackdrop#d93d859c name:string backdrop_id:int center_color:int edge_color:int pattern_color:int text_color:int rarity_permille:int = StarGiftAttribute; +starGiftAttributeBackdrop#9f2504e4 name:string backdrop_id:int center_color:int edge_color:int pattern_color:int text_color:int rarity:StarGiftAttributeRarity = StarGiftAttribute; starGiftAttributeOriginalDetails#e0bff26c flags:# sender_id:flags.0?Peer recipient_id:Peer date:int message:flags.1?TextWithEntities = StarGiftAttribute; @@ -2914,7 +2946,7 @@ payments.uniqueStarGift#416c56e8 gift:StarGift chats:Vector users:Vector users:Vector = messages.WebPagePreview; -savedStarGift#8983a452 flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true pinned_to_top:flags.12?true upgrade_separate:flags.17?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long can_transfer_at:flags.13?int can_resell_at:flags.14?int collection_id:flags.15?Vector prepaid_upgrade_hash:flags.16?string drop_original_details_stars:flags.18?long = SavedStarGift; +savedStarGift#41df43fc flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true pinned_to_top:flags.12?true upgrade_separate:flags.17?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long can_transfer_at:flags.13?int can_resell_at:flags.14?int collection_id:flags.15?Vector prepaid_upgrade_hash:flags.16?string drop_original_details_stars:flags.18?long gift_num:flags.19?int can_craft_at:flags.20?int = SavedStarGift; payments.savedStarGifts#95f389b1 flags:# count:int chat_notifications_enabled:flags.1?Bool gifts:Vector next_offset:flags.0?string chats:Vector users:Vector = payments.SavedStarGifts; @@ -3028,12 +3060,80 @@ starGiftUpgradePrice#99ea331d date:int upgrade_stars:long = StarGiftUpgradePrice groupCallMessage#1a8afc7e flags:# from_admin:flags.1?true id:int from_id:Peer date:int message:TextWithEntities paid_message_stars:flags.0?long = GroupCallMessage; -groupCallDonor#ee430c85 flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer stars:long = GroupCallDonor; +groupCallDonor#ee430c85 flags:# top:flags.0?true my:flags.1?true peer_id:flags.3?Peer stars:long = GroupCallDonor; phone.groupCallStars#9d1dbd26 total_stars:long top_donors:Vector chats:Vector users:Vector = phone.GroupCallStars; recentStory#711d692d flags:# live:flags.0?true max_id:flags.1?int = RecentStory; +auctionBidLevel#310240cc pos:int amount:long date:int = AuctionBidLevel; + +starGiftAuctionStateNotModified#fe333952 = StarGiftAuctionState; + +starGiftAuctionState#771a4e66 version:int start_date:int end_date:int min_bid_amount:long bid_levels:Vector top_bidders:Vector next_round_at:int last_gift_num:int gifts_left:int current_round:int total_rounds:int rounds:Vector = StarGiftAuctionState; + +starGiftAuctionStateFinished#972dabbf flags:# start_date:int end_date:int average_price:long listed_count:flags.0?int fragment_listed_count:flags.1?int fragment_listed_url:flags.1?string = StarGiftAuctionState; + +starGiftAuctionUserState#2eeed1c4 flags:# returned:flags.1?true bid_amount:flags.0?long bid_date:flags.0?int min_bid_amount:flags.0?long bid_peer:flags.0?Peer acquired_count:int = StarGiftAuctionUserState; + +payments.starGiftAuctionState#6b39f4ec gift:StarGift state:StarGiftAuctionState user_state:StarGiftAuctionUserState timeout:int users:Vector chats:Vector = payments.StarGiftAuctionState; + +starGiftAuctionAcquiredGift#42b00348 flags:# name_hidden:flags.0?true peer:Peer date:int bid_amount:long round:int pos:int message:flags.1?TextWithEntities gift_num:flags.2?int = StarGiftAuctionAcquiredGift; + +payments.starGiftAuctionAcquiredGifts#7d5bd1f0 gifts:Vector users:Vector chats:Vector = payments.StarGiftAuctionAcquiredGifts; + +starGiftActiveAuctionState#d31bc45d gift:StarGift state:StarGiftAuctionState user_state:StarGiftAuctionUserState = StarGiftActiveAuctionState; + +payments.starGiftActiveAuctionsNotModified#db33dad0 = payments.StarGiftActiveAuctions; + +payments.starGiftActiveAuctions#aef6abbc auctions:Vector users:Vector chats:Vector = payments.StarGiftActiveAuctions; + +inputStarGiftAuction#2e16c98 gift_id:long = InputStarGiftAuction; + +inputStarGiftAuctionSlug#7ab58308 slug:string = InputStarGiftAuction; + +passkey#98613ebf flags:# id:string name:string date:int software_emoji_id:flags.0?long last_usage_date:flags.1?int = Passkey; + +account.passkeys#f8e0aa1c passkeys:Vector = account.Passkeys; + +account.passkeyRegistrationOptions#e16b5ce1 options:DataJSON = account.PasskeyRegistrationOptions; + +auth.passkeyLoginOptions#e2037789 options:DataJSON = auth.PasskeyLoginOptions; + +inputPasskeyResponseRegister#3e63935c client_data:DataJSON attestation_data:bytes = InputPasskeyResponse; + +inputPasskeyResponseLogin#c31fc14a client_data:DataJSON authenticator_data:bytes signature:bytes user_handle:string = InputPasskeyResponse; + +inputPasskeyCredentialPublicKey#3c27b78f id:string raw_id:string response:InputPasskeyResponse = InputPasskeyCredential; + +inputPasskeyCredentialFirebasePNV#5b1ccb28 pnv_token:string = InputPasskeyCredential; + +starGiftBackground#aff56398 center_color:int edge_color:int text_color:int = StarGiftBackground; + +starGiftAuctionRound#3aae0528 num:int duration:int = StarGiftAuctionRound; + +starGiftAuctionRoundExtendable#aa021e5 num:int duration:int extend_top:int extend_window:int = StarGiftAuctionRound; + +payments.starGiftUpgradeAttributes#46c6e36f attributes:Vector = payments.StarGiftUpgradeAttributes; + +messages.emojiGameOutcome#da2ad647 seed:bytes stake_ton_amount:long ton_amount:long = messages.EmojiGameOutcome; + +messages.emojiGameUnavailable#59e65335 = messages.EmojiGameInfo; + +messages.emojiGameDiceInfo#44e56023 flags:# game_hash:string prev_stake:long current_streak:int params:Vector plays_left:flags.0?int = messages.EmojiGameInfo; + +starGiftAttributeRarity#36437737 permille:int = StarGiftAttributeRarity; + +starGiftAttributeRarityUncommon#dbce6389 = StarGiftAttributeRarity; + +starGiftAttributeRarityRare#f08d516b = StarGiftAttributeRarity; + +starGiftAttributeRarityEpic#78fbf3a8 = StarGiftAttributeRarity; + +starGiftAttributeRarityLegendary#cef7e7a8 = StarGiftAttributeRarity; + +keyboardButtonStyle#4fdd3430 flags:# bg_primary:flags.0?true bg_danger:flags.1?true bg_success:flags.2?true icon:flags.3?long = KeyboardButtonStyle; + ---functions--- @@ -3107,6 +3207,10 @@ auth.reportMissingCode#cb9deff6 phone_number:string phone_code_hash:string mnc:s auth.checkPaidAuth#56e59f9c phone_number:string phone_code_hash:string form_id:long = auth.SentCode; +auth.initPasskeyLogin#518ad0b7 api_id:int api_hash:string = auth.PasskeyLoginOptions; + +auth.finishPasskeyLogin#9857ad07 flags:# credential:InputPasskeyCredential from_dc_id:flags.0?int from_auth_key_id:flags.0?long = auth.Authorization; + account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector = Bool; @@ -3345,6 +3449,14 @@ account.getSavedMusicIds#e09d5faf hash:long = account.SavedMusicIds; account.getUniqueGiftChatThemes#e42ce9c9 offset:string limit:int hash:long = account.ChatThemes; +account.initPasskeyRegistration#429547e8 = account.PasskeyRegistrationOptions; + +account.registerPasskey#55b41fd6 credential:InputPasskeyCredential = Passkey; + +account.getPasskeys#ea1f0c52 = account.Passkeys; + +account.deletePasskey#f5b5563f id:string = Bool; + users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -3437,7 +3549,7 @@ messages.sendMessage#545cd15a flags:# no_webpage:flags.1?true silent:flags.5?tru messages.sendMedia#330e77f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int schedule_repeat_period:flags.24?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long allow_paid_stars:flags.21?long suggested_post:flags.22?SuggestedPost = Updates; -messages.forwardMessages#41d41ade flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int reply_to:flags.22?InputReplyTo schedule_date:flags.10?int schedule_repeat_period:flags.24?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut video_timestamp:flags.20?int allow_paid_stars:flags.21?long suggested_post:flags.23?SuggestedPost = Updates; +messages.forwardMessages#13704a7c flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int reply_to:flags.22?InputReplyTo schedule_date:flags.10?int schedule_repeat_period:flags.24?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long video_timestamp:flags.20?int allow_paid_stars:flags.21?long suggested_post:flags.23?SuggestedPost = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; @@ -3629,9 +3741,9 @@ messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL; messages.getSearchCounters#1bbcf300 flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer top_msg_id:flags.0?int filters:Vector = Vector; -messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.requestUrlAuth#894cc99c flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string in_app_origin:flags.3?string = UrlAuthResult; -messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.acceptUrlAuth#67a3f0de flags:# write_allowed:flags.0?true share_phone_number:flags.3?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string match_code:flags.4?string = UrlAuthResult; messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool; @@ -3707,7 +3819,7 @@ messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPe messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates; -messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates; +messages.toggleNoForwards#b2081a35 flags:# peer:InputPeer enabled:Bool request_msg_id:flags.0?int = Updates; messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool; @@ -3889,6 +4001,20 @@ messages.createForumTopic#2f98c3d5 flags:# title_missing:flags.4?true peer:Input messages.deleteTopicHistory#d2816f10 peer:InputPeer top_msg_id:int = messages.AffectedHistory; +messages.getEmojiGameInfo#fb7e8ca7 = messages.EmojiGameInfo; + +messages.summarizeText#9d4104e2 flags:# peer:InputPeer id:int to_lang:flags.0?string = TextWithEntities; + +messages.editChatCreator#f743b857 peer:InputPeer user_id:InputUser password:InputCheckPasswordSRP = Updates; + +messages.getFutureChatCreatorAfterLeave#3b7d0ea6 peer:InputPeer = User; + +messages.editChatParticipantRank#a00f32b0 peer:InputPeer participant:InputPeer rank:string = Updates; + +messages.declineUrlAuth#35436bbc url:string = Bool; + +messages.checkUrlAuthMatchCode#c9a47b0b url:string match_code:string = Bool; + 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; @@ -3989,7 +4115,7 @@ channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true forum:flags.5?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates; -channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates; +channels.editAdmin#9a98ad68 flags:# channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:flags.0?string = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; @@ -4031,8 +4157,6 @@ channels.getGroupsForDiscussion#f5dad378 = messages.Chats; channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool; -channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates; - channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool; channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates; @@ -4245,7 +4369,7 @@ payments.toggleStarGiftsPinnedToTop#1513e7b0 peer:InputPeer stargift:Vector offset:string limit:int = payments.ResaleStarGifts; +payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true for_craft:flags.4?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector offset:string limit:int = payments.ResaleStarGifts; payments.updateStarGiftPrice#edbe6ccb stargift:InputSavedStarGift resell_amount:StarsAmount = Updates; @@ -4263,6 +4387,22 @@ payments.getUniqueStarGiftValueInfo#4365af6b slug:string = payments.UniqueStarGi payments.checkCanSendGift#c0c4edc9 gift_id:long = payments.CheckCanSendGiftResult; +payments.getStarGiftAuctionState#5c9ff4d6 auction:InputStarGiftAuction version:int = payments.StarGiftAuctionState; + +payments.getStarGiftAuctionAcquiredGifts#6ba2cbec gift_id:long = payments.StarGiftAuctionAcquiredGifts; + +payments.getStarGiftActiveAuctions#a5d0514d hash:long = payments.StarGiftActiveAuctions; + +payments.resolveStarGiftOffer#e9ce781c flags:# decline:flags.0?true offer_msg_id:int = Updates; + +payments.sendStarGiftOffer#8fb86b41 flags:# peer:InputPeer slug:string price:StarsAmount duration:int random_id:long allow_paid_stars:flags.0?long = Updates; + +payments.getStarGiftUpgradeAttributes#6d038b58 gift_id:long = payments.StarGiftUpgradeAttributes; + +payments.getCraftStarGifts#fd05dd00 gift_id:long offset:string limit:int = payments.SavedStarGifts; + +payments.craftStarGift#b0f9684f stargift:Vector = Updates; + 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; @@ -4511,4 +4651,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 217 +// LAYER 223 diff --git a/pkg/gotd/_schema/telegram.tl b/pkg/gotd/_schema/telegram.tl index 8c8d047f..d0d41750 100644 --- a/pkg/gotd/_schema/telegram.tl +++ b/pkg/gotd/_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: 218 -// SHA256: 33b36383ad43d41e6b592791311ca0d65a06cf2d3ef9d607a6e187cddac7f14b +// Layer: 223 +// SHA256: efb4626bec87841fc0736a74e02bfd4e8bfbff001cab309246195af4897e6602 boolFalse#bc799737 = Bool; @@ -83,6 +83,8 @@ inputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User; +user#31774388 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true bot_forum_can_manage_topics:flags2.17?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; @@ -171,17 +173,17 @@ chatForbidden#6592a1a7 id:long title:string = Chat; channel#1c32b11c flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true autotranslation:flags2.15?true broadcast_messages_allowed:flags2.16?true monoforum:flags2.17?true forum_tabs:flags2.19?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?RecentStory color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification_icon:flags2.13?long send_paid_messages_stars:flags2.14?long linked_monoforum_id:flags2.18?long = Chat; -channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; +channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true monoforum:flags.10?true id:long access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull; channelFull#e4e0b29d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true paid_messages_available:flags2.20?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int send_paid_messages_stars:flags2.21?long main_tab:flags2.22?ProfileTab = ChatFull; -chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; +chatParticipant#38e79fde flags:# user_id:long inviter_id:long date:int rank:flags.0?string = ChatParticipant; -chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant; +chatParticipantCreator#e1f867b8 flags:# user_id:long rank:flags.0?string = ChatParticipant; -chatParticipantAdmin#a0933f5b user_id:long inviter_id:long date:int = ChatParticipant; +chatParticipantAdmin#360d5d2 flags:# user_id:long inviter_id:long date:int rank:flags.0?string = ChatParticipant; chatParticipantsForbidden#8763d3e1 flags:# chat_id:long self_participant:flags.0?ChatParticipant = ChatParticipants; @@ -193,7 +195,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#b92f76cf flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true paid_suggested_post_stars:flags2.8?true paid_suggested_post_ton:flags2.9?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int paid_message_stars:flags2.6?long suggested_post:flags2.7?SuggestedPost schedule_repeat_period:flags2.10?int = Message; +message#3ae56482 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true paid_suggested_post_stars:flags2.8?true paid_suggested_post_ton:flags2.9?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int from_rank:flags2.12?string peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int paid_message_stars:flags2.6?long suggested_post:flags2.7?SuggestedPost schedule_repeat_period:flags2.10?int summary_from_language:flags2.11?string = Message; messageService#7a800e0a flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true reactions_are_possible:flags.9?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer saved_peer_id:flags.28?Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction reactions:flags.20?MessageReactions ttl_period:flags.25?int = Message; @@ -221,7 +223,7 @@ messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; -messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; +messageMediaDice#8cbec07 flags:# value:int emoticon:string game_outcome:flags.0?messages.EmojiGameOutcome = MessageMedia; messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; @@ -327,9 +329,9 @@ 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#db596550 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true prepaid_upgrade:flags.13?true upgrade_separate:flags.16?true auction_acquired:flags.17?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long prepaid_upgrade_hash:flags.14?string gift_msg_id:flags.15?int to_id:flags.18?Peer = MessageAction; +messageActionStarGift#ea2c31d3 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true prepaid_upgrade:flags.13?true upgrade_separate:flags.16?true auction_acquired:flags.17?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long prepaid_upgrade_hash:flags.14?string gift_msg_id:flags.15?int to_id:flags.18?Peer gift_num:flags.19?int = MessageAction; -messageActionStarGiftUnique#95728543 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true prepaid_upgrade:flags.11?true assigned:flags.13?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long resale_amount:flags.8?StarsAmount can_transfer_at:flags.9?int can_resell_at:flags.10?int drop_original_details_stars:flags.12?long = MessageAction; +messageActionStarGiftUnique#e6c31522 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true prepaid_upgrade:flags.11?true assigned:flags.13?true from_offer:flags.14?true craft:flags.16?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long resale_amount:flags.8?StarsAmount can_transfer_at:flags.9?int can_resell_at:flags.10?int drop_original_details_stars:flags.12?long can_craft_at:flags.15?int = MessageAction; messageActionPaidMessagesRefunded#ac1f1fcd count:int stars:long = MessageAction; @@ -351,6 +353,18 @@ messageActionGiftTon#a8a3c699 flags:# currency:string amount:long crypto_currenc messageActionSuggestBirthday#2c8f2a25 birthday:Birthday = MessageAction; +messageActionStarGiftPurchaseOffer#774278d4 flags:# accepted:flags.0?true declined:flags.1?true gift:StarGift price:StarsAmount expires_at:int = MessageAction; + +messageActionStarGiftPurchaseOfferDeclined#73ada76b flags:# expired:flags.0?true gift:StarGift price:StarsAmount = MessageAction; + +messageActionNewCreatorPending#b07ed085 new_creator_id:long = MessageAction; + +messageActionChangeCreator#e188503b new_creator_id:long = MessageAction; + +messageActionNoForwardsToggle#bf7d6572 prev_value:Bool new_value:Bool = MessageAction; + +messageActionNoForwardsRequest#3e2793ba flags:# expired:flags.0?true prev_value:Bool new_value:Bool = MessageAction; + dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -427,7 +441,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#a02bc13e 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 display_gifts_button:flags2.16?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:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights 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 starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities = UserFull; +userFull#a02bc13e 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 display_gifts_button:flags2.16?true noforwards_my_enabled:flags2.23?true noforwards_peer_enabled:flags2.24?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:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights 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 starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document note:flags2.22?TextWithEntities = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -801,6 +815,12 @@ updateStarGiftAuctionState#48e246c2 gift_id:long state:StarGiftAuctionState = Up updateStarGiftAuctionUserState#dc58f31e gift_id:long user_state:StarGiftAuctionUserState = Update; +updateEmojiGameInfo#fb9c547a info:messages.EmojiGameInfo = Update; + +updateStarGiftCraftFail#ac072444 = Update; + +updateChatParticipantRank#bd8367b9 chat_id:long user_id:long rank:string version: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; @@ -1145,41 +1165,41 @@ botCommand#c27ac8c7 command:string description:string = BotCommand; botInfo#4d8a0299 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 verifier_settings:flags.9?BotVerifierSettings = BotInfo; -keyboardButton#a2fa4880 text:string = KeyboardButton; +keyboardButton#7d170cff flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; +keyboardButtonUrl#d80c25ec flags:# style:flags.10?KeyboardButtonStyle text:string url:string = KeyboardButton; -keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton; +keyboardButtonCallback#e62bc960 flags:# requires_password:flags.0?true style:flags.10?KeyboardButtonStyle text:string data:bytes = KeyboardButton; -keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; +keyboardButtonRequestPhone#417efd8f flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; +keyboardButtonRequestGeoLocation#aa40f94d flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonSwitchInline#93b9fbb5 flags:# same_peer:flags.0?true text:string query:string peer_types:flags.1?Vector = KeyboardButton; +keyboardButtonSwitchInline#991399fc flags:# same_peer:flags.0?true style:flags.10?KeyboardButtonStyle text:string query:string peer_types:flags.1?Vector = KeyboardButton; -keyboardButtonGame#50f41ccf text:string = KeyboardButton; +keyboardButtonGame#89c590f9 flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonBuy#afd93fbb text:string = KeyboardButton; +keyboardButtonBuy#3fa53905 flags:# style:flags.10?KeyboardButtonStyle text:string = KeyboardButton; -keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; +keyboardButtonUrlAuth#f51006f9 flags:# style:flags.10?KeyboardButtonStyle text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; -inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; +inputKeyboardButtonUrlAuth#68013e72 flags:# request_write_access:flags.0?true style:flags.10?KeyboardButtonStyle text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; -keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton; +keyboardButtonRequestPoll#7a11d782 flags:# style:flags.10?KeyboardButtonStyle quiz:flags.0?Bool text:string = KeyboardButton; -inputKeyboardButtonUserProfile#e988037b text:string user_id:InputUser = KeyboardButton; +inputKeyboardButtonUserProfile#7d5e07c7 flags:# style:flags.10?KeyboardButtonStyle text:string user_id:InputUser = KeyboardButton; -keyboardButtonUserProfile#308660c1 text:string user_id:long = KeyboardButton; +keyboardButtonUserProfile#c0fd5d09 flags:# style:flags.10?KeyboardButtonStyle text:string user_id:long = KeyboardButton; -keyboardButtonWebView#13767230 text:string url:string = KeyboardButton; +keyboardButtonWebView#e846b1a0 flags:# style:flags.10?KeyboardButtonStyle text:string url:string = KeyboardButton; -keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton; +keyboardButtonSimpleWebView#e15c4370 flags:# style:flags.10?KeyboardButtonStyle text:string url:string = KeyboardButton; -keyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; +keyboardButtonRequestPeer#5b0f15f5 flags:# style:flags.10?KeyboardButtonStyle text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; -inputKeyboardButtonRequestPeer#c9662d05 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; +inputKeyboardButtonRequestPeer#2b78156 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true style:flags.10?KeyboardButtonStyle text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; -keyboardButtonCopy#75d2698e text:string copy_text:string = KeyboardButton; +keyboardButtonCopy#bcc4af10 flags:# style:flags.10?KeyboardButtonStyle text:string copy_text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -1233,6 +1253,8 @@ messageEntityCustomEmoji#c8cf05f8 offset:int length:int document_id:long = Messa messageEntityBlockquote#f1ccaaac flags:# collapsed:flags.0?true offset:int length:int = MessageEntity; +messageEntityFormattedDate#904ac7c7 flags:# relative:flags.0?true short_time:flags.1?true long_time:flags.2?true short_date:flags.3?true long_date:flags.4?true day_of_week:flags.5?true offset:int length:int date:int = MessageEntity; + inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#f35aec28 channel_id:long access_hash:long = InputChannel; @@ -1253,15 +1275,15 @@ channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; -channelParticipant#cb397619 flags:# user_id:long date:int subscription_until_date:flags.0?int = ChannelParticipant; +channelParticipant#1bd54456 flags:# user_id:long date:int subscription_until_date:flags.0?int rank:flags.2?string = ChannelParticipant; -channelParticipantSelf#4f607bef flags:# via_request:flags.0?true user_id:long inviter_id:long date:int subscription_until_date:flags.1?int = ChannelParticipant; +channelParticipantSelf#a9478a1a flags:# via_request:flags.0?true user_id:long inviter_id:long date:int subscription_until_date:flags.1?int rank:flags.2?string = ChannelParticipant; channelParticipantCreator#2fe601d3 flags:# user_id:long admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant; channelParticipantAdmin#34c3bb53 flags:# can_edit:flags.0?true self:flags.1?true user_id:long inviter_id:flags.1?long promoted_by:long date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant; -channelParticipantBanned#6df8014e flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights = ChannelParticipant; +channelParticipantBanned#d5f0ad91 flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights rank:flags.2?string = ChannelParticipant; channelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant; @@ -1757,11 +1779,13 @@ channelAdminLogEventActionParticipantSubExtend#64642db3 prev_participant:Channel channelAdminLogEventActionToggleAutotranslation#c517f77e new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantEditRank#5806b4ec user_id:long prev_rank:string new_rank:string = ChannelAdminLogEventAction; + channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; -channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true = ChannelAdminLogEventsFilter; +channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true edit_rank:flags.19?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; @@ -1969,9 +1993,9 @@ chatOnlines#f041e250 onlines:int = ChatOnlines; statsURL#47a971e0 url:string = StatsURL; -chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true manage_direct_messages:flags.17?true = ChatAdminRights; +chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true manage_direct_messages:flags.17?true manage_ranks:flags.18?true = ChatAdminRights; -chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true until_date:int = ChatBannedRights; +chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true edit_rank:flags.26?true until_date:int = ChatBannedRights; inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper; @@ -2009,9 +2033,9 @@ folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer; messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter; -urlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult; +urlAuthResultRequest#f8f8eb1e flags:# request_write_access:flags.0?true request_phone_number:flags.1?true match_codes_first:flags.5?true bot:User domain:string browser:flags.2?string platform:flags.2?string ip:flags.2?string region:flags.2?string match_codes:flags.3?Vector user_id_hint:flags.4?long = UrlAuthResult; -urlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult; +urlAuthResultAccepted#623a8fa0 flags:# url:flags.0?string = UrlAuthResult; urlAuthResultDefault#a9d6db1f = UrlAuthResult; @@ -2069,7 +2093,7 @@ webPageAttributeUniqueStarGift#cf6f6db8 gift:StarGift = WebPageAttribute; webPageAttributeStarGiftCollection#31cad303 icons:Vector = WebPageAttribute; -webPageAttributeStarGiftAuction#34986ab gift:StarGift end_date:int center_color:int edge_color:int text_color:int = WebPageAttribute; +webPageAttributeStarGiftAuction#1c641c2 gift:StarGift end_date:int = WebPageAttribute; messages.votesList#4899484e flags:# count:int votes:Vector chats:Vector users:Vector next_offset:flags.0?string = messages.VotesList; @@ -2785,7 +2809,7 @@ starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#13659eb0 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true business_transfer:flags.21?true stargift_resale:flags.22?true posts_search:flags.24?true stargift_prepaid_upgrade:flags.25?true stargift_drop_original_details:flags.26?true phonegroup_message:flags.27?true stargift_auction_bid:flags.28?true id:string amount:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount paid_messages:flags.19?int premium_gift_months:flags.20?int ads_proceeds_from_date:flags.23?int ads_proceeds_to_date:flags.23?int = StarsTransaction; +starsTransaction#13659eb0 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true business_transfer:flags.21?true stargift_resale:flags.22?true posts_search:flags.24?true stargift_prepaid_upgrade:flags.25?true stargift_drop_original_details:flags.26?true phonegroup_message:flags.27?true stargift_auction_bid:flags.28?true offer:flags.29?true id:string amount:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount paid_messages:flags.19?int premium_gift_months:flags.20?int ads_proceeds_from_date:flags.23?int ads_proceeds_to_date:flags.23?int = StarsTransaction; payments.starsStatus#6c9ce8ed flags:# balance:StarsAmount subscriptions:flags.1?Vector subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; @@ -2823,9 +2847,9 @@ 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#1b9a4d7f flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true require_premium:flags.7?true limited_per_user:flags.8?true peer_color_available:flags.10?true auction:flags.11?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string released_by:flags.6?Peer per_user_total:flags.8?int per_user_remains:flags.8?int locked_until_date:flags.9?int auction_slug:flags.11?string gifts_per_round:flags.11?int = StarGift; +starGift#313a9547 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true require_premium:flags.7?true limited_per_user:flags.8?true peer_color_available:flags.10?true auction:flags.11?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string released_by:flags.6?Peer per_user_total:flags.8?int per_user_remains:flags.8?int locked_until_date:flags.9?int auction_slug:flags.11?string gifts_per_round:flags.11?int auction_start_date:flags.11?int upgrade_variants:flags.12?int background:flags.13?StarGiftBackground = StarGift; -starGiftUnique#b0bf741b flags:# require_premium:flags.6?true resale_ton_only:flags.7?true theme_available:flags.9?true id:long gift_id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector availability_issued:int availability_total:int gift_address:flags.3?string resell_amount:flags.4?Vector released_by:flags.5?Peer value_amount:flags.8?long value_currency:flags.8?string theme_peer:flags.10?Peer peer_color:flags.11?PeerColor host_id:flags.12?Peer = StarGift; +starGiftUnique#85f0a9cd flags:# require_premium:flags.6?true resale_ton_only:flags.7?true theme_available:flags.9?true burned:flags.14?true crafted:flags.15?true id:long gift_id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector availability_issued:int availability_total:int gift_address:flags.3?string resell_amount:flags.4?Vector released_by:flags.5?Peer value_amount:flags.8?long value_currency:flags.8?string value_usd_amount:flags.8?long theme_peer:flags.10?Peer peer_color:flags.11?PeerColor host_id:flags.12?Peer offer_min_stars:flags.13?int craft_chance_permille:flags.16?int = StarGift; payments.starGiftsNotModified#a388a368 = payments.StarGifts; @@ -2865,11 +2889,11 @@ botVerifierSettings#b0cd6617 flags:# can_modify_custom_description:flags.1?true botVerification#f93cd45c bot_id:long icon:long description:string = BotVerification; -starGiftAttributeModel#39d99013 name:string document:Document rarity_permille:int = StarGiftAttribute; +starGiftAttributeModel#565251e2 flags:# crafted:flags.0?true name:string document:Document rarity:StarGiftAttributeRarity = StarGiftAttribute; -starGiftAttributePattern#13acff19 name:string document:Document rarity_permille:int = StarGiftAttribute; +starGiftAttributePattern#4e7085ea name:string document:Document rarity:StarGiftAttributeRarity = StarGiftAttribute; -starGiftAttributeBackdrop#d93d859c name:string backdrop_id:int center_color:int edge_color:int pattern_color:int text_color:int rarity_permille:int = StarGiftAttribute; +starGiftAttributeBackdrop#9f2504e4 name:string backdrop_id:int center_color:int edge_color:int pattern_color:int text_color:int rarity:StarGiftAttributeRarity = StarGiftAttribute; starGiftAttributeOriginalDetails#e0bff26c flags:# sender_id:flags.0?Peer recipient_id:Peer date:int message:flags.1?TextWithEntities = StarGiftAttribute; @@ -2883,7 +2907,7 @@ payments.uniqueStarGift#416c56e8 gift:StarGift chats:Vector users:Vector users:Vector = messages.WebPagePreview; -savedStarGift#8983a452 flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true pinned_to_top:flags.12?true upgrade_separate:flags.17?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long can_transfer_at:flags.13?int can_resell_at:flags.14?int collection_id:flags.15?Vector prepaid_upgrade_hash:flags.16?string drop_original_details_stars:flags.18?long = SavedStarGift; +savedStarGift#41df43fc flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true pinned_to_top:flags.12?true upgrade_separate:flags.17?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long can_transfer_at:flags.13?int can_resell_at:flags.14?int collection_id:flags.15?Vector prepaid_upgrade_hash:flags.16?string drop_original_details_stars:flags.18?long gift_num:flags.19?int can_craft_at:flags.20?int = SavedStarGift; payments.savedStarGifts#95f389b1 flags:# count:int chat_notifications_enabled:flags.1?Bool gifts:Vector next_offset:flags.0?string chats:Vector users:Vector = payments.SavedStarGifts; @@ -2997,7 +3021,7 @@ starGiftUpgradePrice#99ea331d date:int upgrade_stars:long = StarGiftUpgradePrice groupCallMessage#1a8afc7e flags:# from_admin:flags.1?true id:int from_id:Peer date:int message:TextWithEntities paid_message_stars:flags.0?long = GroupCallMessage; -groupCallDonor#ee430c85 flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer stars:long = GroupCallDonor; +groupCallDonor#ee430c85 flags:# top:flags.0?true my:flags.1?true peer_id:flags.3?Peer stars:long = GroupCallDonor; phone.groupCallStars#9d1dbd26 total_stars:long top_donors:Vector chats:Vector users:Vector = phone.GroupCallStars; @@ -3007,15 +3031,15 @@ auctionBidLevel#310240cc pos:int amount:long date:int = AuctionBidLevel; starGiftAuctionStateNotModified#fe333952 = StarGiftAuctionState; -starGiftAuctionState#5db04f4b version:int start_date:int end_date:int min_bid_amount:long bid_levels:Vector top_bidders:Vector next_round_at:int gifts_left:int current_round:int total_rounds:int = StarGiftAuctionState; +starGiftAuctionState#771a4e66 version:int start_date:int end_date:int min_bid_amount:long bid_levels:Vector top_bidders:Vector next_round_at:int last_gift_num:int gifts_left:int current_round:int total_rounds:int rounds:Vector = StarGiftAuctionState; -starGiftAuctionStateFinished#7d967c3a start_date:int end_date:int average_price:long = StarGiftAuctionState; +starGiftAuctionStateFinished#972dabbf flags:# start_date:int end_date:int average_price:long listed_count:flags.0?int fragment_listed_count:flags.1?int fragment_listed_url:flags.1?string = StarGiftAuctionState; starGiftAuctionUserState#2eeed1c4 flags:# returned:flags.1?true bid_amount:flags.0?long bid_date:flags.0?int min_bid_amount:flags.0?long bid_peer:flags.0?Peer acquired_count:int = StarGiftAuctionUserState; -payments.starGiftAuctionState#e98e474 gift:StarGift state:StarGiftAuctionState user_state:StarGiftAuctionUserState timeout:int users:Vector = payments.StarGiftAuctionState; +payments.starGiftAuctionState#6b39f4ec gift:StarGift state:StarGiftAuctionState user_state:StarGiftAuctionUserState timeout:int users:Vector chats:Vector = payments.StarGiftAuctionState; -starGiftAuctionAcquiredGift#ab60e20b flags:# name_hidden:flags.0?true peer:Peer date:int bid_amount:long round:int pos:int message:flags.1?TextWithEntities = StarGiftAuctionAcquiredGift; +starGiftAuctionAcquiredGift#42b00348 flags:# name_hidden:flags.0?true peer:Peer date:int bid_amount:long round:int pos:int message:flags.1?TextWithEntities gift_num:flags.2?int = StarGiftAuctionAcquiredGift; payments.starGiftAuctionAcquiredGifts#7d5bd1f0 gifts:Vector users:Vector chats:Vector = payments.StarGiftAuctionAcquiredGifts; @@ -3023,12 +3047,54 @@ starGiftActiveAuctionState#d31bc45d gift:StarGift state:StarGiftAuctionState use payments.starGiftActiveAuctionsNotModified#db33dad0 = payments.StarGiftActiveAuctions; -payments.starGiftActiveAuctions#97f187d8 auctions:Vector users:Vector = payments.StarGiftActiveAuctions; +payments.starGiftActiveAuctions#aef6abbc auctions:Vector users:Vector chats:Vector = payments.StarGiftActiveAuctions; inputStarGiftAuction#2e16c98 gift_id:long = InputStarGiftAuction; inputStarGiftAuctionSlug#7ab58308 slug:string = InputStarGiftAuction; +passkey#98613ebf flags:# id:string name:string date:int software_emoji_id:flags.0?long last_usage_date:flags.1?int = Passkey; + +account.passkeys#f8e0aa1c passkeys:Vector = account.Passkeys; + +account.passkeyRegistrationOptions#e16b5ce1 options:DataJSON = account.PasskeyRegistrationOptions; + +auth.passkeyLoginOptions#e2037789 options:DataJSON = auth.PasskeyLoginOptions; + +inputPasskeyResponseRegister#3e63935c client_data:DataJSON attestation_data:bytes = InputPasskeyResponse; + +inputPasskeyResponseLogin#c31fc14a client_data:DataJSON authenticator_data:bytes signature:bytes user_handle:string = InputPasskeyResponse; + +inputPasskeyCredentialPublicKey#3c27b78f id:string raw_id:string response:InputPasskeyResponse = InputPasskeyCredential; + +inputPasskeyCredentialFirebasePNV#5b1ccb28 pnv_token:string = InputPasskeyCredential; + +starGiftBackground#aff56398 center_color:int edge_color:int text_color:int = StarGiftBackground; + +starGiftAuctionRound#3aae0528 num:int duration:int = StarGiftAuctionRound; + +starGiftAuctionRoundExtendable#aa021e5 num:int duration:int extend_top:int extend_window:int = StarGiftAuctionRound; + +payments.starGiftUpgradeAttributes#46c6e36f attributes:Vector = payments.StarGiftUpgradeAttributes; + +messages.emojiGameOutcome#da2ad647 seed:bytes stake_ton_amount:long ton_amount:long = messages.EmojiGameOutcome; + +messages.emojiGameUnavailable#59e65335 = messages.EmojiGameInfo; + +messages.emojiGameDiceInfo#44e56023 flags:# game_hash:string prev_stake:long current_streak:int params:Vector plays_left:flags.0?int = messages.EmojiGameInfo; + +starGiftAttributeRarity#36437737 permille:int = StarGiftAttributeRarity; + +starGiftAttributeRarityUncommon#dbce6389 = StarGiftAttributeRarity; + +starGiftAttributeRarityRare#f08d516b = StarGiftAttributeRarity; + +starGiftAttributeRarityEpic#78fbf3a8 = StarGiftAttributeRarity; + +starGiftAttributeRarityLegendary#cef7e7a8 = StarGiftAttributeRarity; + +keyboardButtonStyle#4fdd3430 flags:# bg_primary:flags.0?true bg_danger:flags.1?true bg_success:flags.2?true icon:flags.3?long = KeyboardButtonStyle; + ---functions--- @@ -3102,6 +3168,10 @@ auth.reportMissingCode#cb9deff6 phone_number:string phone_code_hash:string mnc:s auth.checkPaidAuth#56e59f9c phone_number:string phone_code_hash:string form_id:long = auth.SentCode; +auth.initPasskeyLogin#518ad0b7 api_id:int api_hash:string = auth.PasskeyLoginOptions; + +auth.finishPasskeyLogin#9857ad07 flags:# credential:InputPasskeyCredential from_dc_id:flags.0?int from_auth_key_id:flags.0?long = auth.Authorization; + account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector = Bool; @@ -3340,6 +3410,14 @@ account.getSavedMusicIds#e09d5faf hash:long = account.SavedMusicIds; account.getUniqueGiftChatThemes#e42ce9c9 offset:string limit:int hash:long = account.ChatThemes; +account.initPasskeyRegistration#429547e8 = account.PasskeyRegistrationOptions; + +account.registerPasskey#55b41fd6 credential:InputPasskeyCredential = Passkey; + +account.getPasskeys#ea1f0c52 = account.Passkeys; + +account.deletePasskey#f5b5563f id:string = Bool; + users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -3432,7 +3510,7 @@ messages.sendMessage#545cd15a flags:# no_webpage:flags.1?true silent:flags.5?tru messages.sendMedia#330e77f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int schedule_repeat_period:flags.24?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long allow_paid_stars:flags.21?long suggested_post:flags.22?SuggestedPost = Updates; -messages.forwardMessages#41d41ade flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int reply_to:flags.22?InputReplyTo schedule_date:flags.10?int schedule_repeat_period:flags.24?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut video_timestamp:flags.20?int allow_paid_stars:flags.21?long suggested_post:flags.23?SuggestedPost = Updates; +messages.forwardMessages#13704a7c flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int reply_to:flags.22?InputReplyTo schedule_date:flags.10?int schedule_repeat_period:flags.24?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long video_timestamp:flags.20?int allow_paid_stars:flags.21?long suggested_post:flags.23?SuggestedPost = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; @@ -3624,9 +3702,9 @@ messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL; messages.getSearchCounters#1bbcf300 flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer top_msg_id:flags.0?int filters:Vector = Vector; -messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.requestUrlAuth#894cc99c flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string in_app_origin:flags.3?string = UrlAuthResult; -messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.acceptUrlAuth#67a3f0de flags:# write_allowed:flags.0?true share_phone_number:flags.3?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string match_code:flags.4?string = UrlAuthResult; messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool; @@ -3702,7 +3780,7 @@ messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPe messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates; -messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates; +messages.toggleNoForwards#b2081a35 flags:# peer:InputPeer enabled:Bool request_msg_id:flags.0?int = Updates; messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool; @@ -3884,6 +3962,20 @@ messages.createForumTopic#2f98c3d5 flags:# title_missing:flags.4?true peer:Input messages.deleteTopicHistory#d2816f10 peer:InputPeer top_msg_id:int = messages.AffectedHistory; +messages.getEmojiGameInfo#fb7e8ca7 = messages.EmojiGameInfo; + +messages.summarizeText#9d4104e2 flags:# peer:InputPeer id:int to_lang:flags.0?string = TextWithEntities; + +messages.editChatCreator#f743b857 peer:InputPeer user_id:InputUser password:InputCheckPasswordSRP = Updates; + +messages.getFutureChatCreatorAfterLeave#3b7d0ea6 peer:InputPeer = User; + +messages.editChatParticipantRank#a00f32b0 peer:InputPeer participant:InputPeer rank:string = Updates; + +messages.declineUrlAuth#35436bbc url:string = Bool; + +messages.checkUrlAuthMatchCode#c9a47b0b url:string match_code:string = Bool; + 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; @@ -3984,7 +4076,7 @@ channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true forum:flags.5?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates; -channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates; +channels.editAdmin#9a98ad68 flags:# channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:flags.0?string = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; @@ -4026,8 +4118,6 @@ channels.getGroupsForDiscussion#f5dad378 = messages.Chats; channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool; -channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates; - channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool; channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates; @@ -4240,7 +4330,7 @@ payments.toggleStarGiftsPinnedToTop#1513e7b0 peer:InputPeer stargift:Vector offset:string limit:int = payments.ResaleStarGifts; +payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true for_craft:flags.4?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector offset:string limit:int = payments.ResaleStarGifts; payments.updateStarGiftPrice#edbe6ccb stargift:InputSavedStarGift resell_amount:StarsAmount = Updates; @@ -4264,6 +4354,16 @@ payments.getStarGiftAuctionAcquiredGifts#6ba2cbec gift_id:long = payments.StarGi payments.getStarGiftActiveAuctions#a5d0514d hash:long = payments.StarGiftActiveAuctions; +payments.resolveStarGiftOffer#e9ce781c flags:# decline:flags.0?true offer_msg_id:int = Updates; + +payments.sendStarGiftOffer#8fb86b41 flags:# peer:InputPeer slug:string price:StarsAmount duration:int random_id:long allow_paid_stars:flags.0?long = Updates; + +payments.getStarGiftUpgradeAttributes#6d038b58 gift_id:long = payments.StarGiftUpgradeAttributes; + +payments.getCraftStarGifts#fd05dd00 gift_id:long offset:string limit:int = payments.SavedStarGifts; + +payments.craftStarGift#b0f9684f stargift:Vector = Updates; + 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; @@ -4544,4 +4644,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 218 +// LAYER 223 diff --git a/pkg/gotd/tg/tl_account_delete_passkey_gen.go b/pkg/gotd/tg/tl_account_delete_passkey_gen.go new file mode 100644 index 00000000..06d7b0cd --- /dev/null +++ b/pkg/gotd/tg/tl_account_delete_passkey_gen.go @@ -0,0 +1,177 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// AccountDeletePasskeyRequest represents TL type `account.deletePasskey#f5b5563f`. +// +// See https://core.telegram.org/method/account.deletePasskey for reference. +type AccountDeletePasskeyRequest struct { + // ID field of AccountDeletePasskeyRequest. + ID string +} + +// AccountDeletePasskeyRequestTypeID is TL type id of AccountDeletePasskeyRequest. +const AccountDeletePasskeyRequestTypeID = 0xf5b5563f + +// Ensuring interfaces in compile-time for AccountDeletePasskeyRequest. +var ( + _ bin.Encoder = &AccountDeletePasskeyRequest{} + _ bin.Decoder = &AccountDeletePasskeyRequest{} + _ bin.BareEncoder = &AccountDeletePasskeyRequest{} + _ bin.BareDecoder = &AccountDeletePasskeyRequest{} +) + +func (d *AccountDeletePasskeyRequest) Zero() bool { + if d == nil { + return true + } + if !(d.ID == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *AccountDeletePasskeyRequest) String() string { + if d == nil { + return "AccountDeletePasskeyRequest(nil)" + } + type Alias AccountDeletePasskeyRequest + return fmt.Sprintf("AccountDeletePasskeyRequest%+v", Alias(*d)) +} + +// FillFrom fills AccountDeletePasskeyRequest from given interface. +func (d *AccountDeletePasskeyRequest) FillFrom(from interface { + GetID() (value string) +}) { + d.ID = from.GetID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountDeletePasskeyRequest) TypeID() uint32 { + return AccountDeletePasskeyRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountDeletePasskeyRequest) TypeName() string { + return "account.deletePasskey" +} + +// TypeInfo returns info about TL type. +func (d *AccountDeletePasskeyRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.deletePasskey", + ID: AccountDeletePasskeyRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *AccountDeletePasskeyRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode account.deletePasskey#f5b5563f as nil") + } + b.PutID(AccountDeletePasskeyRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *AccountDeletePasskeyRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode account.deletePasskey#f5b5563f as nil") + } + b.PutString(d.ID) + return nil +} + +// Decode implements bin.Decoder. +func (d *AccountDeletePasskeyRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode account.deletePasskey#f5b5563f to nil") + } + if err := b.ConsumeID(AccountDeletePasskeyRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.deletePasskey#f5b5563f: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *AccountDeletePasskeyRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode account.deletePasskey#f5b5563f to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode account.deletePasskey#f5b5563f: field id: %w", err) + } + d.ID = value + } + return nil +} + +// GetID returns value of ID field. +func (d *AccountDeletePasskeyRequest) GetID() (value string) { + if d == nil { + return + } + return d.ID +} + +// AccountDeletePasskey invokes method account.deletePasskey#f5b5563f returning error if any. +// +// See https://core.telegram.org/method/account.deletePasskey for reference. +func (c *Client) AccountDeletePasskey(ctx context.Context, id string) (bool, error) { + var result BoolBox + + request := &AccountDeletePasskeyRequest{ + ID: id, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/pkg/gotd/tg/tl_channels_edit_creator_slices_gen.go b/pkg/gotd/tg/tl_account_delete_passkey_slices_gen.go similarity index 100% rename from pkg/gotd/tg/tl_channels_edit_creator_slices_gen.go rename to pkg/gotd/tg/tl_account_delete_passkey_slices_gen.go diff --git a/pkg/gotd/tg/tl_account_get_passkeys_gen.go b/pkg/gotd/tg/tl_account_get_passkeys_gen.go new file mode 100644 index 00000000..ae98d71b --- /dev/null +++ b/pkg/gotd/tg/tl_account_get_passkeys_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// AccountGetPasskeysRequest represents TL type `account.getPasskeys#ea1f0c52`. +// +// See https://core.telegram.org/method/account.getPasskeys for reference. +type AccountGetPasskeysRequest struct { +} + +// AccountGetPasskeysRequestTypeID is TL type id of AccountGetPasskeysRequest. +const AccountGetPasskeysRequestTypeID = 0xea1f0c52 + +// Ensuring interfaces in compile-time for AccountGetPasskeysRequest. +var ( + _ bin.Encoder = &AccountGetPasskeysRequest{} + _ bin.Decoder = &AccountGetPasskeysRequest{} + _ bin.BareEncoder = &AccountGetPasskeysRequest{} + _ bin.BareDecoder = &AccountGetPasskeysRequest{} +) + +func (g *AccountGetPasskeysRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *AccountGetPasskeysRequest) String() string { + if g == nil { + return "AccountGetPasskeysRequest(nil)" + } + type Alias AccountGetPasskeysRequest + return fmt.Sprintf("AccountGetPasskeysRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountGetPasskeysRequest) TypeID() uint32 { + return AccountGetPasskeysRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountGetPasskeysRequest) TypeName() string { + return "account.getPasskeys" +} + +// TypeInfo returns info about TL type. +func (g *AccountGetPasskeysRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.getPasskeys", + ID: AccountGetPasskeysRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *AccountGetPasskeysRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode account.getPasskeys#ea1f0c52 as nil") + } + b.PutID(AccountGetPasskeysRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *AccountGetPasskeysRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode account.getPasskeys#ea1f0c52 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *AccountGetPasskeysRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode account.getPasskeys#ea1f0c52 to nil") + } + if err := b.ConsumeID(AccountGetPasskeysRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.getPasskeys#ea1f0c52: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *AccountGetPasskeysRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode account.getPasskeys#ea1f0c52 to nil") + } + return nil +} + +// AccountGetPasskeys invokes method account.getPasskeys#ea1f0c52 returning error if any. +// +// See https://core.telegram.org/method/account.getPasskeys for reference. +func (c *Client) AccountGetPasskeys(ctx context.Context) (*AccountPasskeys, error) { + var result AccountPasskeys + + request := &AccountGetPasskeysRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/pkg/gotd/tg/tl_account_get_passkeys_slices_gen.go b/pkg/gotd/tg/tl_account_get_passkeys_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_account_get_passkeys_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_account_init_passkey_registration_gen.go b/pkg/gotd/tg/tl_account_init_passkey_registration_gen.go new file mode 100644 index 00000000..6ea7c5a4 --- /dev/null +++ b/pkg/gotd/tg/tl_account_init_passkey_registration_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// AccountInitPasskeyRegistrationRequest represents TL type `account.initPasskeyRegistration#429547e8`. +// +// See https://core.telegram.org/method/account.initPasskeyRegistration for reference. +type AccountInitPasskeyRegistrationRequest struct { +} + +// AccountInitPasskeyRegistrationRequestTypeID is TL type id of AccountInitPasskeyRegistrationRequest. +const AccountInitPasskeyRegistrationRequestTypeID = 0x429547e8 + +// Ensuring interfaces in compile-time for AccountInitPasskeyRegistrationRequest. +var ( + _ bin.Encoder = &AccountInitPasskeyRegistrationRequest{} + _ bin.Decoder = &AccountInitPasskeyRegistrationRequest{} + _ bin.BareEncoder = &AccountInitPasskeyRegistrationRequest{} + _ bin.BareDecoder = &AccountInitPasskeyRegistrationRequest{} +) + +func (i *AccountInitPasskeyRegistrationRequest) Zero() bool { + if i == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (i *AccountInitPasskeyRegistrationRequest) String() string { + if i == nil { + return "AccountInitPasskeyRegistrationRequest(nil)" + } + type Alias AccountInitPasskeyRegistrationRequest + return fmt.Sprintf("AccountInitPasskeyRegistrationRequest%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountInitPasskeyRegistrationRequest) TypeID() uint32 { + return AccountInitPasskeyRegistrationRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountInitPasskeyRegistrationRequest) TypeName() string { + return "account.initPasskeyRegistration" +} + +// TypeInfo returns info about TL type. +func (i *AccountInitPasskeyRegistrationRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.initPasskeyRegistration", + ID: AccountInitPasskeyRegistrationRequestTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (i *AccountInitPasskeyRegistrationRequest) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode account.initPasskeyRegistration#429547e8 as nil") + } + b.PutID(AccountInitPasskeyRegistrationRequestTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *AccountInitPasskeyRegistrationRequest) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode account.initPasskeyRegistration#429547e8 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (i *AccountInitPasskeyRegistrationRequest) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode account.initPasskeyRegistration#429547e8 to nil") + } + if err := b.ConsumeID(AccountInitPasskeyRegistrationRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.initPasskeyRegistration#429547e8: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *AccountInitPasskeyRegistrationRequest) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode account.initPasskeyRegistration#429547e8 to nil") + } + return nil +} + +// AccountInitPasskeyRegistration invokes method account.initPasskeyRegistration#429547e8 returning error if any. +// +// See https://core.telegram.org/method/account.initPasskeyRegistration for reference. +func (c *Client) AccountInitPasskeyRegistration(ctx context.Context) (*AccountPasskeyRegistrationOptions, error) { + var result AccountPasskeyRegistrationOptions + + request := &AccountInitPasskeyRegistrationRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/pkg/gotd/tg/tl_account_init_passkey_registration_slices_gen.go b/pkg/gotd/tg/tl_account_init_passkey_registration_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_account_init_passkey_registration_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_account_passkey_registration_options_gen.go b/pkg/gotd/tg/tl_account_passkey_registration_options_gen.go new file mode 100644 index 00000000..39531faf --- /dev/null +++ b/pkg/gotd/tg/tl_account_passkey_registration_options_gen.go @@ -0,0 +1,161 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// AccountPasskeyRegistrationOptions represents TL type `account.passkeyRegistrationOptions#e16b5ce1`. +// +// See https://core.telegram.org/constructor/account.passkeyRegistrationOptions for reference. +type AccountPasskeyRegistrationOptions struct { + // Options field of AccountPasskeyRegistrationOptions. + Options DataJSON +} + +// AccountPasskeyRegistrationOptionsTypeID is TL type id of AccountPasskeyRegistrationOptions. +const AccountPasskeyRegistrationOptionsTypeID = 0xe16b5ce1 + +// Ensuring interfaces in compile-time for AccountPasskeyRegistrationOptions. +var ( + _ bin.Encoder = &AccountPasskeyRegistrationOptions{} + _ bin.Decoder = &AccountPasskeyRegistrationOptions{} + _ bin.BareEncoder = &AccountPasskeyRegistrationOptions{} + _ bin.BareDecoder = &AccountPasskeyRegistrationOptions{} +) + +func (p *AccountPasskeyRegistrationOptions) Zero() bool { + if p == nil { + return true + } + if !(p.Options.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *AccountPasskeyRegistrationOptions) String() string { + if p == nil { + return "AccountPasskeyRegistrationOptions(nil)" + } + type Alias AccountPasskeyRegistrationOptions + return fmt.Sprintf("AccountPasskeyRegistrationOptions%+v", Alias(*p)) +} + +// FillFrom fills AccountPasskeyRegistrationOptions from given interface. +func (p *AccountPasskeyRegistrationOptions) FillFrom(from interface { + GetOptions() (value DataJSON) +}) { + p.Options = from.GetOptions() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountPasskeyRegistrationOptions) TypeID() uint32 { + return AccountPasskeyRegistrationOptionsTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountPasskeyRegistrationOptions) TypeName() string { + return "account.passkeyRegistrationOptions" +} + +// TypeInfo returns info about TL type. +func (p *AccountPasskeyRegistrationOptions) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.passkeyRegistrationOptions", + ID: AccountPasskeyRegistrationOptionsTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Options", + SchemaName: "options", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *AccountPasskeyRegistrationOptions) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode account.passkeyRegistrationOptions#e16b5ce1 as nil") + } + b.PutID(AccountPasskeyRegistrationOptionsTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *AccountPasskeyRegistrationOptions) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode account.passkeyRegistrationOptions#e16b5ce1 as nil") + } + if err := p.Options.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.passkeyRegistrationOptions#e16b5ce1: field options: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *AccountPasskeyRegistrationOptions) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode account.passkeyRegistrationOptions#e16b5ce1 to nil") + } + if err := b.ConsumeID(AccountPasskeyRegistrationOptionsTypeID); err != nil { + return fmt.Errorf("unable to decode account.passkeyRegistrationOptions#e16b5ce1: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *AccountPasskeyRegistrationOptions) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode account.passkeyRegistrationOptions#e16b5ce1 to nil") + } + { + if err := p.Options.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.passkeyRegistrationOptions#e16b5ce1: field options: %w", err) + } + } + return nil +} + +// GetOptions returns value of Options field. +func (p *AccountPasskeyRegistrationOptions) GetOptions() (value DataJSON) { + if p == nil { + return + } + return p.Options +} diff --git a/pkg/gotd/tg/tl_account_passkey_registration_options_slices_gen.go b/pkg/gotd/tg/tl_account_passkey_registration_options_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_account_passkey_registration_options_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_account_passkeys_gen.go b/pkg/gotd/tg/tl_account_passkeys_gen.go new file mode 100644 index 00000000..6a9476d9 --- /dev/null +++ b/pkg/gotd/tg/tl_account_passkeys_gen.go @@ -0,0 +1,176 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// AccountPasskeys represents TL type `account.passkeys#f8e0aa1c`. +// +// See https://core.telegram.org/constructor/account.passkeys for reference. +type AccountPasskeys struct { + // Passkeys field of AccountPasskeys. + Passkeys []Passkey +} + +// AccountPasskeysTypeID is TL type id of AccountPasskeys. +const AccountPasskeysTypeID = 0xf8e0aa1c + +// Ensuring interfaces in compile-time for AccountPasskeys. +var ( + _ bin.Encoder = &AccountPasskeys{} + _ bin.Decoder = &AccountPasskeys{} + _ bin.BareEncoder = &AccountPasskeys{} + _ bin.BareDecoder = &AccountPasskeys{} +) + +func (p *AccountPasskeys) Zero() bool { + if p == nil { + return true + } + if !(p.Passkeys == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *AccountPasskeys) String() string { + if p == nil { + return "AccountPasskeys(nil)" + } + type Alias AccountPasskeys + return fmt.Sprintf("AccountPasskeys%+v", Alias(*p)) +} + +// FillFrom fills AccountPasskeys from given interface. +func (p *AccountPasskeys) FillFrom(from interface { + GetPasskeys() (value []Passkey) +}) { + p.Passkeys = from.GetPasskeys() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountPasskeys) TypeID() uint32 { + return AccountPasskeysTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountPasskeys) TypeName() string { + return "account.passkeys" +} + +// TypeInfo returns info about TL type. +func (p *AccountPasskeys) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.passkeys", + ID: AccountPasskeysTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Passkeys", + SchemaName: "passkeys", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *AccountPasskeys) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode account.passkeys#f8e0aa1c as nil") + } + b.PutID(AccountPasskeysTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *AccountPasskeys) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode account.passkeys#f8e0aa1c as nil") + } + b.PutVectorHeader(len(p.Passkeys)) + for idx, v := range p.Passkeys { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.passkeys#f8e0aa1c: field passkeys element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (p *AccountPasskeys) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode account.passkeys#f8e0aa1c to nil") + } + if err := b.ConsumeID(AccountPasskeysTypeID); err != nil { + return fmt.Errorf("unable to decode account.passkeys#f8e0aa1c: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *AccountPasskeys) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode account.passkeys#f8e0aa1c to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode account.passkeys#f8e0aa1c: field passkeys: %w", err) + } + + if headerLen > 0 { + p.Passkeys = make([]Passkey, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value Passkey + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode account.passkeys#f8e0aa1c: field passkeys: %w", err) + } + p.Passkeys = append(p.Passkeys, value) + } + } + return nil +} + +// GetPasskeys returns value of Passkeys field. +func (p *AccountPasskeys) GetPasskeys() (value []Passkey) { + if p == nil { + return + } + return p.Passkeys +} diff --git a/pkg/gotd/tg/tl_account_passkeys_slices_gen.go b/pkg/gotd/tg/tl_account_passkeys_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_account_passkeys_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_account_register_passkey_gen.go b/pkg/gotd/tg/tl_account_register_passkey_gen.go new file mode 100644 index 00000000..67b355af --- /dev/null +++ b/pkg/gotd/tg/tl_account_register_passkey_gen.go @@ -0,0 +1,181 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// AccountRegisterPasskeyRequest represents TL type `account.registerPasskey#55b41fd6`. +// +// See https://core.telegram.org/method/account.registerPasskey for reference. +type AccountRegisterPasskeyRequest struct { + // Credential field of AccountRegisterPasskeyRequest. + Credential InputPasskeyCredentialClass +} + +// AccountRegisterPasskeyRequestTypeID is TL type id of AccountRegisterPasskeyRequest. +const AccountRegisterPasskeyRequestTypeID = 0x55b41fd6 + +// Ensuring interfaces in compile-time for AccountRegisterPasskeyRequest. +var ( + _ bin.Encoder = &AccountRegisterPasskeyRequest{} + _ bin.Decoder = &AccountRegisterPasskeyRequest{} + _ bin.BareEncoder = &AccountRegisterPasskeyRequest{} + _ bin.BareDecoder = &AccountRegisterPasskeyRequest{} +) + +func (r *AccountRegisterPasskeyRequest) Zero() bool { + if r == nil { + return true + } + if !(r.Credential == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *AccountRegisterPasskeyRequest) String() string { + if r == nil { + return "AccountRegisterPasskeyRequest(nil)" + } + type Alias AccountRegisterPasskeyRequest + return fmt.Sprintf("AccountRegisterPasskeyRequest%+v", Alias(*r)) +} + +// FillFrom fills AccountRegisterPasskeyRequest from given interface. +func (r *AccountRegisterPasskeyRequest) FillFrom(from interface { + GetCredential() (value InputPasskeyCredentialClass) +}) { + r.Credential = from.GetCredential() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountRegisterPasskeyRequest) TypeID() uint32 { + return AccountRegisterPasskeyRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountRegisterPasskeyRequest) TypeName() string { + return "account.registerPasskey" +} + +// TypeInfo returns info about TL type. +func (r *AccountRegisterPasskeyRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.registerPasskey", + ID: AccountRegisterPasskeyRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Credential", + SchemaName: "credential", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *AccountRegisterPasskeyRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode account.registerPasskey#55b41fd6 as nil") + } + b.PutID(AccountRegisterPasskeyRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *AccountRegisterPasskeyRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode account.registerPasskey#55b41fd6 as nil") + } + if r.Credential == nil { + return fmt.Errorf("unable to encode account.registerPasskey#55b41fd6: field credential is nil") + } + if err := r.Credential.Encode(b); err != nil { + return fmt.Errorf("unable to encode account.registerPasskey#55b41fd6: field credential: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (r *AccountRegisterPasskeyRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode account.registerPasskey#55b41fd6 to nil") + } + if err := b.ConsumeID(AccountRegisterPasskeyRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.registerPasskey#55b41fd6: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *AccountRegisterPasskeyRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode account.registerPasskey#55b41fd6 to nil") + } + { + value, err := DecodeInputPasskeyCredential(b) + if err != nil { + return fmt.Errorf("unable to decode account.registerPasskey#55b41fd6: field credential: %w", err) + } + r.Credential = value + } + return nil +} + +// GetCredential returns value of Credential field. +func (r *AccountRegisterPasskeyRequest) GetCredential() (value InputPasskeyCredentialClass) { + if r == nil { + return + } + return r.Credential +} + +// AccountRegisterPasskey invokes method account.registerPasskey#55b41fd6 returning error if any. +// +// See https://core.telegram.org/method/account.registerPasskey for reference. +func (c *Client) AccountRegisterPasskey(ctx context.Context, credential InputPasskeyCredentialClass) (*Passkey, error) { + var result Passkey + + request := &AccountRegisterPasskeyRequest{ + Credential: credential, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/pkg/gotd/tg/tl_account_register_passkey_slices_gen.go b/pkg/gotd/tg/tl_account_register_passkey_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_account_register_passkey_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_auth_finish_passkey_login_gen.go b/pkg/gotd/tg/tl_auth_finish_passkey_login_gen.go new file mode 100644 index 00000000..bf3eab72 --- /dev/null +++ b/pkg/gotd/tg/tl_auth_finish_passkey_login_gen.go @@ -0,0 +1,292 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// AuthFinishPasskeyLoginRequest represents TL type `auth.finishPasskeyLogin#9857ad07`. +// +// See https://core.telegram.org/method/auth.finishPasskeyLogin for reference. +type AuthFinishPasskeyLoginRequest struct { + // Flags field of AuthFinishPasskeyLoginRequest. + Flags bin.Fields + // Credential field of AuthFinishPasskeyLoginRequest. + Credential InputPasskeyCredentialClass + // FromDCID field of AuthFinishPasskeyLoginRequest. + // + // Use SetFromDCID and GetFromDCID helpers. + FromDCID int + // FromAuthKeyID field of AuthFinishPasskeyLoginRequest. + // + // Use SetFromAuthKeyID and GetFromAuthKeyID helpers. + FromAuthKeyID int64 +} + +// AuthFinishPasskeyLoginRequestTypeID is TL type id of AuthFinishPasskeyLoginRequest. +const AuthFinishPasskeyLoginRequestTypeID = 0x9857ad07 + +// Ensuring interfaces in compile-time for AuthFinishPasskeyLoginRequest. +var ( + _ bin.Encoder = &AuthFinishPasskeyLoginRequest{} + _ bin.Decoder = &AuthFinishPasskeyLoginRequest{} + _ bin.BareEncoder = &AuthFinishPasskeyLoginRequest{} + _ bin.BareDecoder = &AuthFinishPasskeyLoginRequest{} +) + +func (f *AuthFinishPasskeyLoginRequest) Zero() bool { + if f == nil { + return true + } + if !(f.Flags.Zero()) { + return false + } + if !(f.Credential == nil) { + return false + } + if !(f.FromDCID == 0) { + return false + } + if !(f.FromAuthKeyID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (f *AuthFinishPasskeyLoginRequest) String() string { + if f == nil { + return "AuthFinishPasskeyLoginRequest(nil)" + } + type Alias AuthFinishPasskeyLoginRequest + return fmt.Sprintf("AuthFinishPasskeyLoginRequest%+v", Alias(*f)) +} + +// FillFrom fills AuthFinishPasskeyLoginRequest from given interface. +func (f *AuthFinishPasskeyLoginRequest) FillFrom(from interface { + GetCredential() (value InputPasskeyCredentialClass) + GetFromDCID() (value int, ok bool) + GetFromAuthKeyID() (value int64, ok bool) +}) { + f.Credential = from.GetCredential() + if val, ok := from.GetFromDCID(); ok { + f.FromDCID = val + } + + if val, ok := from.GetFromAuthKeyID(); ok { + f.FromAuthKeyID = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AuthFinishPasskeyLoginRequest) TypeID() uint32 { + return AuthFinishPasskeyLoginRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AuthFinishPasskeyLoginRequest) TypeName() string { + return "auth.finishPasskeyLogin" +} + +// TypeInfo returns info about TL type. +func (f *AuthFinishPasskeyLoginRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "auth.finishPasskeyLogin", + ID: AuthFinishPasskeyLoginRequestTypeID, + } + if f == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Credential", + SchemaName: "credential", + }, + { + Name: "FromDCID", + SchemaName: "from_dc_id", + Null: !f.Flags.Has(0), + }, + { + Name: "FromAuthKeyID", + SchemaName: "from_auth_key_id", + Null: !f.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (f *AuthFinishPasskeyLoginRequest) SetFlags() { + if !(f.FromDCID == 0) { + f.Flags.Set(0) + } + if !(f.FromAuthKeyID == 0) { + f.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (f *AuthFinishPasskeyLoginRequest) Encode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode auth.finishPasskeyLogin#9857ad07 as nil") + } + b.PutID(AuthFinishPasskeyLoginRequestTypeID) + return f.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (f *AuthFinishPasskeyLoginRequest) EncodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't encode auth.finishPasskeyLogin#9857ad07 as nil") + } + f.SetFlags() + if err := f.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode auth.finishPasskeyLogin#9857ad07: field flags: %w", err) + } + if f.Credential == nil { + return fmt.Errorf("unable to encode auth.finishPasskeyLogin#9857ad07: field credential is nil") + } + if err := f.Credential.Encode(b); err != nil { + return fmt.Errorf("unable to encode auth.finishPasskeyLogin#9857ad07: field credential: %w", err) + } + if f.Flags.Has(0) { + b.PutInt(f.FromDCID) + } + if f.Flags.Has(0) { + b.PutLong(f.FromAuthKeyID) + } + return nil +} + +// Decode implements bin.Decoder. +func (f *AuthFinishPasskeyLoginRequest) Decode(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode auth.finishPasskeyLogin#9857ad07 to nil") + } + if err := b.ConsumeID(AuthFinishPasskeyLoginRequestTypeID); err != nil { + return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: %w", err) + } + return f.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (f *AuthFinishPasskeyLoginRequest) DecodeBare(b *bin.Buffer) error { + if f == nil { + return fmt.Errorf("can't decode auth.finishPasskeyLogin#9857ad07 to nil") + } + { + if err := f.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: field flags: %w", err) + } + } + { + value, err := DecodeInputPasskeyCredential(b) + if err != nil { + return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: field credential: %w", err) + } + f.Credential = value + } + if f.Flags.Has(0) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: field from_dc_id: %w", err) + } + f.FromDCID = value + } + if f.Flags.Has(0) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: field from_auth_key_id: %w", err) + } + f.FromAuthKeyID = value + } + return nil +} + +// GetCredential returns value of Credential field. +func (f *AuthFinishPasskeyLoginRequest) GetCredential() (value InputPasskeyCredentialClass) { + if f == nil { + return + } + return f.Credential +} + +// SetFromDCID sets value of FromDCID conditional field. +func (f *AuthFinishPasskeyLoginRequest) SetFromDCID(value int) { + f.Flags.Set(0) + f.FromDCID = value +} + +// GetFromDCID returns value of FromDCID conditional field and +// boolean which is true if field was set. +func (f *AuthFinishPasskeyLoginRequest) GetFromDCID() (value int, ok bool) { + if f == nil { + return + } + if !f.Flags.Has(0) { + return value, false + } + return f.FromDCID, true +} + +// SetFromAuthKeyID sets value of FromAuthKeyID conditional field. +func (f *AuthFinishPasskeyLoginRequest) SetFromAuthKeyID(value int64) { + f.Flags.Set(0) + f.FromAuthKeyID = value +} + +// GetFromAuthKeyID returns value of FromAuthKeyID conditional field and +// boolean which is true if field was set. +func (f *AuthFinishPasskeyLoginRequest) GetFromAuthKeyID() (value int64, ok bool) { + if f == nil { + return + } + if !f.Flags.Has(0) { + return value, false + } + return f.FromAuthKeyID, true +} + +// AuthFinishPasskeyLogin invokes method auth.finishPasskeyLogin#9857ad07 returning error if any. +// +// See https://core.telegram.org/method/auth.finishPasskeyLogin for reference. +func (c *Client) AuthFinishPasskeyLogin(ctx context.Context, request *AuthFinishPasskeyLoginRequest) (AuthAuthorizationClass, error) { + var result AuthAuthorizationBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Authorization, nil +} diff --git a/pkg/gotd/tg/tl_auth_finish_passkey_login_slices_gen.go b/pkg/gotd/tg/tl_auth_finish_passkey_login_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_auth_finish_passkey_login_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_auth_init_passkey_login_gen.go b/pkg/gotd/tg/tl_auth_init_passkey_login_gen.go new file mode 100644 index 00000000..0d4a53dd --- /dev/null +++ b/pkg/gotd/tg/tl_auth_init_passkey_login_gen.go @@ -0,0 +1,200 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// AuthInitPasskeyLoginRequest represents TL type `auth.initPasskeyLogin#518ad0b7`. +// +// See https://core.telegram.org/method/auth.initPasskeyLogin for reference. +type AuthInitPasskeyLoginRequest struct { + // APIID field of AuthInitPasskeyLoginRequest. + APIID int + // APIHash field of AuthInitPasskeyLoginRequest. + APIHash string +} + +// AuthInitPasskeyLoginRequestTypeID is TL type id of AuthInitPasskeyLoginRequest. +const AuthInitPasskeyLoginRequestTypeID = 0x518ad0b7 + +// Ensuring interfaces in compile-time for AuthInitPasskeyLoginRequest. +var ( + _ bin.Encoder = &AuthInitPasskeyLoginRequest{} + _ bin.Decoder = &AuthInitPasskeyLoginRequest{} + _ bin.BareEncoder = &AuthInitPasskeyLoginRequest{} + _ bin.BareDecoder = &AuthInitPasskeyLoginRequest{} +) + +func (i *AuthInitPasskeyLoginRequest) Zero() bool { + if i == nil { + return true + } + if !(i.APIID == 0) { + return false + } + if !(i.APIHash == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *AuthInitPasskeyLoginRequest) String() string { + if i == nil { + return "AuthInitPasskeyLoginRequest(nil)" + } + type Alias AuthInitPasskeyLoginRequest + return fmt.Sprintf("AuthInitPasskeyLoginRequest%+v", Alias(*i)) +} + +// FillFrom fills AuthInitPasskeyLoginRequest from given interface. +func (i *AuthInitPasskeyLoginRequest) FillFrom(from interface { + GetAPIID() (value int) + GetAPIHash() (value string) +}) { + i.APIID = from.GetAPIID() + i.APIHash = from.GetAPIHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AuthInitPasskeyLoginRequest) TypeID() uint32 { + return AuthInitPasskeyLoginRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AuthInitPasskeyLoginRequest) TypeName() string { + return "auth.initPasskeyLogin" +} + +// TypeInfo returns info about TL type. +func (i *AuthInitPasskeyLoginRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "auth.initPasskeyLogin", + ID: AuthInitPasskeyLoginRequestTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "APIID", + SchemaName: "api_id", + }, + { + Name: "APIHash", + SchemaName: "api_hash", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *AuthInitPasskeyLoginRequest) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode auth.initPasskeyLogin#518ad0b7 as nil") + } + b.PutID(AuthInitPasskeyLoginRequestTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *AuthInitPasskeyLoginRequest) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode auth.initPasskeyLogin#518ad0b7 as nil") + } + b.PutInt(i.APIID) + b.PutString(i.APIHash) + return nil +} + +// Decode implements bin.Decoder. +func (i *AuthInitPasskeyLoginRequest) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode auth.initPasskeyLogin#518ad0b7 to nil") + } + if err := b.ConsumeID(AuthInitPasskeyLoginRequestTypeID); err != nil { + return fmt.Errorf("unable to decode auth.initPasskeyLogin#518ad0b7: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *AuthInitPasskeyLoginRequest) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode auth.initPasskeyLogin#518ad0b7 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode auth.initPasskeyLogin#518ad0b7: field api_id: %w", err) + } + i.APIID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode auth.initPasskeyLogin#518ad0b7: field api_hash: %w", err) + } + i.APIHash = value + } + return nil +} + +// GetAPIID returns value of APIID field. +func (i *AuthInitPasskeyLoginRequest) GetAPIID() (value int) { + if i == nil { + return + } + return i.APIID +} + +// GetAPIHash returns value of APIHash field. +func (i *AuthInitPasskeyLoginRequest) GetAPIHash() (value string) { + if i == nil { + return + } + return i.APIHash +} + +// AuthInitPasskeyLogin invokes method auth.initPasskeyLogin#518ad0b7 returning error if any. +// +// See https://core.telegram.org/method/auth.initPasskeyLogin for reference. +func (c *Client) AuthInitPasskeyLogin(ctx context.Context, request *AuthInitPasskeyLoginRequest) (*AuthPasskeyLoginOptions, error) { + var result AuthPasskeyLoginOptions + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/pkg/gotd/tg/tl_auth_init_passkey_login_slices_gen.go b/pkg/gotd/tg/tl_auth_init_passkey_login_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_auth_init_passkey_login_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_auth_passkey_login_options_gen.go b/pkg/gotd/tg/tl_auth_passkey_login_options_gen.go new file mode 100644 index 00000000..3f0a05c6 --- /dev/null +++ b/pkg/gotd/tg/tl_auth_passkey_login_options_gen.go @@ -0,0 +1,161 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// AuthPasskeyLoginOptions represents TL type `auth.passkeyLoginOptions#e2037789`. +// +// See https://core.telegram.org/constructor/auth.passkeyLoginOptions for reference. +type AuthPasskeyLoginOptions struct { + // Options field of AuthPasskeyLoginOptions. + Options DataJSON +} + +// AuthPasskeyLoginOptionsTypeID is TL type id of AuthPasskeyLoginOptions. +const AuthPasskeyLoginOptionsTypeID = 0xe2037789 + +// Ensuring interfaces in compile-time for AuthPasskeyLoginOptions. +var ( + _ bin.Encoder = &AuthPasskeyLoginOptions{} + _ bin.Decoder = &AuthPasskeyLoginOptions{} + _ bin.BareEncoder = &AuthPasskeyLoginOptions{} + _ bin.BareDecoder = &AuthPasskeyLoginOptions{} +) + +func (p *AuthPasskeyLoginOptions) Zero() bool { + if p == nil { + return true + } + if !(p.Options.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *AuthPasskeyLoginOptions) String() string { + if p == nil { + return "AuthPasskeyLoginOptions(nil)" + } + type Alias AuthPasskeyLoginOptions + return fmt.Sprintf("AuthPasskeyLoginOptions%+v", Alias(*p)) +} + +// FillFrom fills AuthPasskeyLoginOptions from given interface. +func (p *AuthPasskeyLoginOptions) FillFrom(from interface { + GetOptions() (value DataJSON) +}) { + p.Options = from.GetOptions() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AuthPasskeyLoginOptions) TypeID() uint32 { + return AuthPasskeyLoginOptionsTypeID +} + +// TypeName returns name of type in TL schema. +func (*AuthPasskeyLoginOptions) TypeName() string { + return "auth.passkeyLoginOptions" +} + +// TypeInfo returns info about TL type. +func (p *AuthPasskeyLoginOptions) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "auth.passkeyLoginOptions", + ID: AuthPasskeyLoginOptionsTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Options", + SchemaName: "options", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *AuthPasskeyLoginOptions) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode auth.passkeyLoginOptions#e2037789 as nil") + } + b.PutID(AuthPasskeyLoginOptionsTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *AuthPasskeyLoginOptions) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode auth.passkeyLoginOptions#e2037789 as nil") + } + if err := p.Options.Encode(b); err != nil { + return fmt.Errorf("unable to encode auth.passkeyLoginOptions#e2037789: field options: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *AuthPasskeyLoginOptions) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode auth.passkeyLoginOptions#e2037789 to nil") + } + if err := b.ConsumeID(AuthPasskeyLoginOptionsTypeID); err != nil { + return fmt.Errorf("unable to decode auth.passkeyLoginOptions#e2037789: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *AuthPasskeyLoginOptions) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode auth.passkeyLoginOptions#e2037789 to nil") + } + { + if err := p.Options.Decode(b); err != nil { + return fmt.Errorf("unable to decode auth.passkeyLoginOptions#e2037789: field options: %w", err) + } + } + return nil +} + +// GetOptions returns value of Options field. +func (p *AuthPasskeyLoginOptions) GetOptions() (value DataJSON) { + if p == nil { + return + } + return p.Options +} diff --git a/pkg/gotd/tg/tl_auth_passkey_login_options_slices_gen.go b/pkg/gotd/tg/tl_auth_passkey_login_options_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_auth_passkey_login_options_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_channel_admin_log_event_action_gen.go b/pkg/gotd/tg/tl_channel_admin_log_event_action_gen.go index c903f383..0b22227a 100644 --- a/pkg/gotd/tg/tl_channel_admin_log_event_action_gen.go +++ b/pkg/gotd/tg/tl_channel_admin_log_event_action_gen.go @@ -8056,6 +8056,196 @@ func (c *ChannelAdminLogEventActionToggleAutotranslation) GetNewValue() (value b return c.NewValue } +// ChannelAdminLogEventActionParticipantEditRank represents TL type `channelAdminLogEventActionParticipantEditRank#5806b4ec`. +// +// See https://core.telegram.org/constructor/channelAdminLogEventActionParticipantEditRank for reference. +type ChannelAdminLogEventActionParticipantEditRank struct { + // UserID field of ChannelAdminLogEventActionParticipantEditRank. + UserID int64 + // PrevRank field of ChannelAdminLogEventActionParticipantEditRank. + PrevRank string + // NewRank field of ChannelAdminLogEventActionParticipantEditRank. + NewRank string +} + +// ChannelAdminLogEventActionParticipantEditRankTypeID is TL type id of ChannelAdminLogEventActionParticipantEditRank. +const ChannelAdminLogEventActionParticipantEditRankTypeID = 0x5806b4ec + +// construct implements constructor of ChannelAdminLogEventActionClass. +func (c ChannelAdminLogEventActionParticipantEditRank) construct() ChannelAdminLogEventActionClass { + return &c +} + +// Ensuring interfaces in compile-time for ChannelAdminLogEventActionParticipantEditRank. +var ( + _ bin.Encoder = &ChannelAdminLogEventActionParticipantEditRank{} + _ bin.Decoder = &ChannelAdminLogEventActionParticipantEditRank{} + _ bin.BareEncoder = &ChannelAdminLogEventActionParticipantEditRank{} + _ bin.BareDecoder = &ChannelAdminLogEventActionParticipantEditRank{} + + _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionParticipantEditRank{} +) + +func (c *ChannelAdminLogEventActionParticipantEditRank) Zero() bool { + if c == nil { + return true + } + if !(c.UserID == 0) { + return false + } + if !(c.PrevRank == "") { + return false + } + if !(c.NewRank == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChannelAdminLogEventActionParticipantEditRank) String() string { + if c == nil { + return "ChannelAdminLogEventActionParticipantEditRank(nil)" + } + type Alias ChannelAdminLogEventActionParticipantEditRank + return fmt.Sprintf("ChannelAdminLogEventActionParticipantEditRank%+v", Alias(*c)) +} + +// FillFrom fills ChannelAdminLogEventActionParticipantEditRank from given interface. +func (c *ChannelAdminLogEventActionParticipantEditRank) FillFrom(from interface { + GetUserID() (value int64) + GetPrevRank() (value string) + GetNewRank() (value string) +}) { + c.UserID = from.GetUserID() + c.PrevRank = from.GetPrevRank() + c.NewRank = from.GetNewRank() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelAdminLogEventActionParticipantEditRank) TypeID() uint32 { + return ChannelAdminLogEventActionParticipantEditRankTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelAdminLogEventActionParticipantEditRank) TypeName() string { + return "channelAdminLogEventActionParticipantEditRank" +} + +// TypeInfo returns info about TL type. +func (c *ChannelAdminLogEventActionParticipantEditRank) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channelAdminLogEventActionParticipantEditRank", + ID: ChannelAdminLogEventActionParticipantEditRankTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "PrevRank", + SchemaName: "prev_rank", + }, + { + Name: "NewRank", + SchemaName: "new_rank", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChannelAdminLogEventActionParticipantEditRank) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionParticipantEditRank#5806b4ec as nil") + } + b.PutID(ChannelAdminLogEventActionParticipantEditRankTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChannelAdminLogEventActionParticipantEditRank) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionParticipantEditRank#5806b4ec as nil") + } + b.PutLong(c.UserID) + b.PutString(c.PrevRank) + b.PutString(c.NewRank) + return nil +} + +// Decode implements bin.Decoder. +func (c *ChannelAdminLogEventActionParticipantEditRank) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionParticipantEditRank#5806b4ec to nil") + } + if err := b.ConsumeID(ChannelAdminLogEventActionParticipantEditRankTypeID); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantEditRank#5806b4ec: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChannelAdminLogEventActionParticipantEditRank) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionParticipantEditRank#5806b4ec to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantEditRank#5806b4ec: field user_id: %w", err) + } + c.UserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantEditRank#5806b4ec: field prev_rank: %w", err) + } + c.PrevRank = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantEditRank#5806b4ec: field new_rank: %w", err) + } + c.NewRank = value + } + return nil +} + +// GetUserID returns value of UserID field. +func (c *ChannelAdminLogEventActionParticipantEditRank) GetUserID() (value int64) { + if c == nil { + return + } + return c.UserID +} + +// GetPrevRank returns value of PrevRank field. +func (c *ChannelAdminLogEventActionParticipantEditRank) GetPrevRank() (value string) { + if c == nil { + return + } + return c.PrevRank +} + +// GetNewRank returns value of NewRank field. +func (c *ChannelAdminLogEventActionParticipantEditRank) GetNewRank() (value string) { + if c == nil { + return + } + return c.NewRank +} + // ChannelAdminLogEventActionClassName is schema name of ChannelAdminLogEventActionClass. const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction" @@ -8121,6 +8311,7 @@ const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction" // case *tg.ChannelAdminLogEventActionToggleSignatureProfiles: // channelAdminLogEventActionToggleSignatureProfiles#60a79c79 // case *tg.ChannelAdminLogEventActionParticipantSubExtend: // channelAdminLogEventActionParticipantSubExtend#64642db3 // case *tg.ChannelAdminLogEventActionToggleAutotranslation: // channelAdminLogEventActionToggleAutotranslation#c517f77e +// case *tg.ChannelAdminLogEventActionParticipantEditRank: // channelAdminLogEventActionParticipantEditRank#5806b4ec // default: panic(v) // } type ChannelAdminLogEventActionClass interface { @@ -8506,6 +8697,13 @@ func DecodeChannelAdminLogEventAction(buf *bin.Buffer) (ChannelAdminLogEventActi return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) } return &v, nil + case ChannelAdminLogEventActionParticipantEditRankTypeID: + // Decoding channelAdminLogEventActionParticipantEditRank#5806b4ec. + v := ChannelAdminLogEventActionParticipantEditRank{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", bin.NewUnexpectedID(id)) } diff --git a/pkg/gotd/tg/tl_channel_admin_log_event_action_slices_gen.go b/pkg/gotd/tg/tl_channel_admin_log_event_action_slices_gen.go index e79b5b53..e41948a5 100644 --- a/pkg/gotd/tg/tl_channel_admin_log_event_action_slices_gen.go +++ b/pkg/gotd/tg/tl_channel_admin_log_event_action_slices_gen.go @@ -753,6 +753,19 @@ func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionToggle return to } +// AsChannelAdminLogEventActionParticipantEditRank returns copy with only ChannelAdminLogEventActionParticipantEditRank constructors. +func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionParticipantEditRank() (to ChannelAdminLogEventActionParticipantEditRankArray) { + for _, elem := range s { + value, ok := elem.(*ChannelAdminLogEventActionParticipantEditRank) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // ChannelAdminLogEventActionChangeTitleArray is adapter for slice of ChannelAdminLogEventActionChangeTitle. type ChannelAdminLogEventActionChangeTitleArray []ChannelAdminLogEventActionChangeTitle @@ -4770,3 +4783,85 @@ func (s *ChannelAdminLogEventActionToggleAutotranslationArray) Pop() (v ChannelA return v, true } + +// ChannelAdminLogEventActionParticipantEditRankArray is adapter for slice of ChannelAdminLogEventActionParticipantEditRank. +type ChannelAdminLogEventActionParticipantEditRankArray []ChannelAdminLogEventActionParticipantEditRank + +// Sort sorts slice of ChannelAdminLogEventActionParticipantEditRank. +func (s ChannelAdminLogEventActionParticipantEditRankArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantEditRank) bool) ChannelAdminLogEventActionParticipantEditRankArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of ChannelAdminLogEventActionParticipantEditRank. +func (s ChannelAdminLogEventActionParticipantEditRankArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantEditRank) bool) ChannelAdminLogEventActionParticipantEditRankArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of ChannelAdminLogEventActionParticipantEditRank. +func (s ChannelAdminLogEventActionParticipantEditRankArray) Retain(keep func(x ChannelAdminLogEventActionParticipantEditRank) bool) ChannelAdminLogEventActionParticipantEditRankArray { + 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 ChannelAdminLogEventActionParticipantEditRankArray) First() (v ChannelAdminLogEventActionParticipantEditRank, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s ChannelAdminLogEventActionParticipantEditRankArray) Last() (v ChannelAdminLogEventActionParticipantEditRank, 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 *ChannelAdminLogEventActionParticipantEditRankArray) PopFirst() (v ChannelAdminLogEventActionParticipantEditRank, 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 ChannelAdminLogEventActionParticipantEditRank + 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 *ChannelAdminLogEventActionParticipantEditRankArray) Pop() (v ChannelAdminLogEventActionParticipantEditRank, 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/pkg/gotd/tg/tl_channel_admin_log_events_filter_gen.go b/pkg/gotd/tg/tl_channel_admin_log_events_filter_gen.go index 1c5e7a94..7f86b888 100644 --- a/pkg/gotd/tg/tl_channel_admin_log_events_filter_gen.go +++ b/pkg/gotd/tg/tl_channel_admin_log_events_filter_gen.go @@ -144,6 +144,8 @@ type ChannelAdminLogEventsFilter struct { // Links: // 1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantSubExtend SubExtend bool + // EditRank field of ChannelAdminLogEventsFilter. + EditRank bool } // ChannelAdminLogEventsFilterTypeID is TL type id of ChannelAdminLogEventsFilter. @@ -221,6 +223,9 @@ func (c *ChannelAdminLogEventsFilter) Zero() bool { if !(c.SubExtend == false) { return false } + if !(c.EditRank == false) { + return false + } return true } @@ -255,6 +260,7 @@ func (c *ChannelAdminLogEventsFilter) FillFrom(from interface { GetSend() (value bool) GetForums() (value bool) GetSubExtend() (value bool) + GetEditRank() (value bool) }) { c.Join = from.GetJoin() c.Leave = from.GetLeave() @@ -275,6 +281,7 @@ func (c *ChannelAdminLogEventsFilter) FillFrom(from interface { c.Send = from.GetSend() c.Forums = from.GetForums() c.SubExtend = from.GetSubExtend() + c.EditRank = from.GetEditRank() } // TypeID returns type id in TL schema. @@ -395,6 +402,11 @@ func (c *ChannelAdminLogEventsFilter) TypeInfo() tdp.Type { SchemaName: "sub_extend", Null: !c.Flags.Has(18), }, + { + Name: "EditRank", + SchemaName: "edit_rank", + Null: !c.Flags.Has(19), + }, } return typ } @@ -458,6 +470,9 @@ func (c *ChannelAdminLogEventsFilter) SetFlags() { if !(c.SubExtend == false) { c.Flags.Set(18) } + if !(c.EditRank == false) { + c.Flags.Set(19) + } } // Encode implements bin.Encoder. @@ -521,6 +536,7 @@ func (c *ChannelAdminLogEventsFilter) DecodeBare(b *bin.Buffer) error { c.Send = c.Flags.Has(16) c.Forums = c.Flags.Has(17) c.SubExtend = c.Flags.Has(18) + c.EditRank = c.Flags.Has(19) return nil } @@ -884,3 +900,22 @@ func (c *ChannelAdminLogEventsFilter) GetSubExtend() (value bool) { } return c.Flags.Has(18) } + +// SetEditRank sets value of EditRank conditional field. +func (c *ChannelAdminLogEventsFilter) SetEditRank(value bool) { + if value { + c.Flags.Set(19) + c.EditRank = true + } else { + c.Flags.Unset(19) + c.EditRank = false + } +} + +// GetEditRank returns value of EditRank conditional field. +func (c *ChannelAdminLogEventsFilter) GetEditRank() (value bool) { + if c == nil { + return + } + return c.Flags.Has(19) +} diff --git a/pkg/gotd/tg/tl_channel_participant_gen.go b/pkg/gotd/tg/tl_channel_participant_gen.go index 0bb8f2f1..ca695ae2 100644 --- a/pkg/gotd/tg/tl_channel_participant_gen.go +++ b/pkg/gotd/tg/tl_channel_participant_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChannelParticipant represents TL type `channelParticipant#cb397619`. +// ChannelParticipant represents TL type `channelParticipant#1bd54456`. // Channel/supergroup participant // // See https://core.telegram.org/constructor/channelParticipant for reference. @@ -53,10 +53,14 @@ type ChannelParticipant struct { // // Use SetSubscriptionUntilDate and GetSubscriptionUntilDate helpers. SubscriptionUntilDate int + // Rank field of ChannelParticipant. + // + // Use SetRank and GetRank helpers. + Rank string } // ChannelParticipantTypeID is TL type id of ChannelParticipant. -const ChannelParticipantTypeID = 0xcb397619 +const ChannelParticipantTypeID = 0x1bd54456 // construct implements constructor of ChannelParticipantClass. func (c ChannelParticipant) construct() ChannelParticipantClass { return &c } @@ -87,6 +91,9 @@ func (c *ChannelParticipant) Zero() bool { if !(c.SubscriptionUntilDate == 0) { return false } + if !(c.Rank == "") { + return false + } return true } @@ -105,6 +112,7 @@ func (c *ChannelParticipant) FillFrom(from interface { GetUserID() (value int64) GetDate() (value int) GetSubscriptionUntilDate() (value int, ok bool) + GetRank() (value string, ok bool) }) { c.UserID = from.GetUserID() c.Date = from.GetDate() @@ -112,6 +120,10 @@ func (c *ChannelParticipant) FillFrom(from interface { c.SubscriptionUntilDate = val } + if val, ok := from.GetRank(); ok { + c.Rank = val + } + } // TypeID returns type id in TL schema. @@ -150,6 +162,11 @@ func (c *ChannelParticipant) TypeInfo() tdp.Type { SchemaName: "subscription_until_date", Null: !c.Flags.Has(0), }, + { + Name: "Rank", + SchemaName: "rank", + Null: !c.Flags.Has(2), + }, } return typ } @@ -159,12 +176,15 @@ func (c *ChannelParticipant) SetFlags() { if !(c.SubscriptionUntilDate == 0) { c.Flags.Set(0) } + if !(c.Rank == "") { + c.Flags.Set(2) + } } // Encode implements bin.Encoder. func (c *ChannelParticipant) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipant#cb397619 as nil") + return fmt.Errorf("can't encode channelParticipant#1bd54456 as nil") } b.PutID(ChannelParticipantTypeID) return c.EncodeBare(b) @@ -173,27 +193,30 @@ func (c *ChannelParticipant) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChannelParticipant) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipant#cb397619 as nil") + return fmt.Errorf("can't encode channelParticipant#1bd54456 as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelParticipant#cb397619: field flags: %w", err) + return fmt.Errorf("unable to encode channelParticipant#1bd54456: field flags: %w", err) } b.PutLong(c.UserID) b.PutInt(c.Date) if c.Flags.Has(0) { b.PutInt(c.SubscriptionUntilDate) } + if c.Flags.Has(2) { + b.PutString(c.Rank) + } return nil } // Decode implements bin.Decoder. func (c *ChannelParticipant) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipant#cb397619 to nil") + return fmt.Errorf("can't decode channelParticipant#1bd54456 to nil") } if err := b.ConsumeID(ChannelParticipantTypeID); err != nil { - return fmt.Errorf("unable to decode channelParticipant#cb397619: %w", err) + return fmt.Errorf("unable to decode channelParticipant#1bd54456: %w", err) } return c.DecodeBare(b) } @@ -201,34 +224,41 @@ func (c *ChannelParticipant) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChannelParticipant) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipant#cb397619 to nil") + return fmt.Errorf("can't decode channelParticipant#1bd54456 to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelParticipant#cb397619: field flags: %w", err) + return fmt.Errorf("unable to decode channelParticipant#1bd54456: field flags: %w", err) } } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelParticipant#cb397619: field user_id: %w", err) + return fmt.Errorf("unable to decode channelParticipant#1bd54456: field user_id: %w", err) } c.UserID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelParticipant#cb397619: field date: %w", err) + return fmt.Errorf("unable to decode channelParticipant#1bd54456: field date: %w", err) } c.Date = value } if c.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelParticipant#cb397619: field subscription_until_date: %w", err) + return fmt.Errorf("unable to decode channelParticipant#1bd54456: field subscription_until_date: %w", err) } c.SubscriptionUntilDate = value } + if c.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode channelParticipant#1bd54456: field rank: %w", err) + } + c.Rank = value + } return nil } @@ -266,7 +296,25 @@ func (c *ChannelParticipant) GetSubscriptionUntilDate() (value int, ok bool) { return c.SubscriptionUntilDate, true } -// ChannelParticipantSelf represents TL type `channelParticipantSelf#4f607bef`. +// SetRank sets value of Rank conditional field. +func (c *ChannelParticipant) SetRank(value string) { + c.Flags.Set(2) + c.Rank = value +} + +// GetRank returns value of Rank conditional field and +// boolean which is true if field was set. +func (c *ChannelParticipant) GetRank() (value string, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(2) { + return value, false + } + return c.Rank, true +} + +// ChannelParticipantSelf represents TL type `channelParticipantSelf#a9478a1a`. // Myself // // See https://core.telegram.org/constructor/channelParticipantSelf for reference. @@ -292,10 +340,14 @@ type ChannelParticipantSelf struct { // // Use SetSubscriptionUntilDate and GetSubscriptionUntilDate helpers. SubscriptionUntilDate int + // Rank field of ChannelParticipantSelf. + // + // Use SetRank and GetRank helpers. + Rank string } // ChannelParticipantSelfTypeID is TL type id of ChannelParticipantSelf. -const ChannelParticipantSelfTypeID = 0x4f607bef +const ChannelParticipantSelfTypeID = 0xa9478a1a // construct implements constructor of ChannelParticipantClass. func (c ChannelParticipantSelf) construct() ChannelParticipantClass { return &c } @@ -332,6 +384,9 @@ func (c *ChannelParticipantSelf) Zero() bool { if !(c.SubscriptionUntilDate == 0) { return false } + if !(c.Rank == "") { + return false + } return true } @@ -352,6 +407,7 @@ func (c *ChannelParticipantSelf) FillFrom(from interface { GetInviterID() (value int64) GetDate() (value int) GetSubscriptionUntilDate() (value int, ok bool) + GetRank() (value string, ok bool) }) { c.ViaRequest = from.GetViaRequest() c.UserID = from.GetUserID() @@ -361,6 +417,10 @@ func (c *ChannelParticipantSelf) FillFrom(from interface { c.SubscriptionUntilDate = val } + if val, ok := from.GetRank(); ok { + c.Rank = val + } + } // TypeID returns type id in TL schema. @@ -408,6 +468,11 @@ func (c *ChannelParticipantSelf) TypeInfo() tdp.Type { SchemaName: "subscription_until_date", Null: !c.Flags.Has(1), }, + { + Name: "Rank", + SchemaName: "rank", + Null: !c.Flags.Has(2), + }, } return typ } @@ -420,12 +485,15 @@ func (c *ChannelParticipantSelf) SetFlags() { if !(c.SubscriptionUntilDate == 0) { c.Flags.Set(1) } + if !(c.Rank == "") { + c.Flags.Set(2) + } } // Encode implements bin.Encoder. func (c *ChannelParticipantSelf) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipantSelf#4f607bef as nil") + return fmt.Errorf("can't encode channelParticipantSelf#a9478a1a as nil") } b.PutID(ChannelParticipantSelfTypeID) return c.EncodeBare(b) @@ -434,11 +502,11 @@ func (c *ChannelParticipantSelf) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChannelParticipantSelf) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipantSelf#4f607bef as nil") + return fmt.Errorf("can't encode channelParticipantSelf#a9478a1a as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelParticipantSelf#4f607bef: field flags: %w", err) + return fmt.Errorf("unable to encode channelParticipantSelf#a9478a1a: field flags: %w", err) } b.PutLong(c.UserID) b.PutLong(c.InviterID) @@ -446,16 +514,19 @@ func (c *ChannelParticipantSelf) EncodeBare(b *bin.Buffer) error { if c.Flags.Has(1) { b.PutInt(c.SubscriptionUntilDate) } + if c.Flags.Has(2) { + b.PutString(c.Rank) + } return nil } // Decode implements bin.Decoder. func (c *ChannelParticipantSelf) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipantSelf#4f607bef to nil") + return fmt.Errorf("can't decode channelParticipantSelf#a9478a1a to nil") } if err := b.ConsumeID(ChannelParticipantSelfTypeID); err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: %w", err) } return c.DecodeBare(b) } @@ -463,42 +534,49 @@ func (c *ChannelParticipantSelf) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChannelParticipantSelf) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipantSelf#4f607bef to nil") + return fmt.Errorf("can't decode channelParticipantSelf#a9478a1a to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field flags: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field flags: %w", err) } } c.ViaRequest = c.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field user_id: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field user_id: %w", err) } c.UserID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field inviter_id: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field inviter_id: %w", err) } c.InviterID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field date: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field date: %w", err) } c.Date = value } if c.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field subscription_until_date: %w", err) + return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field subscription_until_date: %w", err) } c.SubscriptionUntilDate = value } + if c.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field rank: %w", err) + } + c.Rank = value + } return nil } @@ -563,6 +641,24 @@ func (c *ChannelParticipantSelf) GetSubscriptionUntilDate() (value int, ok bool) return c.SubscriptionUntilDate, true } +// SetRank sets value of Rank conditional field. +func (c *ChannelParticipantSelf) SetRank(value string) { + c.Flags.Set(2) + c.Rank = value +} + +// GetRank returns value of Rank conditional field and +// boolean which is true if field was set. +func (c *ChannelParticipantSelf) GetRank() (value string, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(2) { + return value, false + } + return c.Rank, true +} + // ChannelParticipantCreator represents TL type `channelParticipantCreator#2fe601d3`. // Channel/supergroup creator // @@ -1201,7 +1297,7 @@ func (c *ChannelParticipantAdmin) GetRank() (value string, ok bool) { return c.Rank, true } -// ChannelParticipantBanned represents TL type `channelParticipantBanned#6df8014e`. +// ChannelParticipantBanned represents TL type `channelParticipantBanned#d5f0ad91`. // Banned/kicked user // // See https://core.telegram.org/constructor/channelParticipantBanned for reference. @@ -1224,10 +1320,14 @@ type ChannelParticipantBanned struct { // Links: // 1) https://core.telegram.org/api/rights BannedRights ChatBannedRights + // Rank field of ChannelParticipantBanned. + // + // Use SetRank and GetRank helpers. + Rank string } // ChannelParticipantBannedTypeID is TL type id of ChannelParticipantBanned. -const ChannelParticipantBannedTypeID = 0x6df8014e +const ChannelParticipantBannedTypeID = 0xd5f0ad91 // construct implements constructor of ChannelParticipantClass. func (c ChannelParticipantBanned) construct() ChannelParticipantClass { return &c } @@ -1264,6 +1364,9 @@ func (c *ChannelParticipantBanned) Zero() bool { if !(c.BannedRights.Zero()) { return false } + if !(c.Rank == "") { + return false + } return true } @@ -1284,12 +1387,17 @@ func (c *ChannelParticipantBanned) FillFrom(from interface { GetKickedBy() (value int64) GetDate() (value int) GetBannedRights() (value ChatBannedRights) + GetRank() (value string, ok bool) }) { c.Left = from.GetLeft() c.Peer = from.GetPeer() c.KickedBy = from.GetKickedBy() c.Date = from.GetDate() c.BannedRights = from.GetBannedRights() + if val, ok := from.GetRank(); ok { + c.Rank = val + } + } // TypeID returns type id in TL schema. @@ -1336,6 +1444,11 @@ func (c *ChannelParticipantBanned) TypeInfo() tdp.Type { Name: "BannedRights", SchemaName: "banned_rights", }, + { + Name: "Rank", + SchemaName: "rank", + Null: !c.Flags.Has(2), + }, } return typ } @@ -1345,12 +1458,15 @@ func (c *ChannelParticipantBanned) SetFlags() { if !(c.Left == false) { c.Flags.Set(0) } + if !(c.Rank == "") { + c.Flags.Set(2) + } } // Encode implements bin.Encoder. func (c *ChannelParticipantBanned) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipantBanned#6df8014e as nil") + return fmt.Errorf("can't encode channelParticipantBanned#d5f0ad91 as nil") } b.PutID(ChannelParticipantBannedTypeID) return c.EncodeBare(b) @@ -1359,22 +1475,25 @@ func (c *ChannelParticipantBanned) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChannelParticipantBanned) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelParticipantBanned#6df8014e as nil") + return fmt.Errorf("can't encode channelParticipantBanned#d5f0ad91 as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelParticipantBanned#6df8014e: field flags: %w", err) + return fmt.Errorf("unable to encode channelParticipantBanned#d5f0ad91: field flags: %w", err) } if c.Peer == nil { - return fmt.Errorf("unable to encode channelParticipantBanned#6df8014e: field peer is nil") + return fmt.Errorf("unable to encode channelParticipantBanned#d5f0ad91: field peer is nil") } if err := c.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelParticipantBanned#6df8014e: field peer: %w", err) + return fmt.Errorf("unable to encode channelParticipantBanned#d5f0ad91: field peer: %w", err) } b.PutLong(c.KickedBy) b.PutInt(c.Date) if err := c.BannedRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelParticipantBanned#6df8014e: field banned_rights: %w", err) + return fmt.Errorf("unable to encode channelParticipantBanned#d5f0ad91: field banned_rights: %w", err) + } + if c.Flags.Has(2) { + b.PutString(c.Rank) } return nil } @@ -1382,10 +1501,10 @@ func (c *ChannelParticipantBanned) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChannelParticipantBanned) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipantBanned#6df8014e to nil") + return fmt.Errorf("can't decode channelParticipantBanned#d5f0ad91 to nil") } if err := b.ConsumeID(ChannelParticipantBannedTypeID); err != nil { - return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: %w", err) + return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: %w", err) } return c.DecodeBare(b) } @@ -1393,40 +1512,47 @@ func (c *ChannelParticipantBanned) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChannelParticipantBanned) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelParticipantBanned#6df8014e to nil") + return fmt.Errorf("can't decode channelParticipantBanned#d5f0ad91 to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field flags: %w", err) + return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field flags: %w", err) } } c.Left = c.Flags.Has(0) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field peer: %w", err) + return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field peer: %w", err) } c.Peer = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field kicked_by: %w", err) + return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field kicked_by: %w", err) } c.KickedBy = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field date: %w", err) + return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field date: %w", err) } c.Date = value } { if err := c.BannedRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field banned_rights: %w", err) + return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field banned_rights: %w", err) } } + if c.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field rank: %w", err) + } + c.Rank = value + } return nil } @@ -1481,6 +1607,24 @@ func (c *ChannelParticipantBanned) GetBannedRights() (value ChatBannedRights) { return c.BannedRights } +// SetRank sets value of Rank conditional field. +func (c *ChannelParticipantBanned) SetRank(value string) { + c.Flags.Set(2) + c.Rank = value +} + +// GetRank returns value of Rank conditional field and +// boolean which is true if field was set. +func (c *ChannelParticipantBanned) GetRank() (value string, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(2) { + return value, false + } + return c.Rank, true +} + // ChannelParticipantLeft represents TL type `channelParticipantLeft#1b03f006`. // A participant that left the channel/supergroup // @@ -1635,11 +1779,11 @@ const ChannelParticipantClassName = "ChannelParticipant" // panic(err) // } // switch v := g.(type) { -// case *tg.ChannelParticipant: // channelParticipant#cb397619 -// case *tg.ChannelParticipantSelf: // channelParticipantSelf#4f607bef +// case *tg.ChannelParticipant: // channelParticipant#1bd54456 +// case *tg.ChannelParticipantSelf: // channelParticipantSelf#a9478a1a // case *tg.ChannelParticipantCreator: // channelParticipantCreator#2fe601d3 // case *tg.ChannelParticipantAdmin: // channelParticipantAdmin#34c3bb53 -// case *tg.ChannelParticipantBanned: // channelParticipantBanned#6df8014e +// case *tg.ChannelParticipantBanned: // channelParticipantBanned#d5f0ad91 // case *tg.ChannelParticipantLeft: // channelParticipantLeft#1b03f006 // default: panic(v) // } @@ -1670,14 +1814,14 @@ func DecodeChannelParticipant(buf *bin.Buffer) (ChannelParticipantClass, error) } switch id { case ChannelParticipantTypeID: - // Decoding channelParticipant#cb397619. + // Decoding channelParticipant#1bd54456. v := ChannelParticipant{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChannelParticipantClass: %w", err) } return &v, nil case ChannelParticipantSelfTypeID: - // Decoding channelParticipantSelf#4f607bef. + // Decoding channelParticipantSelf#a9478a1a. v := ChannelParticipantSelf{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChannelParticipantClass: %w", err) @@ -1698,7 +1842,7 @@ func DecodeChannelParticipant(buf *bin.Buffer) (ChannelParticipantClass, error) } return &v, nil case ChannelParticipantBannedTypeID: - // Decoding channelParticipantBanned#6df8014e. + // Decoding channelParticipantBanned#d5f0ad91. v := ChannelParticipantBanned{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChannelParticipantClass: %w", err) diff --git a/pkg/gotd/tg/tl_channels_edit_admin_gen.go b/pkg/gotd/tg/tl_channels_edit_admin_gen.go index 6b7aefb2..72ed81cf 100644 --- a/pkg/gotd/tg/tl_channels_edit_admin_gen.go +++ b/pkg/gotd/tg/tl_channels_edit_admin_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChannelsEditAdminRequest represents TL type `channels.editAdmin#d33c8902`. +// ChannelsEditAdminRequest represents TL type `channels.editAdmin#9a98ad68`. // Modify the admin rights of a user in a supergroup/channel¹. // // Links: @@ -39,6 +39,8 @@ var ( // // See https://core.telegram.org/method/channels.editAdmin for reference. type ChannelsEditAdminRequest struct { + // Flags field of ChannelsEditAdminRequest. + Flags bin.Fields // The supergroup/channel¹. // // Links: @@ -49,11 +51,13 @@ type ChannelsEditAdminRequest struct { // The admin rights AdminRights ChatAdminRights // Indicates the role (rank) of the admin in the group: just an arbitrary string + // + // Use SetRank and GetRank helpers. Rank string } // ChannelsEditAdminRequestTypeID is TL type id of ChannelsEditAdminRequest. -const ChannelsEditAdminRequestTypeID = 0xd33c8902 +const ChannelsEditAdminRequestTypeID = 0x9a98ad68 // Ensuring interfaces in compile-time for ChannelsEditAdminRequest. var ( @@ -67,6 +71,9 @@ func (e *ChannelsEditAdminRequest) Zero() bool { if e == nil { return true } + if !(e.Flags.Zero()) { + return false + } if !(e.Channel == nil) { return false } @@ -97,12 +104,15 @@ func (e *ChannelsEditAdminRequest) FillFrom(from interface { GetChannel() (value InputChannelClass) GetUserID() (value InputUserClass) GetAdminRights() (value ChatAdminRights) - GetRank() (value string) + GetRank() (value string, ok bool) }) { e.Channel = from.GetChannel() e.UserID = from.GetUserID() e.AdminRights = from.GetAdminRights() - e.Rank = from.GetRank() + if val, ok := from.GetRank(); ok { + e.Rank = val + } + } // TypeID returns type id in TL schema. @@ -143,15 +153,23 @@ func (e *ChannelsEditAdminRequest) TypeInfo() tdp.Type { { Name: "Rank", SchemaName: "rank", + Null: !e.Flags.Has(0), }, } return typ } +// SetFlags sets flags for non-zero fields. +func (e *ChannelsEditAdminRequest) SetFlags() { + if !(e.Rank == "") { + e.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (e *ChannelsEditAdminRequest) Encode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode channels.editAdmin#d33c8902 as nil") + return fmt.Errorf("can't encode channels.editAdmin#9a98ad68 as nil") } b.PutID(ChannelsEditAdminRequestTypeID) return e.EncodeBare(b) @@ -160,34 +178,40 @@ func (e *ChannelsEditAdminRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (e *ChannelsEditAdminRequest) EncodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't encode channels.editAdmin#d33c8902 as nil") + return fmt.Errorf("can't encode channels.editAdmin#9a98ad68 as nil") + } + e.SetFlags() + if err := e.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field flags: %w", err) } if e.Channel == nil { - return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field channel is nil") + return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field channel is nil") } if err := e.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field channel: %w", err) + return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field channel: %w", err) } if e.UserID == nil { - return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field user_id is nil") + return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field user_id is nil") } if err := e.UserID.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field user_id: %w", err) + return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field user_id: %w", err) } if err := e.AdminRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field admin_rights: %w", err) + return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field admin_rights: %w", err) + } + if e.Flags.Has(0) { + b.PutString(e.Rank) } - b.PutString(e.Rank) return nil } // Decode implements bin.Decoder. func (e *ChannelsEditAdminRequest) Decode(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode channels.editAdmin#d33c8902 to nil") + return fmt.Errorf("can't decode channels.editAdmin#9a98ad68 to nil") } if err := b.ConsumeID(ChannelsEditAdminRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: %w", err) + return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: %w", err) } return e.DecodeBare(b) } @@ -195,31 +219,36 @@ func (e *ChannelsEditAdminRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (e *ChannelsEditAdminRequest) DecodeBare(b *bin.Buffer) error { if e == nil { - return fmt.Errorf("can't decode channels.editAdmin#d33c8902 to nil") + return fmt.Errorf("can't decode channels.editAdmin#9a98ad68 to nil") + } + { + if err := e.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field flags: %w", err) + } } { value, err := DecodeInputChannel(b) if err != nil { - return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: field channel: %w", err) + return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field channel: %w", err) } e.Channel = value } { value, err := DecodeInputUser(b) if err != nil { - return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: field user_id: %w", err) + return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field user_id: %w", err) } e.UserID = value } { if err := e.AdminRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: field admin_rights: %w", err) + return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field admin_rights: %w", err) } } - { + if e.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: field rank: %w", err) + return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field rank: %w", err) } e.Rank = value } @@ -250,12 +279,22 @@ func (e *ChannelsEditAdminRequest) GetAdminRights() (value ChatAdminRights) { return e.AdminRights } -// GetRank returns value of Rank field. -func (e *ChannelsEditAdminRequest) GetRank() (value string) { +// SetRank sets value of Rank conditional field. +func (e *ChannelsEditAdminRequest) SetRank(value string) { + e.Flags.Set(0) + e.Rank = value +} + +// GetRank returns value of Rank conditional field and +// boolean which is true if field was set. +func (e *ChannelsEditAdminRequest) GetRank() (value string, ok bool) { if e == nil { return } - return e.Rank + if !e.Flags.Has(0) { + return value, false + } + return e.Rank, true } // GetChannelAsNotEmpty returns mapped value of Channel field. @@ -263,7 +302,7 @@ func (e *ChannelsEditAdminRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, return e.Channel.AsNotEmpty() } -// ChannelsEditAdmin invokes method channels.editAdmin#d33c8902 returning error if any. +// ChannelsEditAdmin invokes method channels.editAdmin#9a98ad68 returning error if any. // Modify the admin rights of a user in a supergroup/channel¹. // // Links: diff --git a/pkg/gotd/tg/tl_channels_edit_creator_gen.go b/pkg/gotd/tg/tl_channels_edit_creator_gen.go deleted file mode 100644 index fb0b506d..00000000 --- a/pkg/gotd/tg/tl_channels_edit_creator_gen.go +++ /dev/null @@ -1,274 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tg - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "go.mau.fi/mautrix-telegram/pkg/gotd/bin" - "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" - "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" - "go.mau.fi/mautrix-telegram/pkg/gotd/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{} -) - -// ChannelsEditCreatorRequest represents TL type `channels.editCreator#8f38cd1f`. -// Transfer channel ownership -// -// See https://core.telegram.org/method/channels.editCreator for reference. -type ChannelsEditCreatorRequest struct { - // Channel - Channel InputChannelClass - // New channel owner - UserID InputUserClass - // 2FA password¹ of account - // - // Links: - // 1) https://core.telegram.org/api/srp - Password InputCheckPasswordSRPClass -} - -// ChannelsEditCreatorRequestTypeID is TL type id of ChannelsEditCreatorRequest. -const ChannelsEditCreatorRequestTypeID = 0x8f38cd1f - -// Ensuring interfaces in compile-time for ChannelsEditCreatorRequest. -var ( - _ bin.Encoder = &ChannelsEditCreatorRequest{} - _ bin.Decoder = &ChannelsEditCreatorRequest{} - _ bin.BareEncoder = &ChannelsEditCreatorRequest{} - _ bin.BareDecoder = &ChannelsEditCreatorRequest{} -) - -func (e *ChannelsEditCreatorRequest) Zero() bool { - if e == nil { - return true - } - if !(e.Channel == nil) { - return false - } - if !(e.UserID == nil) { - return false - } - if !(e.Password == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *ChannelsEditCreatorRequest) String() string { - if e == nil { - return "ChannelsEditCreatorRequest(nil)" - } - type Alias ChannelsEditCreatorRequest - return fmt.Sprintf("ChannelsEditCreatorRequest%+v", Alias(*e)) -} - -// FillFrom fills ChannelsEditCreatorRequest from given interface. -func (e *ChannelsEditCreatorRequest) FillFrom(from interface { - GetChannel() (value InputChannelClass) - GetUserID() (value InputUserClass) - GetPassword() (value InputCheckPasswordSRPClass) -}) { - e.Channel = from.GetChannel() - e.UserID = from.GetUserID() - e.Password = from.GetPassword() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChannelsEditCreatorRequest) TypeID() uint32 { - return ChannelsEditCreatorRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChannelsEditCreatorRequest) TypeName() string { - return "channels.editCreator" -} - -// TypeInfo returns info about TL type. -func (e *ChannelsEditCreatorRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "channels.editCreator", - ID: ChannelsEditCreatorRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Channel", - SchemaName: "channel", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *ChannelsEditCreatorRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode channels.editCreator#8f38cd1f as nil") - } - b.PutID(ChannelsEditCreatorRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *ChannelsEditCreatorRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode channels.editCreator#8f38cd1f as nil") - } - if e.Channel == nil { - return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field channel is nil") - } - if err := e.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field channel: %w", err) - } - if e.UserID == nil { - return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field user_id is nil") - } - if err := e.UserID.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field user_id: %w", err) - } - if e.Password == nil { - return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field password is nil") - } - if err := e.Password.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field password: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *ChannelsEditCreatorRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode channels.editCreator#8f38cd1f to nil") - } - if err := b.ConsumeID(ChannelsEditCreatorRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *ChannelsEditCreatorRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode channels.editCreator#8f38cd1f to nil") - } - { - value, err := DecodeInputChannel(b) - if err != nil { - return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: field channel: %w", err) - } - e.Channel = value - } - { - value, err := DecodeInputUser(b) - if err != nil { - return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: field user_id: %w", err) - } - e.UserID = value - } - { - value, err := DecodeInputCheckPasswordSRP(b) - if err != nil { - return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: field password: %w", err) - } - e.Password = value - } - return nil -} - -// GetChannel returns value of Channel field. -func (e *ChannelsEditCreatorRequest) GetChannel() (value InputChannelClass) { - if e == nil { - return - } - return e.Channel -} - -// GetUserID returns value of UserID field. -func (e *ChannelsEditCreatorRequest) GetUserID() (value InputUserClass) { - if e == nil { - return - } - return e.UserID -} - -// GetPassword returns value of Password field. -func (e *ChannelsEditCreatorRequest) GetPassword() (value InputCheckPasswordSRPClass) { - if e == nil { - return - } - return e.Password -} - -// GetChannelAsNotEmpty returns mapped value of Channel field. -func (e *ChannelsEditCreatorRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { - return e.Channel.AsNotEmpty() -} - -// GetPasswordAsNotEmpty returns mapped value of Password field. -func (e *ChannelsEditCreatorRequest) GetPasswordAsNotEmpty() (*InputCheckPasswordSRP, bool) { - return e.Password.AsNotEmpty() -} - -// ChannelsEditCreator invokes method channels.editCreator#8f38cd1f returning error if any. -// Transfer channel ownership -// -// Possible errors: -// -// 400 CHANNELS_ADMIN_PUBLIC_TOO_MUCH: You're admin of too many public channels, make some channels private to change the username of this channel. -// 400 CHANNEL_MONOFORUM_UNSUPPORTED: Monoforums do not support this feature. -// 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. -// 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. -// 400 CHAT_MEMBER_ADD_FAILED: Could not add participants. -// 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information. -// 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat. -// 400 PASSWORD_HASH_INVALID: The provided password hash is invalid. -// 400 PASSWORD_MISSING: You must enable 2FA before executing this operation. -// 400 PASSWORD_TOO_FRESH_%d: The password was modified less than 24 hours ago, try again in %d seconds. -// 400 SESSION_TOO_FRESH_%d: This session was created less than 24 hours ago, try again in %d seconds. -// 400 SRP_ID_INVALID: Invalid SRP ID provided. -// 400 USER_ID_INVALID: The provided user ID is invalid. -// 403 USER_PRIVACY_RESTRICTED: The user's privacy settings do not allow you to do this. -// -// See https://core.telegram.org/method/channels.editCreator for reference. -func (c *Client) ChannelsEditCreator(ctx context.Context, request *ChannelsEditCreatorRequest) (UpdatesClass, error) { - var result UpdatesBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.Updates, nil -} diff --git a/pkg/gotd/tg/tl_chat_admin_rights_gen.go b/pkg/gotd/tg/tl_chat_admin_rights_gen.go index 535e2508..ae1fc2f0 100644 --- a/pkg/gotd/tg/tl_chat_admin_rights_gen.go +++ b/pkg/gotd/tg/tl_chat_admin_rights_gen.go @@ -130,6 +130,8 @@ type ChatAdminRights struct { // 1) https://core.telegram.org/api/monoforum // 2) https://core.telegram.org/api/suggested-posts ManageDirectMessages bool + // ManageRanks field of ChatAdminRights. + ManageRanks bool } // ChatAdminRightsTypeID is TL type id of ChatAdminRights. @@ -198,6 +200,9 @@ func (c *ChatAdminRights) Zero() bool { if !(c.ManageDirectMessages == false) { return false } + if !(c.ManageRanks == false) { + return false + } return true } @@ -229,6 +234,7 @@ func (c *ChatAdminRights) FillFrom(from interface { GetEditStories() (value bool) GetDeleteStories() (value bool) GetManageDirectMessages() (value bool) + GetManageRanks() (value bool) }) { c.ChangeInfo = from.GetChangeInfo() c.PostMessages = from.GetPostMessages() @@ -246,6 +252,7 @@ func (c *ChatAdminRights) FillFrom(from interface { c.EditStories = from.GetEditStories() c.DeleteStories = from.GetDeleteStories() c.ManageDirectMessages = from.GetManageDirectMessages() + c.ManageRanks = from.GetManageRanks() } // TypeID returns type id in TL schema. @@ -351,6 +358,11 @@ func (c *ChatAdminRights) TypeInfo() tdp.Type { SchemaName: "manage_direct_messages", Null: !c.Flags.Has(17), }, + { + Name: "ManageRanks", + SchemaName: "manage_ranks", + Null: !c.Flags.Has(18), + }, } return typ } @@ -405,6 +417,9 @@ func (c *ChatAdminRights) SetFlags() { if !(c.ManageDirectMessages == false) { c.Flags.Set(17) } + if !(c.ManageRanks == false) { + c.Flags.Set(18) + } } // Encode implements bin.Encoder. @@ -465,6 +480,7 @@ func (c *ChatAdminRights) DecodeBare(b *bin.Buffer) error { c.EditStories = c.Flags.Has(15) c.DeleteStories = c.Flags.Has(16) c.ManageDirectMessages = c.Flags.Has(17) + c.ManageRanks = c.Flags.Has(18) return nil } @@ -771,3 +787,22 @@ func (c *ChatAdminRights) GetManageDirectMessages() (value bool) { } return c.Flags.Has(17) } + +// SetManageRanks sets value of ManageRanks conditional field. +func (c *ChatAdminRights) SetManageRanks(value bool) { + if value { + c.Flags.Set(18) + c.ManageRanks = true + } else { + c.Flags.Unset(18) + c.ManageRanks = false + } +} + +// GetManageRanks returns value of ManageRanks conditional field. +func (c *ChatAdminRights) GetManageRanks() (value bool) { + if c == nil { + return + } + return c.Flags.Has(18) +} diff --git a/pkg/gotd/tg/tl_chat_banned_rights_gen.go b/pkg/gotd/tg/tl_chat_banned_rights_gen.go index 93bcc2d1..8ca45edd 100644 --- a/pkg/gotd/tg/tl_chat_banned_rights_gen.go +++ b/pkg/gotd/tg/tl_chat_banned_rights_gen.go @@ -145,6 +145,8 @@ type ChatBannedRights struct { // Links: // 1) https://core.telegram.org/api/channel SendPlain bool + // EditRank field of ChatBannedRights. + EditRank bool // Validity of said permissions (it is considered forever any value less then 30 seconds // or more then 366 days). UntilDate int @@ -228,6 +230,9 @@ func (c *ChatBannedRights) Zero() bool { if !(c.SendPlain == false) { return false } + if !(c.EditRank == false) { + return false + } if !(c.UntilDate == 0) { return false } @@ -266,6 +271,7 @@ func (c *ChatBannedRights) FillFrom(from interface { GetSendVoices() (value bool) GetSendDocs() (value bool) GetSendPlain() (value bool) + GetEditRank() (value bool) GetUntilDate() (value int) }) { c.ViewMessages = from.GetViewMessages() @@ -288,6 +294,7 @@ func (c *ChatBannedRights) FillFrom(from interface { c.SendVoices = from.GetSendVoices() c.SendDocs = from.GetSendDocs() c.SendPlain = from.GetSendPlain() + c.EditRank = from.GetEditRank() c.UntilDate = from.GetUntilDate() } @@ -414,6 +421,11 @@ func (c *ChatBannedRights) TypeInfo() tdp.Type { SchemaName: "send_plain", Null: !c.Flags.Has(25), }, + { + Name: "EditRank", + SchemaName: "edit_rank", + Null: !c.Flags.Has(26), + }, { Name: "UntilDate", SchemaName: "until_date", @@ -484,6 +496,9 @@ func (c *ChatBannedRights) SetFlags() { if !(c.SendPlain == false) { c.Flags.Set(25) } + if !(c.EditRank == false) { + c.Flags.Set(26) + } } // Encode implements bin.Encoder. @@ -549,6 +564,7 @@ func (c *ChatBannedRights) DecodeBare(b *bin.Buffer) error { c.SendVoices = c.Flags.Has(23) c.SendDocs = c.Flags.Has(24) c.SendPlain = c.Flags.Has(25) + c.EditRank = c.Flags.Has(26) { value, err := b.Int() if err != nil { @@ -939,6 +955,25 @@ func (c *ChatBannedRights) GetSendPlain() (value bool) { return c.Flags.Has(25) } +// SetEditRank sets value of EditRank conditional field. +func (c *ChatBannedRights) SetEditRank(value bool) { + if value { + c.Flags.Set(26) + c.EditRank = true + } else { + c.Flags.Unset(26) + c.EditRank = false + } +} + +// GetEditRank returns value of EditRank conditional field. +func (c *ChatBannedRights) GetEditRank() (value bool) { + if c == nil { + return + } + return c.Flags.Has(26) +} + // GetUntilDate returns value of UntilDate field. func (c *ChatBannedRights) GetUntilDate() (value int) { if c == nil { diff --git a/pkg/gotd/tg/tl_chat_gen.go b/pkg/gotd/tg/tl_chat_gen.go index 333e9222..ee2b087e 100644 --- a/pkg/gotd/tg/tl_chat_gen.go +++ b/pkg/gotd/tg/tl_chat_gen.go @@ -3295,6 +3295,8 @@ type ChannelForbidden struct { Broadcast bool // Is this a supergroup Megagroup bool + // Monoforum field of ChannelForbidden. + Monoforum bool // Channel ID ID int64 // Access hash @@ -3336,6 +3338,9 @@ func (c *ChannelForbidden) Zero() bool { if !(c.Megagroup == false) { return false } + if !(c.Monoforum == false) { + return false + } if !(c.ID == 0) { return false } @@ -3365,6 +3370,7 @@ func (c *ChannelForbidden) String() string { func (c *ChannelForbidden) FillFrom(from interface { GetBroadcast() (value bool) GetMegagroup() (value bool) + GetMonoforum() (value bool) GetID() (value int64) GetAccessHash() (value int64) GetTitle() (value string) @@ -3372,6 +3378,7 @@ func (c *ChannelForbidden) FillFrom(from interface { }) { c.Broadcast = from.GetBroadcast() c.Megagroup = from.GetMegagroup() + c.Monoforum = from.GetMonoforum() c.ID = from.GetID() c.AccessHash = from.GetAccessHash() c.Title = from.GetTitle() @@ -3414,6 +3421,11 @@ func (c *ChannelForbidden) TypeInfo() tdp.Type { SchemaName: "megagroup", Null: !c.Flags.Has(8), }, + { + Name: "Monoforum", + SchemaName: "monoforum", + Null: !c.Flags.Has(10), + }, { Name: "ID", SchemaName: "id", @@ -3443,6 +3455,9 @@ func (c *ChannelForbidden) SetFlags() { if !(c.Megagroup == false) { c.Flags.Set(8) } + if !(c.Monoforum == false) { + c.Flags.Set(10) + } if !(c.UntilDate == 0) { c.Flags.Set(16) } @@ -3498,6 +3513,7 @@ func (c *ChannelForbidden) DecodeBare(b *bin.Buffer) error { } c.Broadcast = c.Flags.Has(5) c.Megagroup = c.Flags.Has(8) + c.Monoforum = c.Flags.Has(10) { value, err := b.Long() if err != nil { @@ -3567,6 +3583,25 @@ func (c *ChannelForbidden) GetMegagroup() (value bool) { return c.Flags.Has(8) } +// SetMonoforum sets value of Monoforum conditional field. +func (c *ChannelForbidden) SetMonoforum(value bool) { + if value { + c.Flags.Set(10) + c.Monoforum = true + } else { + c.Flags.Unset(10) + c.Monoforum = false + } +} + +// GetMonoforum returns value of Monoforum conditional field. +func (c *ChannelForbidden) GetMonoforum() (value bool) { + if c == nil { + return + } + return c.Flags.Has(10) +} + // GetID returns value of ID field. func (c *ChannelForbidden) GetID() (value int64) { if c == nil { diff --git a/pkg/gotd/tg/tl_chat_participant_gen.go b/pkg/gotd/tg/tl_chat_participant_gen.go index 84e0b792..21c01cfe 100644 --- a/pkg/gotd/tg/tl_chat_participant_gen.go +++ b/pkg/gotd/tg/tl_chat_participant_gen.go @@ -31,21 +31,27 @@ var ( _ = tdjson.Encoder{} ) -// ChatParticipant represents TL type `chatParticipant#c02d4007`. +// ChatParticipant represents TL type `chatParticipant#38e79fde`. // Group member. // // See https://core.telegram.org/constructor/chatParticipant for reference. type ChatParticipant struct { + // Flags field of ChatParticipant. + Flags bin.Fields // Member user ID UserID int64 // ID of the user that added the member to the group InviterID int64 // Date added to the group Date int + // Rank field of ChatParticipant. + // + // Use SetRank and GetRank helpers. + Rank string } // ChatParticipantTypeID is TL type id of ChatParticipant. -const ChatParticipantTypeID = 0xc02d4007 +const ChatParticipantTypeID = 0x38e79fde // construct implements constructor of ChatParticipantClass. func (c ChatParticipant) construct() ChatParticipantClass { return &c } @@ -64,6 +70,9 @@ func (c *ChatParticipant) Zero() bool { if c == nil { return true } + if !(c.Flags.Zero()) { + return false + } if !(c.UserID == 0) { return false } @@ -73,6 +82,9 @@ func (c *ChatParticipant) Zero() bool { if !(c.Date == 0) { return false } + if !(c.Rank == "") { + return false + } return true } @@ -91,10 +103,15 @@ func (c *ChatParticipant) FillFrom(from interface { GetUserID() (value int64) GetInviterID() (value int64) GetDate() (value int) + GetRank() (value string, ok bool) }) { c.UserID = from.GetUserID() c.InviterID = from.GetInviterID() c.Date = from.GetDate() + if val, ok := from.GetRank(); ok { + c.Rank = val + } + } // TypeID returns type id in TL schema. @@ -132,14 +149,26 @@ func (c *ChatParticipant) TypeInfo() tdp.Type { Name: "Date", SchemaName: "date", }, + { + Name: "Rank", + SchemaName: "rank", + Null: !c.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (c *ChatParticipant) SetFlags() { + if !(c.Rank == "") { + c.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (c *ChatParticipant) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatParticipant#c02d4007 as nil") + return fmt.Errorf("can't encode chatParticipant#38e79fde as nil") } b.PutID(ChatParticipantTypeID) return c.EncodeBare(b) @@ -148,21 +177,28 @@ func (c *ChatParticipant) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatParticipant) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatParticipant#c02d4007 as nil") + return fmt.Errorf("can't encode chatParticipant#38e79fde as nil") + } + c.SetFlags() + if err := c.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatParticipant#38e79fde: field flags: %w", err) } b.PutLong(c.UserID) b.PutLong(c.InviterID) b.PutInt(c.Date) + if c.Flags.Has(0) { + b.PutString(c.Rank) + } return nil } // Decode implements bin.Decoder. func (c *ChatParticipant) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatParticipant#c02d4007 to nil") + return fmt.Errorf("can't decode chatParticipant#38e79fde to nil") } if err := b.ConsumeID(ChatParticipantTypeID); err != nil { - return fmt.Errorf("unable to decode chatParticipant#c02d4007: %w", err) + return fmt.Errorf("unable to decode chatParticipant#38e79fde: %w", err) } return c.DecodeBare(b) } @@ -170,29 +206,41 @@ func (c *ChatParticipant) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatParticipant) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatParticipant#c02d4007 to nil") + return fmt.Errorf("can't decode chatParticipant#38e79fde to nil") + } + { + if err := c.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatParticipant#38e79fde: field flags: %w", err) + } } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatParticipant#c02d4007: field user_id: %w", err) + return fmt.Errorf("unable to decode chatParticipant#38e79fde: field user_id: %w", err) } c.UserID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatParticipant#c02d4007: field inviter_id: %w", err) + return fmt.Errorf("unable to decode chatParticipant#38e79fde: field inviter_id: %w", err) } c.InviterID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatParticipant#c02d4007: field date: %w", err) + return fmt.Errorf("unable to decode chatParticipant#38e79fde: field date: %w", err) } c.Date = value } + if c.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatParticipant#38e79fde: field rank: %w", err) + } + c.Rank = value + } return nil } @@ -220,17 +268,41 @@ func (c *ChatParticipant) GetDate() (value int) { return c.Date } -// ChatParticipantCreator represents TL type `chatParticipantCreator#e46bcee4`. +// SetRank sets value of Rank conditional field. +func (c *ChatParticipant) SetRank(value string) { + c.Flags.Set(0) + c.Rank = value +} + +// GetRank returns value of Rank conditional field and +// boolean which is true if field was set. +func (c *ChatParticipant) GetRank() (value string, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(0) { + return value, false + } + return c.Rank, true +} + +// ChatParticipantCreator represents TL type `chatParticipantCreator#e1f867b8`. // Represents the creator of the group // // See https://core.telegram.org/constructor/chatParticipantCreator for reference. type ChatParticipantCreator struct { + // Flags field of ChatParticipantCreator. + Flags bin.Fields // ID of the user that created the group UserID int64 + // Rank field of ChatParticipantCreator. + // + // Use SetRank and GetRank helpers. + Rank string } // ChatParticipantCreatorTypeID is TL type id of ChatParticipantCreator. -const ChatParticipantCreatorTypeID = 0xe46bcee4 +const ChatParticipantCreatorTypeID = 0xe1f867b8 // construct implements constructor of ChatParticipantClass. func (c ChatParticipantCreator) construct() ChatParticipantClass { return &c } @@ -249,9 +321,15 @@ func (c *ChatParticipantCreator) Zero() bool { if c == nil { return true } + if !(c.Flags.Zero()) { + return false + } if !(c.UserID == 0) { return false } + if !(c.Rank == "") { + return false + } return true } @@ -268,8 +346,13 @@ func (c *ChatParticipantCreator) String() string { // FillFrom fills ChatParticipantCreator from given interface. func (c *ChatParticipantCreator) FillFrom(from interface { GetUserID() (value int64) + GetRank() (value string, ok bool) }) { c.UserID = from.GetUserID() + if val, ok := from.GetRank(); ok { + c.Rank = val + } + } // TypeID returns type id in TL schema. @@ -299,14 +382,26 @@ func (c *ChatParticipantCreator) TypeInfo() tdp.Type { Name: "UserID", SchemaName: "user_id", }, + { + Name: "Rank", + SchemaName: "rank", + Null: !c.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (c *ChatParticipantCreator) SetFlags() { + if !(c.Rank == "") { + c.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (c *ChatParticipantCreator) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatParticipantCreator#e46bcee4 as nil") + return fmt.Errorf("can't encode chatParticipantCreator#e1f867b8 as nil") } b.PutID(ChatParticipantCreatorTypeID) return c.EncodeBare(b) @@ -315,19 +410,26 @@ func (c *ChatParticipantCreator) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatParticipantCreator) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatParticipantCreator#e46bcee4 as nil") + return fmt.Errorf("can't encode chatParticipantCreator#e1f867b8 as nil") + } + c.SetFlags() + if err := c.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatParticipantCreator#e1f867b8: field flags: %w", err) } b.PutLong(c.UserID) + if c.Flags.Has(0) { + b.PutString(c.Rank) + } return nil } // Decode implements bin.Decoder. func (c *ChatParticipantCreator) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatParticipantCreator#e46bcee4 to nil") + return fmt.Errorf("can't decode chatParticipantCreator#e1f867b8 to nil") } if err := b.ConsumeID(ChatParticipantCreatorTypeID); err != nil { - return fmt.Errorf("unable to decode chatParticipantCreator#e46bcee4: %w", err) + return fmt.Errorf("unable to decode chatParticipantCreator#e1f867b8: %w", err) } return c.DecodeBare(b) } @@ -335,15 +437,27 @@ func (c *ChatParticipantCreator) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatParticipantCreator) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatParticipantCreator#e46bcee4 to nil") + return fmt.Errorf("can't decode chatParticipantCreator#e1f867b8 to nil") + } + { + if err := c.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatParticipantCreator#e1f867b8: field flags: %w", err) + } } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatParticipantCreator#e46bcee4: field user_id: %w", err) + return fmt.Errorf("unable to decode chatParticipantCreator#e1f867b8: field user_id: %w", err) } c.UserID = value } + if c.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatParticipantCreator#e1f867b8: field rank: %w", err) + } + c.Rank = value + } return nil } @@ -355,21 +469,45 @@ func (c *ChatParticipantCreator) GetUserID() (value int64) { return c.UserID } -// ChatParticipantAdmin represents TL type `chatParticipantAdmin#a0933f5b`. +// SetRank sets value of Rank conditional field. +func (c *ChatParticipantCreator) SetRank(value string) { + c.Flags.Set(0) + c.Rank = value +} + +// GetRank returns value of Rank conditional field and +// boolean which is true if field was set. +func (c *ChatParticipantCreator) GetRank() (value string, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(0) { + return value, false + } + return c.Rank, true +} + +// ChatParticipantAdmin represents TL type `chatParticipantAdmin#360d5d2`. // Chat admin // // See https://core.telegram.org/constructor/chatParticipantAdmin for reference. type ChatParticipantAdmin struct { + // Flags field of ChatParticipantAdmin. + Flags bin.Fields // ID of a group member that is admin UserID int64 // ID of the user that added the member to the group InviterID int64 // Date when the user was added Date int + // Rank field of ChatParticipantAdmin. + // + // Use SetRank and GetRank helpers. + Rank string } // ChatParticipantAdminTypeID is TL type id of ChatParticipantAdmin. -const ChatParticipantAdminTypeID = 0xa0933f5b +const ChatParticipantAdminTypeID = 0x360d5d2 // construct implements constructor of ChatParticipantClass. func (c ChatParticipantAdmin) construct() ChatParticipantClass { return &c } @@ -388,6 +526,9 @@ func (c *ChatParticipantAdmin) Zero() bool { if c == nil { return true } + if !(c.Flags.Zero()) { + return false + } if !(c.UserID == 0) { return false } @@ -397,6 +538,9 @@ func (c *ChatParticipantAdmin) Zero() bool { if !(c.Date == 0) { return false } + if !(c.Rank == "") { + return false + } return true } @@ -415,10 +559,15 @@ func (c *ChatParticipantAdmin) FillFrom(from interface { GetUserID() (value int64) GetInviterID() (value int64) GetDate() (value int) + GetRank() (value string, ok bool) }) { c.UserID = from.GetUserID() c.InviterID = from.GetInviterID() c.Date = from.GetDate() + if val, ok := from.GetRank(); ok { + c.Rank = val + } + } // TypeID returns type id in TL schema. @@ -456,14 +605,26 @@ func (c *ChatParticipantAdmin) TypeInfo() tdp.Type { Name: "Date", SchemaName: "date", }, + { + Name: "Rank", + SchemaName: "rank", + Null: !c.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (c *ChatParticipantAdmin) SetFlags() { + if !(c.Rank == "") { + c.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (c *ChatParticipantAdmin) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatParticipantAdmin#a0933f5b as nil") + return fmt.Errorf("can't encode chatParticipantAdmin#360d5d2 as nil") } b.PutID(ChatParticipantAdminTypeID) return c.EncodeBare(b) @@ -472,21 +633,28 @@ func (c *ChatParticipantAdmin) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChatParticipantAdmin) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode chatParticipantAdmin#a0933f5b as nil") + return fmt.Errorf("can't encode chatParticipantAdmin#360d5d2 as nil") + } + c.SetFlags() + if err := c.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode chatParticipantAdmin#360d5d2: field flags: %w", err) } b.PutLong(c.UserID) b.PutLong(c.InviterID) b.PutInt(c.Date) + if c.Flags.Has(0) { + b.PutString(c.Rank) + } return nil } // Decode implements bin.Decoder. func (c *ChatParticipantAdmin) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatParticipantAdmin#a0933f5b to nil") + return fmt.Errorf("can't decode chatParticipantAdmin#360d5d2 to nil") } if err := b.ConsumeID(ChatParticipantAdminTypeID); err != nil { - return fmt.Errorf("unable to decode chatParticipantAdmin#a0933f5b: %w", err) + return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: %w", err) } return c.DecodeBare(b) } @@ -494,29 +662,41 @@ func (c *ChatParticipantAdmin) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChatParticipantAdmin) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode chatParticipantAdmin#a0933f5b to nil") + return fmt.Errorf("can't decode chatParticipantAdmin#360d5d2 to nil") + } + { + if err := c.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field flags: %w", err) + } } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatParticipantAdmin#a0933f5b: field user_id: %w", err) + return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field user_id: %w", err) } c.UserID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode chatParticipantAdmin#a0933f5b: field inviter_id: %w", err) + return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field inviter_id: %w", err) } c.InviterID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode chatParticipantAdmin#a0933f5b: field date: %w", err) + return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field date: %w", err) } c.Date = value } + if c.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field rank: %w", err) + } + c.Rank = value + } return nil } @@ -544,6 +724,24 @@ func (c *ChatParticipantAdmin) GetDate() (value int) { return c.Date } +// SetRank sets value of Rank conditional field. +func (c *ChatParticipantAdmin) SetRank(value string) { + c.Flags.Set(0) + c.Rank = value +} + +// GetRank returns value of Rank conditional field and +// boolean which is true if field was set. +func (c *ChatParticipantAdmin) GetRank() (value string, ok bool) { + if c == nil { + return + } + if !c.Flags.Has(0) { + return value, false + } + return c.Rank, true +} + // ChatParticipantClassName is schema name of ChatParticipantClass. const ChatParticipantClassName = "ChatParticipant" @@ -558,9 +756,9 @@ const ChatParticipantClassName = "ChatParticipant" // panic(err) // } // switch v := g.(type) { -// case *tg.ChatParticipant: // chatParticipant#c02d4007 -// case *tg.ChatParticipantCreator: // chatParticipantCreator#e46bcee4 -// case *tg.ChatParticipantAdmin: // chatParticipantAdmin#a0933f5b +// case *tg.ChatParticipant: // chatParticipant#38e79fde +// case *tg.ChatParticipantCreator: // chatParticipantCreator#e1f867b8 +// case *tg.ChatParticipantAdmin: // chatParticipantAdmin#360d5d2 // default: panic(v) // } type ChatParticipantClass interface { @@ -583,6 +781,9 @@ type ChatParticipantClass interface { // Member user ID GetUserID() (value int64) + + // Rank field of ChatParticipant. + GetRank() (value string, ok bool) } // DecodeChatParticipant implements binary de-serialization for ChatParticipantClass. @@ -593,21 +794,21 @@ func DecodeChatParticipant(buf *bin.Buffer) (ChatParticipantClass, error) { } switch id { case ChatParticipantTypeID: - // Decoding chatParticipant#c02d4007. + // Decoding chatParticipant#38e79fde. v := ChatParticipant{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatParticipantClass: %w", err) } return &v, nil case ChatParticipantCreatorTypeID: - // Decoding chatParticipantCreator#e46bcee4. + // Decoding chatParticipantCreator#e1f867b8. v := ChatParticipantCreator{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatParticipantClass: %w", err) } return &v, nil case ChatParticipantAdminTypeID: - // Decoding chatParticipantAdmin#a0933f5b. + // Decoding chatParticipantAdmin#360d5d2. v := ChatParticipantAdmin{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatParticipantClass: %w", err) diff --git a/pkg/gotd/tg/tl_group_call_donor_gen.go b/pkg/gotd/tg/tl_group_call_donor_gen.go index 2b0bcdc6..6db10dad 100644 --- a/pkg/gotd/tg/tl_group_call_donor_gen.go +++ b/pkg/gotd/tg/tl_group_call_donor_gen.go @@ -41,8 +41,6 @@ type GroupCallDonor struct { Top bool // My field of GroupCallDonor. My bool - // Anonymous field of GroupCallDonor. - Anonymous bool // PeerID field of GroupCallDonor. // // Use SetPeerID and GetPeerID helpers. @@ -75,9 +73,6 @@ func (g *GroupCallDonor) Zero() bool { if !(g.My == false) { return false } - if !(g.Anonymous == false) { - return false - } if !(g.PeerID == nil) { return false } @@ -101,13 +96,11 @@ func (g *GroupCallDonor) String() string { func (g *GroupCallDonor) FillFrom(from interface { GetTop() (value bool) GetMy() (value bool) - GetAnonymous() (value bool) GetPeerID() (value PeerClass, ok bool) GetStars() (value int64) }) { g.Top = from.GetTop() g.My = from.GetMy() - g.Anonymous = from.GetAnonymous() if val, ok := from.GetPeerID(); ok { g.PeerID = val } @@ -148,11 +141,6 @@ func (g *GroupCallDonor) TypeInfo() tdp.Type { SchemaName: "my", Null: !g.Flags.Has(1), }, - { - Name: "Anonymous", - SchemaName: "anonymous", - Null: !g.Flags.Has(2), - }, { Name: "PeerID", SchemaName: "peer_id", @@ -174,9 +162,6 @@ func (g *GroupCallDonor) SetFlags() { if !(g.My == false) { g.Flags.Set(1) } - if !(g.Anonymous == false) { - g.Flags.Set(2) - } if !(g.PeerID == nil) { g.Flags.Set(3) } @@ -235,7 +220,6 @@ func (g *GroupCallDonor) DecodeBare(b *bin.Buffer) error { } g.Top = g.Flags.Has(0) g.My = g.Flags.Has(1) - g.Anonymous = g.Flags.Has(2) if g.Flags.Has(3) { value, err := DecodePeer(b) if err != nil { @@ -291,25 +275,6 @@ func (g *GroupCallDonor) GetMy() (value bool) { return g.Flags.Has(1) } -// SetAnonymous sets value of Anonymous conditional field. -func (g *GroupCallDonor) SetAnonymous(value bool) { - if value { - g.Flags.Set(2) - g.Anonymous = true - } else { - g.Flags.Unset(2) - g.Anonymous = false - } -} - -// GetAnonymous returns value of Anonymous conditional field. -func (g *GroupCallDonor) GetAnonymous() (value bool) { - if g == nil { - return - } - return g.Flags.Has(2) -} - // SetPeerID sets value of PeerID conditional field. func (g *GroupCallDonor) SetPeerID(value PeerClass) { g.Flags.Set(3) diff --git a/pkg/gotd/tg/tl_handlers_gen.go b/pkg/gotd/tg/tl_handlers_gen.go index 301b5a4d..f979f2e9 100644 --- a/pkg/gotd/tg/tl_handlers_gen.go +++ b/pkg/gotd/tg/tl_handlers_gen.go @@ -1531,6 +1531,36 @@ func (u UpdateDispatcher) OnStarGiftAuctionUserState(handler StarGiftAuctionUser } } +// EmojiGameInfoHandler is a EmojiGameInfo event handler. +type EmojiGameInfoHandler func(ctx context.Context, e Entities, update *UpdateEmojiGameInfo) error + +// OnEmojiGameInfo sets EmojiGameInfo handler. +func (u UpdateDispatcher) OnEmojiGameInfo(handler EmojiGameInfoHandler) { + u.handlers[UpdateEmojiGameInfoTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateEmojiGameInfo)) + } +} + +// StarGiftCraftFailHandler is a StarGiftCraftFail event handler. +type StarGiftCraftFailHandler func(ctx context.Context, e Entities, update *UpdateStarGiftCraftFail) error + +// OnStarGiftCraftFail sets StarGiftCraftFail handler. +func (u UpdateDispatcher) OnStarGiftCraftFail(handler StarGiftCraftFailHandler) { + u.handlers[UpdateStarGiftCraftFailTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateStarGiftCraftFail)) + } +} + +// ChatParticipantRankHandler is a ChatParticipantRank event handler. +type ChatParticipantRankHandler func(ctx context.Context, e Entities, update *UpdateChatParticipantRank) error + +// OnChatParticipantRank sets ChatParticipantRank handler. +func (u UpdateDispatcher) OnChatParticipantRank(handler ChatParticipantRankHandler) { + u.handlers[UpdateChatParticipantRankTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateChatParticipantRank)) + } +} + // OnFallback sets fallback handler. func (u *UpdateDispatcher) OnFallback(handler Handler) { u.fallback = handler diff --git a/pkg/gotd/tg/tl_input_media_gen.go b/pkg/gotd/tg/tl_input_media_gen.go index 07afdcc3..81c40cc1 100644 --- a/pkg/gotd/tg/tl_input_media_gen.go +++ b/pkg/gotd/tg/tl_input_media_gen.go @@ -5213,6 +5213,194 @@ func (i *InputMediaTodo) GetTodo() (value TodoList) { return i.Todo } +// InputMediaStakeDice represents TL type `inputMediaStakeDice#f3a9244a`. +// +// See https://core.telegram.org/constructor/inputMediaStakeDice for reference. +type InputMediaStakeDice struct { + // GameHash field of InputMediaStakeDice. + GameHash string + // TonAmount field of InputMediaStakeDice. + TonAmount int64 + // ClientSeed field of InputMediaStakeDice. + ClientSeed []byte +} + +// InputMediaStakeDiceTypeID is TL type id of InputMediaStakeDice. +const InputMediaStakeDiceTypeID = 0xf3a9244a + +// construct implements constructor of InputMediaClass. +func (i InputMediaStakeDice) construct() InputMediaClass { return &i } + +// Ensuring interfaces in compile-time for InputMediaStakeDice. +var ( + _ bin.Encoder = &InputMediaStakeDice{} + _ bin.Decoder = &InputMediaStakeDice{} + _ bin.BareEncoder = &InputMediaStakeDice{} + _ bin.BareDecoder = &InputMediaStakeDice{} + + _ InputMediaClass = &InputMediaStakeDice{} +) + +func (i *InputMediaStakeDice) Zero() bool { + if i == nil { + return true + } + if !(i.GameHash == "") { + return false + } + if !(i.TonAmount == 0) { + return false + } + if !(i.ClientSeed == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputMediaStakeDice) String() string { + if i == nil { + return "InputMediaStakeDice(nil)" + } + type Alias InputMediaStakeDice + return fmt.Sprintf("InputMediaStakeDice%+v", Alias(*i)) +} + +// FillFrom fills InputMediaStakeDice from given interface. +func (i *InputMediaStakeDice) FillFrom(from interface { + GetGameHash() (value string) + GetTonAmount() (value int64) + GetClientSeed() (value []byte) +}) { + i.GameHash = from.GetGameHash() + i.TonAmount = from.GetTonAmount() + i.ClientSeed = from.GetClientSeed() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputMediaStakeDice) TypeID() uint32 { + return InputMediaStakeDiceTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputMediaStakeDice) TypeName() string { + return "inputMediaStakeDice" +} + +// TypeInfo returns info about TL type. +func (i *InputMediaStakeDice) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputMediaStakeDice", + ID: InputMediaStakeDiceTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GameHash", + SchemaName: "game_hash", + }, + { + Name: "TonAmount", + SchemaName: "ton_amount", + }, + { + Name: "ClientSeed", + SchemaName: "client_seed", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputMediaStakeDice) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputMediaStakeDice#f3a9244a as nil") + } + b.PutID(InputMediaStakeDiceTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputMediaStakeDice) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputMediaStakeDice#f3a9244a as nil") + } + b.PutString(i.GameHash) + b.PutLong(i.TonAmount) + b.PutBytes(i.ClientSeed) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputMediaStakeDice) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputMediaStakeDice#f3a9244a to nil") + } + if err := b.ConsumeID(InputMediaStakeDiceTypeID); err != nil { + return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputMediaStakeDice) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputMediaStakeDice#f3a9244a to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: field game_hash: %w", err) + } + i.GameHash = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: field ton_amount: %w", err) + } + i.TonAmount = value + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: field client_seed: %w", err) + } + i.ClientSeed = value + } + return nil +} + +// GetGameHash returns value of GameHash field. +func (i *InputMediaStakeDice) GetGameHash() (value string) { + if i == nil { + return + } + return i.GameHash +} + +// GetTonAmount returns value of TonAmount field. +func (i *InputMediaStakeDice) GetTonAmount() (value int64) { + if i == nil { + return + } + return i.TonAmount +} + +// GetClientSeed returns value of ClientSeed field. +func (i *InputMediaStakeDice) GetClientSeed() (value []byte) { + if i == nil { + return + } + return i.ClientSeed +} + // InputMediaClassName is schema name of InputMediaClass. const InputMediaClassName = "InputMedia" @@ -5246,6 +5434,7 @@ const InputMediaClassName = "InputMedia" // case *tg.InputMediaWebPage: // inputMediaWebPage#c21b8849 // case *tg.InputMediaPaidMedia: // inputMediaPaidMedia#c4103386 // case *tg.InputMediaTodo: // inputMediaTodo#9fc55fde +// case *tg.InputMediaStakeDice: // inputMediaStakeDice#f3a9244a // default: panic(v) // } type InputMediaClass interface { @@ -5407,6 +5596,13 @@ func DecodeInputMedia(buf *bin.Buffer) (InputMediaClass, error) { return nil, fmt.Errorf("unable to decode InputMediaClass: %w", err) } return &v, nil + case InputMediaStakeDiceTypeID: + // Decoding inputMediaStakeDice#f3a9244a. + v := InputMediaStakeDice{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputMediaClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputMediaClass: %w", bin.NewUnexpectedID(id)) } diff --git a/pkg/gotd/tg/tl_input_media_slices_gen.go b/pkg/gotd/tg/tl_input_media_slices_gen.go index 70f8df6a..19bde1ed 100644 --- a/pkg/gotd/tg/tl_input_media_slices_gen.go +++ b/pkg/gotd/tg/tl_input_media_slices_gen.go @@ -350,6 +350,19 @@ func (s InputMediaClassArray) AsInputMediaTodo() (to InputMediaTodoArray) { return to } +// AsInputMediaStakeDice returns copy with only InputMediaStakeDice constructors. +func (s InputMediaClassArray) AsInputMediaStakeDice() (to InputMediaStakeDiceArray) { + for _, elem := range s { + value, ok := elem.(*InputMediaStakeDice) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // InputMediaUploadedPhotoArray is adapter for slice of InputMediaUploadedPhoto. type InputMediaUploadedPhotoArray []InputMediaUploadedPhoto @@ -1853,3 +1866,85 @@ func (s *InputMediaTodoArray) Pop() (v InputMediaTodo, ok bool) { return v, true } + +// InputMediaStakeDiceArray is adapter for slice of InputMediaStakeDice. +type InputMediaStakeDiceArray []InputMediaStakeDice + +// Sort sorts slice of InputMediaStakeDice. +func (s InputMediaStakeDiceArray) Sort(less func(a, b InputMediaStakeDice) bool) InputMediaStakeDiceArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputMediaStakeDice. +func (s InputMediaStakeDiceArray) SortStable(less func(a, b InputMediaStakeDice) bool) InputMediaStakeDiceArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputMediaStakeDice. +func (s InputMediaStakeDiceArray) Retain(keep func(x InputMediaStakeDice) bool) InputMediaStakeDiceArray { + 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 InputMediaStakeDiceArray) First() (v InputMediaStakeDice, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputMediaStakeDiceArray) Last() (v InputMediaStakeDice, 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 *InputMediaStakeDiceArray) PopFirst() (v InputMediaStakeDice, 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 InputMediaStakeDice + 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 *InputMediaStakeDiceArray) Pop() (v InputMediaStakeDice, 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/pkg/gotd/tg/tl_input_passkey_credential_gen.go b/pkg/gotd/tg/tl_input_passkey_credential_gen.go new file mode 100644 index 00000000..8823d1ca --- /dev/null +++ b/pkg/gotd/tg/tl_input_passkey_credential_gen.go @@ -0,0 +1,448 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// InputPasskeyCredentialPublicKey represents TL type `inputPasskeyCredentialPublicKey#3c27b78f`. +// +// See https://core.telegram.org/constructor/inputPasskeyCredentialPublicKey for reference. +type InputPasskeyCredentialPublicKey struct { + // ID field of InputPasskeyCredentialPublicKey. + ID string + // RawID field of InputPasskeyCredentialPublicKey. + RawID string + // Response field of InputPasskeyCredentialPublicKey. + Response InputPasskeyResponseClass +} + +// InputPasskeyCredentialPublicKeyTypeID is TL type id of InputPasskeyCredentialPublicKey. +const InputPasskeyCredentialPublicKeyTypeID = 0x3c27b78f + +// construct implements constructor of InputPasskeyCredentialClass. +func (i InputPasskeyCredentialPublicKey) construct() InputPasskeyCredentialClass { return &i } + +// Ensuring interfaces in compile-time for InputPasskeyCredentialPublicKey. +var ( + _ bin.Encoder = &InputPasskeyCredentialPublicKey{} + _ bin.Decoder = &InputPasskeyCredentialPublicKey{} + _ bin.BareEncoder = &InputPasskeyCredentialPublicKey{} + _ bin.BareDecoder = &InputPasskeyCredentialPublicKey{} + + _ InputPasskeyCredentialClass = &InputPasskeyCredentialPublicKey{} +) + +func (i *InputPasskeyCredentialPublicKey) Zero() bool { + if i == nil { + return true + } + if !(i.ID == "") { + return false + } + if !(i.RawID == "") { + return false + } + if !(i.Response == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputPasskeyCredentialPublicKey) String() string { + if i == nil { + return "InputPasskeyCredentialPublicKey(nil)" + } + type Alias InputPasskeyCredentialPublicKey + return fmt.Sprintf("InputPasskeyCredentialPublicKey%+v", Alias(*i)) +} + +// FillFrom fills InputPasskeyCredentialPublicKey from given interface. +func (i *InputPasskeyCredentialPublicKey) FillFrom(from interface { + GetID() (value string) + GetRawID() (value string) + GetResponse() (value InputPasskeyResponseClass) +}) { + i.ID = from.GetID() + i.RawID = from.GetRawID() + i.Response = from.GetResponse() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputPasskeyCredentialPublicKey) TypeID() uint32 { + return InputPasskeyCredentialPublicKeyTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputPasskeyCredentialPublicKey) TypeName() string { + return "inputPasskeyCredentialPublicKey" +} + +// TypeInfo returns info about TL type. +func (i *InputPasskeyCredentialPublicKey) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputPasskeyCredentialPublicKey", + ID: InputPasskeyCredentialPublicKeyTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "RawID", + SchemaName: "raw_id", + }, + { + Name: "Response", + SchemaName: "response", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputPasskeyCredentialPublicKey) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPasskeyCredentialPublicKey#3c27b78f as nil") + } + b.PutID(InputPasskeyCredentialPublicKeyTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputPasskeyCredentialPublicKey) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPasskeyCredentialPublicKey#3c27b78f as nil") + } + b.PutString(i.ID) + b.PutString(i.RawID) + if i.Response == nil { + return fmt.Errorf("unable to encode inputPasskeyCredentialPublicKey#3c27b78f: field response is nil") + } + if err := i.Response.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputPasskeyCredentialPublicKey#3c27b78f: field response: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (i *InputPasskeyCredentialPublicKey) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPasskeyCredentialPublicKey#3c27b78f to nil") + } + if err := b.ConsumeID(InputPasskeyCredentialPublicKeyTypeID); err != nil { + return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputPasskeyCredentialPublicKey) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPasskeyCredentialPublicKey#3c27b78f to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: field id: %w", err) + } + i.ID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: field raw_id: %w", err) + } + i.RawID = value + } + { + value, err := DecodeInputPasskeyResponse(b) + if err != nil { + return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: field response: %w", err) + } + i.Response = value + } + return nil +} + +// GetID returns value of ID field. +func (i *InputPasskeyCredentialPublicKey) GetID() (value string) { + if i == nil { + return + } + return i.ID +} + +// GetRawID returns value of RawID field. +func (i *InputPasskeyCredentialPublicKey) GetRawID() (value string) { + if i == nil { + return + } + return i.RawID +} + +// GetResponse returns value of Response field. +func (i *InputPasskeyCredentialPublicKey) GetResponse() (value InputPasskeyResponseClass) { + if i == nil { + return + } + return i.Response +} + +// InputPasskeyCredentialFirebasePNV represents TL type `inputPasskeyCredentialFirebasePNV#5b1ccb28`. +// +// See https://core.telegram.org/constructor/inputPasskeyCredentialFirebasePNV for reference. +type InputPasskeyCredentialFirebasePNV struct { + // PnvToken field of InputPasskeyCredentialFirebasePNV. + PnvToken string +} + +// InputPasskeyCredentialFirebasePNVTypeID is TL type id of InputPasskeyCredentialFirebasePNV. +const InputPasskeyCredentialFirebasePNVTypeID = 0x5b1ccb28 + +// construct implements constructor of InputPasskeyCredentialClass. +func (i InputPasskeyCredentialFirebasePNV) construct() InputPasskeyCredentialClass { return &i } + +// Ensuring interfaces in compile-time for InputPasskeyCredentialFirebasePNV. +var ( + _ bin.Encoder = &InputPasskeyCredentialFirebasePNV{} + _ bin.Decoder = &InputPasskeyCredentialFirebasePNV{} + _ bin.BareEncoder = &InputPasskeyCredentialFirebasePNV{} + _ bin.BareDecoder = &InputPasskeyCredentialFirebasePNV{} + + _ InputPasskeyCredentialClass = &InputPasskeyCredentialFirebasePNV{} +) + +func (i *InputPasskeyCredentialFirebasePNV) Zero() bool { + if i == nil { + return true + } + if !(i.PnvToken == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputPasskeyCredentialFirebasePNV) String() string { + if i == nil { + return "InputPasskeyCredentialFirebasePNV(nil)" + } + type Alias InputPasskeyCredentialFirebasePNV + return fmt.Sprintf("InputPasskeyCredentialFirebasePNV%+v", Alias(*i)) +} + +// FillFrom fills InputPasskeyCredentialFirebasePNV from given interface. +func (i *InputPasskeyCredentialFirebasePNV) FillFrom(from interface { + GetPnvToken() (value string) +}) { + i.PnvToken = from.GetPnvToken() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputPasskeyCredentialFirebasePNV) TypeID() uint32 { + return InputPasskeyCredentialFirebasePNVTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputPasskeyCredentialFirebasePNV) TypeName() string { + return "inputPasskeyCredentialFirebasePNV" +} + +// TypeInfo returns info about TL type. +func (i *InputPasskeyCredentialFirebasePNV) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputPasskeyCredentialFirebasePNV", + ID: InputPasskeyCredentialFirebasePNVTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "PnvToken", + SchemaName: "pnv_token", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputPasskeyCredentialFirebasePNV) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPasskeyCredentialFirebasePNV#5b1ccb28 as nil") + } + b.PutID(InputPasskeyCredentialFirebasePNVTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputPasskeyCredentialFirebasePNV) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPasskeyCredentialFirebasePNV#5b1ccb28 as nil") + } + b.PutString(i.PnvToken) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputPasskeyCredentialFirebasePNV) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPasskeyCredentialFirebasePNV#5b1ccb28 to nil") + } + if err := b.ConsumeID(InputPasskeyCredentialFirebasePNVTypeID); err != nil { + return fmt.Errorf("unable to decode inputPasskeyCredentialFirebasePNV#5b1ccb28: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputPasskeyCredentialFirebasePNV) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPasskeyCredentialFirebasePNV#5b1ccb28 to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputPasskeyCredentialFirebasePNV#5b1ccb28: field pnv_token: %w", err) + } + i.PnvToken = value + } + return nil +} + +// GetPnvToken returns value of PnvToken field. +func (i *InputPasskeyCredentialFirebasePNV) GetPnvToken() (value string) { + if i == nil { + return + } + return i.PnvToken +} + +// InputPasskeyCredentialClassName is schema name of InputPasskeyCredentialClass. +const InputPasskeyCredentialClassName = "InputPasskeyCredential" + +// InputPasskeyCredentialClass represents InputPasskeyCredential generic type. +// +// See https://core.telegram.org/type/InputPasskeyCredential for reference. +// +// Example: +// +// g, err := tg.DecodeInputPasskeyCredential(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.InputPasskeyCredentialPublicKey: // inputPasskeyCredentialPublicKey#3c27b78f +// case *tg.InputPasskeyCredentialFirebasePNV: // inputPasskeyCredentialFirebasePNV#5b1ccb28 +// default: panic(v) +// } +type InputPasskeyCredentialClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() InputPasskeyCredentialClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool +} + +// DecodeInputPasskeyCredential implements binary de-serialization for InputPasskeyCredentialClass. +func DecodeInputPasskeyCredential(buf *bin.Buffer) (InputPasskeyCredentialClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case InputPasskeyCredentialPublicKeyTypeID: + // Decoding inputPasskeyCredentialPublicKey#3c27b78f. + v := InputPasskeyCredentialPublicKey{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputPasskeyCredentialClass: %w", err) + } + return &v, nil + case InputPasskeyCredentialFirebasePNVTypeID: + // Decoding inputPasskeyCredentialFirebasePNV#5b1ccb28. + v := InputPasskeyCredentialFirebasePNV{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputPasskeyCredentialClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode InputPasskeyCredentialClass: %w", bin.NewUnexpectedID(id)) + } +} + +// InputPasskeyCredential boxes the InputPasskeyCredentialClass providing a helper. +type InputPasskeyCredentialBox struct { + InputPasskeyCredential InputPasskeyCredentialClass +} + +// Decode implements bin.Decoder for InputPasskeyCredentialBox. +func (b *InputPasskeyCredentialBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode InputPasskeyCredentialBox to nil") + } + v, err := DecodeInputPasskeyCredential(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.InputPasskeyCredential = v + return nil +} + +// Encode implements bin.Encode for InputPasskeyCredentialBox. +func (b *InputPasskeyCredentialBox) Encode(buf *bin.Buffer) error { + if b == nil || b.InputPasskeyCredential == nil { + return fmt.Errorf("unable to encode InputPasskeyCredentialClass as nil") + } + return b.InputPasskeyCredential.Encode(buf) +} diff --git a/pkg/gotd/tg/tl_input_passkey_credential_slices_gen.go b/pkg/gotd/tg/tl_input_passkey_credential_slices_gen.go new file mode 100644 index 00000000..513041fc --- /dev/null +++ b/pkg/gotd/tg/tl_input_passkey_credential_slices_gen.go @@ -0,0 +1,307 @@ +//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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// InputPasskeyCredentialClassArray is adapter for slice of InputPasskeyCredentialClass. +type InputPasskeyCredentialClassArray []InputPasskeyCredentialClass + +// Sort sorts slice of InputPasskeyCredentialClass. +func (s InputPasskeyCredentialClassArray) Sort(less func(a, b InputPasskeyCredentialClass) bool) InputPasskeyCredentialClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputPasskeyCredentialClass. +func (s InputPasskeyCredentialClassArray) SortStable(less func(a, b InputPasskeyCredentialClass) bool) InputPasskeyCredentialClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputPasskeyCredentialClass. +func (s InputPasskeyCredentialClassArray) Retain(keep func(x InputPasskeyCredentialClass) bool) InputPasskeyCredentialClassArray { + 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 InputPasskeyCredentialClassArray) First() (v InputPasskeyCredentialClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputPasskeyCredentialClassArray) Last() (v InputPasskeyCredentialClass, 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 *InputPasskeyCredentialClassArray) PopFirst() (v InputPasskeyCredentialClass, 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 InputPasskeyCredentialClass + 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 *InputPasskeyCredentialClassArray) Pop() (v InputPasskeyCredentialClass, 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 +} + +// AsInputPasskeyCredentialPublicKey returns copy with only InputPasskeyCredentialPublicKey constructors. +func (s InputPasskeyCredentialClassArray) AsInputPasskeyCredentialPublicKey() (to InputPasskeyCredentialPublicKeyArray) { + for _, elem := range s { + value, ok := elem.(*InputPasskeyCredentialPublicKey) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsInputPasskeyCredentialFirebasePNV returns copy with only InputPasskeyCredentialFirebasePNV constructors. +func (s InputPasskeyCredentialClassArray) AsInputPasskeyCredentialFirebasePNV() (to InputPasskeyCredentialFirebasePNVArray) { + for _, elem := range s { + value, ok := elem.(*InputPasskeyCredentialFirebasePNV) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// InputPasskeyCredentialPublicKeyArray is adapter for slice of InputPasskeyCredentialPublicKey. +type InputPasskeyCredentialPublicKeyArray []InputPasskeyCredentialPublicKey + +// Sort sorts slice of InputPasskeyCredentialPublicKey. +func (s InputPasskeyCredentialPublicKeyArray) Sort(less func(a, b InputPasskeyCredentialPublicKey) bool) InputPasskeyCredentialPublicKeyArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputPasskeyCredentialPublicKey. +func (s InputPasskeyCredentialPublicKeyArray) SortStable(less func(a, b InputPasskeyCredentialPublicKey) bool) InputPasskeyCredentialPublicKeyArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputPasskeyCredentialPublicKey. +func (s InputPasskeyCredentialPublicKeyArray) Retain(keep func(x InputPasskeyCredentialPublicKey) bool) InputPasskeyCredentialPublicKeyArray { + 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 InputPasskeyCredentialPublicKeyArray) First() (v InputPasskeyCredentialPublicKey, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputPasskeyCredentialPublicKeyArray) Last() (v InputPasskeyCredentialPublicKey, 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 *InputPasskeyCredentialPublicKeyArray) PopFirst() (v InputPasskeyCredentialPublicKey, 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 InputPasskeyCredentialPublicKey + 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 *InputPasskeyCredentialPublicKeyArray) Pop() (v InputPasskeyCredentialPublicKey, 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 +} + +// InputPasskeyCredentialFirebasePNVArray is adapter for slice of InputPasskeyCredentialFirebasePNV. +type InputPasskeyCredentialFirebasePNVArray []InputPasskeyCredentialFirebasePNV + +// Sort sorts slice of InputPasskeyCredentialFirebasePNV. +func (s InputPasskeyCredentialFirebasePNVArray) Sort(less func(a, b InputPasskeyCredentialFirebasePNV) bool) InputPasskeyCredentialFirebasePNVArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputPasskeyCredentialFirebasePNV. +func (s InputPasskeyCredentialFirebasePNVArray) SortStable(less func(a, b InputPasskeyCredentialFirebasePNV) bool) InputPasskeyCredentialFirebasePNVArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputPasskeyCredentialFirebasePNV. +func (s InputPasskeyCredentialFirebasePNVArray) Retain(keep func(x InputPasskeyCredentialFirebasePNV) bool) InputPasskeyCredentialFirebasePNVArray { + 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 InputPasskeyCredentialFirebasePNVArray) First() (v InputPasskeyCredentialFirebasePNV, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputPasskeyCredentialFirebasePNVArray) Last() (v InputPasskeyCredentialFirebasePNV, 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 *InputPasskeyCredentialFirebasePNVArray) PopFirst() (v InputPasskeyCredentialFirebasePNV, 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 InputPasskeyCredentialFirebasePNV + 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 *InputPasskeyCredentialFirebasePNVArray) Pop() (v InputPasskeyCredentialFirebasePNV, 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/pkg/gotd/tg/tl_input_passkey_response_gen.go b/pkg/gotd/tg/tl_input_passkey_response_gen.go new file mode 100644 index 00000000..b0c79fc6 --- /dev/null +++ b/pkg/gotd/tg/tl_input_passkey_response_gen.go @@ -0,0 +1,500 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// InputPasskeyResponseRegister represents TL type `inputPasskeyResponseRegister#3e63935c`. +// +// See https://core.telegram.org/constructor/inputPasskeyResponseRegister for reference. +type InputPasskeyResponseRegister struct { + // ClientData field of InputPasskeyResponseRegister. + ClientData DataJSON + // AttestationData field of InputPasskeyResponseRegister. + AttestationData []byte +} + +// InputPasskeyResponseRegisterTypeID is TL type id of InputPasskeyResponseRegister. +const InputPasskeyResponseRegisterTypeID = 0x3e63935c + +// construct implements constructor of InputPasskeyResponseClass. +func (i InputPasskeyResponseRegister) construct() InputPasskeyResponseClass { return &i } + +// Ensuring interfaces in compile-time for InputPasskeyResponseRegister. +var ( + _ bin.Encoder = &InputPasskeyResponseRegister{} + _ bin.Decoder = &InputPasskeyResponseRegister{} + _ bin.BareEncoder = &InputPasskeyResponseRegister{} + _ bin.BareDecoder = &InputPasskeyResponseRegister{} + + _ InputPasskeyResponseClass = &InputPasskeyResponseRegister{} +) + +func (i *InputPasskeyResponseRegister) Zero() bool { + if i == nil { + return true + } + if !(i.ClientData.Zero()) { + return false + } + if !(i.AttestationData == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputPasskeyResponseRegister) String() string { + if i == nil { + return "InputPasskeyResponseRegister(nil)" + } + type Alias InputPasskeyResponseRegister + return fmt.Sprintf("InputPasskeyResponseRegister%+v", Alias(*i)) +} + +// FillFrom fills InputPasskeyResponseRegister from given interface. +func (i *InputPasskeyResponseRegister) FillFrom(from interface { + GetClientData() (value DataJSON) + GetAttestationData() (value []byte) +}) { + i.ClientData = from.GetClientData() + i.AttestationData = from.GetAttestationData() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputPasskeyResponseRegister) TypeID() uint32 { + return InputPasskeyResponseRegisterTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputPasskeyResponseRegister) TypeName() string { + return "inputPasskeyResponseRegister" +} + +// TypeInfo returns info about TL type. +func (i *InputPasskeyResponseRegister) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputPasskeyResponseRegister", + ID: InputPasskeyResponseRegisterTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ClientData", + SchemaName: "client_data", + }, + { + Name: "AttestationData", + SchemaName: "attestation_data", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputPasskeyResponseRegister) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPasskeyResponseRegister#3e63935c as nil") + } + b.PutID(InputPasskeyResponseRegisterTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputPasskeyResponseRegister) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPasskeyResponseRegister#3e63935c as nil") + } + if err := i.ClientData.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputPasskeyResponseRegister#3e63935c: field client_data: %w", err) + } + b.PutBytes(i.AttestationData) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputPasskeyResponseRegister) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPasskeyResponseRegister#3e63935c to nil") + } + if err := b.ConsumeID(InputPasskeyResponseRegisterTypeID); err != nil { + return fmt.Errorf("unable to decode inputPasskeyResponseRegister#3e63935c: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputPasskeyResponseRegister) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPasskeyResponseRegister#3e63935c to nil") + } + { + if err := i.ClientData.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputPasskeyResponseRegister#3e63935c: field client_data: %w", err) + } + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode inputPasskeyResponseRegister#3e63935c: field attestation_data: %w", err) + } + i.AttestationData = value + } + return nil +} + +// GetClientData returns value of ClientData field. +func (i *InputPasskeyResponseRegister) GetClientData() (value DataJSON) { + if i == nil { + return + } + return i.ClientData +} + +// GetAttestationData returns value of AttestationData field. +func (i *InputPasskeyResponseRegister) GetAttestationData() (value []byte) { + if i == nil { + return + } + return i.AttestationData +} + +// InputPasskeyResponseLogin represents TL type `inputPasskeyResponseLogin#c31fc14a`. +// +// See https://core.telegram.org/constructor/inputPasskeyResponseLogin for reference. +type InputPasskeyResponseLogin struct { + // ClientData field of InputPasskeyResponseLogin. + ClientData DataJSON + // AuthenticatorData field of InputPasskeyResponseLogin. + AuthenticatorData []byte + // Signature field of InputPasskeyResponseLogin. + Signature []byte + // UserHandle field of InputPasskeyResponseLogin. + UserHandle string +} + +// InputPasskeyResponseLoginTypeID is TL type id of InputPasskeyResponseLogin. +const InputPasskeyResponseLoginTypeID = 0xc31fc14a + +// construct implements constructor of InputPasskeyResponseClass. +func (i InputPasskeyResponseLogin) construct() InputPasskeyResponseClass { return &i } + +// Ensuring interfaces in compile-time for InputPasskeyResponseLogin. +var ( + _ bin.Encoder = &InputPasskeyResponseLogin{} + _ bin.Decoder = &InputPasskeyResponseLogin{} + _ bin.BareEncoder = &InputPasskeyResponseLogin{} + _ bin.BareDecoder = &InputPasskeyResponseLogin{} + + _ InputPasskeyResponseClass = &InputPasskeyResponseLogin{} +) + +func (i *InputPasskeyResponseLogin) Zero() bool { + if i == nil { + return true + } + if !(i.ClientData.Zero()) { + return false + } + if !(i.AuthenticatorData == nil) { + return false + } + if !(i.Signature == nil) { + return false + } + if !(i.UserHandle == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputPasskeyResponseLogin) String() string { + if i == nil { + return "InputPasskeyResponseLogin(nil)" + } + type Alias InputPasskeyResponseLogin + return fmt.Sprintf("InputPasskeyResponseLogin%+v", Alias(*i)) +} + +// FillFrom fills InputPasskeyResponseLogin from given interface. +func (i *InputPasskeyResponseLogin) FillFrom(from interface { + GetClientData() (value DataJSON) + GetAuthenticatorData() (value []byte) + GetSignature() (value []byte) + GetUserHandle() (value string) +}) { + i.ClientData = from.GetClientData() + i.AuthenticatorData = from.GetAuthenticatorData() + i.Signature = from.GetSignature() + i.UserHandle = from.GetUserHandle() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputPasskeyResponseLogin) TypeID() uint32 { + return InputPasskeyResponseLoginTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputPasskeyResponseLogin) TypeName() string { + return "inputPasskeyResponseLogin" +} + +// TypeInfo returns info about TL type. +func (i *InputPasskeyResponseLogin) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputPasskeyResponseLogin", + ID: InputPasskeyResponseLoginTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ClientData", + SchemaName: "client_data", + }, + { + Name: "AuthenticatorData", + SchemaName: "authenticator_data", + }, + { + Name: "Signature", + SchemaName: "signature", + }, + { + Name: "UserHandle", + SchemaName: "user_handle", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputPasskeyResponseLogin) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPasskeyResponseLogin#c31fc14a as nil") + } + b.PutID(InputPasskeyResponseLoginTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputPasskeyResponseLogin) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputPasskeyResponseLogin#c31fc14a as nil") + } + if err := i.ClientData.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputPasskeyResponseLogin#c31fc14a: field client_data: %w", err) + } + b.PutBytes(i.AuthenticatorData) + b.PutBytes(i.Signature) + b.PutString(i.UserHandle) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputPasskeyResponseLogin) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPasskeyResponseLogin#c31fc14a to nil") + } + if err := b.ConsumeID(InputPasskeyResponseLoginTypeID); err != nil { + return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputPasskeyResponseLogin) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputPasskeyResponseLogin#c31fc14a to nil") + } + { + if err := i.ClientData.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: field client_data: %w", err) + } + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: field authenticator_data: %w", err) + } + i.AuthenticatorData = value + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: field signature: %w", err) + } + i.Signature = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: field user_handle: %w", err) + } + i.UserHandle = value + } + return nil +} + +// GetClientData returns value of ClientData field. +func (i *InputPasskeyResponseLogin) GetClientData() (value DataJSON) { + if i == nil { + return + } + return i.ClientData +} + +// GetAuthenticatorData returns value of AuthenticatorData field. +func (i *InputPasskeyResponseLogin) GetAuthenticatorData() (value []byte) { + if i == nil { + return + } + return i.AuthenticatorData +} + +// GetSignature returns value of Signature field. +func (i *InputPasskeyResponseLogin) GetSignature() (value []byte) { + if i == nil { + return + } + return i.Signature +} + +// GetUserHandle returns value of UserHandle field. +func (i *InputPasskeyResponseLogin) GetUserHandle() (value string) { + if i == nil { + return + } + return i.UserHandle +} + +// InputPasskeyResponseClassName is schema name of InputPasskeyResponseClass. +const InputPasskeyResponseClassName = "InputPasskeyResponse" + +// InputPasskeyResponseClass represents InputPasskeyResponse generic type. +// +// See https://core.telegram.org/type/InputPasskeyResponse for reference. +// +// Example: +// +// g, err := tg.DecodeInputPasskeyResponse(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.InputPasskeyResponseRegister: // inputPasskeyResponseRegister#3e63935c +// case *tg.InputPasskeyResponseLogin: // inputPasskeyResponseLogin#c31fc14a +// default: panic(v) +// } +type InputPasskeyResponseClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() InputPasskeyResponseClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + // ClientData field of InputPasskeyResponseRegister. + GetClientData() (value DataJSON) +} + +// DecodeInputPasskeyResponse implements binary de-serialization for InputPasskeyResponseClass. +func DecodeInputPasskeyResponse(buf *bin.Buffer) (InputPasskeyResponseClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case InputPasskeyResponseRegisterTypeID: + // Decoding inputPasskeyResponseRegister#3e63935c. + v := InputPasskeyResponseRegister{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputPasskeyResponseClass: %w", err) + } + return &v, nil + case InputPasskeyResponseLoginTypeID: + // Decoding inputPasskeyResponseLogin#c31fc14a. + v := InputPasskeyResponseLogin{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputPasskeyResponseClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode InputPasskeyResponseClass: %w", bin.NewUnexpectedID(id)) + } +} + +// InputPasskeyResponse boxes the InputPasskeyResponseClass providing a helper. +type InputPasskeyResponseBox struct { + InputPasskeyResponse InputPasskeyResponseClass +} + +// Decode implements bin.Decoder for InputPasskeyResponseBox. +func (b *InputPasskeyResponseBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode InputPasskeyResponseBox to nil") + } + v, err := DecodeInputPasskeyResponse(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.InputPasskeyResponse = v + return nil +} + +// Encode implements bin.Encode for InputPasskeyResponseBox. +func (b *InputPasskeyResponseBox) Encode(buf *bin.Buffer) error { + if b == nil || b.InputPasskeyResponse == nil { + return fmt.Errorf("unable to encode InputPasskeyResponseClass as nil") + } + return b.InputPasskeyResponse.Encode(buf) +} diff --git a/pkg/gotd/tg/tl_input_passkey_response_slices_gen.go b/pkg/gotd/tg/tl_input_passkey_response_slices_gen.go new file mode 100644 index 00000000..cb55959f --- /dev/null +++ b/pkg/gotd/tg/tl_input_passkey_response_slices_gen.go @@ -0,0 +1,307 @@ +//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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// InputPasskeyResponseClassArray is adapter for slice of InputPasskeyResponseClass. +type InputPasskeyResponseClassArray []InputPasskeyResponseClass + +// Sort sorts slice of InputPasskeyResponseClass. +func (s InputPasskeyResponseClassArray) Sort(less func(a, b InputPasskeyResponseClass) bool) InputPasskeyResponseClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputPasskeyResponseClass. +func (s InputPasskeyResponseClassArray) SortStable(less func(a, b InputPasskeyResponseClass) bool) InputPasskeyResponseClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputPasskeyResponseClass. +func (s InputPasskeyResponseClassArray) Retain(keep func(x InputPasskeyResponseClass) bool) InputPasskeyResponseClassArray { + 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 InputPasskeyResponseClassArray) First() (v InputPasskeyResponseClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputPasskeyResponseClassArray) Last() (v InputPasskeyResponseClass, 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 *InputPasskeyResponseClassArray) PopFirst() (v InputPasskeyResponseClass, 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 InputPasskeyResponseClass + 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 *InputPasskeyResponseClassArray) Pop() (v InputPasskeyResponseClass, 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 +} + +// AsInputPasskeyResponseRegister returns copy with only InputPasskeyResponseRegister constructors. +func (s InputPasskeyResponseClassArray) AsInputPasskeyResponseRegister() (to InputPasskeyResponseRegisterArray) { + for _, elem := range s { + value, ok := elem.(*InputPasskeyResponseRegister) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsInputPasskeyResponseLogin returns copy with only InputPasskeyResponseLogin constructors. +func (s InputPasskeyResponseClassArray) AsInputPasskeyResponseLogin() (to InputPasskeyResponseLoginArray) { + for _, elem := range s { + value, ok := elem.(*InputPasskeyResponseLogin) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// InputPasskeyResponseRegisterArray is adapter for slice of InputPasskeyResponseRegister. +type InputPasskeyResponseRegisterArray []InputPasskeyResponseRegister + +// Sort sorts slice of InputPasskeyResponseRegister. +func (s InputPasskeyResponseRegisterArray) Sort(less func(a, b InputPasskeyResponseRegister) bool) InputPasskeyResponseRegisterArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputPasskeyResponseRegister. +func (s InputPasskeyResponseRegisterArray) SortStable(less func(a, b InputPasskeyResponseRegister) bool) InputPasskeyResponseRegisterArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputPasskeyResponseRegister. +func (s InputPasskeyResponseRegisterArray) Retain(keep func(x InputPasskeyResponseRegister) bool) InputPasskeyResponseRegisterArray { + 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 InputPasskeyResponseRegisterArray) First() (v InputPasskeyResponseRegister, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputPasskeyResponseRegisterArray) Last() (v InputPasskeyResponseRegister, 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 *InputPasskeyResponseRegisterArray) PopFirst() (v InputPasskeyResponseRegister, 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 InputPasskeyResponseRegister + 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 *InputPasskeyResponseRegisterArray) Pop() (v InputPasskeyResponseRegister, 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 +} + +// InputPasskeyResponseLoginArray is adapter for slice of InputPasskeyResponseLogin. +type InputPasskeyResponseLoginArray []InputPasskeyResponseLogin + +// Sort sorts slice of InputPasskeyResponseLogin. +func (s InputPasskeyResponseLoginArray) Sort(less func(a, b InputPasskeyResponseLogin) bool) InputPasskeyResponseLoginArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputPasskeyResponseLogin. +func (s InputPasskeyResponseLoginArray) SortStable(less func(a, b InputPasskeyResponseLogin) bool) InputPasskeyResponseLoginArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputPasskeyResponseLogin. +func (s InputPasskeyResponseLoginArray) Retain(keep func(x InputPasskeyResponseLogin) bool) InputPasskeyResponseLoginArray { + 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 InputPasskeyResponseLoginArray) First() (v InputPasskeyResponseLogin, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputPasskeyResponseLoginArray) Last() (v InputPasskeyResponseLogin, 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 *InputPasskeyResponseLoginArray) PopFirst() (v InputPasskeyResponseLogin, 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 InputPasskeyResponseLogin + 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 *InputPasskeyResponseLoginArray) Pop() (v InputPasskeyResponseLogin, 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/pkg/gotd/tg/tl_keyboard_button_gen.go b/pkg/gotd/tg/tl_keyboard_button_gen.go index 7aec2ad2..2b6bef69 100644 --- a/pkg/gotd/tg/tl_keyboard_button_gen.go +++ b/pkg/gotd/tg/tl_keyboard_button_gen.go @@ -31,17 +31,23 @@ var ( _ = tdjson.Encoder{} ) -// KeyboardButton represents TL type `keyboardButton#a2fa4880`. +// KeyboardButton represents TL type `keyboardButton#7d170cff`. // Bot keyboard button // // See https://core.telegram.org/constructor/keyboardButton for reference. type KeyboardButton struct { + // Flags field of KeyboardButton. + Flags bin.Fields + // Style field of KeyboardButton. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string } // KeyboardButtonTypeID is TL type id of KeyboardButton. -const KeyboardButtonTypeID = 0xa2fa4880 +const KeyboardButtonTypeID = 0x7d170cff // construct implements constructor of KeyboardButtonClass. func (k KeyboardButton) construct() KeyboardButtonClass { return &k } @@ -60,6 +66,12 @@ func (k *KeyboardButton) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -78,8 +90,13 @@ func (k *KeyboardButton) String() string { // FillFrom fills KeyboardButton from given interface. func (k *KeyboardButton) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() } @@ -106,6 +123,11 @@ func (k *KeyboardButton) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -114,10 +136,17 @@ func (k *KeyboardButton) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButton) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButton) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButton#a2fa4880 as nil") + return fmt.Errorf("can't encode keyboardButton#7d170cff as nil") } b.PutID(KeyboardButtonTypeID) return k.EncodeBare(b) @@ -126,7 +155,16 @@ func (k *KeyboardButton) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButton) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButton#a2fa4880 as nil") + return fmt.Errorf("can't encode keyboardButton#7d170cff as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButton#7d170cff: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButton#7d170cff: field style: %w", err) + } } b.PutString(k.Text) return nil @@ -135,10 +173,10 @@ func (k *KeyboardButton) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButton) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButton#a2fa4880 to nil") + return fmt.Errorf("can't decode keyboardButton#7d170cff to nil") } if err := b.ConsumeID(KeyboardButtonTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButton#a2fa4880: %w", err) + return fmt.Errorf("unable to decode keyboardButton#7d170cff: %w", err) } return k.DecodeBare(b) } @@ -146,18 +184,46 @@ func (k *KeyboardButton) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButton) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButton#a2fa4880 to nil") + return fmt.Errorf("can't decode keyboardButton#7d170cff to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButton#7d170cff: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButton#7d170cff: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButton#a2fa4880: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButton#7d170cff: field text: %w", err) } k.Text = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButton) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButton) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButton) GetText() (value string) { if k == nil { @@ -166,11 +232,17 @@ func (k *KeyboardButton) GetText() (value string) { return k.Text } -// KeyboardButtonURL represents TL type `keyboardButtonUrl#258aff05`. +// KeyboardButtonURL represents TL type `keyboardButtonUrl#d80c25ec`. // URL button // // See https://core.telegram.org/constructor/keyboardButtonUrl for reference. type KeyboardButtonURL struct { + // Flags field of KeyboardButtonURL. + Flags bin.Fields + // Style field of KeyboardButtonURL. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button label Text string // URL @@ -178,7 +250,7 @@ type KeyboardButtonURL struct { } // KeyboardButtonURLTypeID is TL type id of KeyboardButtonURL. -const KeyboardButtonURLTypeID = 0x258aff05 +const KeyboardButtonURLTypeID = 0xd80c25ec // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonURL) construct() KeyboardButtonClass { return &k } @@ -197,6 +269,12 @@ func (k *KeyboardButtonURL) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -218,9 +296,14 @@ func (k *KeyboardButtonURL) String() string { // FillFrom fills KeyboardButtonURL from given interface. func (k *KeyboardButtonURL) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetURL() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() k.URL = from.GetURL() } @@ -248,6 +331,11 @@ func (k *KeyboardButtonURL) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -260,10 +348,17 @@ func (k *KeyboardButtonURL) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonURL) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonURL) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonUrl#258aff05 as nil") + return fmt.Errorf("can't encode keyboardButtonUrl#d80c25ec as nil") } b.PutID(KeyboardButtonURLTypeID) return k.EncodeBare(b) @@ -272,7 +367,16 @@ func (k *KeyboardButtonURL) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonURL) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonUrl#258aff05 as nil") + return fmt.Errorf("can't encode keyboardButtonUrl#d80c25ec as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonUrl#d80c25ec: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonUrl#d80c25ec: field style: %w", err) + } } b.PutString(k.Text) b.PutString(k.URL) @@ -282,10 +386,10 @@ func (k *KeyboardButtonURL) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonURL) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonUrl#258aff05 to nil") + return fmt.Errorf("can't decode keyboardButtonUrl#d80c25ec to nil") } if err := b.ConsumeID(KeyboardButtonURLTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonUrl#258aff05: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUrl#d80c25ec: %w", err) } return k.DecodeBare(b) } @@ -293,25 +397,53 @@ func (k *KeyboardButtonURL) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonURL) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonUrl#258aff05 to nil") + return fmt.Errorf("can't decode keyboardButtonUrl#d80c25ec to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonUrl#d80c25ec: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonUrl#d80c25ec: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonUrl#258aff05: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUrl#d80c25ec: field text: %w", err) } k.Text = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonUrl#258aff05: field url: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUrl#d80c25ec: field url: %w", err) } k.URL = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonURL) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonURL) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonURL) GetText() (value string) { if k == nil { @@ -328,7 +460,7 @@ func (k *KeyboardButtonURL) GetURL() (value string) { return k.URL } -// KeyboardButtonCallback represents TL type `keyboardButtonCallback#35bbdb6b`. +// KeyboardButtonCallback represents TL type `keyboardButtonCallback#e62bc960`. // Callback button // // See https://core.telegram.org/constructor/keyboardButtonCallback for reference. @@ -350,6 +482,10 @@ type KeyboardButtonCallback struct { // 3) https://core.telegram.org/api/srp // 4) https://t.me/botfather RequiresPassword bool + // Style field of KeyboardButtonCallback. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string // Callback data @@ -357,7 +493,7 @@ type KeyboardButtonCallback struct { } // KeyboardButtonCallbackTypeID is TL type id of KeyboardButtonCallback. -const KeyboardButtonCallbackTypeID = 0x35bbdb6b +const KeyboardButtonCallbackTypeID = 0xe62bc960 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonCallback) construct() KeyboardButtonClass { return &k } @@ -382,6 +518,9 @@ func (k *KeyboardButtonCallback) Zero() bool { if !(k.RequiresPassword == false) { return false } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -404,10 +543,15 @@ func (k *KeyboardButtonCallback) String() string { // FillFrom fills KeyboardButtonCallback from given interface. func (k *KeyboardButtonCallback) FillFrom(from interface { GetRequiresPassword() (value bool) + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetData() (value []byte) }) { k.RequiresPassword = from.GetRequiresPassword() + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() k.Data = from.GetData() } @@ -440,6 +584,11 @@ func (k *KeyboardButtonCallback) TypeInfo() tdp.Type { SchemaName: "requires_password", Null: !k.Flags.Has(0), }, + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -457,12 +606,15 @@ func (k *KeyboardButtonCallback) SetFlags() { if !(k.RequiresPassword == false) { k.Flags.Set(0) } + if !(k.Style.Zero()) { + k.Flags.Set(10) + } } // Encode implements bin.Encoder. func (k *KeyboardButtonCallback) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonCallback#35bbdb6b as nil") + return fmt.Errorf("can't encode keyboardButtonCallback#e62bc960 as nil") } b.PutID(KeyboardButtonCallbackTypeID) return k.EncodeBare(b) @@ -471,11 +623,16 @@ func (k *KeyboardButtonCallback) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonCallback) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonCallback#35bbdb6b as nil") + return fmt.Errorf("can't encode keyboardButtonCallback#e62bc960 as nil") } k.SetFlags() if err := k.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonCallback#35bbdb6b: field flags: %w", err) + return fmt.Errorf("unable to encode keyboardButtonCallback#e62bc960: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonCallback#e62bc960: field style: %w", err) + } } b.PutString(k.Text) b.PutBytes(k.Data) @@ -485,10 +642,10 @@ func (k *KeyboardButtonCallback) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonCallback) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonCallback#35bbdb6b to nil") + return fmt.Errorf("can't decode keyboardButtonCallback#e62bc960 to nil") } if err := b.ConsumeID(KeyboardButtonCallbackTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonCallback#35bbdb6b: %w", err) + return fmt.Errorf("unable to decode keyboardButtonCallback#e62bc960: %w", err) } return k.DecodeBare(b) } @@ -496,25 +653,30 @@ func (k *KeyboardButtonCallback) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonCallback) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonCallback#35bbdb6b to nil") + return fmt.Errorf("can't decode keyboardButtonCallback#e62bc960 to nil") } { if err := k.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode keyboardButtonCallback#35bbdb6b: field flags: %w", err) + return fmt.Errorf("unable to decode keyboardButtonCallback#e62bc960: field flags: %w", err) } } k.RequiresPassword = k.Flags.Has(0) + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonCallback#e62bc960: field style: %w", err) + } + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonCallback#35bbdb6b: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonCallback#e62bc960: field text: %w", err) } k.Text = value } { value, err := b.Bytes() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonCallback#35bbdb6b: field data: %w", err) + return fmt.Errorf("unable to decode keyboardButtonCallback#e62bc960: field data: %w", err) } k.Data = value } @@ -540,6 +702,24 @@ func (k *KeyboardButtonCallback) GetRequiresPassword() (value bool) { return k.Flags.Has(0) } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonCallback) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonCallback) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonCallback) GetText() (value string) { if k == nil { @@ -556,17 +736,23 @@ func (k *KeyboardButtonCallback) GetData() (value []byte) { return k.Data } -// KeyboardButtonRequestPhone represents TL type `keyboardButtonRequestPhone#b16a6c29`. +// KeyboardButtonRequestPhone represents TL type `keyboardButtonRequestPhone#417efd8f`. // Button to request a user's phone number // // See https://core.telegram.org/constructor/keyboardButtonRequestPhone for reference. type KeyboardButtonRequestPhone struct { + // Flags field of KeyboardButtonRequestPhone. + Flags bin.Fields + // Style field of KeyboardButtonRequestPhone. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string } // KeyboardButtonRequestPhoneTypeID is TL type id of KeyboardButtonRequestPhone. -const KeyboardButtonRequestPhoneTypeID = 0xb16a6c29 +const KeyboardButtonRequestPhoneTypeID = 0x417efd8f // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonRequestPhone) construct() KeyboardButtonClass { return &k } @@ -585,6 +771,12 @@ func (k *KeyboardButtonRequestPhone) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -603,8 +795,13 @@ func (k *KeyboardButtonRequestPhone) String() string { // FillFrom fills KeyboardButtonRequestPhone from given interface. func (k *KeyboardButtonRequestPhone) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() } @@ -631,6 +828,11 @@ func (k *KeyboardButtonRequestPhone) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -639,10 +841,17 @@ func (k *KeyboardButtonRequestPhone) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonRequestPhone) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonRequestPhone) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonRequestPhone#b16a6c29 as nil") + return fmt.Errorf("can't encode keyboardButtonRequestPhone#417efd8f as nil") } b.PutID(KeyboardButtonRequestPhoneTypeID) return k.EncodeBare(b) @@ -651,7 +860,16 @@ func (k *KeyboardButtonRequestPhone) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonRequestPhone) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonRequestPhone#b16a6c29 as nil") + return fmt.Errorf("can't encode keyboardButtonRequestPhone#417efd8f as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonRequestPhone#417efd8f: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonRequestPhone#417efd8f: field style: %w", err) + } } b.PutString(k.Text) return nil @@ -660,10 +878,10 @@ func (k *KeyboardButtonRequestPhone) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonRequestPhone) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonRequestPhone#b16a6c29 to nil") + return fmt.Errorf("can't decode keyboardButtonRequestPhone#417efd8f to nil") } if err := b.ConsumeID(KeyboardButtonRequestPhoneTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPhone#b16a6c29: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPhone#417efd8f: %w", err) } return k.DecodeBare(b) } @@ -671,18 +889,46 @@ func (k *KeyboardButtonRequestPhone) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonRequestPhone) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonRequestPhone#b16a6c29 to nil") + return fmt.Errorf("can't decode keyboardButtonRequestPhone#417efd8f to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonRequestPhone#417efd8f: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonRequestPhone#417efd8f: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPhone#b16a6c29: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPhone#417efd8f: field text: %w", err) } k.Text = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonRequestPhone) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonRequestPhone) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonRequestPhone) GetText() (value string) { if k == nil { @@ -691,17 +937,23 @@ func (k *KeyboardButtonRequestPhone) GetText() (value string) { return k.Text } -// KeyboardButtonRequestGeoLocation represents TL type `keyboardButtonRequestGeoLocation#fc796b3f`. +// KeyboardButtonRequestGeoLocation represents TL type `keyboardButtonRequestGeoLocation#aa40f94d`. // Button to request a user's geolocation // // See https://core.telegram.org/constructor/keyboardButtonRequestGeoLocation for reference. type KeyboardButtonRequestGeoLocation struct { + // Flags field of KeyboardButtonRequestGeoLocation. + Flags bin.Fields + // Style field of KeyboardButtonRequestGeoLocation. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string } // KeyboardButtonRequestGeoLocationTypeID is TL type id of KeyboardButtonRequestGeoLocation. -const KeyboardButtonRequestGeoLocationTypeID = 0xfc796b3f +const KeyboardButtonRequestGeoLocationTypeID = 0xaa40f94d // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonRequestGeoLocation) construct() KeyboardButtonClass { return &k } @@ -720,6 +972,12 @@ func (k *KeyboardButtonRequestGeoLocation) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -738,8 +996,13 @@ func (k *KeyboardButtonRequestGeoLocation) String() string { // FillFrom fills KeyboardButtonRequestGeoLocation from given interface. func (k *KeyboardButtonRequestGeoLocation) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() } @@ -766,6 +1029,11 @@ func (k *KeyboardButtonRequestGeoLocation) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -774,10 +1042,17 @@ func (k *KeyboardButtonRequestGeoLocation) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonRequestGeoLocation) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonRequestGeoLocation) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonRequestGeoLocation#fc796b3f as nil") + return fmt.Errorf("can't encode keyboardButtonRequestGeoLocation#aa40f94d as nil") } b.PutID(KeyboardButtonRequestGeoLocationTypeID) return k.EncodeBare(b) @@ -786,7 +1061,16 @@ func (k *KeyboardButtonRequestGeoLocation) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonRequestGeoLocation) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonRequestGeoLocation#fc796b3f as nil") + return fmt.Errorf("can't encode keyboardButtonRequestGeoLocation#aa40f94d as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonRequestGeoLocation#aa40f94d: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonRequestGeoLocation#aa40f94d: field style: %w", err) + } } b.PutString(k.Text) return nil @@ -795,10 +1079,10 @@ func (k *KeyboardButtonRequestGeoLocation) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonRequestGeoLocation) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonRequestGeoLocation#fc796b3f to nil") + return fmt.Errorf("can't decode keyboardButtonRequestGeoLocation#aa40f94d to nil") } if err := b.ConsumeID(KeyboardButtonRequestGeoLocationTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#fc796b3f: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#aa40f94d: %w", err) } return k.DecodeBare(b) } @@ -806,18 +1090,46 @@ func (k *KeyboardButtonRequestGeoLocation) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonRequestGeoLocation) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonRequestGeoLocation#fc796b3f to nil") + return fmt.Errorf("can't decode keyboardButtonRequestGeoLocation#aa40f94d to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#aa40f94d: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#aa40f94d: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#fc796b3f: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#aa40f94d: field text: %w", err) } k.Text = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonRequestGeoLocation) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonRequestGeoLocation) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonRequestGeoLocation) GetText() (value string) { if k == nil { @@ -826,7 +1138,7 @@ func (k *KeyboardButtonRequestGeoLocation) GetText() (value string) { return k.Text } -// KeyboardButtonSwitchInline represents TL type `keyboardButtonSwitchInline#93b9fbb5`. +// KeyboardButtonSwitchInline represents TL type `keyboardButtonSwitchInline#991399fc`. // Button to force a user to switch to inline mode: pressing the button will prompt the // user to select one of their chats, open that chat and insert the bot's username and // the specified inline query in the input field. @@ -841,6 +1153,10 @@ type KeyboardButtonSwitchInline struct { // If set, pressing the button will insert the bot's username and the specified inline // query in the current chat's input field. SamePeer bool + // Style field of KeyboardButtonSwitchInline. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button label Text string // The inline query to use @@ -852,7 +1168,7 @@ type KeyboardButtonSwitchInline struct { } // KeyboardButtonSwitchInlineTypeID is TL type id of KeyboardButtonSwitchInline. -const KeyboardButtonSwitchInlineTypeID = 0x93b9fbb5 +const KeyboardButtonSwitchInlineTypeID = 0x991399fc // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonSwitchInline) construct() KeyboardButtonClass { return &k } @@ -877,6 +1193,9 @@ func (k *KeyboardButtonSwitchInline) Zero() bool { if !(k.SamePeer == false) { return false } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -902,11 +1221,16 @@ func (k *KeyboardButtonSwitchInline) String() string { // FillFrom fills KeyboardButtonSwitchInline from given interface. func (k *KeyboardButtonSwitchInline) FillFrom(from interface { GetSamePeer() (value bool) + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetQuery() (value string) GetPeerTypes() (value []InlineQueryPeerTypeClass, ok bool) }) { k.SamePeer = from.GetSamePeer() + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() k.Query = from.GetQuery() if val, ok := from.GetPeerTypes(); ok { @@ -943,6 +1267,11 @@ func (k *KeyboardButtonSwitchInline) TypeInfo() tdp.Type { SchemaName: "same_peer", Null: !k.Flags.Has(0), }, + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -965,6 +1294,9 @@ func (k *KeyboardButtonSwitchInline) SetFlags() { if !(k.SamePeer == false) { k.Flags.Set(0) } + if !(k.Style.Zero()) { + k.Flags.Set(10) + } if !(k.PeerTypes == nil) { k.Flags.Set(1) } @@ -973,7 +1305,7 @@ func (k *KeyboardButtonSwitchInline) SetFlags() { // Encode implements bin.Encoder. func (k *KeyboardButtonSwitchInline) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonSwitchInline#93b9fbb5 as nil") + return fmt.Errorf("can't encode keyboardButtonSwitchInline#991399fc as nil") } b.PutID(KeyboardButtonSwitchInlineTypeID) return k.EncodeBare(b) @@ -982,11 +1314,16 @@ func (k *KeyboardButtonSwitchInline) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonSwitchInline) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonSwitchInline#93b9fbb5 as nil") + return fmt.Errorf("can't encode keyboardButtonSwitchInline#991399fc as nil") } k.SetFlags() if err := k.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonSwitchInline#93b9fbb5: field flags: %w", err) + return fmt.Errorf("unable to encode keyboardButtonSwitchInline#991399fc: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonSwitchInline#991399fc: field style: %w", err) + } } b.PutString(k.Text) b.PutString(k.Query) @@ -994,10 +1331,10 @@ func (k *KeyboardButtonSwitchInline) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(k.PeerTypes)) for idx, v := range k.PeerTypes { if v == nil { - return fmt.Errorf("unable to encode keyboardButtonSwitchInline#93b9fbb5: field peer_types element with index %d is nil", idx) + return fmt.Errorf("unable to encode keyboardButtonSwitchInline#991399fc: field peer_types element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonSwitchInline#93b9fbb5: field peer_types element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode keyboardButtonSwitchInline#991399fc: field peer_types element with index %d: %w", idx, err) } } } @@ -1007,10 +1344,10 @@ func (k *KeyboardButtonSwitchInline) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonSwitchInline) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonSwitchInline#93b9fbb5 to nil") + return fmt.Errorf("can't decode keyboardButtonSwitchInline#991399fc to nil") } if err := b.ConsumeID(KeyboardButtonSwitchInlineTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: %w", err) + return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: %w", err) } return k.DecodeBare(b) } @@ -1018,32 +1355,37 @@ func (k *KeyboardButtonSwitchInline) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonSwitchInline) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonSwitchInline#93b9fbb5 to nil") + return fmt.Errorf("can't decode keyboardButtonSwitchInline#991399fc to nil") } { if err := k.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field flags: %w", err) + return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field flags: %w", err) } } k.SamePeer = k.Flags.Has(0) + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field style: %w", err) + } + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field text: %w", err) } k.Text = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field query: %w", err) + return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field query: %w", err) } k.Query = value } if k.Flags.Has(1) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field peer_types: %w", err) + return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field peer_types: %w", err) } if headerLen > 0 { @@ -1052,7 +1394,7 @@ func (k *KeyboardButtonSwitchInline) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInlineQueryPeerType(b) if err != nil { - return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field peer_types: %w", err) + return fmt.Errorf("unable to decode keyboardButtonSwitchInline#991399fc: field peer_types: %w", err) } k.PeerTypes = append(k.PeerTypes, value) } @@ -1079,6 +1421,24 @@ func (k *KeyboardButtonSwitchInline) GetSamePeer() (value bool) { return k.Flags.Has(0) } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonSwitchInline) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonSwitchInline) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonSwitchInline) GetText() (value string) { if k == nil { @@ -1121,17 +1481,23 @@ func (k *KeyboardButtonSwitchInline) MapPeerTypes() (value InlineQueryPeerTypeCl return InlineQueryPeerTypeClassArray(k.PeerTypes), true } -// KeyboardButtonGame represents TL type `keyboardButtonGame#50f41ccf`. +// KeyboardButtonGame represents TL type `keyboardButtonGame#89c590f9`. // Button to start a game // // See https://core.telegram.org/constructor/keyboardButtonGame for reference. type KeyboardButtonGame struct { + // Flags field of KeyboardButtonGame. + Flags bin.Fields + // Style field of KeyboardButtonGame. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string } // KeyboardButtonGameTypeID is TL type id of KeyboardButtonGame. -const KeyboardButtonGameTypeID = 0x50f41ccf +const KeyboardButtonGameTypeID = 0x89c590f9 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonGame) construct() KeyboardButtonClass { return &k } @@ -1150,6 +1516,12 @@ func (k *KeyboardButtonGame) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -1168,8 +1540,13 @@ func (k *KeyboardButtonGame) String() string { // FillFrom fills KeyboardButtonGame from given interface. func (k *KeyboardButtonGame) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() } @@ -1196,6 +1573,11 @@ func (k *KeyboardButtonGame) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -1204,10 +1586,17 @@ func (k *KeyboardButtonGame) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonGame) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonGame) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonGame#50f41ccf as nil") + return fmt.Errorf("can't encode keyboardButtonGame#89c590f9 as nil") } b.PutID(KeyboardButtonGameTypeID) return k.EncodeBare(b) @@ -1216,7 +1605,16 @@ func (k *KeyboardButtonGame) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonGame) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonGame#50f41ccf as nil") + return fmt.Errorf("can't encode keyboardButtonGame#89c590f9 as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonGame#89c590f9: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonGame#89c590f9: field style: %w", err) + } } b.PutString(k.Text) return nil @@ -1225,10 +1623,10 @@ func (k *KeyboardButtonGame) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonGame) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonGame#50f41ccf to nil") + return fmt.Errorf("can't decode keyboardButtonGame#89c590f9 to nil") } if err := b.ConsumeID(KeyboardButtonGameTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonGame#50f41ccf: %w", err) + return fmt.Errorf("unable to decode keyboardButtonGame#89c590f9: %w", err) } return k.DecodeBare(b) } @@ -1236,18 +1634,46 @@ func (k *KeyboardButtonGame) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonGame) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonGame#50f41ccf to nil") + return fmt.Errorf("can't decode keyboardButtonGame#89c590f9 to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonGame#89c590f9: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonGame#89c590f9: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonGame#50f41ccf: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonGame#89c590f9: field text: %w", err) } k.Text = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonGame) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonGame) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonGame) GetText() (value string) { if k == nil { @@ -1256,17 +1682,23 @@ func (k *KeyboardButtonGame) GetText() (value string) { return k.Text } -// KeyboardButtonBuy represents TL type `keyboardButtonBuy#afd93fbb`. +// KeyboardButtonBuy represents TL type `keyboardButtonBuy#3fa53905`. // Button to buy a product // // See https://core.telegram.org/constructor/keyboardButtonBuy for reference. type KeyboardButtonBuy struct { + // Flags field of KeyboardButtonBuy. + Flags bin.Fields + // Style field of KeyboardButtonBuy. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string } // KeyboardButtonBuyTypeID is TL type id of KeyboardButtonBuy. -const KeyboardButtonBuyTypeID = 0xafd93fbb +const KeyboardButtonBuyTypeID = 0x3fa53905 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonBuy) construct() KeyboardButtonClass { return &k } @@ -1285,6 +1717,12 @@ func (k *KeyboardButtonBuy) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -1303,8 +1741,13 @@ func (k *KeyboardButtonBuy) String() string { // FillFrom fills KeyboardButtonBuy from given interface. func (k *KeyboardButtonBuy) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() } @@ -1331,6 +1774,11 @@ func (k *KeyboardButtonBuy) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -1339,10 +1787,17 @@ func (k *KeyboardButtonBuy) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonBuy) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonBuy) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonBuy#afd93fbb as nil") + return fmt.Errorf("can't encode keyboardButtonBuy#3fa53905 as nil") } b.PutID(KeyboardButtonBuyTypeID) return k.EncodeBare(b) @@ -1351,7 +1806,16 @@ func (k *KeyboardButtonBuy) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonBuy) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonBuy#afd93fbb as nil") + return fmt.Errorf("can't encode keyboardButtonBuy#3fa53905 as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonBuy#3fa53905: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonBuy#3fa53905: field style: %w", err) + } } b.PutString(k.Text) return nil @@ -1360,10 +1824,10 @@ func (k *KeyboardButtonBuy) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonBuy) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonBuy#afd93fbb to nil") + return fmt.Errorf("can't decode keyboardButtonBuy#3fa53905 to nil") } if err := b.ConsumeID(KeyboardButtonBuyTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonBuy#afd93fbb: %w", err) + return fmt.Errorf("unable to decode keyboardButtonBuy#3fa53905: %w", err) } return k.DecodeBare(b) } @@ -1371,18 +1835,46 @@ func (k *KeyboardButtonBuy) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonBuy) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonBuy#afd93fbb to nil") + return fmt.Errorf("can't decode keyboardButtonBuy#3fa53905 to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonBuy#3fa53905: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonBuy#3fa53905: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonBuy#afd93fbb: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonBuy#3fa53905: field text: %w", err) } k.Text = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonBuy) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonBuy) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonBuy) GetText() (value string) { if k == nil { @@ -1391,7 +1883,7 @@ func (k *KeyboardButtonBuy) GetText() (value string) { return k.Text } -// KeyboardButtonURLAuth represents TL type `keyboardButtonUrlAuth#10b78d29`. +// KeyboardButtonURLAuth represents TL type `keyboardButtonUrlAuth#f51006f9`. // Button to request a user to authorize via URL using Seamless Telegram Login¹. When // the user clicks on such a button, messages.requestUrlAuth² should be called, // providing the button_id and the ID of the container message. The returned @@ -1419,6 +1911,10 @@ type KeyboardButtonURLAuth struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields + // Style field of KeyboardButtonURLAuth. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button label Text string // New text of the button in forwarded messages. @@ -1444,7 +1940,7 @@ type KeyboardButtonURLAuth struct { } // KeyboardButtonURLAuthTypeID is TL type id of KeyboardButtonURLAuth. -const KeyboardButtonURLAuthTypeID = 0x10b78d29 +const KeyboardButtonURLAuthTypeID = 0xf51006f9 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonURLAuth) construct() KeyboardButtonClass { return &k } @@ -1466,6 +1962,9 @@ func (k *KeyboardButtonURLAuth) Zero() bool { if !(k.Flags.Zero()) { return false } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -1493,11 +1992,16 @@ func (k *KeyboardButtonURLAuth) String() string { // FillFrom fills KeyboardButtonURLAuth from given interface. func (k *KeyboardButtonURLAuth) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetFwdText() (value string, ok bool) GetURL() (value string) GetButtonID() (value int) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() if val, ok := from.GetFwdText(); ok { k.FwdText = val @@ -1530,6 +2034,11 @@ func (k *KeyboardButtonURLAuth) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -1553,6 +2062,9 @@ func (k *KeyboardButtonURLAuth) TypeInfo() tdp.Type { // SetFlags sets flags for non-zero fields. func (k *KeyboardButtonURLAuth) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } if !(k.FwdText == "") { k.Flags.Set(0) } @@ -1561,7 +2073,7 @@ func (k *KeyboardButtonURLAuth) SetFlags() { // Encode implements bin.Encoder. func (k *KeyboardButtonURLAuth) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonUrlAuth#10b78d29 as nil") + return fmt.Errorf("can't encode keyboardButtonUrlAuth#f51006f9 as nil") } b.PutID(KeyboardButtonURLAuthTypeID) return k.EncodeBare(b) @@ -1570,11 +2082,16 @@ func (k *KeyboardButtonURLAuth) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonURLAuth) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonUrlAuth#10b78d29 as nil") + return fmt.Errorf("can't encode keyboardButtonUrlAuth#f51006f9 as nil") } k.SetFlags() if err := k.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonUrlAuth#10b78d29: field flags: %w", err) + return fmt.Errorf("unable to encode keyboardButtonUrlAuth#f51006f9: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonUrlAuth#f51006f9: field style: %w", err) + } } b.PutString(k.Text) if k.Flags.Has(0) { @@ -1588,10 +2105,10 @@ func (k *KeyboardButtonURLAuth) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonURLAuth) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonUrlAuth#10b78d29 to nil") + return fmt.Errorf("can't decode keyboardButtonUrlAuth#f51006f9 to nil") } if err := b.ConsumeID(KeyboardButtonURLAuthTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: %w", err) } return k.DecodeBare(b) } @@ -1599,44 +2116,67 @@ func (k *KeyboardButtonURLAuth) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonURLAuth) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonUrlAuth#10b78d29 to nil") + return fmt.Errorf("can't decode keyboardButtonUrlAuth#f51006f9 to nil") } { if err := k.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field flags: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field style: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field text: %w", err) } k.Text = value } if k.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field fwd_text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field fwd_text: %w", err) } k.FwdText = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field url: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field url: %w", err) } k.URL = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field button_id: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUrlAuth#f51006f9: field button_id: %w", err) } k.ButtonID = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonURLAuth) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonURLAuth) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonURLAuth) GetText() (value string) { if k == nil { @@ -1679,7 +2219,7 @@ func (k *KeyboardButtonURLAuth) GetButtonID() (value int) { return k.ButtonID } -// InputKeyboardButtonURLAuth represents TL type `inputKeyboardButtonUrlAuth#d02e7fd4`. +// InputKeyboardButtonURLAuth represents TL type `inputKeyboardButtonUrlAuth#68013e72`. // Button to request a user to authorize¹ via URL using Seamless Telegram Login². // // Links: @@ -1695,6 +2235,10 @@ type InputKeyboardButtonURLAuth struct { Flags bin.Fields // Set this flag to request the permission for your bot to send messages to the user. RequestWriteAccess bool + // Style field of InputKeyboardButtonURLAuth. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string // New text of the button in forwarded messages. @@ -1724,7 +2268,7 @@ type InputKeyboardButtonURLAuth struct { } // InputKeyboardButtonURLAuthTypeID is TL type id of InputKeyboardButtonURLAuth. -const InputKeyboardButtonURLAuthTypeID = 0xd02e7fd4 +const InputKeyboardButtonURLAuthTypeID = 0x68013e72 // construct implements constructor of KeyboardButtonClass. func (i InputKeyboardButtonURLAuth) construct() KeyboardButtonClass { return &i } @@ -1749,6 +2293,9 @@ func (i *InputKeyboardButtonURLAuth) Zero() bool { if !(i.RequestWriteAccess == false) { return false } + if !(i.Style.Zero()) { + return false + } if !(i.Text == "") { return false } @@ -1777,12 +2324,17 @@ func (i *InputKeyboardButtonURLAuth) String() string { // FillFrom fills InputKeyboardButtonURLAuth from given interface. func (i *InputKeyboardButtonURLAuth) FillFrom(from interface { GetRequestWriteAccess() (value bool) + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetFwdText() (value string, ok bool) GetURL() (value string) GetBot() (value InputUserClass) }) { i.RequestWriteAccess = from.GetRequestWriteAccess() + if val, ok := from.GetStyle(); ok { + i.Style = val + } + i.Text = from.GetText() if val, ok := from.GetFwdText(); ok { i.FwdText = val @@ -1820,6 +2372,11 @@ func (i *InputKeyboardButtonURLAuth) TypeInfo() tdp.Type { SchemaName: "request_write_access", Null: !i.Flags.Has(0), }, + { + Name: "Style", + SchemaName: "style", + Null: !i.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -1846,6 +2403,9 @@ func (i *InputKeyboardButtonURLAuth) SetFlags() { if !(i.RequestWriteAccess == false) { i.Flags.Set(0) } + if !(i.Style.Zero()) { + i.Flags.Set(10) + } if !(i.FwdText == "") { i.Flags.Set(1) } @@ -1854,7 +2414,7 @@ func (i *InputKeyboardButtonURLAuth) SetFlags() { // Encode implements bin.Encoder. func (i *InputKeyboardButtonURLAuth) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputKeyboardButtonUrlAuth#d02e7fd4 as nil") + return fmt.Errorf("can't encode inputKeyboardButtonUrlAuth#68013e72 as nil") } b.PutID(InputKeyboardButtonURLAuthTypeID) return i.EncodeBare(b) @@ -1863,11 +2423,16 @@ func (i *InputKeyboardButtonURLAuth) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputKeyboardButtonURLAuth) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputKeyboardButtonUrlAuth#d02e7fd4 as nil") + return fmt.Errorf("can't encode inputKeyboardButtonUrlAuth#68013e72 as nil") } i.SetFlags() if err := i.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#d02e7fd4: field flags: %w", err) + return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#68013e72: field flags: %w", err) + } + if i.Flags.Has(10) { + if err := i.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#68013e72: field style: %w", err) + } } b.PutString(i.Text) if i.Flags.Has(1) { @@ -1875,10 +2440,10 @@ func (i *InputKeyboardButtonURLAuth) EncodeBare(b *bin.Buffer) error { } b.PutString(i.URL) if i.Bot == nil { - return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#d02e7fd4: field bot is nil") + return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#68013e72: field bot is nil") } if err := i.Bot.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#d02e7fd4: field bot: %w", err) + return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#68013e72: field bot: %w", err) } return nil } @@ -1886,10 +2451,10 @@ func (i *InputKeyboardButtonURLAuth) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputKeyboardButtonURLAuth) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputKeyboardButtonUrlAuth#d02e7fd4 to nil") + return fmt.Errorf("can't decode inputKeyboardButtonUrlAuth#68013e72 to nil") } if err := b.ConsumeID(InputKeyboardButtonURLAuthTypeID); err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: %w", err) } return i.DecodeBare(b) } @@ -1897,39 +2462,44 @@ func (i *InputKeyboardButtonURLAuth) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputKeyboardButtonURLAuth) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputKeyboardButtonUrlAuth#d02e7fd4 to nil") + return fmt.Errorf("can't decode inputKeyboardButtonUrlAuth#68013e72 to nil") } { if err := i.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field flags: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field flags: %w", err) } } i.RequestWriteAccess = i.Flags.Has(0) + if i.Flags.Has(10) { + if err := i.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field style: %w", err) + } + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field text: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field text: %w", err) } i.Text = value } if i.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field fwd_text: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field fwd_text: %w", err) } i.FwdText = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field url: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field url: %w", err) } i.URL = value } { value, err := DecodeInputUser(b) if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field bot: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#68013e72: field bot: %w", err) } i.Bot = value } @@ -1955,6 +2525,24 @@ func (i *InputKeyboardButtonURLAuth) GetRequestWriteAccess() (value bool) { return i.Flags.Has(0) } +// SetStyle sets value of Style conditional field. +func (i *InputKeyboardButtonURLAuth) SetStyle(value KeyboardButtonStyle) { + i.Flags.Set(10) + i.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (i *InputKeyboardButtonURLAuth) GetStyle() (value KeyboardButtonStyle, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(10) { + return value, false + } + return i.Style, true +} + // GetText returns value of Text field. func (i *InputKeyboardButtonURLAuth) GetText() (value string) { if i == nil { @@ -1997,7 +2585,7 @@ func (i *InputKeyboardButtonURLAuth) GetBot() (value InputUserClass) { return i.Bot } -// KeyboardButtonRequestPoll represents TL type `keyboardButtonRequestPoll#bbc7515d`. +// KeyboardButtonRequestPoll represents TL type `keyboardButtonRequestPoll#7a11d782`. // A button that allows the user to create and send a poll when pressed; available only // in private // @@ -2008,6 +2596,10 @@ type KeyboardButtonRequestPoll struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields + // Style field of KeyboardButtonRequestPoll. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // If set, only quiz polls can be sent // // Use SetQuiz and GetQuiz helpers. @@ -2017,7 +2609,7 @@ type KeyboardButtonRequestPoll struct { } // KeyboardButtonRequestPollTypeID is TL type id of KeyboardButtonRequestPoll. -const KeyboardButtonRequestPollTypeID = 0xbbc7515d +const KeyboardButtonRequestPollTypeID = 0x7a11d782 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonRequestPoll) construct() KeyboardButtonClass { return &k } @@ -2039,6 +2631,9 @@ func (k *KeyboardButtonRequestPoll) Zero() bool { if !(k.Flags.Zero()) { return false } + if !(k.Style.Zero()) { + return false + } if !(k.Quiz == false) { return false } @@ -2060,9 +2655,14 @@ func (k *KeyboardButtonRequestPoll) String() string { // FillFrom fills KeyboardButtonRequestPoll from given interface. func (k *KeyboardButtonRequestPoll) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetQuiz() (value bool, ok bool) GetText() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + if val, ok := from.GetQuiz(); ok { k.Quiz = val } @@ -2093,6 +2693,11 @@ func (k *KeyboardButtonRequestPoll) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Quiz", SchemaName: "quiz", @@ -2108,6 +2713,9 @@ func (k *KeyboardButtonRequestPoll) TypeInfo() tdp.Type { // SetFlags sets flags for non-zero fields. func (k *KeyboardButtonRequestPoll) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } if !(k.Quiz == false) { k.Flags.Set(0) } @@ -2116,7 +2724,7 @@ func (k *KeyboardButtonRequestPoll) SetFlags() { // Encode implements bin.Encoder. func (k *KeyboardButtonRequestPoll) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonRequestPoll#bbc7515d as nil") + return fmt.Errorf("can't encode keyboardButtonRequestPoll#7a11d782 as nil") } b.PutID(KeyboardButtonRequestPollTypeID) return k.EncodeBare(b) @@ -2125,11 +2733,16 @@ func (k *KeyboardButtonRequestPoll) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonRequestPoll) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonRequestPoll#bbc7515d as nil") + return fmt.Errorf("can't encode keyboardButtonRequestPoll#7a11d782 as nil") } k.SetFlags() if err := k.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonRequestPoll#bbc7515d: field flags: %w", err) + return fmt.Errorf("unable to encode keyboardButtonRequestPoll#7a11d782: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonRequestPoll#7a11d782: field style: %w", err) + } } if k.Flags.Has(0) { b.PutBool(k.Quiz) @@ -2141,10 +2754,10 @@ func (k *KeyboardButtonRequestPoll) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonRequestPoll) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonRequestPoll#bbc7515d to nil") + return fmt.Errorf("can't decode keyboardButtonRequestPoll#7a11d782 to nil") } if err := b.ConsumeID(KeyboardButtonRequestPollTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPoll#bbc7515d: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPoll#7a11d782: %w", err) } return k.DecodeBare(b) } @@ -2152,30 +2765,53 @@ func (k *KeyboardButtonRequestPoll) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonRequestPoll) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonRequestPoll#bbc7515d to nil") + return fmt.Errorf("can't decode keyboardButtonRequestPoll#7a11d782 to nil") } { if err := k.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPoll#bbc7515d: field flags: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPoll#7a11d782: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonRequestPoll#7a11d782: field style: %w", err) } } if k.Flags.Has(0) { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPoll#bbc7515d: field quiz: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPoll#7a11d782: field quiz: %w", err) } k.Quiz = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPoll#bbc7515d: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPoll#7a11d782: field text: %w", err) } k.Text = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonRequestPoll) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonRequestPoll) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // SetQuiz sets value of Quiz conditional field. func (k *KeyboardButtonRequestPoll) SetQuiz(value bool) { k.Flags.Set(0) @@ -2202,11 +2838,17 @@ func (k *KeyboardButtonRequestPoll) GetText() (value string) { return k.Text } -// InputKeyboardButtonUserProfile represents TL type `inputKeyboardButtonUserProfile#e988037b`. +// InputKeyboardButtonUserProfile represents TL type `inputKeyboardButtonUserProfile#7d5e07c7`. // Button that links directly to a user profile // // See https://core.telegram.org/constructor/inputKeyboardButtonUserProfile for reference. type InputKeyboardButtonUserProfile struct { + // Flags field of InputKeyboardButtonUserProfile. + Flags bin.Fields + // Style field of InputKeyboardButtonUserProfile. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string // User ID @@ -2214,7 +2856,7 @@ type InputKeyboardButtonUserProfile struct { } // InputKeyboardButtonUserProfileTypeID is TL type id of InputKeyboardButtonUserProfile. -const InputKeyboardButtonUserProfileTypeID = 0xe988037b +const InputKeyboardButtonUserProfileTypeID = 0x7d5e07c7 // construct implements constructor of KeyboardButtonClass. func (i InputKeyboardButtonUserProfile) construct() KeyboardButtonClass { return &i } @@ -2233,6 +2875,12 @@ func (i *InputKeyboardButtonUserProfile) Zero() bool { if i == nil { return true } + if !(i.Flags.Zero()) { + return false + } + if !(i.Style.Zero()) { + return false + } if !(i.Text == "") { return false } @@ -2254,9 +2902,14 @@ func (i *InputKeyboardButtonUserProfile) String() string { // FillFrom fills InputKeyboardButtonUserProfile from given interface. func (i *InputKeyboardButtonUserProfile) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetUserID() (value InputUserClass) }) { + if val, ok := from.GetStyle(); ok { + i.Style = val + } + i.Text = from.GetText() i.UserID = from.GetUserID() } @@ -2284,6 +2937,11 @@ func (i *InputKeyboardButtonUserProfile) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !i.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -2296,10 +2954,17 @@ func (i *InputKeyboardButtonUserProfile) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (i *InputKeyboardButtonUserProfile) SetFlags() { + if !(i.Style.Zero()) { + i.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (i *InputKeyboardButtonUserProfile) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputKeyboardButtonUserProfile#e988037b as nil") + return fmt.Errorf("can't encode inputKeyboardButtonUserProfile#7d5e07c7 as nil") } b.PutID(InputKeyboardButtonUserProfileTypeID) return i.EncodeBare(b) @@ -2308,14 +2973,23 @@ func (i *InputKeyboardButtonUserProfile) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputKeyboardButtonUserProfile) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputKeyboardButtonUserProfile#e988037b as nil") + return fmt.Errorf("can't encode inputKeyboardButtonUserProfile#7d5e07c7 as nil") + } + i.SetFlags() + if err := i.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#7d5e07c7: field flags: %w", err) + } + if i.Flags.Has(10) { + if err := i.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#7d5e07c7: field style: %w", err) + } } b.PutString(i.Text) if i.UserID == nil { - return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#e988037b: field user_id is nil") + return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#7d5e07c7: field user_id is nil") } if err := i.UserID.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#e988037b: field user_id: %w", err) + return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#7d5e07c7: field user_id: %w", err) } return nil } @@ -2323,10 +2997,10 @@ func (i *InputKeyboardButtonUserProfile) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputKeyboardButtonUserProfile) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputKeyboardButtonUserProfile#e988037b to nil") + return fmt.Errorf("can't decode inputKeyboardButtonUserProfile#7d5e07c7 to nil") } if err := b.ConsumeID(InputKeyboardButtonUserProfileTypeID); err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#e988037b: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#7d5e07c7: %w", err) } return i.DecodeBare(b) } @@ -2334,25 +3008,53 @@ func (i *InputKeyboardButtonUserProfile) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputKeyboardButtonUserProfile) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputKeyboardButtonUserProfile#e988037b to nil") + return fmt.Errorf("can't decode inputKeyboardButtonUserProfile#7d5e07c7 to nil") + } + { + if err := i.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#7d5e07c7: field flags: %w", err) + } + } + if i.Flags.Has(10) { + if err := i.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#7d5e07c7: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#e988037b: field text: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#7d5e07c7: field text: %w", err) } i.Text = value } { value, err := DecodeInputUser(b) if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#e988037b: field user_id: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#7d5e07c7: field user_id: %w", err) } i.UserID = value } return nil } +// SetStyle sets value of Style conditional field. +func (i *InputKeyboardButtonUserProfile) SetStyle(value KeyboardButtonStyle) { + i.Flags.Set(10) + i.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (i *InputKeyboardButtonUserProfile) GetStyle() (value KeyboardButtonStyle, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(10) { + return value, false + } + return i.Style, true +} + // GetText returns value of Text field. func (i *InputKeyboardButtonUserProfile) GetText() (value string) { if i == nil { @@ -2369,11 +3071,17 @@ func (i *InputKeyboardButtonUserProfile) GetUserID() (value InputUserClass) { return i.UserID } -// KeyboardButtonUserProfile represents TL type `keyboardButtonUserProfile#308660c1`. +// KeyboardButtonUserProfile represents TL type `keyboardButtonUserProfile#c0fd5d09`. // Button that links directly to a user profile // // See https://core.telegram.org/constructor/keyboardButtonUserProfile for reference. type KeyboardButtonUserProfile struct { + // Flags field of KeyboardButtonUserProfile. + Flags bin.Fields + // Style field of KeyboardButtonUserProfile. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string // User ID @@ -2381,7 +3089,7 @@ type KeyboardButtonUserProfile struct { } // KeyboardButtonUserProfileTypeID is TL type id of KeyboardButtonUserProfile. -const KeyboardButtonUserProfileTypeID = 0x308660c1 +const KeyboardButtonUserProfileTypeID = 0xc0fd5d09 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonUserProfile) construct() KeyboardButtonClass { return &k } @@ -2400,6 +3108,12 @@ func (k *KeyboardButtonUserProfile) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -2421,9 +3135,14 @@ func (k *KeyboardButtonUserProfile) String() string { // FillFrom fills KeyboardButtonUserProfile from given interface. func (k *KeyboardButtonUserProfile) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetUserID() (value int64) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() k.UserID = from.GetUserID() } @@ -2451,6 +3170,11 @@ func (k *KeyboardButtonUserProfile) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -2463,10 +3187,17 @@ func (k *KeyboardButtonUserProfile) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonUserProfile) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonUserProfile) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonUserProfile#308660c1 as nil") + return fmt.Errorf("can't encode keyboardButtonUserProfile#c0fd5d09 as nil") } b.PutID(KeyboardButtonUserProfileTypeID) return k.EncodeBare(b) @@ -2475,7 +3206,16 @@ func (k *KeyboardButtonUserProfile) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonUserProfile) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonUserProfile#308660c1 as nil") + return fmt.Errorf("can't encode keyboardButtonUserProfile#c0fd5d09 as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonUserProfile#c0fd5d09: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonUserProfile#c0fd5d09: field style: %w", err) + } } b.PutString(k.Text) b.PutLong(k.UserID) @@ -2485,10 +3225,10 @@ func (k *KeyboardButtonUserProfile) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonUserProfile) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonUserProfile#308660c1 to nil") + return fmt.Errorf("can't decode keyboardButtonUserProfile#c0fd5d09 to nil") } if err := b.ConsumeID(KeyboardButtonUserProfileTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonUserProfile#308660c1: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUserProfile#c0fd5d09: %w", err) } return k.DecodeBare(b) } @@ -2496,25 +3236,53 @@ func (k *KeyboardButtonUserProfile) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonUserProfile) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonUserProfile#308660c1 to nil") + return fmt.Errorf("can't decode keyboardButtonUserProfile#c0fd5d09 to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonUserProfile#c0fd5d09: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonUserProfile#c0fd5d09: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonUserProfile#308660c1: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUserProfile#c0fd5d09: field text: %w", err) } k.Text = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonUserProfile#308660c1: field user_id: %w", err) + return fmt.Errorf("unable to decode keyboardButtonUserProfile#c0fd5d09: field user_id: %w", err) } k.UserID = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonUserProfile) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonUserProfile) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonUserProfile) GetText() (value string) { if k == nil { @@ -2531,7 +3299,7 @@ func (k *KeyboardButtonUserProfile) GetUserID() (value int64) { return k.UserID } -// KeyboardButtonWebView represents TL type `keyboardButtonWebView#13767230`. +// KeyboardButtonWebView represents TL type `keyboardButtonWebView#e846b1a0`. // Button to open a bot mini app¹ using messages.requestWebView², sending over user // information after user confirmation. // Can only be sent or received as part of an inline keyboard, use @@ -2544,6 +3312,12 @@ func (k *KeyboardButtonUserProfile) GetUserID() (value int64) { // // See https://core.telegram.org/constructor/keyboardButtonWebView for reference. type KeyboardButtonWebView struct { + // Flags field of KeyboardButtonWebView. + Flags bin.Fields + // Style field of KeyboardButtonWebView. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string // Web app url¹ @@ -2554,7 +3328,7 @@ type KeyboardButtonWebView struct { } // KeyboardButtonWebViewTypeID is TL type id of KeyboardButtonWebView. -const KeyboardButtonWebViewTypeID = 0x13767230 +const KeyboardButtonWebViewTypeID = 0xe846b1a0 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonWebView) construct() KeyboardButtonClass { return &k } @@ -2573,6 +3347,12 @@ func (k *KeyboardButtonWebView) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -2594,9 +3374,14 @@ func (k *KeyboardButtonWebView) String() string { // FillFrom fills KeyboardButtonWebView from given interface. func (k *KeyboardButtonWebView) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetURL() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() k.URL = from.GetURL() } @@ -2624,6 +3409,11 @@ func (k *KeyboardButtonWebView) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -2636,10 +3426,17 @@ func (k *KeyboardButtonWebView) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonWebView) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonWebView) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonWebView#13767230 as nil") + return fmt.Errorf("can't encode keyboardButtonWebView#e846b1a0 as nil") } b.PutID(KeyboardButtonWebViewTypeID) return k.EncodeBare(b) @@ -2648,7 +3445,16 @@ func (k *KeyboardButtonWebView) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonWebView) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonWebView#13767230 as nil") + return fmt.Errorf("can't encode keyboardButtonWebView#e846b1a0 as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonWebView#e846b1a0: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonWebView#e846b1a0: field style: %w", err) + } } b.PutString(k.Text) b.PutString(k.URL) @@ -2658,10 +3464,10 @@ func (k *KeyboardButtonWebView) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonWebView) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonWebView#13767230 to nil") + return fmt.Errorf("can't decode keyboardButtonWebView#e846b1a0 to nil") } if err := b.ConsumeID(KeyboardButtonWebViewTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonWebView#13767230: %w", err) + return fmt.Errorf("unable to decode keyboardButtonWebView#e846b1a0: %w", err) } return k.DecodeBare(b) } @@ -2669,25 +3475,53 @@ func (k *KeyboardButtonWebView) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonWebView) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonWebView#13767230 to nil") + return fmt.Errorf("can't decode keyboardButtonWebView#e846b1a0 to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonWebView#e846b1a0: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonWebView#e846b1a0: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonWebView#13767230: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonWebView#e846b1a0: field text: %w", err) } k.Text = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonWebView#13767230: field url: %w", err) + return fmt.Errorf("unable to decode keyboardButtonWebView#e846b1a0: field url: %w", err) } k.URL = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonWebView) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonWebView) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonWebView) GetText() (value string) { if k == nil { @@ -2704,7 +3538,7 @@ func (k *KeyboardButtonWebView) GetURL() (value string) { return k.URL } -// KeyboardButtonSimpleWebView represents TL type `keyboardButtonSimpleWebView#a0c0505c`. +// KeyboardButtonSimpleWebView represents TL type `keyboardButtonSimpleWebView#e15c4370`. // Button to open a bot mini app¹ using messages.requestSimpleWebView², without sending // user information to the web app. // Can only be sent or received as part of a reply keyboard, use keyboardButtonWebView¹ @@ -2717,6 +3551,12 @@ func (k *KeyboardButtonWebView) GetURL() (value string) { // // See https://core.telegram.org/constructor/keyboardButtonSimpleWebView for reference. type KeyboardButtonSimpleWebView struct { + // Flags field of KeyboardButtonSimpleWebView. + Flags bin.Fields + // Style field of KeyboardButtonSimpleWebView. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string // Web app URL¹ @@ -2727,7 +3567,7 @@ type KeyboardButtonSimpleWebView struct { } // KeyboardButtonSimpleWebViewTypeID is TL type id of KeyboardButtonSimpleWebView. -const KeyboardButtonSimpleWebViewTypeID = 0xa0c0505c +const KeyboardButtonSimpleWebViewTypeID = 0xe15c4370 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonSimpleWebView) construct() KeyboardButtonClass { return &k } @@ -2746,6 +3586,12 @@ func (k *KeyboardButtonSimpleWebView) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -2767,9 +3613,14 @@ func (k *KeyboardButtonSimpleWebView) String() string { // FillFrom fills KeyboardButtonSimpleWebView from given interface. func (k *KeyboardButtonSimpleWebView) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetURL() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() k.URL = from.GetURL() } @@ -2797,6 +3648,11 @@ func (k *KeyboardButtonSimpleWebView) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -2809,10 +3665,17 @@ func (k *KeyboardButtonSimpleWebView) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonSimpleWebView) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonSimpleWebView) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonSimpleWebView#a0c0505c as nil") + return fmt.Errorf("can't encode keyboardButtonSimpleWebView#e15c4370 as nil") } b.PutID(KeyboardButtonSimpleWebViewTypeID) return k.EncodeBare(b) @@ -2821,7 +3684,16 @@ func (k *KeyboardButtonSimpleWebView) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonSimpleWebView) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonSimpleWebView#a0c0505c as nil") + return fmt.Errorf("can't encode keyboardButtonSimpleWebView#e15c4370 as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonSimpleWebView#e15c4370: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonSimpleWebView#e15c4370: field style: %w", err) + } } b.PutString(k.Text) b.PutString(k.URL) @@ -2831,10 +3703,10 @@ func (k *KeyboardButtonSimpleWebView) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonSimpleWebView) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonSimpleWebView#a0c0505c to nil") + return fmt.Errorf("can't decode keyboardButtonSimpleWebView#e15c4370 to nil") } if err := b.ConsumeID(KeyboardButtonSimpleWebViewTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#a0c0505c: %w", err) + return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#e15c4370: %w", err) } return k.DecodeBare(b) } @@ -2842,25 +3714,53 @@ func (k *KeyboardButtonSimpleWebView) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonSimpleWebView) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonSimpleWebView#a0c0505c to nil") + return fmt.Errorf("can't decode keyboardButtonSimpleWebView#e15c4370 to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#e15c4370: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#e15c4370: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#a0c0505c: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#e15c4370: field text: %w", err) } k.Text = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#a0c0505c: field url: %w", err) + return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#e15c4370: field url: %w", err) } k.URL = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonSimpleWebView) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonSimpleWebView) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonSimpleWebView) GetText() (value string) { if k == nil { @@ -2877,7 +3777,7 @@ func (k *KeyboardButtonSimpleWebView) GetURL() (value string) { return k.URL } -// KeyboardButtonRequestPeer represents TL type `keyboardButtonRequestPeer#53d7bfd8`. +// KeyboardButtonRequestPeer represents TL type `keyboardButtonRequestPeer#5b0f15f5`. // Prompts the user to select and share one or more peers with the bot using messages // sendBotRequestedPeer¹ // @@ -2886,6 +3786,12 @@ func (k *KeyboardButtonSimpleWebView) GetURL() (value string) { // // See https://core.telegram.org/constructor/keyboardButtonRequestPeer for reference. type KeyboardButtonRequestPeer struct { + // Flags field of KeyboardButtonRequestPeer. + Flags bin.Fields + // Style field of KeyboardButtonRequestPeer. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string // Button ID, to be passed to messages.sendBotRequestedPeer¹. @@ -2903,7 +3809,7 @@ type KeyboardButtonRequestPeer struct { } // KeyboardButtonRequestPeerTypeID is TL type id of KeyboardButtonRequestPeer. -const KeyboardButtonRequestPeerTypeID = 0x53d7bfd8 +const KeyboardButtonRequestPeerTypeID = 0x5b0f15f5 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonRequestPeer) construct() KeyboardButtonClass { return &k } @@ -2922,6 +3828,12 @@ func (k *KeyboardButtonRequestPeer) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -2949,11 +3861,16 @@ func (k *KeyboardButtonRequestPeer) String() string { // FillFrom fills KeyboardButtonRequestPeer from given interface. func (k *KeyboardButtonRequestPeer) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetButtonID() (value int) GetPeerType() (value RequestPeerTypeClass) GetMaxQuantity() (value int) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() k.ButtonID = from.GetButtonID() k.PeerType = from.GetPeerType() @@ -2983,6 +3900,11 @@ func (k *KeyboardButtonRequestPeer) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -3003,10 +3925,17 @@ func (k *KeyboardButtonRequestPeer) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonRequestPeer) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonRequestPeer) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonRequestPeer#53d7bfd8 as nil") + return fmt.Errorf("can't encode keyboardButtonRequestPeer#5b0f15f5 as nil") } b.PutID(KeyboardButtonRequestPeerTypeID) return k.EncodeBare(b) @@ -3015,15 +3944,24 @@ func (k *KeyboardButtonRequestPeer) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonRequestPeer) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonRequestPeer#53d7bfd8 as nil") + return fmt.Errorf("can't encode keyboardButtonRequestPeer#5b0f15f5 as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonRequestPeer#5b0f15f5: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonRequestPeer#5b0f15f5: field style: %w", err) + } } b.PutString(k.Text) b.PutInt(k.ButtonID) if k.PeerType == nil { - return fmt.Errorf("unable to encode keyboardButtonRequestPeer#53d7bfd8: field peer_type is nil") + return fmt.Errorf("unable to encode keyboardButtonRequestPeer#5b0f15f5: field peer_type is nil") } if err := k.PeerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonRequestPeer#53d7bfd8: field peer_type: %w", err) + return fmt.Errorf("unable to encode keyboardButtonRequestPeer#5b0f15f5: field peer_type: %w", err) } b.PutInt(k.MaxQuantity) return nil @@ -3032,10 +3970,10 @@ func (k *KeyboardButtonRequestPeer) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonRequestPeer) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonRequestPeer#53d7bfd8 to nil") + return fmt.Errorf("can't decode keyboardButtonRequestPeer#5b0f15f5 to nil") } if err := b.ConsumeID(KeyboardButtonRequestPeerTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: %w", err) } return k.DecodeBare(b) } @@ -3043,39 +3981,67 @@ func (k *KeyboardButtonRequestPeer) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonRequestPeer) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonRequestPeer#53d7bfd8 to nil") + return fmt.Errorf("can't decode keyboardButtonRequestPeer#5b0f15f5 to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field text: %w", err) } k.Text = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field button_id: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field button_id: %w", err) } k.ButtonID = value } { value, err := DecodeRequestPeerType(b) if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field peer_type: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field peer_type: %w", err) } k.PeerType = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field max_quantity: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#5b0f15f5: field max_quantity: %w", err) } k.MaxQuantity = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonRequestPeer) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonRequestPeer) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonRequestPeer) GetText() (value string) { if k == nil { @@ -3108,7 +4074,7 @@ func (k *KeyboardButtonRequestPeer) GetMaxQuantity() (value int) { return k.MaxQuantity } -// InputKeyboardButtonRequestPeer represents TL type `inputKeyboardButtonRequestPeer#c9662d05`. +// InputKeyboardButtonRequestPeer represents TL type `inputKeyboardButtonRequestPeer#2b78156`. // Prompts the user to select and share one or more peers with the bot using messages // sendBotRequestedPeer¹. // @@ -3128,6 +4094,10 @@ type InputKeyboardButtonRequestPeer struct { UsernameRequested bool // Set this flag to request the peer's photo (if any). PhotoRequested bool + // Style field of InputKeyboardButtonRequestPeer. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Button text Text string // Button ID, to be passed to messages.sendBotRequestedPeer¹. @@ -3145,7 +4115,7 @@ type InputKeyboardButtonRequestPeer struct { } // InputKeyboardButtonRequestPeerTypeID is TL type id of InputKeyboardButtonRequestPeer. -const InputKeyboardButtonRequestPeerTypeID = 0xc9662d05 +const InputKeyboardButtonRequestPeerTypeID = 0x2b78156 // construct implements constructor of KeyboardButtonClass. func (i InputKeyboardButtonRequestPeer) construct() KeyboardButtonClass { return &i } @@ -3176,6 +4146,9 @@ func (i *InputKeyboardButtonRequestPeer) Zero() bool { if !(i.PhotoRequested == false) { return false } + if !(i.Style.Zero()) { + return false + } if !(i.Text == "") { return false } @@ -3206,6 +4179,7 @@ func (i *InputKeyboardButtonRequestPeer) FillFrom(from interface { GetNameRequested() (value bool) GetUsernameRequested() (value bool) GetPhotoRequested() (value bool) + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetButtonID() (value int) GetPeerType() (value RequestPeerTypeClass) @@ -3214,6 +4188,10 @@ func (i *InputKeyboardButtonRequestPeer) FillFrom(from interface { i.NameRequested = from.GetNameRequested() i.UsernameRequested = from.GetUsernameRequested() i.PhotoRequested = from.GetPhotoRequested() + if val, ok := from.GetStyle(); ok { + i.Style = val + } + i.Text = from.GetText() i.ButtonID = from.GetButtonID() i.PeerType = from.GetPeerType() @@ -3258,6 +4236,11 @@ func (i *InputKeyboardButtonRequestPeer) TypeInfo() tdp.Type { SchemaName: "photo_requested", Null: !i.Flags.Has(2), }, + { + Name: "Style", + SchemaName: "style", + Null: !i.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -3289,12 +4272,15 @@ func (i *InputKeyboardButtonRequestPeer) SetFlags() { if !(i.PhotoRequested == false) { i.Flags.Set(2) } + if !(i.Style.Zero()) { + i.Flags.Set(10) + } } // Encode implements bin.Encoder. func (i *InputKeyboardButtonRequestPeer) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputKeyboardButtonRequestPeer#c9662d05 as nil") + return fmt.Errorf("can't encode inputKeyboardButtonRequestPeer#2b78156 as nil") } b.PutID(InputKeyboardButtonRequestPeerTypeID) return i.EncodeBare(b) @@ -3303,19 +4289,24 @@ func (i *InputKeyboardButtonRequestPeer) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputKeyboardButtonRequestPeer) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputKeyboardButtonRequestPeer#c9662d05 as nil") + return fmt.Errorf("can't encode inputKeyboardButtonRequestPeer#2b78156 as nil") } i.SetFlags() if err := i.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#c9662d05: field flags: %w", err) + return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#2b78156: field flags: %w", err) + } + if i.Flags.Has(10) { + if err := i.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#2b78156: field style: %w", err) + } } b.PutString(i.Text) b.PutInt(i.ButtonID) if i.PeerType == nil { - return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#c9662d05: field peer_type is nil") + return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#2b78156: field peer_type is nil") } if err := i.PeerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#c9662d05: field peer_type: %w", err) + return fmt.Errorf("unable to encode inputKeyboardButtonRequestPeer#2b78156: field peer_type: %w", err) } b.PutInt(i.MaxQuantity) return nil @@ -3324,10 +4315,10 @@ func (i *InputKeyboardButtonRequestPeer) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputKeyboardButtonRequestPeer) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputKeyboardButtonRequestPeer#c9662d05 to nil") + return fmt.Errorf("can't decode inputKeyboardButtonRequestPeer#2b78156 to nil") } if err := b.ConsumeID(InputKeyboardButtonRequestPeerTypeID); err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#c9662d05: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: %w", err) } return i.DecodeBare(b) } @@ -3335,41 +4326,46 @@ func (i *InputKeyboardButtonRequestPeer) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputKeyboardButtonRequestPeer) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputKeyboardButtonRequestPeer#c9662d05 to nil") + return fmt.Errorf("can't decode inputKeyboardButtonRequestPeer#2b78156 to nil") } { if err := i.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#c9662d05: field flags: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field flags: %w", err) } } i.NameRequested = i.Flags.Has(0) i.UsernameRequested = i.Flags.Has(1) i.PhotoRequested = i.Flags.Has(2) + if i.Flags.Has(10) { + if err := i.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field style: %w", err) + } + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#c9662d05: field text: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field text: %w", err) } i.Text = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#c9662d05: field button_id: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field button_id: %w", err) } i.ButtonID = value } { value, err := DecodeRequestPeerType(b) if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#c9662d05: field peer_type: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field peer_type: %w", err) } i.PeerType = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#c9662d05: field max_quantity: %w", err) + return fmt.Errorf("unable to decode inputKeyboardButtonRequestPeer#2b78156: field max_quantity: %w", err) } i.MaxQuantity = value } @@ -3433,6 +4429,24 @@ func (i *InputKeyboardButtonRequestPeer) GetPhotoRequested() (value bool) { return i.Flags.Has(2) } +// SetStyle sets value of Style conditional field. +func (i *InputKeyboardButtonRequestPeer) SetStyle(value KeyboardButtonStyle) { + i.Flags.Set(10) + i.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (i *InputKeyboardButtonRequestPeer) GetStyle() (value KeyboardButtonStyle, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(10) { + return value, false + } + return i.Style, true +} + // GetText returns value of Text field. func (i *InputKeyboardButtonRequestPeer) GetText() (value string) { if i == nil { @@ -3465,11 +4479,17 @@ func (i *InputKeyboardButtonRequestPeer) GetMaxQuantity() (value int) { return i.MaxQuantity } -// KeyboardButtonCopy represents TL type `keyboardButtonCopy#75d2698e`. +// KeyboardButtonCopy represents TL type `keyboardButtonCopy#bcc4af10`. // Clipboard button: when clicked, the attached text must be copied to the clipboard. // // See https://core.telegram.org/constructor/keyboardButtonCopy for reference. type KeyboardButtonCopy struct { + // Flags field of KeyboardButtonCopy. + Flags bin.Fields + // Style field of KeyboardButtonCopy. + // + // Use SetStyle and GetStyle helpers. + Style KeyboardButtonStyle // Title of the button Text string // The text that will be copied to the clipboard @@ -3477,7 +4497,7 @@ type KeyboardButtonCopy struct { } // KeyboardButtonCopyTypeID is TL type id of KeyboardButtonCopy. -const KeyboardButtonCopyTypeID = 0x75d2698e +const KeyboardButtonCopyTypeID = 0xbcc4af10 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonCopy) construct() KeyboardButtonClass { return &k } @@ -3496,6 +4516,12 @@ func (k *KeyboardButtonCopy) Zero() bool { if k == nil { return true } + if !(k.Flags.Zero()) { + return false + } + if !(k.Style.Zero()) { + return false + } if !(k.Text == "") { return false } @@ -3517,9 +4543,14 @@ func (k *KeyboardButtonCopy) String() string { // FillFrom fills KeyboardButtonCopy from given interface. func (k *KeyboardButtonCopy) FillFrom(from interface { + GetStyle() (value KeyboardButtonStyle, ok bool) GetText() (value string) GetCopyText() (value string) }) { + if val, ok := from.GetStyle(); ok { + k.Style = val + } + k.Text = from.GetText() k.CopyText = from.GetCopyText() } @@ -3547,6 +4578,11 @@ func (k *KeyboardButtonCopy) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Style", + SchemaName: "style", + Null: !k.Flags.Has(10), + }, { Name: "Text", SchemaName: "text", @@ -3559,10 +4595,17 @@ func (k *KeyboardButtonCopy) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonCopy) SetFlags() { + if !(k.Style.Zero()) { + k.Flags.Set(10) + } +} + // Encode implements bin.Encoder. func (k *KeyboardButtonCopy) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonCopy#75d2698e as nil") + return fmt.Errorf("can't encode keyboardButtonCopy#bcc4af10 as nil") } b.PutID(KeyboardButtonCopyTypeID) return k.EncodeBare(b) @@ -3571,7 +4614,16 @@ func (k *KeyboardButtonCopy) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (k *KeyboardButtonCopy) EncodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonCopy#75d2698e as nil") + return fmt.Errorf("can't encode keyboardButtonCopy#bcc4af10 as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonCopy#bcc4af10: field flags: %w", err) + } + if k.Flags.Has(10) { + if err := k.Style.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonCopy#bcc4af10: field style: %w", err) + } } b.PutString(k.Text) b.PutString(k.CopyText) @@ -3581,10 +4633,10 @@ func (k *KeyboardButtonCopy) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (k *KeyboardButtonCopy) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonCopy#75d2698e to nil") + return fmt.Errorf("can't decode keyboardButtonCopy#bcc4af10 to nil") } if err := b.ConsumeID(KeyboardButtonCopyTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonCopy#75d2698e: %w", err) + return fmt.Errorf("unable to decode keyboardButtonCopy#bcc4af10: %w", err) } return k.DecodeBare(b) } @@ -3592,25 +4644,53 @@ func (k *KeyboardButtonCopy) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (k *KeyboardButtonCopy) DecodeBare(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonCopy#75d2698e to nil") + return fmt.Errorf("can't decode keyboardButtonCopy#bcc4af10 to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonCopy#bcc4af10: field flags: %w", err) + } + } + if k.Flags.Has(10) { + if err := k.Style.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonCopy#bcc4af10: field style: %w", err) + } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonCopy#75d2698e: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonCopy#bcc4af10: field text: %w", err) } k.Text = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonCopy#75d2698e: field copy_text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonCopy#bcc4af10: field copy_text: %w", err) } k.CopyText = value } return nil } +// SetStyle sets value of Style conditional field. +func (k *KeyboardButtonCopy) SetStyle(value KeyboardButtonStyle) { + k.Flags.Set(10) + k.Style = value +} + +// GetStyle returns value of Style conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonCopy) GetStyle() (value KeyboardButtonStyle, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(10) { + return value, false + } + return k.Style, true +} + // GetText returns value of Text field. func (k *KeyboardButtonCopy) GetText() (value string) { if k == nil { @@ -3641,24 +4721,24 @@ const KeyboardButtonClassName = "KeyboardButton" // panic(err) // } // switch v := g.(type) { -// case *tg.KeyboardButton: // keyboardButton#a2fa4880 -// case *tg.KeyboardButtonURL: // keyboardButtonUrl#258aff05 -// case *tg.KeyboardButtonCallback: // keyboardButtonCallback#35bbdb6b -// case *tg.KeyboardButtonRequestPhone: // keyboardButtonRequestPhone#b16a6c29 -// case *tg.KeyboardButtonRequestGeoLocation: // keyboardButtonRequestGeoLocation#fc796b3f -// case *tg.KeyboardButtonSwitchInline: // keyboardButtonSwitchInline#93b9fbb5 -// case *tg.KeyboardButtonGame: // keyboardButtonGame#50f41ccf -// case *tg.KeyboardButtonBuy: // keyboardButtonBuy#afd93fbb -// case *tg.KeyboardButtonURLAuth: // keyboardButtonUrlAuth#10b78d29 -// case *tg.InputKeyboardButtonURLAuth: // inputKeyboardButtonUrlAuth#d02e7fd4 -// case *tg.KeyboardButtonRequestPoll: // keyboardButtonRequestPoll#bbc7515d -// case *tg.InputKeyboardButtonUserProfile: // inputKeyboardButtonUserProfile#e988037b -// case *tg.KeyboardButtonUserProfile: // keyboardButtonUserProfile#308660c1 -// case *tg.KeyboardButtonWebView: // keyboardButtonWebView#13767230 -// case *tg.KeyboardButtonSimpleWebView: // keyboardButtonSimpleWebView#a0c0505c -// case *tg.KeyboardButtonRequestPeer: // keyboardButtonRequestPeer#53d7bfd8 -// case *tg.InputKeyboardButtonRequestPeer: // inputKeyboardButtonRequestPeer#c9662d05 -// case *tg.KeyboardButtonCopy: // keyboardButtonCopy#75d2698e +// case *tg.KeyboardButton: // keyboardButton#7d170cff +// case *tg.KeyboardButtonURL: // keyboardButtonUrl#d80c25ec +// case *tg.KeyboardButtonCallback: // keyboardButtonCallback#e62bc960 +// case *tg.KeyboardButtonRequestPhone: // keyboardButtonRequestPhone#417efd8f +// case *tg.KeyboardButtonRequestGeoLocation: // keyboardButtonRequestGeoLocation#aa40f94d +// case *tg.KeyboardButtonSwitchInline: // keyboardButtonSwitchInline#991399fc +// case *tg.KeyboardButtonGame: // keyboardButtonGame#89c590f9 +// case *tg.KeyboardButtonBuy: // keyboardButtonBuy#3fa53905 +// case *tg.KeyboardButtonURLAuth: // keyboardButtonUrlAuth#f51006f9 +// case *tg.InputKeyboardButtonURLAuth: // inputKeyboardButtonUrlAuth#68013e72 +// case *tg.KeyboardButtonRequestPoll: // keyboardButtonRequestPoll#7a11d782 +// case *tg.InputKeyboardButtonUserProfile: // inputKeyboardButtonUserProfile#7d5e07c7 +// case *tg.KeyboardButtonUserProfile: // keyboardButtonUserProfile#c0fd5d09 +// case *tg.KeyboardButtonWebView: // keyboardButtonWebView#e846b1a0 +// case *tg.KeyboardButtonSimpleWebView: // keyboardButtonSimpleWebView#e15c4370 +// case *tg.KeyboardButtonRequestPeer: // keyboardButtonRequestPeer#5b0f15f5 +// case *tg.InputKeyboardButtonRequestPeer: // inputKeyboardButtonRequestPeer#2b78156 +// case *tg.KeyboardButtonCopy: // keyboardButtonCopy#bcc4af10 // default: panic(v) // } type KeyboardButtonClass interface { @@ -3679,6 +4759,9 @@ type KeyboardButtonClass interface { // Zero returns true if current object has a zero value. Zero() bool + // Style field of KeyboardButton. + GetStyle() (value KeyboardButtonStyle, ok bool) + // Button text GetText() (value string) } @@ -3691,126 +4774,126 @@ func DecodeKeyboardButton(buf *bin.Buffer) (KeyboardButtonClass, error) { } switch id { case KeyboardButtonTypeID: - // Decoding keyboardButton#a2fa4880. + // Decoding keyboardButton#7d170cff. v := KeyboardButton{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonURLTypeID: - // Decoding keyboardButtonUrl#258aff05. + // Decoding keyboardButtonUrl#d80c25ec. v := KeyboardButtonURL{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonCallbackTypeID: - // Decoding keyboardButtonCallback#35bbdb6b. + // Decoding keyboardButtonCallback#e62bc960. v := KeyboardButtonCallback{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonRequestPhoneTypeID: - // Decoding keyboardButtonRequestPhone#b16a6c29. + // Decoding keyboardButtonRequestPhone#417efd8f. v := KeyboardButtonRequestPhone{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonRequestGeoLocationTypeID: - // Decoding keyboardButtonRequestGeoLocation#fc796b3f. + // Decoding keyboardButtonRequestGeoLocation#aa40f94d. v := KeyboardButtonRequestGeoLocation{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonSwitchInlineTypeID: - // Decoding keyboardButtonSwitchInline#93b9fbb5. + // Decoding keyboardButtonSwitchInline#991399fc. v := KeyboardButtonSwitchInline{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonGameTypeID: - // Decoding keyboardButtonGame#50f41ccf. + // Decoding keyboardButtonGame#89c590f9. v := KeyboardButtonGame{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonBuyTypeID: - // Decoding keyboardButtonBuy#afd93fbb. + // Decoding keyboardButtonBuy#3fa53905. v := KeyboardButtonBuy{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonURLAuthTypeID: - // Decoding keyboardButtonUrlAuth#10b78d29. + // Decoding keyboardButtonUrlAuth#f51006f9. v := KeyboardButtonURLAuth{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case InputKeyboardButtonURLAuthTypeID: - // Decoding inputKeyboardButtonUrlAuth#d02e7fd4. + // Decoding inputKeyboardButtonUrlAuth#68013e72. v := InputKeyboardButtonURLAuth{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonRequestPollTypeID: - // Decoding keyboardButtonRequestPoll#bbc7515d. + // Decoding keyboardButtonRequestPoll#7a11d782. v := KeyboardButtonRequestPoll{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case InputKeyboardButtonUserProfileTypeID: - // Decoding inputKeyboardButtonUserProfile#e988037b. + // Decoding inputKeyboardButtonUserProfile#7d5e07c7. v := InputKeyboardButtonUserProfile{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonUserProfileTypeID: - // Decoding keyboardButtonUserProfile#308660c1. + // Decoding keyboardButtonUserProfile#c0fd5d09. v := KeyboardButtonUserProfile{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonWebViewTypeID: - // Decoding keyboardButtonWebView#13767230. + // Decoding keyboardButtonWebView#e846b1a0. v := KeyboardButtonWebView{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonSimpleWebViewTypeID: - // Decoding keyboardButtonSimpleWebView#a0c0505c. + // Decoding keyboardButtonSimpleWebView#e15c4370. v := KeyboardButtonSimpleWebView{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonRequestPeerTypeID: - // Decoding keyboardButtonRequestPeer#53d7bfd8. + // Decoding keyboardButtonRequestPeer#5b0f15f5. v := KeyboardButtonRequestPeer{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case InputKeyboardButtonRequestPeerTypeID: - // Decoding inputKeyboardButtonRequestPeer#c9662d05. + // Decoding inputKeyboardButtonRequestPeer#2b78156. v := InputKeyboardButtonRequestPeer{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) } return &v, nil case KeyboardButtonCopyTypeID: - // Decoding keyboardButtonCopy#75d2698e. + // Decoding keyboardButtonCopy#bcc4af10. v := KeyboardButtonCopy{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) diff --git a/pkg/gotd/tg/tl_keyboard_button_style_gen.go b/pkg/gotd/tg/tl_keyboard_button_style_gen.go new file mode 100644 index 00000000..19d974cc --- /dev/null +++ b/pkg/gotd/tg/tl_keyboard_button_style_gen.go @@ -0,0 +1,305 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// KeyboardButtonStyle represents TL type `keyboardButtonStyle#4fdd3430`. +// +// See https://core.telegram.org/constructor/keyboardButtonStyle for reference. +type KeyboardButtonStyle struct { + // Flags field of KeyboardButtonStyle. + Flags bin.Fields + // BgPrimary field of KeyboardButtonStyle. + BgPrimary bool + // BgDanger field of KeyboardButtonStyle. + BgDanger bool + // BgSuccess field of KeyboardButtonStyle. + BgSuccess bool + // Icon field of KeyboardButtonStyle. + // + // Use SetIcon and GetIcon helpers. + Icon int64 +} + +// KeyboardButtonStyleTypeID is TL type id of KeyboardButtonStyle. +const KeyboardButtonStyleTypeID = 0x4fdd3430 + +// Ensuring interfaces in compile-time for KeyboardButtonStyle. +var ( + _ bin.Encoder = &KeyboardButtonStyle{} + _ bin.Decoder = &KeyboardButtonStyle{} + _ bin.BareEncoder = &KeyboardButtonStyle{} + _ bin.BareDecoder = &KeyboardButtonStyle{} +) + +func (k *KeyboardButtonStyle) Zero() bool { + if k == nil { + return true + } + if !(k.Flags.Zero()) { + return false + } + if !(k.BgPrimary == false) { + return false + } + if !(k.BgDanger == false) { + return false + } + if !(k.BgSuccess == false) { + return false + } + if !(k.Icon == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (k *KeyboardButtonStyle) String() string { + if k == nil { + return "KeyboardButtonStyle(nil)" + } + type Alias KeyboardButtonStyle + return fmt.Sprintf("KeyboardButtonStyle%+v", Alias(*k)) +} + +// FillFrom fills KeyboardButtonStyle from given interface. +func (k *KeyboardButtonStyle) FillFrom(from interface { + GetBgPrimary() (value bool) + GetBgDanger() (value bool) + GetBgSuccess() (value bool) + GetIcon() (value int64, ok bool) +}) { + k.BgPrimary = from.GetBgPrimary() + k.BgDanger = from.GetBgDanger() + k.BgSuccess = from.GetBgSuccess() + if val, ok := from.GetIcon(); ok { + k.Icon = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*KeyboardButtonStyle) TypeID() uint32 { + return KeyboardButtonStyleTypeID +} + +// TypeName returns name of type in TL schema. +func (*KeyboardButtonStyle) TypeName() string { + return "keyboardButtonStyle" +} + +// TypeInfo returns info about TL type. +func (k *KeyboardButtonStyle) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "keyboardButtonStyle", + ID: KeyboardButtonStyleTypeID, + } + if k == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "BgPrimary", + SchemaName: "bg_primary", + Null: !k.Flags.Has(0), + }, + { + Name: "BgDanger", + SchemaName: "bg_danger", + Null: !k.Flags.Has(1), + }, + { + Name: "BgSuccess", + SchemaName: "bg_success", + Null: !k.Flags.Has(2), + }, + { + Name: "Icon", + SchemaName: "icon", + Null: !k.Flags.Has(3), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (k *KeyboardButtonStyle) SetFlags() { + if !(k.BgPrimary == false) { + k.Flags.Set(0) + } + if !(k.BgDanger == false) { + k.Flags.Set(1) + } + if !(k.BgSuccess == false) { + k.Flags.Set(2) + } + if !(k.Icon == 0) { + k.Flags.Set(3) + } +} + +// Encode implements bin.Encoder. +func (k *KeyboardButtonStyle) Encode(b *bin.Buffer) error { + if k == nil { + return fmt.Errorf("can't encode keyboardButtonStyle#4fdd3430 as nil") + } + b.PutID(KeyboardButtonStyleTypeID) + return k.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (k *KeyboardButtonStyle) EncodeBare(b *bin.Buffer) error { + if k == nil { + return fmt.Errorf("can't encode keyboardButtonStyle#4fdd3430 as nil") + } + k.SetFlags() + if err := k.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode keyboardButtonStyle#4fdd3430: field flags: %w", err) + } + if k.Flags.Has(3) { + b.PutLong(k.Icon) + } + return nil +} + +// Decode implements bin.Decoder. +func (k *KeyboardButtonStyle) Decode(b *bin.Buffer) error { + if k == nil { + return fmt.Errorf("can't decode keyboardButtonStyle#4fdd3430 to nil") + } + if err := b.ConsumeID(KeyboardButtonStyleTypeID); err != nil { + return fmt.Errorf("unable to decode keyboardButtonStyle#4fdd3430: %w", err) + } + return k.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (k *KeyboardButtonStyle) DecodeBare(b *bin.Buffer) error { + if k == nil { + return fmt.Errorf("can't decode keyboardButtonStyle#4fdd3430 to nil") + } + { + if err := k.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode keyboardButtonStyle#4fdd3430: field flags: %w", err) + } + } + k.BgPrimary = k.Flags.Has(0) + k.BgDanger = k.Flags.Has(1) + k.BgSuccess = k.Flags.Has(2) + if k.Flags.Has(3) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode keyboardButtonStyle#4fdd3430: field icon: %w", err) + } + k.Icon = value + } + return nil +} + +// SetBgPrimary sets value of BgPrimary conditional field. +func (k *KeyboardButtonStyle) SetBgPrimary(value bool) { + if value { + k.Flags.Set(0) + k.BgPrimary = true + } else { + k.Flags.Unset(0) + k.BgPrimary = false + } +} + +// GetBgPrimary returns value of BgPrimary conditional field. +func (k *KeyboardButtonStyle) GetBgPrimary() (value bool) { + if k == nil { + return + } + return k.Flags.Has(0) +} + +// SetBgDanger sets value of BgDanger conditional field. +func (k *KeyboardButtonStyle) SetBgDanger(value bool) { + if value { + k.Flags.Set(1) + k.BgDanger = true + } else { + k.Flags.Unset(1) + k.BgDanger = false + } +} + +// GetBgDanger returns value of BgDanger conditional field. +func (k *KeyboardButtonStyle) GetBgDanger() (value bool) { + if k == nil { + return + } + return k.Flags.Has(1) +} + +// SetBgSuccess sets value of BgSuccess conditional field. +func (k *KeyboardButtonStyle) SetBgSuccess(value bool) { + if value { + k.Flags.Set(2) + k.BgSuccess = true + } else { + k.Flags.Unset(2) + k.BgSuccess = false + } +} + +// GetBgSuccess returns value of BgSuccess conditional field. +func (k *KeyboardButtonStyle) GetBgSuccess() (value bool) { + if k == nil { + return + } + return k.Flags.Has(2) +} + +// SetIcon sets value of Icon conditional field. +func (k *KeyboardButtonStyle) SetIcon(value int64) { + k.Flags.Set(3) + k.Icon = value +} + +// GetIcon returns value of Icon conditional field and +// boolean which is true if field was set. +func (k *KeyboardButtonStyle) GetIcon() (value int64, ok bool) { + if k == nil { + return + } + if !k.Flags.Has(3) { + return value, false + } + return k.Icon, true +} diff --git a/pkg/gotd/tg/tl_keyboard_button_style_slices_gen.go b/pkg/gotd/tg/tl_keyboard_button_style_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_keyboard_button_style_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_message_action_gen.go b/pkg/gotd/tg/tl_message_action_gen.go index 08bffcee..47fd2272 100644 --- a/pkg/gotd/tg/tl_message_action_gen.go +++ b/pkg/gotd/tg/tl_message_action_gen.go @@ -9379,7 +9379,7 @@ func (m *MessageActionPrizeStars) GetGiveawayMsgID() (value int) { return m.GiveawayMsgID } -// MessageActionStarGift represents TL type `messageActionStarGift#db596550`. +// MessageActionStarGift represents TL type `messageActionStarGift#ea2c31d3`. // You received a gift, see here »¹ for more info. // // Links: @@ -9496,10 +9496,14 @@ type MessageActionStarGift struct { // // Use SetToID and GetToID helpers. ToID PeerClass + // GiftNum field of MessageActionStarGift. + // + // Use SetGiftNum and GetGiftNum helpers. + GiftNum int } // MessageActionStarGiftTypeID is TL type id of MessageActionStarGift. -const MessageActionStarGiftTypeID = 0xdb596550 +const MessageActionStarGiftTypeID = 0xea2c31d3 // construct implements constructor of MessageActionClass. func (m MessageActionStarGift) construct() MessageActionClass { return &m } @@ -9581,6 +9585,9 @@ func (m *MessageActionStarGift) Zero() bool { if !(m.ToID == nil) { return false } + if !(m.GiftNum == 0) { + return false + } return true } @@ -9616,6 +9623,7 @@ func (m *MessageActionStarGift) FillFrom(from interface { GetPrepaidUpgradeHash() (value string, ok bool) GetGiftMsgID() (value int, ok bool) GetToID() (value PeerClass, ok bool) + GetGiftNum() (value int, ok bool) }) { m.NameHidden = from.GetNameHidden() m.Saved = from.GetSaved() @@ -9667,6 +9675,10 @@ func (m *MessageActionStarGift) FillFrom(from interface { m.ToID = val } + if val, ok := from.GetGiftNum(); ok { + m.GiftNum = val + } + } // TypeID returns type id in TL schema. @@ -9791,6 +9803,11 @@ func (m *MessageActionStarGift) TypeInfo() tdp.Type { SchemaName: "to_id", Null: !m.Flags.Has(18), }, + { + Name: "GiftNum", + SchemaName: "gift_num", + Null: !m.Flags.Has(19), + }, } return typ } @@ -9854,12 +9871,15 @@ func (m *MessageActionStarGift) SetFlags() { if !(m.ToID == nil) { m.Flags.Set(18) } + if !(m.GiftNum == 0) { + m.Flags.Set(19) + } } // Encode implements bin.Encoder. func (m *MessageActionStarGift) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionStarGift#db596550 as nil") + return fmt.Errorf("can't encode messageActionStarGift#ea2c31d3 as nil") } b.PutID(MessageActionStarGiftTypeID) return m.EncodeBare(b) @@ -9868,21 +9888,21 @@ 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#db596550 as nil") + return fmt.Errorf("can't encode messageActionStarGift#ea2c31d3 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field flags: %w", err) + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field flags: %w", err) } if m.Gift == nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field gift is nil") + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field gift is nil") } if err := m.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field gift: %w", err) + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field gift: %w", err) } if m.Flags.Has(1) { if err := m.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field message: %w", err) + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field message: %w", err) } } if m.Flags.Has(4) { @@ -9896,18 +9916,18 @@ func (m *MessageActionStarGift) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(11) { if m.FromID == nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field from_id is nil") + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field from_id is nil") } if err := m.FromID.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field from_id: %w", err) + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field from_id: %w", err) } } if m.Flags.Has(12) { if m.Peer == nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field peer is nil") + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field peer is nil") } if err := m.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field peer: %w", err) + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field peer: %w", err) } } if m.Flags.Has(12) { @@ -9921,22 +9941,25 @@ func (m *MessageActionStarGift) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(18) { if m.ToID == nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field to_id is nil") + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field to_id is nil") } if err := m.ToID.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGift#db596550: field to_id: %w", err) + return fmt.Errorf("unable to encode messageActionStarGift#ea2c31d3: field to_id: %w", err) } } + if m.Flags.Has(19) { + b.PutInt(m.GiftNum) + } return nil } // Decode implements bin.Decoder. func (m *MessageActionStarGift) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionStarGift#db596550 to nil") + return fmt.Errorf("can't decode messageActionStarGift#ea2c31d3 to nil") } if err := b.ConsumeID(MessageActionStarGiftTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: %w", err) } return m.DecodeBare(b) } @@ -9944,11 +9967,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#db596550 to nil") + return fmt.Errorf("can't decode messageActionStarGift#ea2c31d3 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field flags: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field flags: %w", err) } } m.NameHidden = m.Flags.Has(0) @@ -9963,78 +9986,85 @@ func (m *MessageActionStarGift) DecodeBare(b *bin.Buffer) error { { value, err := DecodeStarGift(b) if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field gift: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field gift: %w", err) } m.Gift = value } if m.Flags.Has(1) { if err := m.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field message: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field message: %w", err) } } if m.Flags.Has(4) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field convert_stars: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field convert_stars: %w", err) } m.ConvertStars = value } if m.Flags.Has(5) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field upgrade_msg_id: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field upgrade_msg_id: %w", err) } m.UpgradeMsgID = value } if m.Flags.Has(8) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field upgrade_stars: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field upgrade_stars: %w", err) } m.UpgradeStars = value } if m.Flags.Has(11) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field from_id: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field from_id: %w", err) } m.FromID = value } if m.Flags.Has(12) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field peer: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field peer: %w", err) } m.Peer = value } if m.Flags.Has(12) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field saved_id: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field saved_id: %w", err) } m.SavedID = value } if m.Flags.Has(14) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field prepaid_upgrade_hash: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field prepaid_upgrade_hash: %w", err) } m.PrepaidUpgradeHash = value } if m.Flags.Has(15) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field gift_msg_id: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field gift_msg_id: %w", err) } m.GiftMsgID = value } if m.Flags.Has(18) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageActionStarGift#db596550: field to_id: %w", err) + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field to_id: %w", err) } m.ToID = value } + if m.Flags.Has(19) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageActionStarGift#ea2c31d3: field gift_num: %w", err) + } + m.GiftNum = value + } return nil } @@ -10397,7 +10427,25 @@ func (m *MessageActionStarGift) GetToID() (value PeerClass, ok bool) { return m.ToID, true } -// MessageActionStarGiftUnique represents TL type `messageActionStarGiftUnique#95728543`. +// SetGiftNum sets value of GiftNum conditional field. +func (m *MessageActionStarGift) SetGiftNum(value int) { + m.Flags.Set(19) + m.GiftNum = value +} + +// GetGiftNum returns value of GiftNum conditional field and +// boolean which is true if field was set. +func (m *MessageActionStarGift) GetGiftNum() (value int, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(19) { + return value, false + } + return m.GiftNum, true +} + +// MessageActionStarGiftUnique represents TL type `messageActionStarGiftUnique#e6c31522`. // A gift »¹ was upgraded to a collectible gift »². // // Links: @@ -10440,6 +10488,10 @@ type MessageActionStarGiftUnique struct { PrepaidUpgrade bool // Assigned field of MessageActionStarGiftUnique. Assigned bool + // FromOffer field of MessageActionStarGiftUnique. + FromOffer bool + // Craft field of MessageActionStarGiftUnique. + Craft bool // The collectible gift. Gift StarGiftClass // If set, indicates that the current gift can't be exported to the TON blockchain »¹ @@ -10497,10 +10549,14 @@ type MessageActionStarGiftUnique struct { // // Use SetDropOriginalDetailsStars and GetDropOriginalDetailsStars helpers. DropOriginalDetailsStars int64 + // CanCraftAt field of MessageActionStarGiftUnique. + // + // Use SetCanCraftAt and GetCanCraftAt helpers. + CanCraftAt int } // MessageActionStarGiftUniqueTypeID is TL type id of MessageActionStarGiftUnique. -const MessageActionStarGiftUniqueTypeID = 0x95728543 +const MessageActionStarGiftUniqueTypeID = 0xe6c31522 // construct implements constructor of MessageActionClass. func (m MessageActionStarGiftUnique) construct() MessageActionClass { return &m } @@ -10540,6 +10596,12 @@ func (m *MessageActionStarGiftUnique) Zero() bool { if !(m.Assigned == false) { return false } + if !(m.FromOffer == false) { + return false + } + if !(m.Craft == false) { + return false + } if !(m.Gift == nil) { return false } @@ -10570,6 +10632,9 @@ func (m *MessageActionStarGiftUnique) Zero() bool { if !(m.DropOriginalDetailsStars == 0) { return false } + if !(m.CanCraftAt == 0) { + return false + } return true } @@ -10591,6 +10656,8 @@ func (m *MessageActionStarGiftUnique) FillFrom(from interface { GetRefunded() (value bool) GetPrepaidUpgrade() (value bool) GetAssigned() (value bool) + GetFromOffer() (value bool) + GetCraft() (value bool) GetGift() (value StarGiftClass) GetCanExportAt() (value int, ok bool) GetTransferStars() (value int64, ok bool) @@ -10601,6 +10668,7 @@ func (m *MessageActionStarGiftUnique) FillFrom(from interface { GetCanTransferAt() (value int, ok bool) GetCanResellAt() (value int, ok bool) GetDropOriginalDetailsStars() (value int64, ok bool) + GetCanCraftAt() (value int, ok bool) }) { m.Upgrade = from.GetUpgrade() m.Transferred = from.GetTransferred() @@ -10608,6 +10676,8 @@ func (m *MessageActionStarGiftUnique) FillFrom(from interface { m.Refunded = from.GetRefunded() m.PrepaidUpgrade = from.GetPrepaidUpgrade() m.Assigned = from.GetAssigned() + m.FromOffer = from.GetFromOffer() + m.Craft = from.GetCraft() m.Gift = from.GetGift() if val, ok := from.GetCanExportAt(); ok { m.CanExportAt = val @@ -10645,6 +10715,10 @@ func (m *MessageActionStarGiftUnique) FillFrom(from interface { m.DropOriginalDetailsStars = val } + if val, ok := from.GetCanCraftAt(); ok { + m.CanCraftAt = val + } + } // TypeID returns type id in TL schema. @@ -10700,6 +10774,16 @@ func (m *MessageActionStarGiftUnique) TypeInfo() tdp.Type { SchemaName: "assigned", Null: !m.Flags.Has(13), }, + { + Name: "FromOffer", + SchemaName: "from_offer", + Null: !m.Flags.Has(14), + }, + { + Name: "Craft", + SchemaName: "craft", + Null: !m.Flags.Has(16), + }, { Name: "Gift", SchemaName: "gift", @@ -10749,6 +10833,11 @@ func (m *MessageActionStarGiftUnique) TypeInfo() tdp.Type { SchemaName: "drop_original_details_stars", Null: !m.Flags.Has(12), }, + { + Name: "CanCraftAt", + SchemaName: "can_craft_at", + Null: !m.Flags.Has(15), + }, } return typ } @@ -10773,6 +10862,12 @@ func (m *MessageActionStarGiftUnique) SetFlags() { if !(m.Assigned == false) { m.Flags.Set(13) } + if !(m.FromOffer == false) { + m.Flags.Set(14) + } + if !(m.Craft == false) { + m.Flags.Set(16) + } if !(m.CanExportAt == 0) { m.Flags.Set(3) } @@ -10800,12 +10895,15 @@ func (m *MessageActionStarGiftUnique) SetFlags() { if !(m.DropOriginalDetailsStars == 0) { m.Flags.Set(12) } + if !(m.CanCraftAt == 0) { + m.Flags.Set(15) + } } // Encode implements bin.Encoder. func (m *MessageActionStarGiftUnique) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionStarGiftUnique#95728543 as nil") + return fmt.Errorf("can't encode messageActionStarGiftUnique#e6c31522 as nil") } b.PutID(MessageActionStarGiftUniqueTypeID) return m.EncodeBare(b) @@ -10814,17 +10912,17 @@ func (m *MessageActionStarGiftUnique) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionStarGiftUnique) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionStarGiftUnique#95728543 as nil") + return fmt.Errorf("can't encode messageActionStarGiftUnique#e6c31522 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGiftUnique#95728543: field flags: %w", err) + return fmt.Errorf("unable to encode messageActionStarGiftUnique#e6c31522: field flags: %w", err) } if m.Gift == nil { - return fmt.Errorf("unable to encode messageActionStarGiftUnique#95728543: field gift is nil") + return fmt.Errorf("unable to encode messageActionStarGiftUnique#e6c31522: field gift is nil") } if err := m.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGiftUnique#95728543: field gift: %w", err) + return fmt.Errorf("unable to encode messageActionStarGiftUnique#e6c31522: field gift: %w", err) } if m.Flags.Has(3) { b.PutInt(m.CanExportAt) @@ -10834,18 +10932,18 @@ func (m *MessageActionStarGiftUnique) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(6) { if m.FromID == nil { - return fmt.Errorf("unable to encode messageActionStarGiftUnique#95728543: field from_id is nil") + return fmt.Errorf("unable to encode messageActionStarGiftUnique#e6c31522: field from_id is nil") } if err := m.FromID.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGiftUnique#95728543: field from_id: %w", err) + return fmt.Errorf("unable to encode messageActionStarGiftUnique#e6c31522: field from_id: %w", err) } } if m.Flags.Has(7) { if m.Peer == nil { - return fmt.Errorf("unable to encode messageActionStarGiftUnique#95728543: field peer is nil") + return fmt.Errorf("unable to encode messageActionStarGiftUnique#e6c31522: field peer is nil") } if err := m.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGiftUnique#95728543: field peer: %w", err) + return fmt.Errorf("unable to encode messageActionStarGiftUnique#e6c31522: field peer: %w", err) } } if m.Flags.Has(7) { @@ -10853,10 +10951,10 @@ func (m *MessageActionStarGiftUnique) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(8) { if m.ResaleAmount == nil { - return fmt.Errorf("unable to encode messageActionStarGiftUnique#95728543: field resale_amount is nil") + return fmt.Errorf("unable to encode messageActionStarGiftUnique#e6c31522: field resale_amount is nil") } if err := m.ResaleAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionStarGiftUnique#95728543: field resale_amount: %w", err) + return fmt.Errorf("unable to encode messageActionStarGiftUnique#e6c31522: field resale_amount: %w", err) } } if m.Flags.Has(9) { @@ -10868,16 +10966,19 @@ func (m *MessageActionStarGiftUnique) EncodeBare(b *bin.Buffer) error { if m.Flags.Has(12) { b.PutLong(m.DropOriginalDetailsStars) } + if m.Flags.Has(15) { + b.PutInt(m.CanCraftAt) + } return nil } // Decode implements bin.Decoder. func (m *MessageActionStarGiftUnique) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionStarGiftUnique#95728543 to nil") + return fmt.Errorf("can't decode messageActionStarGiftUnique#e6c31522 to nil") } if err := b.ConsumeID(MessageActionStarGiftUniqueTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: %w", err) } return m.DecodeBare(b) } @@ -10885,11 +10986,11 @@ func (m *MessageActionStarGiftUnique) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionStarGiftUnique) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionStarGiftUnique#95728543 to nil") + return fmt.Errorf("can't decode messageActionStarGiftUnique#e6c31522 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field flags: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field flags: %w", err) } } m.Upgrade = m.Flags.Has(0) @@ -10898,76 +10999,85 @@ func (m *MessageActionStarGiftUnique) DecodeBare(b *bin.Buffer) error { m.Refunded = m.Flags.Has(5) m.PrepaidUpgrade = m.Flags.Has(11) m.Assigned = m.Flags.Has(13) + m.FromOffer = m.Flags.Has(14) + m.Craft = m.Flags.Has(16) { value, err := DecodeStarGift(b) if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field gift: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field gift: %w", err) } m.Gift = value } if m.Flags.Has(3) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field can_export_at: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field can_export_at: %w", err) } m.CanExportAt = value } if m.Flags.Has(4) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field transfer_stars: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field transfer_stars: %w", err) } m.TransferStars = value } if m.Flags.Has(6) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field from_id: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field from_id: %w", err) } m.FromID = value } if m.Flags.Has(7) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field peer: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field peer: %w", err) } m.Peer = value } if m.Flags.Has(7) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field saved_id: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field saved_id: %w", err) } m.SavedID = value } if m.Flags.Has(8) { value, err := DecodeStarsAmount(b) if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field resale_amount: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field resale_amount: %w", err) } m.ResaleAmount = value } if m.Flags.Has(9) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field can_transfer_at: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field can_transfer_at: %w", err) } m.CanTransferAt = value } if m.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field can_resell_at: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field can_resell_at: %w", err) } m.CanResellAt = value } if m.Flags.Has(12) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionStarGiftUnique#95728543: field drop_original_details_stars: %w", err) + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field drop_original_details_stars: %w", err) } m.DropOriginalDetailsStars = value } + if m.Flags.Has(15) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftUnique#e6c31522: field can_craft_at: %w", err) + } + m.CanCraftAt = value + } return nil } @@ -11085,6 +11195,44 @@ func (m *MessageActionStarGiftUnique) GetAssigned() (value bool) { return m.Flags.Has(13) } +// SetFromOffer sets value of FromOffer conditional field. +func (m *MessageActionStarGiftUnique) SetFromOffer(value bool) { + if value { + m.Flags.Set(14) + m.FromOffer = true + } else { + m.Flags.Unset(14) + m.FromOffer = false + } +} + +// GetFromOffer returns value of FromOffer conditional field. +func (m *MessageActionStarGiftUnique) GetFromOffer() (value bool) { + if m == nil { + return + } + return m.Flags.Has(14) +} + +// SetCraft sets value of Craft conditional field. +func (m *MessageActionStarGiftUnique) SetCraft(value bool) { + if value { + m.Flags.Set(16) + m.Craft = true + } else { + m.Flags.Unset(16) + m.Craft = false + } +} + +// GetCraft returns value of Craft conditional field. +func (m *MessageActionStarGiftUnique) GetCraft() (value bool) { + if m == nil { + return + } + return m.Flags.Has(16) +} + // GetGift returns value of Gift field. func (m *MessageActionStarGiftUnique) GetGift() (value StarGiftClass) { if m == nil { @@ -11255,6 +11403,24 @@ func (m *MessageActionStarGiftUnique) GetDropOriginalDetailsStars() (value int64 return m.DropOriginalDetailsStars, true } +// SetCanCraftAt sets value of CanCraftAt conditional field. +func (m *MessageActionStarGiftUnique) SetCanCraftAt(value int) { + m.Flags.Set(15) + m.CanCraftAt = value +} + +// GetCanCraftAt returns value of CanCraftAt conditional field and +// boolean which is true if field was set. +func (m *MessageActionStarGiftUnique) GetCanCraftAt() (value int, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(15) { + return value, false + } + return m.CanCraftAt, true +} + // MessageActionPaidMessagesRefunded represents TL type `messageActionPaidMessagesRefunded#ac1f1fcd`. // Sent from peer A to B, indicates that A refunded all stars¹ B previously paid to send // messages to A, see here »² for more info on paid messages. @@ -13455,6 +13621,1159 @@ func (m *MessageActionSuggestBirthday) GetBirthday() (value Birthday) { return m.Birthday } +// MessageActionStarGiftPurchaseOffer represents TL type `messageActionStarGiftPurchaseOffer#774278d4`. +// +// See https://core.telegram.org/constructor/messageActionStarGiftPurchaseOffer for reference. +type MessageActionStarGiftPurchaseOffer struct { + // Flags field of MessageActionStarGiftPurchaseOffer. + Flags bin.Fields + // Accepted field of MessageActionStarGiftPurchaseOffer. + Accepted bool + // Declined field of MessageActionStarGiftPurchaseOffer. + Declined bool + // Gift field of MessageActionStarGiftPurchaseOffer. + Gift StarGiftClass + // Price field of MessageActionStarGiftPurchaseOffer. + Price StarsAmountClass + // ExpiresAt field of MessageActionStarGiftPurchaseOffer. + ExpiresAt int +} + +// MessageActionStarGiftPurchaseOfferTypeID is TL type id of MessageActionStarGiftPurchaseOffer. +const MessageActionStarGiftPurchaseOfferTypeID = 0x774278d4 + +// construct implements constructor of MessageActionClass. +func (m MessageActionStarGiftPurchaseOffer) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionStarGiftPurchaseOffer. +var ( + _ bin.Encoder = &MessageActionStarGiftPurchaseOffer{} + _ bin.Decoder = &MessageActionStarGiftPurchaseOffer{} + _ bin.BareEncoder = &MessageActionStarGiftPurchaseOffer{} + _ bin.BareDecoder = &MessageActionStarGiftPurchaseOffer{} + + _ MessageActionClass = &MessageActionStarGiftPurchaseOffer{} +) + +func (m *MessageActionStarGiftPurchaseOffer) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.Accepted == false) { + return false + } + if !(m.Declined == false) { + return false + } + if !(m.Gift == nil) { + return false + } + if !(m.Price == nil) { + return false + } + if !(m.ExpiresAt == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionStarGiftPurchaseOffer) String() string { + if m == nil { + return "MessageActionStarGiftPurchaseOffer(nil)" + } + type Alias MessageActionStarGiftPurchaseOffer + return fmt.Sprintf("MessageActionStarGiftPurchaseOffer%+v", Alias(*m)) +} + +// FillFrom fills MessageActionStarGiftPurchaseOffer from given interface. +func (m *MessageActionStarGiftPurchaseOffer) FillFrom(from interface { + GetAccepted() (value bool) + GetDeclined() (value bool) + GetGift() (value StarGiftClass) + GetPrice() (value StarsAmountClass) + GetExpiresAt() (value int) +}) { + m.Accepted = from.GetAccepted() + m.Declined = from.GetDeclined() + m.Gift = from.GetGift() + m.Price = from.GetPrice() + m.ExpiresAt = from.GetExpiresAt() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionStarGiftPurchaseOffer) TypeID() uint32 { + return MessageActionStarGiftPurchaseOfferTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionStarGiftPurchaseOffer) TypeName() string { + return "messageActionStarGiftPurchaseOffer" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionStarGiftPurchaseOffer) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionStarGiftPurchaseOffer", + ID: MessageActionStarGiftPurchaseOfferTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Accepted", + SchemaName: "accepted", + Null: !m.Flags.Has(0), + }, + { + Name: "Declined", + SchemaName: "declined", + Null: !m.Flags.Has(1), + }, + { + Name: "Gift", + SchemaName: "gift", + }, + { + Name: "Price", + SchemaName: "price", + }, + { + Name: "ExpiresAt", + SchemaName: "expires_at", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageActionStarGiftPurchaseOffer) SetFlags() { + if !(m.Accepted == false) { + m.Flags.Set(0) + } + if !(m.Declined == false) { + m.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (m *MessageActionStarGiftPurchaseOffer) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionStarGiftPurchaseOffer#774278d4 as nil") + } + b.PutID(MessageActionStarGiftPurchaseOfferTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionStarGiftPurchaseOffer) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionStarGiftPurchaseOffer#774278d4 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOffer#774278d4: field flags: %w", err) + } + if m.Gift == nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOffer#774278d4: field gift is nil") + } + if err := m.Gift.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOffer#774278d4: field gift: %w", err) + } + if m.Price == nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOffer#774278d4: field price is nil") + } + if err := m.Price.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOffer#774278d4: field price: %w", err) + } + b.PutInt(m.ExpiresAt) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionStarGiftPurchaseOffer) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionStarGiftPurchaseOffer#774278d4 to nil") + } + if err := b.ConsumeID(MessageActionStarGiftPurchaseOfferTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftPurchaseOffer#774278d4: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionStarGiftPurchaseOffer) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionStarGiftPurchaseOffer#774278d4 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftPurchaseOffer#774278d4: field flags: %w", err) + } + } + m.Accepted = m.Flags.Has(0) + m.Declined = m.Flags.Has(1) + { + value, err := DecodeStarGift(b) + if err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftPurchaseOffer#774278d4: field gift: %w", err) + } + m.Gift = value + } + { + value, err := DecodeStarsAmount(b) + if err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftPurchaseOffer#774278d4: field price: %w", err) + } + m.Price = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftPurchaseOffer#774278d4: field expires_at: %w", err) + } + m.ExpiresAt = value + } + return nil +} + +// SetAccepted sets value of Accepted conditional field. +func (m *MessageActionStarGiftPurchaseOffer) SetAccepted(value bool) { + if value { + m.Flags.Set(0) + m.Accepted = true + } else { + m.Flags.Unset(0) + m.Accepted = false + } +} + +// GetAccepted returns value of Accepted conditional field. +func (m *MessageActionStarGiftPurchaseOffer) GetAccepted() (value bool) { + if m == nil { + return + } + return m.Flags.Has(0) +} + +// SetDeclined sets value of Declined conditional field. +func (m *MessageActionStarGiftPurchaseOffer) SetDeclined(value bool) { + if value { + m.Flags.Set(1) + m.Declined = true + } else { + m.Flags.Unset(1) + m.Declined = false + } +} + +// GetDeclined returns value of Declined conditional field. +func (m *MessageActionStarGiftPurchaseOffer) GetDeclined() (value bool) { + if m == nil { + return + } + return m.Flags.Has(1) +} + +// GetGift returns value of Gift field. +func (m *MessageActionStarGiftPurchaseOffer) GetGift() (value StarGiftClass) { + if m == nil { + return + } + return m.Gift +} + +// GetPrice returns value of Price field. +func (m *MessageActionStarGiftPurchaseOffer) GetPrice() (value StarsAmountClass) { + if m == nil { + return + } + return m.Price +} + +// GetExpiresAt returns value of ExpiresAt field. +func (m *MessageActionStarGiftPurchaseOffer) GetExpiresAt() (value int) { + if m == nil { + return + } + return m.ExpiresAt +} + +// MessageActionStarGiftPurchaseOfferDeclined represents TL type `messageActionStarGiftPurchaseOfferDeclined#73ada76b`. +// +// See https://core.telegram.org/constructor/messageActionStarGiftPurchaseOfferDeclined for reference. +type MessageActionStarGiftPurchaseOfferDeclined struct { + // Flags field of MessageActionStarGiftPurchaseOfferDeclined. + Flags bin.Fields + // Expired field of MessageActionStarGiftPurchaseOfferDeclined. + Expired bool + // Gift field of MessageActionStarGiftPurchaseOfferDeclined. + Gift StarGiftClass + // Price field of MessageActionStarGiftPurchaseOfferDeclined. + Price StarsAmountClass +} + +// MessageActionStarGiftPurchaseOfferDeclinedTypeID is TL type id of MessageActionStarGiftPurchaseOfferDeclined. +const MessageActionStarGiftPurchaseOfferDeclinedTypeID = 0x73ada76b + +// construct implements constructor of MessageActionClass. +func (m MessageActionStarGiftPurchaseOfferDeclined) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionStarGiftPurchaseOfferDeclined. +var ( + _ bin.Encoder = &MessageActionStarGiftPurchaseOfferDeclined{} + _ bin.Decoder = &MessageActionStarGiftPurchaseOfferDeclined{} + _ bin.BareEncoder = &MessageActionStarGiftPurchaseOfferDeclined{} + _ bin.BareDecoder = &MessageActionStarGiftPurchaseOfferDeclined{} + + _ MessageActionClass = &MessageActionStarGiftPurchaseOfferDeclined{} +) + +func (m *MessageActionStarGiftPurchaseOfferDeclined) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.Expired == false) { + return false + } + if !(m.Gift == nil) { + return false + } + if !(m.Price == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionStarGiftPurchaseOfferDeclined) String() string { + if m == nil { + return "MessageActionStarGiftPurchaseOfferDeclined(nil)" + } + type Alias MessageActionStarGiftPurchaseOfferDeclined + return fmt.Sprintf("MessageActionStarGiftPurchaseOfferDeclined%+v", Alias(*m)) +} + +// FillFrom fills MessageActionStarGiftPurchaseOfferDeclined from given interface. +func (m *MessageActionStarGiftPurchaseOfferDeclined) FillFrom(from interface { + GetExpired() (value bool) + GetGift() (value StarGiftClass) + GetPrice() (value StarsAmountClass) +}) { + m.Expired = from.GetExpired() + m.Gift = from.GetGift() + m.Price = from.GetPrice() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionStarGiftPurchaseOfferDeclined) TypeID() uint32 { + return MessageActionStarGiftPurchaseOfferDeclinedTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionStarGiftPurchaseOfferDeclined) TypeName() string { + return "messageActionStarGiftPurchaseOfferDeclined" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionStarGiftPurchaseOfferDeclined) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionStarGiftPurchaseOfferDeclined", + ID: MessageActionStarGiftPurchaseOfferDeclinedTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Expired", + SchemaName: "expired", + Null: !m.Flags.Has(0), + }, + { + Name: "Gift", + SchemaName: "gift", + }, + { + Name: "Price", + SchemaName: "price", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageActionStarGiftPurchaseOfferDeclined) SetFlags() { + if !(m.Expired == false) { + m.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (m *MessageActionStarGiftPurchaseOfferDeclined) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionStarGiftPurchaseOfferDeclined#73ada76b as nil") + } + b.PutID(MessageActionStarGiftPurchaseOfferDeclinedTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionStarGiftPurchaseOfferDeclined) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionStarGiftPurchaseOfferDeclined#73ada76b as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOfferDeclined#73ada76b: field flags: %w", err) + } + if m.Gift == nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOfferDeclined#73ada76b: field gift is nil") + } + if err := m.Gift.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOfferDeclined#73ada76b: field gift: %w", err) + } + if m.Price == nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOfferDeclined#73ada76b: field price is nil") + } + if err := m.Price.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionStarGiftPurchaseOfferDeclined#73ada76b: field price: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionStarGiftPurchaseOfferDeclined) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionStarGiftPurchaseOfferDeclined#73ada76b to nil") + } + if err := b.ConsumeID(MessageActionStarGiftPurchaseOfferDeclinedTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftPurchaseOfferDeclined#73ada76b: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionStarGiftPurchaseOfferDeclined) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionStarGiftPurchaseOfferDeclined#73ada76b to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftPurchaseOfferDeclined#73ada76b: field flags: %w", err) + } + } + m.Expired = m.Flags.Has(0) + { + value, err := DecodeStarGift(b) + if err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftPurchaseOfferDeclined#73ada76b: field gift: %w", err) + } + m.Gift = value + } + { + value, err := DecodeStarsAmount(b) + if err != nil { + return fmt.Errorf("unable to decode messageActionStarGiftPurchaseOfferDeclined#73ada76b: field price: %w", err) + } + m.Price = value + } + return nil +} + +// SetExpired sets value of Expired conditional field. +func (m *MessageActionStarGiftPurchaseOfferDeclined) SetExpired(value bool) { + if value { + m.Flags.Set(0) + m.Expired = true + } else { + m.Flags.Unset(0) + m.Expired = false + } +} + +// GetExpired returns value of Expired conditional field. +func (m *MessageActionStarGiftPurchaseOfferDeclined) GetExpired() (value bool) { + if m == nil { + return + } + return m.Flags.Has(0) +} + +// GetGift returns value of Gift field. +func (m *MessageActionStarGiftPurchaseOfferDeclined) GetGift() (value StarGiftClass) { + if m == nil { + return + } + return m.Gift +} + +// GetPrice returns value of Price field. +func (m *MessageActionStarGiftPurchaseOfferDeclined) GetPrice() (value StarsAmountClass) { + if m == nil { + return + } + return m.Price +} + +// MessageActionNewCreatorPending represents TL type `messageActionNewCreatorPending#b07ed085`. +// +// See https://core.telegram.org/constructor/messageActionNewCreatorPending for reference. +type MessageActionNewCreatorPending struct { + // NewCreatorID field of MessageActionNewCreatorPending. + NewCreatorID int64 +} + +// MessageActionNewCreatorPendingTypeID is TL type id of MessageActionNewCreatorPending. +const MessageActionNewCreatorPendingTypeID = 0xb07ed085 + +// construct implements constructor of MessageActionClass. +func (m MessageActionNewCreatorPending) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionNewCreatorPending. +var ( + _ bin.Encoder = &MessageActionNewCreatorPending{} + _ bin.Decoder = &MessageActionNewCreatorPending{} + _ bin.BareEncoder = &MessageActionNewCreatorPending{} + _ bin.BareDecoder = &MessageActionNewCreatorPending{} + + _ MessageActionClass = &MessageActionNewCreatorPending{} +) + +func (m *MessageActionNewCreatorPending) Zero() bool { + if m == nil { + return true + } + if !(m.NewCreatorID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionNewCreatorPending) String() string { + if m == nil { + return "MessageActionNewCreatorPending(nil)" + } + type Alias MessageActionNewCreatorPending + return fmt.Sprintf("MessageActionNewCreatorPending%+v", Alias(*m)) +} + +// FillFrom fills MessageActionNewCreatorPending from given interface. +func (m *MessageActionNewCreatorPending) FillFrom(from interface { + GetNewCreatorID() (value int64) +}) { + m.NewCreatorID = from.GetNewCreatorID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionNewCreatorPending) TypeID() uint32 { + return MessageActionNewCreatorPendingTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionNewCreatorPending) TypeName() string { + return "messageActionNewCreatorPending" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionNewCreatorPending) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionNewCreatorPending", + ID: MessageActionNewCreatorPendingTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "NewCreatorID", + SchemaName: "new_creator_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageActionNewCreatorPending) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionNewCreatorPending#b07ed085 as nil") + } + b.PutID(MessageActionNewCreatorPendingTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionNewCreatorPending) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionNewCreatorPending#b07ed085 as nil") + } + b.PutLong(m.NewCreatorID) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionNewCreatorPending) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionNewCreatorPending#b07ed085 to nil") + } + if err := b.ConsumeID(MessageActionNewCreatorPendingTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionNewCreatorPending#b07ed085: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionNewCreatorPending) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionNewCreatorPending#b07ed085 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionNewCreatorPending#b07ed085: field new_creator_id: %w", err) + } + m.NewCreatorID = value + } + return nil +} + +// GetNewCreatorID returns value of NewCreatorID field. +func (m *MessageActionNewCreatorPending) GetNewCreatorID() (value int64) { + if m == nil { + return + } + return m.NewCreatorID +} + +// MessageActionChangeCreator represents TL type `messageActionChangeCreator#e188503b`. +// +// See https://core.telegram.org/constructor/messageActionChangeCreator for reference. +type MessageActionChangeCreator struct { + // NewCreatorID field of MessageActionChangeCreator. + NewCreatorID int64 +} + +// MessageActionChangeCreatorTypeID is TL type id of MessageActionChangeCreator. +const MessageActionChangeCreatorTypeID = 0xe188503b + +// construct implements constructor of MessageActionClass. +func (m MessageActionChangeCreator) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionChangeCreator. +var ( + _ bin.Encoder = &MessageActionChangeCreator{} + _ bin.Decoder = &MessageActionChangeCreator{} + _ bin.BareEncoder = &MessageActionChangeCreator{} + _ bin.BareDecoder = &MessageActionChangeCreator{} + + _ MessageActionClass = &MessageActionChangeCreator{} +) + +func (m *MessageActionChangeCreator) Zero() bool { + if m == nil { + return true + } + if !(m.NewCreatorID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionChangeCreator) String() string { + if m == nil { + return "MessageActionChangeCreator(nil)" + } + type Alias MessageActionChangeCreator + return fmt.Sprintf("MessageActionChangeCreator%+v", Alias(*m)) +} + +// FillFrom fills MessageActionChangeCreator from given interface. +func (m *MessageActionChangeCreator) FillFrom(from interface { + GetNewCreatorID() (value int64) +}) { + m.NewCreatorID = from.GetNewCreatorID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionChangeCreator) TypeID() uint32 { + return MessageActionChangeCreatorTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionChangeCreator) TypeName() string { + return "messageActionChangeCreator" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionChangeCreator) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionChangeCreator", + ID: MessageActionChangeCreatorTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "NewCreatorID", + SchemaName: "new_creator_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageActionChangeCreator) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionChangeCreator#e188503b as nil") + } + b.PutID(MessageActionChangeCreatorTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionChangeCreator) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionChangeCreator#e188503b as nil") + } + b.PutLong(m.NewCreatorID) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionChangeCreator) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionChangeCreator#e188503b to nil") + } + if err := b.ConsumeID(MessageActionChangeCreatorTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionChangeCreator#e188503b: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionChangeCreator) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionChangeCreator#e188503b to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionChangeCreator#e188503b: field new_creator_id: %w", err) + } + m.NewCreatorID = value + } + return nil +} + +// GetNewCreatorID returns value of NewCreatorID field. +func (m *MessageActionChangeCreator) GetNewCreatorID() (value int64) { + if m == nil { + return + } + return m.NewCreatorID +} + +// MessageActionNoForwardsToggle represents TL type `messageActionNoForwardsToggle#bf7d6572`. +// +// See https://core.telegram.org/constructor/messageActionNoForwardsToggle for reference. +type MessageActionNoForwardsToggle struct { + // PrevValue field of MessageActionNoForwardsToggle. + PrevValue bool + // NewValue field of MessageActionNoForwardsToggle. + NewValue bool +} + +// MessageActionNoForwardsToggleTypeID is TL type id of MessageActionNoForwardsToggle. +const MessageActionNoForwardsToggleTypeID = 0xbf7d6572 + +// construct implements constructor of MessageActionClass. +func (m MessageActionNoForwardsToggle) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionNoForwardsToggle. +var ( + _ bin.Encoder = &MessageActionNoForwardsToggle{} + _ bin.Decoder = &MessageActionNoForwardsToggle{} + _ bin.BareEncoder = &MessageActionNoForwardsToggle{} + _ bin.BareDecoder = &MessageActionNoForwardsToggle{} + + _ MessageActionClass = &MessageActionNoForwardsToggle{} +) + +func (m *MessageActionNoForwardsToggle) Zero() bool { + if m == nil { + return true + } + if !(m.PrevValue == false) { + return false + } + if !(m.NewValue == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionNoForwardsToggle) String() string { + if m == nil { + return "MessageActionNoForwardsToggle(nil)" + } + type Alias MessageActionNoForwardsToggle + return fmt.Sprintf("MessageActionNoForwardsToggle%+v", Alias(*m)) +} + +// FillFrom fills MessageActionNoForwardsToggle from given interface. +func (m *MessageActionNoForwardsToggle) FillFrom(from interface { + GetPrevValue() (value bool) + GetNewValue() (value bool) +}) { + m.PrevValue = from.GetPrevValue() + m.NewValue = from.GetNewValue() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionNoForwardsToggle) TypeID() uint32 { + return MessageActionNoForwardsToggleTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionNoForwardsToggle) TypeName() string { + return "messageActionNoForwardsToggle" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionNoForwardsToggle) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionNoForwardsToggle", + ID: MessageActionNoForwardsToggleTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "PrevValue", + SchemaName: "prev_value", + }, + { + Name: "NewValue", + SchemaName: "new_value", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageActionNoForwardsToggle) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionNoForwardsToggle#bf7d6572 as nil") + } + b.PutID(MessageActionNoForwardsToggleTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionNoForwardsToggle) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionNoForwardsToggle#bf7d6572 as nil") + } + b.PutBool(m.PrevValue) + b.PutBool(m.NewValue) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionNoForwardsToggle) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionNoForwardsToggle#bf7d6572 to nil") + } + if err := b.ConsumeID(MessageActionNoForwardsToggleTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionNoForwardsToggle#bf7d6572: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionNoForwardsToggle) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionNoForwardsToggle#bf7d6572 to nil") + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageActionNoForwardsToggle#bf7d6572: field prev_value: %w", err) + } + m.PrevValue = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageActionNoForwardsToggle#bf7d6572: field new_value: %w", err) + } + m.NewValue = value + } + return nil +} + +// GetPrevValue returns value of PrevValue field. +func (m *MessageActionNoForwardsToggle) GetPrevValue() (value bool) { + if m == nil { + return + } + return m.PrevValue +} + +// GetNewValue returns value of NewValue field. +func (m *MessageActionNoForwardsToggle) GetNewValue() (value bool) { + if m == nil { + return + } + return m.NewValue +} + +// MessageActionNoForwardsRequest represents TL type `messageActionNoForwardsRequest#3e2793ba`. +// +// See https://core.telegram.org/constructor/messageActionNoForwardsRequest for reference. +type MessageActionNoForwardsRequest struct { + // Flags field of MessageActionNoForwardsRequest. + Flags bin.Fields + // Expired field of MessageActionNoForwardsRequest. + Expired bool + // PrevValue field of MessageActionNoForwardsRequest. + PrevValue bool + // NewValue field of MessageActionNoForwardsRequest. + NewValue bool +} + +// MessageActionNoForwardsRequestTypeID is TL type id of MessageActionNoForwardsRequest. +const MessageActionNoForwardsRequestTypeID = 0x3e2793ba + +// construct implements constructor of MessageActionClass. +func (m MessageActionNoForwardsRequest) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionNoForwardsRequest. +var ( + _ bin.Encoder = &MessageActionNoForwardsRequest{} + _ bin.Decoder = &MessageActionNoForwardsRequest{} + _ bin.BareEncoder = &MessageActionNoForwardsRequest{} + _ bin.BareDecoder = &MessageActionNoForwardsRequest{} + + _ MessageActionClass = &MessageActionNoForwardsRequest{} +) + +func (m *MessageActionNoForwardsRequest) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.Expired == false) { + return false + } + if !(m.PrevValue == false) { + return false + } + if !(m.NewValue == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionNoForwardsRequest) String() string { + if m == nil { + return "MessageActionNoForwardsRequest(nil)" + } + type Alias MessageActionNoForwardsRequest + return fmt.Sprintf("MessageActionNoForwardsRequest%+v", Alias(*m)) +} + +// FillFrom fills MessageActionNoForwardsRequest from given interface. +func (m *MessageActionNoForwardsRequest) FillFrom(from interface { + GetExpired() (value bool) + GetPrevValue() (value bool) + GetNewValue() (value bool) +}) { + m.Expired = from.GetExpired() + m.PrevValue = from.GetPrevValue() + m.NewValue = from.GetNewValue() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionNoForwardsRequest) TypeID() uint32 { + return MessageActionNoForwardsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionNoForwardsRequest) TypeName() string { + return "messageActionNoForwardsRequest" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionNoForwardsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionNoForwardsRequest", + ID: MessageActionNoForwardsRequestTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Expired", + SchemaName: "expired", + Null: !m.Flags.Has(0), + }, + { + Name: "PrevValue", + SchemaName: "prev_value", + }, + { + Name: "NewValue", + SchemaName: "new_value", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageActionNoForwardsRequest) SetFlags() { + if !(m.Expired == false) { + m.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (m *MessageActionNoForwardsRequest) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionNoForwardsRequest#3e2793ba as nil") + } + b.PutID(MessageActionNoForwardsRequestTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionNoForwardsRequest) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionNoForwardsRequest#3e2793ba as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionNoForwardsRequest#3e2793ba: field flags: %w", err) + } + b.PutBool(m.PrevValue) + b.PutBool(m.NewValue) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionNoForwardsRequest) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionNoForwardsRequest#3e2793ba to nil") + } + if err := b.ConsumeID(MessageActionNoForwardsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionNoForwardsRequest#3e2793ba: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionNoForwardsRequest) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionNoForwardsRequest#3e2793ba to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionNoForwardsRequest#3e2793ba: field flags: %w", err) + } + } + m.Expired = m.Flags.Has(0) + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageActionNoForwardsRequest#3e2793ba: field prev_value: %w", err) + } + m.PrevValue = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode messageActionNoForwardsRequest#3e2793ba: field new_value: %w", err) + } + m.NewValue = value + } + return nil +} + +// SetExpired sets value of Expired conditional field. +func (m *MessageActionNoForwardsRequest) SetExpired(value bool) { + if value { + m.Flags.Set(0) + m.Expired = true + } else { + m.Flags.Unset(0) + m.Expired = false + } +} + +// GetExpired returns value of Expired conditional field. +func (m *MessageActionNoForwardsRequest) GetExpired() (value bool) { + if m == nil { + return + } + return m.Flags.Has(0) +} + +// GetPrevValue returns value of PrevValue field. +func (m *MessageActionNoForwardsRequest) GetPrevValue() (value bool) { + if m == nil { + return + } + return m.PrevValue +} + +// GetNewValue returns value of NewValue field. +func (m *MessageActionNoForwardsRequest) GetNewValue() (value bool) { + if m == nil { + return + } + return m.NewValue +} + // MessageActionClassName is schema name of MessageActionClass. const MessageActionClassName = "MessageAction" @@ -13515,8 +14834,8 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionPaymentRefunded: // messageActionPaymentRefunded#41b3e202 // case *tg.MessageActionGiftStars: // messageActionGiftStars#45d5b021 // case *tg.MessageActionPrizeStars: // messageActionPrizeStars#b00c47a2 -// case *tg.MessageActionStarGift: // messageActionStarGift#db596550 -// case *tg.MessageActionStarGiftUnique: // messageActionStarGiftUnique#95728543 +// case *tg.MessageActionStarGift: // messageActionStarGift#ea2c31d3 +// case *tg.MessageActionStarGiftUnique: // messageActionStarGiftUnique#e6c31522 // case *tg.MessageActionPaidMessagesRefunded: // messageActionPaidMessagesRefunded#ac1f1fcd // case *tg.MessageActionPaidMessagesPrice: // messageActionPaidMessagesPrice#84b88578 // case *tg.MessageActionConferenceCall: // messageActionConferenceCall#2ffe2f7a @@ -13527,6 +14846,12 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionSuggestedPostRefund: // messageActionSuggestedPostRefund#69f916f8 // case *tg.MessageActionGiftTon: // messageActionGiftTon#a8a3c699 // case *tg.MessageActionSuggestBirthday: // messageActionSuggestBirthday#2c8f2a25 +// case *tg.MessageActionStarGiftPurchaseOffer: // messageActionStarGiftPurchaseOffer#774278d4 +// case *tg.MessageActionStarGiftPurchaseOfferDeclined: // messageActionStarGiftPurchaseOfferDeclined#73ada76b +// case *tg.MessageActionNewCreatorPending: // messageActionNewCreatorPending#b07ed085 +// case *tg.MessageActionChangeCreator: // messageActionChangeCreator#e188503b +// case *tg.MessageActionNoForwardsToggle: // messageActionNoForwardsToggle#bf7d6572 +// case *tg.MessageActionNoForwardsRequest: // messageActionNoForwardsRequest#3e2793ba // default: panic(v) // } type MessageActionClass interface { @@ -13878,14 +15203,14 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionStarGiftTypeID: - // Decoding messageActionStarGift#db596550. + // Decoding messageActionStarGift#ea2c31d3. v := MessageActionStarGift{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) } return &v, nil case MessageActionStarGiftUniqueTypeID: - // Decoding messageActionStarGiftUnique#95728543. + // Decoding messageActionStarGiftUnique#e6c31522. v := MessageActionStarGiftUnique{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) @@ -13961,6 +15286,48 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) } return &v, nil + case MessageActionStarGiftPurchaseOfferTypeID: + // Decoding messageActionStarGiftPurchaseOffer#774278d4. + v := MessageActionStarGiftPurchaseOffer{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil + case MessageActionStarGiftPurchaseOfferDeclinedTypeID: + // Decoding messageActionStarGiftPurchaseOfferDeclined#73ada76b. + v := MessageActionStarGiftPurchaseOfferDeclined{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil + case MessageActionNewCreatorPendingTypeID: + // Decoding messageActionNewCreatorPending#b07ed085. + v := MessageActionNewCreatorPending{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil + case MessageActionChangeCreatorTypeID: + // Decoding messageActionChangeCreator#e188503b. + v := MessageActionChangeCreator{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil + case MessageActionNoForwardsToggleTypeID: + // Decoding messageActionNoForwardsToggle#bf7d6572. + v := MessageActionNoForwardsToggle{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil + case MessageActionNoForwardsRequestTypeID: + // Decoding messageActionNoForwardsRequest#3e2793ba. + v := MessageActionNoForwardsRequest{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode MessageActionClass: %w", bin.NewUnexpectedID(id)) } diff --git a/pkg/gotd/tg/tl_message_action_slices_gen.go b/pkg/gotd/tg/tl_message_action_slices_gen.go index f4e9fba6..a5586e4b 100644 --- a/pkg/gotd/tg/tl_message_action_slices_gen.go +++ b/pkg/gotd/tg/tl_message_action_slices_gen.go @@ -779,6 +779,84 @@ func (s MessageActionClassArray) AsMessageActionSuggestBirthday() (to MessageAct return to } +// AsMessageActionStarGiftPurchaseOffer returns copy with only MessageActionStarGiftPurchaseOffer constructors. +func (s MessageActionClassArray) AsMessageActionStarGiftPurchaseOffer() (to MessageActionStarGiftPurchaseOfferArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionStarGiftPurchaseOffer) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsMessageActionStarGiftPurchaseOfferDeclined returns copy with only MessageActionStarGiftPurchaseOfferDeclined constructors. +func (s MessageActionClassArray) AsMessageActionStarGiftPurchaseOfferDeclined() (to MessageActionStarGiftPurchaseOfferDeclinedArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionStarGiftPurchaseOfferDeclined) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsMessageActionNewCreatorPending returns copy with only MessageActionNewCreatorPending constructors. +func (s MessageActionClassArray) AsMessageActionNewCreatorPending() (to MessageActionNewCreatorPendingArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionNewCreatorPending) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsMessageActionChangeCreator returns copy with only MessageActionChangeCreator constructors. +func (s MessageActionClassArray) AsMessageActionChangeCreator() (to MessageActionChangeCreatorArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionChangeCreator) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsMessageActionNoForwardsToggle returns copy with only MessageActionNoForwardsToggle constructors. +func (s MessageActionClassArray) AsMessageActionNoForwardsToggle() (to MessageActionNoForwardsToggleArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionNoForwardsToggle) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsMessageActionNoForwardsRequest returns copy with only MessageActionNoForwardsRequest constructors. +func (s MessageActionClassArray) AsMessageActionNoForwardsRequest() (to MessageActionNoForwardsRequestArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionNoForwardsRequest) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // MessageActionChatCreateArray is adapter for slice of MessageActionChatCreate. type MessageActionChatCreateArray []MessageActionChatCreate @@ -4960,3 +5038,495 @@ func (s *MessageActionSuggestBirthdayArray) Pop() (v MessageActionSuggestBirthda return v, true } + +// MessageActionStarGiftPurchaseOfferArray is adapter for slice of MessageActionStarGiftPurchaseOffer. +type MessageActionStarGiftPurchaseOfferArray []MessageActionStarGiftPurchaseOffer + +// Sort sorts slice of MessageActionStarGiftPurchaseOffer. +func (s MessageActionStarGiftPurchaseOfferArray) Sort(less func(a, b MessageActionStarGiftPurchaseOffer) bool) MessageActionStarGiftPurchaseOfferArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionStarGiftPurchaseOffer. +func (s MessageActionStarGiftPurchaseOfferArray) SortStable(less func(a, b MessageActionStarGiftPurchaseOffer) bool) MessageActionStarGiftPurchaseOfferArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionStarGiftPurchaseOffer. +func (s MessageActionStarGiftPurchaseOfferArray) Retain(keep func(x MessageActionStarGiftPurchaseOffer) bool) MessageActionStarGiftPurchaseOfferArray { + 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 MessageActionStarGiftPurchaseOfferArray) First() (v MessageActionStarGiftPurchaseOffer, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionStarGiftPurchaseOfferArray) Last() (v MessageActionStarGiftPurchaseOffer, 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 *MessageActionStarGiftPurchaseOfferArray) PopFirst() (v MessageActionStarGiftPurchaseOffer, 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 MessageActionStarGiftPurchaseOffer + 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 *MessageActionStarGiftPurchaseOfferArray) Pop() (v MessageActionStarGiftPurchaseOffer, 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 +} + +// MessageActionStarGiftPurchaseOfferDeclinedArray is adapter for slice of MessageActionStarGiftPurchaseOfferDeclined. +type MessageActionStarGiftPurchaseOfferDeclinedArray []MessageActionStarGiftPurchaseOfferDeclined + +// Sort sorts slice of MessageActionStarGiftPurchaseOfferDeclined. +func (s MessageActionStarGiftPurchaseOfferDeclinedArray) Sort(less func(a, b MessageActionStarGiftPurchaseOfferDeclined) bool) MessageActionStarGiftPurchaseOfferDeclinedArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionStarGiftPurchaseOfferDeclined. +func (s MessageActionStarGiftPurchaseOfferDeclinedArray) SortStable(less func(a, b MessageActionStarGiftPurchaseOfferDeclined) bool) MessageActionStarGiftPurchaseOfferDeclinedArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionStarGiftPurchaseOfferDeclined. +func (s MessageActionStarGiftPurchaseOfferDeclinedArray) Retain(keep func(x MessageActionStarGiftPurchaseOfferDeclined) bool) MessageActionStarGiftPurchaseOfferDeclinedArray { + 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 MessageActionStarGiftPurchaseOfferDeclinedArray) First() (v MessageActionStarGiftPurchaseOfferDeclined, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionStarGiftPurchaseOfferDeclinedArray) Last() (v MessageActionStarGiftPurchaseOfferDeclined, 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 *MessageActionStarGiftPurchaseOfferDeclinedArray) PopFirst() (v MessageActionStarGiftPurchaseOfferDeclined, 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 MessageActionStarGiftPurchaseOfferDeclined + 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 *MessageActionStarGiftPurchaseOfferDeclinedArray) Pop() (v MessageActionStarGiftPurchaseOfferDeclined, 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 +} + +// MessageActionNewCreatorPendingArray is adapter for slice of MessageActionNewCreatorPending. +type MessageActionNewCreatorPendingArray []MessageActionNewCreatorPending + +// Sort sorts slice of MessageActionNewCreatorPending. +func (s MessageActionNewCreatorPendingArray) Sort(less func(a, b MessageActionNewCreatorPending) bool) MessageActionNewCreatorPendingArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionNewCreatorPending. +func (s MessageActionNewCreatorPendingArray) SortStable(less func(a, b MessageActionNewCreatorPending) bool) MessageActionNewCreatorPendingArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionNewCreatorPending. +func (s MessageActionNewCreatorPendingArray) Retain(keep func(x MessageActionNewCreatorPending) bool) MessageActionNewCreatorPendingArray { + 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 MessageActionNewCreatorPendingArray) First() (v MessageActionNewCreatorPending, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionNewCreatorPendingArray) Last() (v MessageActionNewCreatorPending, 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 *MessageActionNewCreatorPendingArray) PopFirst() (v MessageActionNewCreatorPending, 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 MessageActionNewCreatorPending + 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 *MessageActionNewCreatorPendingArray) Pop() (v MessageActionNewCreatorPending, 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 +} + +// MessageActionChangeCreatorArray is adapter for slice of MessageActionChangeCreator. +type MessageActionChangeCreatorArray []MessageActionChangeCreator + +// Sort sorts slice of MessageActionChangeCreator. +func (s MessageActionChangeCreatorArray) Sort(less func(a, b MessageActionChangeCreator) bool) MessageActionChangeCreatorArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionChangeCreator. +func (s MessageActionChangeCreatorArray) SortStable(less func(a, b MessageActionChangeCreator) bool) MessageActionChangeCreatorArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionChangeCreator. +func (s MessageActionChangeCreatorArray) Retain(keep func(x MessageActionChangeCreator) bool) MessageActionChangeCreatorArray { + 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 MessageActionChangeCreatorArray) First() (v MessageActionChangeCreator, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionChangeCreatorArray) Last() (v MessageActionChangeCreator, 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 *MessageActionChangeCreatorArray) PopFirst() (v MessageActionChangeCreator, 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 MessageActionChangeCreator + 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 *MessageActionChangeCreatorArray) Pop() (v MessageActionChangeCreator, 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 +} + +// MessageActionNoForwardsToggleArray is adapter for slice of MessageActionNoForwardsToggle. +type MessageActionNoForwardsToggleArray []MessageActionNoForwardsToggle + +// Sort sorts slice of MessageActionNoForwardsToggle. +func (s MessageActionNoForwardsToggleArray) Sort(less func(a, b MessageActionNoForwardsToggle) bool) MessageActionNoForwardsToggleArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionNoForwardsToggle. +func (s MessageActionNoForwardsToggleArray) SortStable(less func(a, b MessageActionNoForwardsToggle) bool) MessageActionNoForwardsToggleArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionNoForwardsToggle. +func (s MessageActionNoForwardsToggleArray) Retain(keep func(x MessageActionNoForwardsToggle) bool) MessageActionNoForwardsToggleArray { + 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 MessageActionNoForwardsToggleArray) First() (v MessageActionNoForwardsToggle, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionNoForwardsToggleArray) Last() (v MessageActionNoForwardsToggle, 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 *MessageActionNoForwardsToggleArray) PopFirst() (v MessageActionNoForwardsToggle, 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 MessageActionNoForwardsToggle + 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 *MessageActionNoForwardsToggleArray) Pop() (v MessageActionNoForwardsToggle, 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 +} + +// MessageActionNoForwardsRequestArray is adapter for slice of MessageActionNoForwardsRequest. +type MessageActionNoForwardsRequestArray []MessageActionNoForwardsRequest + +// Sort sorts slice of MessageActionNoForwardsRequest. +func (s MessageActionNoForwardsRequestArray) Sort(less func(a, b MessageActionNoForwardsRequest) bool) MessageActionNoForwardsRequestArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionNoForwardsRequest. +func (s MessageActionNoForwardsRequestArray) SortStable(less func(a, b MessageActionNoForwardsRequest) bool) MessageActionNoForwardsRequestArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionNoForwardsRequest. +func (s MessageActionNoForwardsRequestArray) Retain(keep func(x MessageActionNoForwardsRequest) bool) MessageActionNoForwardsRequestArray { + 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 MessageActionNoForwardsRequestArray) First() (v MessageActionNoForwardsRequest, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionNoForwardsRequestArray) Last() (v MessageActionNoForwardsRequest, 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 *MessageActionNoForwardsRequestArray) PopFirst() (v MessageActionNoForwardsRequest, 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 MessageActionNoForwardsRequest + 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 *MessageActionNoForwardsRequestArray) Pop() (v MessageActionNoForwardsRequest, 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/pkg/gotd/tg/tl_message_entity_gen.go b/pkg/gotd/tg/tl_message_entity_gen.go index 39e06d3f..1ba0888b 100644 --- a/pkg/gotd/tg/tl_message_entity_gen.go +++ b/pkg/gotd/tg/tl_message_entity_gen.go @@ -3801,6 +3801,422 @@ func (m *MessageEntityBlockquote) GetLength() (value int) { return m.Length } +// MessageEntityFormattedDate represents TL type `messageEntityFormattedDate#904ac7c7`. +// +// See https://core.telegram.org/constructor/messageEntityFormattedDate for reference. +type MessageEntityFormattedDate struct { + // Flags field of MessageEntityFormattedDate. + Flags bin.Fields + // Relative field of MessageEntityFormattedDate. + Relative bool + // ShortTime field of MessageEntityFormattedDate. + ShortTime bool + // LongTime field of MessageEntityFormattedDate. + LongTime bool + // ShortDate field of MessageEntityFormattedDate. + ShortDate bool + // LongDate field of MessageEntityFormattedDate. + LongDate bool + // DayOfWeek field of MessageEntityFormattedDate. + DayOfWeek bool + // Offset field of MessageEntityFormattedDate. + Offset int + // Length field of MessageEntityFormattedDate. + Length int + // Date field of MessageEntityFormattedDate. + Date int +} + +// MessageEntityFormattedDateTypeID is TL type id of MessageEntityFormattedDate. +const MessageEntityFormattedDateTypeID = 0x904ac7c7 + +// construct implements constructor of MessageEntityClass. +func (m MessageEntityFormattedDate) construct() MessageEntityClass { return &m } + +// Ensuring interfaces in compile-time for MessageEntityFormattedDate. +var ( + _ bin.Encoder = &MessageEntityFormattedDate{} + _ bin.Decoder = &MessageEntityFormattedDate{} + _ bin.BareEncoder = &MessageEntityFormattedDate{} + _ bin.BareDecoder = &MessageEntityFormattedDate{} + + _ MessageEntityClass = &MessageEntityFormattedDate{} +) + +func (m *MessageEntityFormattedDate) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.Relative == false) { + return false + } + if !(m.ShortTime == false) { + return false + } + if !(m.LongTime == false) { + return false + } + if !(m.ShortDate == false) { + return false + } + if !(m.LongDate == false) { + return false + } + if !(m.DayOfWeek == false) { + return false + } + if !(m.Offset == 0) { + return false + } + if !(m.Length == 0) { + return false + } + if !(m.Date == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageEntityFormattedDate) String() string { + if m == nil { + return "MessageEntityFormattedDate(nil)" + } + type Alias MessageEntityFormattedDate + return fmt.Sprintf("MessageEntityFormattedDate%+v", Alias(*m)) +} + +// FillFrom fills MessageEntityFormattedDate from given interface. +func (m *MessageEntityFormattedDate) FillFrom(from interface { + GetRelative() (value bool) + GetShortTime() (value bool) + GetLongTime() (value bool) + GetShortDate() (value bool) + GetLongDate() (value bool) + GetDayOfWeek() (value bool) + GetOffset() (value int) + GetLength() (value int) + GetDate() (value int) +}) { + m.Relative = from.GetRelative() + m.ShortTime = from.GetShortTime() + m.LongTime = from.GetLongTime() + m.ShortDate = from.GetShortDate() + m.LongDate = from.GetLongDate() + m.DayOfWeek = from.GetDayOfWeek() + m.Offset = from.GetOffset() + m.Length = from.GetLength() + m.Date = from.GetDate() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageEntityFormattedDate) TypeID() uint32 { + return MessageEntityFormattedDateTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageEntityFormattedDate) TypeName() string { + return "messageEntityFormattedDate" +} + +// TypeInfo returns info about TL type. +func (m *MessageEntityFormattedDate) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageEntityFormattedDate", + ID: MessageEntityFormattedDateTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Relative", + SchemaName: "relative", + Null: !m.Flags.Has(0), + }, + { + Name: "ShortTime", + SchemaName: "short_time", + Null: !m.Flags.Has(1), + }, + { + Name: "LongTime", + SchemaName: "long_time", + Null: !m.Flags.Has(2), + }, + { + Name: "ShortDate", + SchemaName: "short_date", + Null: !m.Flags.Has(3), + }, + { + Name: "LongDate", + SchemaName: "long_date", + Null: !m.Flags.Has(4), + }, + { + Name: "DayOfWeek", + SchemaName: "day_of_week", + Null: !m.Flags.Has(5), + }, + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Length", + SchemaName: "length", + }, + { + Name: "Date", + SchemaName: "date", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageEntityFormattedDate) SetFlags() { + if !(m.Relative == false) { + m.Flags.Set(0) + } + if !(m.ShortTime == false) { + m.Flags.Set(1) + } + if !(m.LongTime == false) { + m.Flags.Set(2) + } + if !(m.ShortDate == false) { + m.Flags.Set(3) + } + if !(m.LongDate == false) { + m.Flags.Set(4) + } + if !(m.DayOfWeek == false) { + m.Flags.Set(5) + } +} + +// Encode implements bin.Encoder. +func (m *MessageEntityFormattedDate) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageEntityFormattedDate#904ac7c7 as nil") + } + b.PutID(MessageEntityFormattedDateTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageEntityFormattedDate) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageEntityFormattedDate#904ac7c7 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageEntityFormattedDate#904ac7c7: field flags: %w", err) + } + b.PutInt(m.Offset) + b.PutInt(m.Length) + b.PutInt(m.Date) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageEntityFormattedDate) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageEntityFormattedDate#904ac7c7 to nil") + } + if err := b.ConsumeID(MessageEntityFormattedDateTypeID); err != nil { + return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageEntityFormattedDate) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageEntityFormattedDate#904ac7c7 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: field flags: %w", err) + } + } + m.Relative = m.Flags.Has(0) + m.ShortTime = m.Flags.Has(1) + m.LongTime = m.Flags.Has(2) + m.ShortDate = m.Flags.Has(3) + m.LongDate = m.Flags.Has(4) + m.DayOfWeek = m.Flags.Has(5) + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: field offset: %w", err) + } + m.Offset = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: field length: %w", err) + } + m.Length = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: field date: %w", err) + } + m.Date = value + } + return nil +} + +// SetRelative sets value of Relative conditional field. +func (m *MessageEntityFormattedDate) SetRelative(value bool) { + if value { + m.Flags.Set(0) + m.Relative = true + } else { + m.Flags.Unset(0) + m.Relative = false + } +} + +// GetRelative returns value of Relative conditional field. +func (m *MessageEntityFormattedDate) GetRelative() (value bool) { + if m == nil { + return + } + return m.Flags.Has(0) +} + +// SetShortTime sets value of ShortTime conditional field. +func (m *MessageEntityFormattedDate) SetShortTime(value bool) { + if value { + m.Flags.Set(1) + m.ShortTime = true + } else { + m.Flags.Unset(1) + m.ShortTime = false + } +} + +// GetShortTime returns value of ShortTime conditional field. +func (m *MessageEntityFormattedDate) GetShortTime() (value bool) { + if m == nil { + return + } + return m.Flags.Has(1) +} + +// SetLongTime sets value of LongTime conditional field. +func (m *MessageEntityFormattedDate) SetLongTime(value bool) { + if value { + m.Flags.Set(2) + m.LongTime = true + } else { + m.Flags.Unset(2) + m.LongTime = false + } +} + +// GetLongTime returns value of LongTime conditional field. +func (m *MessageEntityFormattedDate) GetLongTime() (value bool) { + if m == nil { + return + } + return m.Flags.Has(2) +} + +// SetShortDate sets value of ShortDate conditional field. +func (m *MessageEntityFormattedDate) SetShortDate(value bool) { + if value { + m.Flags.Set(3) + m.ShortDate = true + } else { + m.Flags.Unset(3) + m.ShortDate = false + } +} + +// GetShortDate returns value of ShortDate conditional field. +func (m *MessageEntityFormattedDate) GetShortDate() (value bool) { + if m == nil { + return + } + return m.Flags.Has(3) +} + +// SetLongDate sets value of LongDate conditional field. +func (m *MessageEntityFormattedDate) SetLongDate(value bool) { + if value { + m.Flags.Set(4) + m.LongDate = true + } else { + m.Flags.Unset(4) + m.LongDate = false + } +} + +// GetLongDate returns value of LongDate conditional field. +func (m *MessageEntityFormattedDate) GetLongDate() (value bool) { + if m == nil { + return + } + return m.Flags.Has(4) +} + +// SetDayOfWeek sets value of DayOfWeek conditional field. +func (m *MessageEntityFormattedDate) SetDayOfWeek(value bool) { + if value { + m.Flags.Set(5) + m.DayOfWeek = true + } else { + m.Flags.Unset(5) + m.DayOfWeek = false + } +} + +// GetDayOfWeek returns value of DayOfWeek conditional field. +func (m *MessageEntityFormattedDate) GetDayOfWeek() (value bool) { + if m == nil { + return + } + return m.Flags.Has(5) +} + +// GetOffset returns value of Offset field. +func (m *MessageEntityFormattedDate) GetOffset() (value int) { + if m == nil { + return + } + return m.Offset +} + +// GetLength returns value of Length field. +func (m *MessageEntityFormattedDate) GetLength() (value int) { + if m == nil { + return + } + return m.Length +} + +// GetDate returns value of Date field. +func (m *MessageEntityFormattedDate) GetDate() (value int) { + if m == nil { + return + } + return m.Date +} + // MessageEntityClassName is schema name of MessageEntityClass. const MessageEntityClassName = "MessageEntity" @@ -3836,6 +4252,7 @@ const MessageEntityClassName = "MessageEntity" // case *tg.MessageEntitySpoiler: // messageEntitySpoiler#32ca960f // case *tg.MessageEntityCustomEmoji: // messageEntityCustomEmoji#c8cf05f8 // case *tg.MessageEntityBlockquote: // messageEntityBlockquote#f1ccaaac +// case *tg.MessageEntityFormattedDate: // messageEntityFormattedDate#904ac7c7 // default: panic(v) // } type MessageEntityClass interface { @@ -4023,6 +4440,13 @@ func DecodeMessageEntity(buf *bin.Buffer) (MessageEntityClass, error) { return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", err) } return &v, nil + case MessageEntityFormattedDateTypeID: + // Decoding messageEntityFormattedDate#904ac7c7. + v := MessageEntityFormattedDate{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", bin.NewUnexpectedID(id)) } diff --git a/pkg/gotd/tg/tl_message_entity_slices_gen.go b/pkg/gotd/tg/tl_message_entity_slices_gen.go index e0be3a37..26bbc38e 100644 --- a/pkg/gotd/tg/tl_message_entity_slices_gen.go +++ b/pkg/gotd/tg/tl_message_entity_slices_gen.go @@ -389,6 +389,19 @@ func (s MessageEntityClassArray) AsMessageEntityBlockquote() (to MessageEntityBl return to } +// AsMessageEntityFormattedDate returns copy with only MessageEntityFormattedDate constructors. +func (s MessageEntityClassArray) AsMessageEntityFormattedDate() (to MessageEntityFormattedDateArray) { + for _, elem := range s { + value, ok := elem.(*MessageEntityFormattedDate) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // MessageEntityUnknownArray is adapter for slice of MessageEntityUnknown. type MessageEntityUnknownArray []MessageEntityUnknown @@ -2110,3 +2123,99 @@ func (s *MessageEntityBlockquoteArray) Pop() (v MessageEntityBlockquote, ok bool return v, true } + +// MessageEntityFormattedDateArray is adapter for slice of MessageEntityFormattedDate. +type MessageEntityFormattedDateArray []MessageEntityFormattedDate + +// Sort sorts slice of MessageEntityFormattedDate. +func (s MessageEntityFormattedDateArray) Sort(less func(a, b MessageEntityFormattedDate) bool) MessageEntityFormattedDateArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageEntityFormattedDate. +func (s MessageEntityFormattedDateArray) SortStable(less func(a, b MessageEntityFormattedDate) bool) MessageEntityFormattedDateArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageEntityFormattedDate. +func (s MessageEntityFormattedDateArray) Retain(keep func(x MessageEntityFormattedDate) bool) MessageEntityFormattedDateArray { + 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 MessageEntityFormattedDateArray) First() (v MessageEntityFormattedDate, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageEntityFormattedDateArray) Last() (v MessageEntityFormattedDate, 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 *MessageEntityFormattedDateArray) PopFirst() (v MessageEntityFormattedDate, 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 MessageEntityFormattedDate + 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 *MessageEntityFormattedDateArray) Pop() (v MessageEntityFormattedDate, 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 +} + +// SortByDate sorts slice of MessageEntityFormattedDate by Date. +func (s MessageEntityFormattedDateArray) SortByDate() MessageEntityFormattedDateArray { + return s.Sort(func(a, b MessageEntityFormattedDate) bool { + return a.GetDate() < b.GetDate() + }) +} + +// SortStableByDate sorts slice of MessageEntityFormattedDate by Date. +func (s MessageEntityFormattedDateArray) SortStableByDate() MessageEntityFormattedDateArray { + return s.SortStable(func(a, b MessageEntityFormattedDate) bool { + return a.GetDate() < b.GetDate() + }) +} diff --git a/pkg/gotd/tg/tl_message_gen.go b/pkg/gotd/tg/tl_message_gen.go index 6cd7e5ba..6414ff7c 100644 --- a/pkg/gotd/tg/tl_message_gen.go +++ b/pkg/gotd/tg/tl_message_gen.go @@ -240,7 +240,7 @@ func (m *MessageEmpty) GetPeerID() (value PeerClass, ok bool) { return m.PeerID, true } -// Message represents TL type `message#b92f76cf`. +// Message represents TL type `message#3ae56482`. // A message // // See https://core.telegram.org/constructor/message for reference. @@ -341,6 +341,10 @@ type Message struct { // // Use SetFromBoostsApplied and GetFromBoostsApplied helpers. FromBoostsApplied int + // FromRank field of Message. + // + // Use SetFromRank and GetFromRank helpers. + FromRank string // Peer ID, the chat where this message was sent PeerID PeerClass // Messages from a saved messages dialog »¹ will have peer=inputPeerSelf² and the @@ -490,10 +494,14 @@ type Message struct { // // Use SetScheduleRepeatPeriod and GetScheduleRepeatPeriod helpers. ScheduleRepeatPeriod int + // SummaryFromLanguage field of Message. + // + // Use SetSummaryFromLanguage and GetSummaryFromLanguage helpers. + SummaryFromLanguage string } // MessageTypeID is TL type id of Message. -const MessageTypeID = 0xb92f76cf +const MessageTypeID = 0x3ae56482 // construct implements constructor of MessageClass. func (m Message) construct() MessageClass { return &m } @@ -572,6 +580,9 @@ func (m *Message) Zero() bool { if !(m.FromBoostsApplied == 0) { return false } + if !(m.FromRank == "") { + return false + } if !(m.PeerID == nil) { return false } @@ -653,6 +664,9 @@ func (m *Message) Zero() bool { if !(m.ScheduleRepeatPeriod == 0) { return false } + if !(m.SummaryFromLanguage == "") { + return false + } return true } @@ -686,6 +700,7 @@ func (m *Message) FillFrom(from interface { GetID() (value int) GetFromID() (value PeerClass, ok bool) GetFromBoostsApplied() (value int, ok bool) + GetFromRank() (value string, ok bool) GetPeerID() (value PeerClass) GetSavedPeerID() (value PeerClass, ok bool) GetFwdFrom() (value MessageFwdHeader, ok bool) @@ -713,6 +728,7 @@ func (m *Message) FillFrom(from interface { GetPaidMessageStars() (value int64, ok bool) GetSuggestedPost() (value SuggestedPost, ok bool) GetScheduleRepeatPeriod() (value int, ok bool) + GetSummaryFromLanguage() (value string, ok bool) }) { m.Out = from.GetOut() m.Mentioned = from.GetMentioned() @@ -738,6 +754,10 @@ func (m *Message) FillFrom(from interface { m.FromBoostsApplied = val } + if val, ok := from.GetFromRank(); ok { + m.FromRank = val + } + m.PeerID = from.GetPeerID() if val, ok := from.GetSavedPeerID(); ok { m.SavedPeerID = val @@ -837,6 +857,10 @@ func (m *Message) FillFrom(from interface { m.ScheduleRepeatPeriod = val } + if val, ok := from.GetSummaryFromLanguage(); ok { + m.SummaryFromLanguage = val + } + } // TypeID returns type id in TL schema. @@ -951,6 +975,11 @@ func (m *Message) TypeInfo() tdp.Type { SchemaName: "from_boosts_applied", Null: !m.Flags.Has(29), }, + { + Name: "FromRank", + SchemaName: "from_rank", + Null: !m.Flags2.Has(12), + }, { Name: "PeerID", SchemaName: "peer_id", @@ -1083,6 +1112,11 @@ func (m *Message) TypeInfo() tdp.Type { SchemaName: "schedule_repeat_period", Null: !m.Flags2.Has(10), }, + { + Name: "SummaryFromLanguage", + SchemaName: "summary_from_language", + Null: !m.Flags2.Has(11), + }, } return typ } @@ -1140,6 +1174,9 @@ func (m *Message) SetFlags() { if !(m.FromBoostsApplied == 0) { m.Flags.Set(29) } + if !(m.FromRank == "") { + m.Flags2.Set(12) + } if !(m.SavedPeerID == nil) { m.Flags.Set(28) } @@ -1212,12 +1249,15 @@ func (m *Message) SetFlags() { if !(m.ScheduleRepeatPeriod == 0) { m.Flags2.Set(10) } + if !(m.SummaryFromLanguage == "") { + m.Flags2.Set(11) + } } // Encode implements bin.Encoder. func (m *Message) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#b92f76cf as nil") + return fmt.Errorf("can't encode message#3ae56482 as nil") } b.PutID(MessageTypeID) return m.EncodeBare(b) @@ -1226,44 +1266,47 @@ func (m *Message) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *Message) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#b92f76cf as nil") + return fmt.Errorf("can't encode message#3ae56482 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field flags: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field flags: %w", err) } if err := m.Flags2.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field flags2: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field flags2: %w", err) } b.PutInt(m.ID) if m.Flags.Has(8) { if m.FromID == nil { - return fmt.Errorf("unable to encode message#b92f76cf: field from_id is nil") + return fmt.Errorf("unable to encode message#3ae56482: field from_id is nil") } if err := m.FromID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field from_id: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field from_id: %w", err) } } if m.Flags.Has(29) { b.PutInt(m.FromBoostsApplied) } + if m.Flags2.Has(12) { + b.PutString(m.FromRank) + } if m.PeerID == nil { - return fmt.Errorf("unable to encode message#b92f76cf: field peer_id is nil") + return fmt.Errorf("unable to encode message#3ae56482: field peer_id is nil") } if err := m.PeerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field peer_id: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field peer_id: %w", err) } if m.Flags.Has(28) { if m.SavedPeerID == nil { - return fmt.Errorf("unable to encode message#b92f76cf: field saved_peer_id is nil") + return fmt.Errorf("unable to encode message#3ae56482: field saved_peer_id is nil") } if err := m.SavedPeerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field saved_peer_id: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field saved_peer_id: %w", err) } } if m.Flags.Has(2) { if err := m.FwdFrom.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field fwd_from: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field fwd_from: %w", err) } } if m.Flags.Has(11) { @@ -1274,38 +1317,38 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(3) { if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#b92f76cf: field reply_to is nil") + return fmt.Errorf("unable to encode message#3ae56482: field reply_to is nil") } if err := m.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field reply_to: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field reply_to: %w", err) } } b.PutInt(m.Date) b.PutString(m.Message) if m.Flags.Has(9) { if m.Media == nil { - return fmt.Errorf("unable to encode message#b92f76cf: field media is nil") + return fmt.Errorf("unable to encode message#3ae56482: field media is nil") } if err := m.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field media: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field media: %w", err) } } if m.Flags.Has(6) { if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#b92f76cf: field reply_markup is nil") + return fmt.Errorf("unable to encode message#3ae56482: field reply_markup is nil") } if err := m.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field reply_markup: %w", err) } } if m.Flags.Has(7) { b.PutVectorHeader(len(m.Entities)) for idx, v := range m.Entities { if v == nil { - return fmt.Errorf("unable to encode message#b92f76cf: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode message#3ae56482: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode message#3ae56482: field entities element with index %d: %w", idx, err) } } } @@ -1317,7 +1360,7 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(23) { if err := m.Replies.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field replies: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field replies: %w", err) } } if m.Flags.Has(15) { @@ -1331,14 +1374,14 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(20) { if err := m.Reactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field reactions: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field reactions: %w", err) } } if m.Flags.Has(22) { b.PutVectorHeader(len(m.RestrictionReason)) for idx, v := range m.RestrictionReason { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field restriction_reason element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode message#3ae56482: field restriction_reason element with index %d: %w", idx, err) } } } @@ -1353,7 +1396,7 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags2.Has(3) { if err := m.Factcheck.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field factcheck: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field factcheck: %w", err) } } if m.Flags2.Has(5) { @@ -1364,22 +1407,25 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags2.Has(7) { if err := m.SuggestedPost.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#b92f76cf: field suggested_post: %w", err) + return fmt.Errorf("unable to encode message#3ae56482: field suggested_post: %w", err) } } if m.Flags2.Has(10) { b.PutInt(m.ScheduleRepeatPeriod) } + if m.Flags2.Has(11) { + b.PutString(m.SummaryFromLanguage) + } return nil } // Decode implements bin.Decoder. func (m *Message) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#b92f76cf to nil") + return fmt.Errorf("can't decode message#3ae56482 to nil") } if err := b.ConsumeID(MessageTypeID); err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: %w", err) } return m.DecodeBare(b) } @@ -1387,11 +1433,11 @@ func (m *Message) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *Message) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#b92f76cf to nil") + return fmt.Errorf("can't decode message#3ae56482 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field flags: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field flags: %w", err) } } m.Out = m.Flags.Has(1) @@ -1407,7 +1453,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { m.InvertMedia = m.Flags.Has(27) { if err := m.Flags2.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field flags2: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field flags2: %w", err) } } m.Offline = m.Flags2.Has(1) @@ -1417,96 +1463,103 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field id: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field id: %w", err) } m.ID = value } if m.Flags.Has(8) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field from_id: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field from_id: %w", err) } m.FromID = value } if m.Flags.Has(29) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field from_boosts_applied: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field from_boosts_applied: %w", err) } m.FromBoostsApplied = value } + if m.Flags2.Has(12) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode message#3ae56482: field from_rank: %w", err) + } + m.FromRank = value + } { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field peer_id: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field peer_id: %w", err) } m.PeerID = value } if m.Flags.Has(28) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field saved_peer_id: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field saved_peer_id: %w", err) } m.SavedPeerID = value } if m.Flags.Has(2) { if err := m.FwdFrom.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field fwd_from: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field fwd_from: %w", err) } } if m.Flags.Has(11) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field via_bot_id: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field via_bot_id: %w", err) } m.ViaBotID = value } if m.Flags2.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field via_business_bot_id: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field via_business_bot_id: %w", err) } m.ViaBusinessBotID = value } if m.Flags.Has(3) { value, err := DecodeMessageReplyHeader(b) if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field reply_to: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field reply_to: %w", err) } m.ReplyTo = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field date: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field date: %w", err) } m.Date = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field message: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field message: %w", err) } m.Message = value } if m.Flags.Has(9) { value, err := DecodeMessageMedia(b) if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field media: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field media: %w", err) } m.Media = value } if m.Flags.Has(6) { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field reply_markup: %w", err) } m.ReplyMarkup = value } if m.Flags.Has(7) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field entities: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field entities: %w", err) } if headerLen > 0 { @@ -1515,7 +1568,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field entities: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field entities: %w", err) } m.Entities = append(m.Entities, value) } @@ -1523,52 +1576,52 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field views: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field views: %w", err) } m.Views = value } if m.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field forwards: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field forwards: %w", err) } m.Forwards = value } if m.Flags.Has(23) { if err := m.Replies.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field replies: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field replies: %w", err) } } if m.Flags.Has(15) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field edit_date: %w", err) } m.EditDate = value } if m.Flags.Has(16) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field post_author: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field post_author: %w", err) } m.PostAuthor = value } if m.Flags.Has(17) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field grouped_id: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field grouped_id: %w", err) } m.GroupedID = value } if m.Flags.Has(20) { if err := m.Reactions.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field reactions: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field reactions: %w", err) } } if m.Flags.Has(22) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field restriction_reason: %w", err) } if headerLen > 0 { @@ -1577,7 +1630,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value RestrictionReason if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field restriction_reason: %w", err) } m.RestrictionReason = append(m.RestrictionReason, value) } @@ -1585,55 +1638,62 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(25) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field ttl_period: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field ttl_period: %w", err) } m.TTLPeriod = value } if m.Flags.Has(30) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field quick_reply_shortcut_id: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field quick_reply_shortcut_id: %w", err) } m.QuickReplyShortcutID = value } if m.Flags2.Has(2) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field effect: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field effect: %w", err) } m.Effect = value } if m.Flags2.Has(3) { if err := m.Factcheck.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field factcheck: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field factcheck: %w", err) } } if m.Flags2.Has(5) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field report_delivery_until_date: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field report_delivery_until_date: %w", err) } m.ReportDeliveryUntilDate = value } if m.Flags2.Has(6) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field paid_message_stars: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field paid_message_stars: %w", err) } m.PaidMessageStars = value } if m.Flags2.Has(7) { if err := m.SuggestedPost.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field suggested_post: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field suggested_post: %w", err) } } if m.Flags2.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#b92f76cf: field schedule_repeat_period: %w", err) + return fmt.Errorf("unable to decode message#3ae56482: field schedule_repeat_period: %w", err) } m.ScheduleRepeatPeriod = value } + if m.Flags2.Has(11) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode message#3ae56482: field summary_from_language: %w", err) + } + m.SummaryFromLanguage = value + } return nil } @@ -1966,6 +2026,24 @@ func (m *Message) GetFromBoostsApplied() (value int, ok bool) { return m.FromBoostsApplied, true } +// SetFromRank sets value of FromRank conditional field. +func (m *Message) SetFromRank(value string) { + m.Flags2.Set(12) + m.FromRank = value +} + +// GetFromRank returns value of FromRank conditional field and +// boolean which is true if field was set. +func (m *Message) GetFromRank() (value string, ok bool) { + if m == nil { + return + } + if !m.Flags2.Has(12) { + return value, false + } + return m.FromRank, true +} + // GetPeerID returns value of PeerID field. func (m *Message) GetPeerID() (value PeerClass) { if m == nil { @@ -2422,6 +2500,24 @@ func (m *Message) GetScheduleRepeatPeriod() (value int, ok bool) { return m.ScheduleRepeatPeriod, true } +// SetSummaryFromLanguage sets value of SummaryFromLanguage conditional field. +func (m *Message) SetSummaryFromLanguage(value string) { + m.Flags2.Set(11) + m.SummaryFromLanguage = value +} + +// GetSummaryFromLanguage returns value of SummaryFromLanguage conditional field and +// boolean which is true if field was set. +func (m *Message) GetSummaryFromLanguage() (value string, ok bool) { + if m == nil { + return + } + if !m.Flags2.Has(11) { + return value, false + } + return m.SummaryFromLanguage, true +} + // MapEntities returns field Entities wrapped in MessageEntityClassArray helper. func (m *Message) MapEntities() (value MessageEntityClassArray, ok bool) { if !m.Flags.Has(7) { @@ -3204,7 +3300,7 @@ const MessageClassName = "Message" // } // switch v := g.(type) { // case *tg.MessageEmpty: // messageEmpty#90a6ca84 -// case *tg.Message: // message#b92f76cf +// case *tg.Message: // message#3ae56482 // case *tg.MessageService: // messageService#7a800e0a // default: panic(v) // } @@ -3363,7 +3459,7 @@ func DecodeMessage(buf *bin.Buffer) (MessageClass, error) { } return &v, nil case MessageTypeID: - // Decoding message#b92f76cf. + // Decoding message#3ae56482. v := Message{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageClass: %w", err) diff --git a/pkg/gotd/tg/tl_message_media_gen.go b/pkg/gotd/tg/tl_message_media_gen.go index 86a56770..8af3bbf6 100644 --- a/pkg/gotd/tg/tl_message_media_gen.go +++ b/pkg/gotd/tg/tl_message_media_gen.go @@ -3143,7 +3143,7 @@ func (m *MessageMediaPoll) GetResults() (value PollResults) { return m.Results } -// MessageMediaDice represents TL type `messageMediaDice#3f7ee58b`. +// MessageMediaDice represents TL type `messageMediaDice#8cbec07`. // Dice-based animated sticker¹ // // Links: @@ -3151,6 +3151,8 @@ func (m *MessageMediaPoll) GetResults() (value PollResults) { // // See https://core.telegram.org/constructor/messageMediaDice for reference. type MessageMediaDice struct { + // Flags field of MessageMediaDice. + Flags bin.Fields // Dice value¹ // // Links: @@ -3158,10 +3160,14 @@ type MessageMediaDice struct { Value int // The emoji, for now , and are supported Emoticon string + // GameOutcome field of MessageMediaDice. + // + // Use SetGameOutcome and GetGameOutcome helpers. + GameOutcome MessagesEmojiGameOutcome } // MessageMediaDiceTypeID is TL type id of MessageMediaDice. -const MessageMediaDiceTypeID = 0x3f7ee58b +const MessageMediaDiceTypeID = 0x8cbec07 // construct implements constructor of MessageMediaClass. func (m MessageMediaDice) construct() MessageMediaClass { return &m } @@ -3180,12 +3186,18 @@ func (m *MessageMediaDice) Zero() bool { if m == nil { return true } + if !(m.Flags.Zero()) { + return false + } if !(m.Value == 0) { return false } if !(m.Emoticon == "") { return false } + if !(m.GameOutcome.Zero()) { + return false + } return true } @@ -3203,9 +3215,14 @@ func (m *MessageMediaDice) String() string { func (m *MessageMediaDice) FillFrom(from interface { GetValue() (value int) GetEmoticon() (value string) + GetGameOutcome() (value MessagesEmojiGameOutcome, ok bool) }) { m.Value = from.GetValue() m.Emoticon = from.GetEmoticon() + if val, ok := from.GetGameOutcome(); ok { + m.GameOutcome = val + } + } // TypeID returns type id in TL schema. @@ -3239,14 +3256,26 @@ func (m *MessageMediaDice) TypeInfo() tdp.Type { Name: "Emoticon", SchemaName: "emoticon", }, + { + Name: "GameOutcome", + SchemaName: "game_outcome", + Null: !m.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (m *MessageMediaDice) SetFlags() { + if !(m.GameOutcome.Zero()) { + m.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (m *MessageMediaDice) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageMediaDice#3f7ee58b as nil") + return fmt.Errorf("can't encode messageMediaDice#8cbec07 as nil") } b.PutID(MessageMediaDiceTypeID) return m.EncodeBare(b) @@ -3255,20 +3284,29 @@ func (m *MessageMediaDice) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageMediaDice) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageMediaDice#3f7ee58b as nil") + return fmt.Errorf("can't encode messageMediaDice#8cbec07 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageMediaDice#8cbec07: field flags: %w", err) } b.PutInt(m.Value) b.PutString(m.Emoticon) + if m.Flags.Has(0) { + if err := m.GameOutcome.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageMediaDice#8cbec07: field game_outcome: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (m *MessageMediaDice) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageMediaDice#3f7ee58b to nil") + return fmt.Errorf("can't decode messageMediaDice#8cbec07 to nil") } if err := b.ConsumeID(MessageMediaDiceTypeID); err != nil { - return fmt.Errorf("unable to decode messageMediaDice#3f7ee58b: %w", err) + return fmt.Errorf("unable to decode messageMediaDice#8cbec07: %w", err) } return m.DecodeBare(b) } @@ -3276,22 +3314,32 @@ func (m *MessageMediaDice) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageMediaDice) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageMediaDice#3f7ee58b to nil") + return fmt.Errorf("can't decode messageMediaDice#8cbec07 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageMediaDice#8cbec07: field flags: %w", err) + } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaDice#3f7ee58b: field value: %w", err) + return fmt.Errorf("unable to decode messageMediaDice#8cbec07: field value: %w", err) } m.Value = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageMediaDice#3f7ee58b: field emoticon: %w", err) + return fmt.Errorf("unable to decode messageMediaDice#8cbec07: field emoticon: %w", err) } m.Emoticon = value } + if m.Flags.Has(0) { + if err := m.GameOutcome.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageMediaDice#8cbec07: field game_outcome: %w", err) + } + } return nil } @@ -3311,6 +3359,24 @@ func (m *MessageMediaDice) GetEmoticon() (value string) { return m.Emoticon } +// SetGameOutcome sets value of GameOutcome conditional field. +func (m *MessageMediaDice) SetGameOutcome(value MessagesEmojiGameOutcome) { + m.Flags.Set(0) + m.GameOutcome = value +} + +// GetGameOutcome returns value of GameOutcome conditional field and +// boolean which is true if field was set. +func (m *MessageMediaDice) GetGameOutcome() (value MessagesEmojiGameOutcome, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(0) { + return value, false + } + return m.GameOutcome, true +} + // MessageMediaStory represents TL type `messageMediaStory#68cb6283`. // Represents a forwarded story¹ or a story mention. // @@ -5331,7 +5397,7 @@ const MessageMediaClassName = "MessageMedia" // case *tg.MessageMediaInvoice: // messageMediaInvoice#f6a548d3 // case *tg.MessageMediaGeoLive: // messageMediaGeoLive#b940c666 // case *tg.MessageMediaPoll: // messageMediaPoll#4bd6e798 -// case *tg.MessageMediaDice: // messageMediaDice#3f7ee58b +// case *tg.MessageMediaDice: // messageMediaDice#8cbec07 // case *tg.MessageMediaStory: // messageMediaStory#68cb6283 // case *tg.MessageMediaGiveaway: // messageMediaGiveaway#aa073beb // case *tg.MessageMediaGiveawayResults: // messageMediaGiveawayResults#ceaa3ea1 @@ -5451,7 +5517,7 @@ func DecodeMessageMedia(buf *bin.Buffer) (MessageMediaClass, error) { } return &v, nil case MessageMediaDiceTypeID: - // Decoding messageMediaDice#3f7ee58b. + // Decoding messageMediaDice#8cbec07. v := MessageMediaDice{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", err) diff --git a/pkg/gotd/tg/tl_messages_accept_url_auth_gen.go b/pkg/gotd/tg/tl_messages_accept_url_auth_gen.go index 0d923263..d2dcbe11 100644 --- a/pkg/gotd/tg/tl_messages_accept_url_auth_gen.go +++ b/pkg/gotd/tg/tl_messages_accept_url_auth_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesAcceptURLAuthRequest represents TL type `messages.acceptUrlAuth#b12c7125`. +// MessagesAcceptURLAuthRequest represents TL type `messages.acceptUrlAuth#67a3f0de`. // Use this to accept a Seamless Telegram Login authorization request, for more info // click here »¹ // @@ -47,6 +47,8 @@ type MessagesAcceptURLAuthRequest struct { Flags bin.Fields // Set this flag to allow the bot to send messages to you (if requested) WriteAllowed bool + // SharePhoneNumber field of MessagesAcceptURLAuthRequest. + SharePhoneNumber bool // The location of the message // // Use SetPeer and GetPeer helpers. @@ -66,10 +68,14 @@ type MessagesAcceptURLAuthRequest struct { // // Use SetURL and GetURL helpers. URL string + // MatchCode field of MessagesAcceptURLAuthRequest. + // + // Use SetMatchCode and GetMatchCode helpers. + MatchCode string } // MessagesAcceptURLAuthRequestTypeID is TL type id of MessagesAcceptURLAuthRequest. -const MessagesAcceptURLAuthRequestTypeID = 0xb12c7125 +const MessagesAcceptURLAuthRequestTypeID = 0x67a3f0de // Ensuring interfaces in compile-time for MessagesAcceptURLAuthRequest. var ( @@ -89,6 +95,9 @@ func (a *MessagesAcceptURLAuthRequest) Zero() bool { if !(a.WriteAllowed == false) { return false } + if !(a.SharePhoneNumber == false) { + return false + } if !(a.Peer == nil) { return false } @@ -101,6 +110,9 @@ func (a *MessagesAcceptURLAuthRequest) Zero() bool { if !(a.URL == "") { return false } + if !(a.MatchCode == "") { + return false + } return true } @@ -117,12 +129,15 @@ func (a *MessagesAcceptURLAuthRequest) String() string { // FillFrom fills MessagesAcceptURLAuthRequest from given interface. func (a *MessagesAcceptURLAuthRequest) FillFrom(from interface { GetWriteAllowed() (value bool) + GetSharePhoneNumber() (value bool) GetPeer() (value InputPeerClass, ok bool) GetMsgID() (value int, ok bool) GetButtonID() (value int, ok bool) GetURL() (value string, ok bool) + GetMatchCode() (value string, ok bool) }) { a.WriteAllowed = from.GetWriteAllowed() + a.SharePhoneNumber = from.GetSharePhoneNumber() if val, ok := from.GetPeer(); ok { a.Peer = val } @@ -139,6 +154,10 @@ func (a *MessagesAcceptURLAuthRequest) FillFrom(from interface { a.URL = val } + if val, ok := from.GetMatchCode(); ok { + a.MatchCode = val + } + } // TypeID returns type id in TL schema. @@ -169,6 +188,11 @@ func (a *MessagesAcceptURLAuthRequest) TypeInfo() tdp.Type { SchemaName: "write_allowed", Null: !a.Flags.Has(0), }, + { + Name: "SharePhoneNumber", + SchemaName: "share_phone_number", + Null: !a.Flags.Has(3), + }, { Name: "Peer", SchemaName: "peer", @@ -189,6 +213,11 @@ func (a *MessagesAcceptURLAuthRequest) TypeInfo() tdp.Type { SchemaName: "url", Null: !a.Flags.Has(2), }, + { + Name: "MatchCode", + SchemaName: "match_code", + Null: !a.Flags.Has(4), + }, } return typ } @@ -198,6 +227,9 @@ func (a *MessagesAcceptURLAuthRequest) SetFlags() { if !(a.WriteAllowed == false) { a.Flags.Set(0) } + if !(a.SharePhoneNumber == false) { + a.Flags.Set(3) + } if !(a.Peer == nil) { a.Flags.Set(1) } @@ -210,12 +242,15 @@ func (a *MessagesAcceptURLAuthRequest) SetFlags() { if !(a.URL == "") { a.Flags.Set(2) } + if !(a.MatchCode == "") { + a.Flags.Set(4) + } } // Encode implements bin.Encoder. func (a *MessagesAcceptURLAuthRequest) Encode(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't encode messages.acceptUrlAuth#b12c7125 as nil") + return fmt.Errorf("can't encode messages.acceptUrlAuth#67a3f0de as nil") } b.PutID(MessagesAcceptURLAuthRequestTypeID) return a.EncodeBare(b) @@ -224,18 +259,18 @@ func (a *MessagesAcceptURLAuthRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (a *MessagesAcceptURLAuthRequest) EncodeBare(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't encode messages.acceptUrlAuth#b12c7125 as nil") + return fmt.Errorf("can't encode messages.acceptUrlAuth#67a3f0de as nil") } a.SetFlags() if err := a.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.acceptUrlAuth#b12c7125: field flags: %w", err) + return fmt.Errorf("unable to encode messages.acceptUrlAuth#67a3f0de: field flags: %w", err) } if a.Flags.Has(1) { if a.Peer == nil { - return fmt.Errorf("unable to encode messages.acceptUrlAuth#b12c7125: field peer is nil") + return fmt.Errorf("unable to encode messages.acceptUrlAuth#67a3f0de: field peer is nil") } if err := a.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.acceptUrlAuth#b12c7125: field peer: %w", err) + return fmt.Errorf("unable to encode messages.acceptUrlAuth#67a3f0de: field peer: %w", err) } } if a.Flags.Has(1) { @@ -247,16 +282,19 @@ func (a *MessagesAcceptURLAuthRequest) EncodeBare(b *bin.Buffer) error { if a.Flags.Has(2) { b.PutString(a.URL) } + if a.Flags.Has(4) { + b.PutString(a.MatchCode) + } return nil } // Decode implements bin.Decoder. func (a *MessagesAcceptURLAuthRequest) Decode(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't decode messages.acceptUrlAuth#b12c7125 to nil") + return fmt.Errorf("can't decode messages.acceptUrlAuth#67a3f0de to nil") } if err := b.ConsumeID(MessagesAcceptURLAuthRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: %w", err) } return a.DecodeBare(b) } @@ -264,42 +302,50 @@ func (a *MessagesAcceptURLAuthRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (a *MessagesAcceptURLAuthRequest) DecodeBare(b *bin.Buffer) error { if a == nil { - return fmt.Errorf("can't decode messages.acceptUrlAuth#b12c7125 to nil") + return fmt.Errorf("can't decode messages.acceptUrlAuth#67a3f0de to nil") } { if err := a.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field flags: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field flags: %w", err) } } a.WriteAllowed = a.Flags.Has(0) + a.SharePhoneNumber = a.Flags.Has(3) if a.Flags.Has(1) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field peer: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field peer: %w", err) } a.Peer = value } if a.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field msg_id: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field msg_id: %w", err) } a.MsgID = value } if a.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field button_id: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field button_id: %w", err) } a.ButtonID = value } if a.Flags.Has(2) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field url: %w", err) + return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field url: %w", err) } a.URL = value } + if a.Flags.Has(4) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field match_code: %w", err) + } + a.MatchCode = value + } return nil } @@ -322,6 +368,25 @@ func (a *MessagesAcceptURLAuthRequest) GetWriteAllowed() (value bool) { return a.Flags.Has(0) } +// SetSharePhoneNumber sets value of SharePhoneNumber conditional field. +func (a *MessagesAcceptURLAuthRequest) SetSharePhoneNumber(value bool) { + if value { + a.Flags.Set(3) + a.SharePhoneNumber = true + } else { + a.Flags.Unset(3) + a.SharePhoneNumber = false + } +} + +// GetSharePhoneNumber returns value of SharePhoneNumber conditional field. +func (a *MessagesAcceptURLAuthRequest) GetSharePhoneNumber() (value bool) { + if a == nil { + return + } + return a.Flags.Has(3) +} + // SetPeer sets value of Peer conditional field. func (a *MessagesAcceptURLAuthRequest) SetPeer(value InputPeerClass) { a.Flags.Set(1) @@ -394,7 +459,25 @@ func (a *MessagesAcceptURLAuthRequest) GetURL() (value string, ok bool) { return a.URL, true } -// MessagesAcceptURLAuth invokes method messages.acceptUrlAuth#b12c7125 returning error if any. +// SetMatchCode sets value of MatchCode conditional field. +func (a *MessagesAcceptURLAuthRequest) SetMatchCode(value string) { + a.Flags.Set(4) + a.MatchCode = value +} + +// GetMatchCode returns value of MatchCode conditional field and +// boolean which is true if field was set. +func (a *MessagesAcceptURLAuthRequest) GetMatchCode() (value string, ok bool) { + if a == nil { + return + } + if !a.Flags.Has(4) { + return value, false + } + return a.MatchCode, true +} + +// MessagesAcceptURLAuth invokes method messages.acceptUrlAuth#67a3f0de returning error if any. // Use this to accept a Seamless Telegram Login authorization request, for more info // click here »¹ // diff --git a/pkg/gotd/tg/tl_messages_check_url_auth_match_code_gen.go b/pkg/gotd/tg/tl_messages_check_url_auth_match_code_gen.go new file mode 100644 index 00000000..b57426ae --- /dev/null +++ b/pkg/gotd/tg/tl_messages_check_url_auth_match_code_gen.go @@ -0,0 +1,201 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesCheckURLAuthMatchCodeRequest represents TL type `messages.checkUrlAuthMatchCode#c9a47b0b`. +// +// See https://core.telegram.org/method/messages.checkUrlAuthMatchCode for reference. +type MessagesCheckURLAuthMatchCodeRequest struct { + // URL field of MessagesCheckURLAuthMatchCodeRequest. + URL string + // MatchCode field of MessagesCheckURLAuthMatchCodeRequest. + MatchCode string +} + +// MessagesCheckURLAuthMatchCodeRequestTypeID is TL type id of MessagesCheckURLAuthMatchCodeRequest. +const MessagesCheckURLAuthMatchCodeRequestTypeID = 0xc9a47b0b + +// Ensuring interfaces in compile-time for MessagesCheckURLAuthMatchCodeRequest. +var ( + _ bin.Encoder = &MessagesCheckURLAuthMatchCodeRequest{} + _ bin.Decoder = &MessagesCheckURLAuthMatchCodeRequest{} + _ bin.BareEncoder = &MessagesCheckURLAuthMatchCodeRequest{} + _ bin.BareDecoder = &MessagesCheckURLAuthMatchCodeRequest{} +) + +func (c *MessagesCheckURLAuthMatchCodeRequest) Zero() bool { + if c == nil { + return true + } + if !(c.URL == "") { + return false + } + if !(c.MatchCode == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *MessagesCheckURLAuthMatchCodeRequest) String() string { + if c == nil { + return "MessagesCheckURLAuthMatchCodeRequest(nil)" + } + type Alias MessagesCheckURLAuthMatchCodeRequest + return fmt.Sprintf("MessagesCheckURLAuthMatchCodeRequest%+v", Alias(*c)) +} + +// FillFrom fills MessagesCheckURLAuthMatchCodeRequest from given interface. +func (c *MessagesCheckURLAuthMatchCodeRequest) FillFrom(from interface { + GetURL() (value string) + GetMatchCode() (value string) +}) { + c.URL = from.GetURL() + c.MatchCode = from.GetMatchCode() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesCheckURLAuthMatchCodeRequest) TypeID() uint32 { + return MessagesCheckURLAuthMatchCodeRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesCheckURLAuthMatchCodeRequest) TypeName() string { + return "messages.checkUrlAuthMatchCode" +} + +// TypeInfo returns info about TL type. +func (c *MessagesCheckURLAuthMatchCodeRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.checkUrlAuthMatchCode", + ID: MessagesCheckURLAuthMatchCodeRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + { + Name: "MatchCode", + SchemaName: "match_code", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *MessagesCheckURLAuthMatchCodeRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode messages.checkUrlAuthMatchCode#c9a47b0b as nil") + } + b.PutID(MessagesCheckURLAuthMatchCodeRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *MessagesCheckURLAuthMatchCodeRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode messages.checkUrlAuthMatchCode#c9a47b0b as nil") + } + b.PutString(c.URL) + b.PutString(c.MatchCode) + return nil +} + +// Decode implements bin.Decoder. +func (c *MessagesCheckURLAuthMatchCodeRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode messages.checkUrlAuthMatchCode#c9a47b0b to nil") + } + if err := b.ConsumeID(MessagesCheckURLAuthMatchCodeRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.checkUrlAuthMatchCode#c9a47b0b: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *MessagesCheckURLAuthMatchCodeRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode messages.checkUrlAuthMatchCode#c9a47b0b to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.checkUrlAuthMatchCode#c9a47b0b: field url: %w", err) + } + c.URL = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.checkUrlAuthMatchCode#c9a47b0b: field match_code: %w", err) + } + c.MatchCode = value + } + return nil +} + +// GetURL returns value of URL field. +func (c *MessagesCheckURLAuthMatchCodeRequest) GetURL() (value string) { + if c == nil { + return + } + return c.URL +} + +// GetMatchCode returns value of MatchCode field. +func (c *MessagesCheckURLAuthMatchCodeRequest) GetMatchCode() (value string) { + if c == nil { + return + } + return c.MatchCode +} + +// MessagesCheckURLAuthMatchCode invokes method messages.checkUrlAuthMatchCode#c9a47b0b returning error if any. +// +// See https://core.telegram.org/method/messages.checkUrlAuthMatchCode for reference. +func (c *Client) MessagesCheckURLAuthMatchCode(ctx context.Context, request *MessagesCheckURLAuthMatchCodeRequest) (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/pkg/gotd/tg/tl_messages_check_url_auth_match_code_slices_gen.go b/pkg/gotd/tg/tl_messages_check_url_auth_match_code_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_check_url_auth_match_code_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_messages_decline_url_auth_gen.go b/pkg/gotd/tg/tl_messages_decline_url_auth_gen.go new file mode 100644 index 00000000..18c2d17b --- /dev/null +++ b/pkg/gotd/tg/tl_messages_decline_url_auth_gen.go @@ -0,0 +1,177 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesDeclineURLAuthRequest represents TL type `messages.declineUrlAuth#35436bbc`. +// +// See https://core.telegram.org/method/messages.declineUrlAuth for reference. +type MessagesDeclineURLAuthRequest struct { + // URL field of MessagesDeclineURLAuthRequest. + URL string +} + +// MessagesDeclineURLAuthRequestTypeID is TL type id of MessagesDeclineURLAuthRequest. +const MessagesDeclineURLAuthRequestTypeID = 0x35436bbc + +// Ensuring interfaces in compile-time for MessagesDeclineURLAuthRequest. +var ( + _ bin.Encoder = &MessagesDeclineURLAuthRequest{} + _ bin.Decoder = &MessagesDeclineURLAuthRequest{} + _ bin.BareEncoder = &MessagesDeclineURLAuthRequest{} + _ bin.BareDecoder = &MessagesDeclineURLAuthRequest{} +) + +func (d *MessagesDeclineURLAuthRequest) Zero() bool { + if d == nil { + return true + } + if !(d.URL == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (d *MessagesDeclineURLAuthRequest) String() string { + if d == nil { + return "MessagesDeclineURLAuthRequest(nil)" + } + type Alias MessagesDeclineURLAuthRequest + return fmt.Sprintf("MessagesDeclineURLAuthRequest%+v", Alias(*d)) +} + +// FillFrom fills MessagesDeclineURLAuthRequest from given interface. +func (d *MessagesDeclineURLAuthRequest) FillFrom(from interface { + GetURL() (value string) +}) { + d.URL = from.GetURL() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesDeclineURLAuthRequest) TypeID() uint32 { + return MessagesDeclineURLAuthRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesDeclineURLAuthRequest) TypeName() string { + return "messages.declineUrlAuth" +} + +// TypeInfo returns info about TL type. +func (d *MessagesDeclineURLAuthRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.declineUrlAuth", + ID: MessagesDeclineURLAuthRequestTypeID, + } + if d == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "URL", + SchemaName: "url", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (d *MessagesDeclineURLAuthRequest) Encode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode messages.declineUrlAuth#35436bbc as nil") + } + b.PutID(MessagesDeclineURLAuthRequestTypeID) + return d.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (d *MessagesDeclineURLAuthRequest) EncodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't encode messages.declineUrlAuth#35436bbc as nil") + } + b.PutString(d.URL) + return nil +} + +// Decode implements bin.Decoder. +func (d *MessagesDeclineURLAuthRequest) Decode(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode messages.declineUrlAuth#35436bbc to nil") + } + if err := b.ConsumeID(MessagesDeclineURLAuthRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.declineUrlAuth#35436bbc: %w", err) + } + return d.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (d *MessagesDeclineURLAuthRequest) DecodeBare(b *bin.Buffer) error { + if d == nil { + return fmt.Errorf("can't decode messages.declineUrlAuth#35436bbc to nil") + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.declineUrlAuth#35436bbc: field url: %w", err) + } + d.URL = value + } + return nil +} + +// GetURL returns value of URL field. +func (d *MessagesDeclineURLAuthRequest) GetURL() (value string) { + if d == nil { + return + } + return d.URL +} + +// MessagesDeclineURLAuth invokes method messages.declineUrlAuth#35436bbc returning error if any. +// +// See https://core.telegram.org/method/messages.declineUrlAuth for reference. +func (c *Client) MessagesDeclineURLAuth(ctx context.Context, url string) (bool, error) { + var result BoolBox + + request := &MessagesDeclineURLAuthRequest{ + URL: url, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/pkg/gotd/tg/tl_messages_decline_url_auth_slices_gen.go b/pkg/gotd/tg/tl_messages_decline_url_auth_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_decline_url_auth_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_messages_edit_chat_creator_gen.go b/pkg/gotd/tg/tl_messages_edit_chat_creator_gen.go new file mode 100644 index 00000000..1efe44ca --- /dev/null +++ b/pkg/gotd/tg/tl_messages_edit_chat_creator_gen.go @@ -0,0 +1,247 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesEditChatCreatorRequest represents TL type `messages.editChatCreator#f743b857`. +// +// See https://core.telegram.org/method/messages.editChatCreator for reference. +type MessagesEditChatCreatorRequest struct { + // Peer field of MessagesEditChatCreatorRequest. + Peer InputPeerClass + // UserID field of MessagesEditChatCreatorRequest. + UserID InputUserClass + // Password field of MessagesEditChatCreatorRequest. + Password InputCheckPasswordSRPClass +} + +// MessagesEditChatCreatorRequestTypeID is TL type id of MessagesEditChatCreatorRequest. +const MessagesEditChatCreatorRequestTypeID = 0xf743b857 + +// Ensuring interfaces in compile-time for MessagesEditChatCreatorRequest. +var ( + _ bin.Encoder = &MessagesEditChatCreatorRequest{} + _ bin.Decoder = &MessagesEditChatCreatorRequest{} + _ bin.BareEncoder = &MessagesEditChatCreatorRequest{} + _ bin.BareDecoder = &MessagesEditChatCreatorRequest{} +) + +func (e *MessagesEditChatCreatorRequest) Zero() bool { + if e == nil { + return true + } + if !(e.Peer == nil) { + return false + } + if !(e.UserID == nil) { + return false + } + if !(e.Password == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *MessagesEditChatCreatorRequest) String() string { + if e == nil { + return "MessagesEditChatCreatorRequest(nil)" + } + type Alias MessagesEditChatCreatorRequest + return fmt.Sprintf("MessagesEditChatCreatorRequest%+v", Alias(*e)) +} + +// FillFrom fills MessagesEditChatCreatorRequest from given interface. +func (e *MessagesEditChatCreatorRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetUserID() (value InputUserClass) + GetPassword() (value InputCheckPasswordSRPClass) +}) { + e.Peer = from.GetPeer() + e.UserID = from.GetUserID() + e.Password = from.GetPassword() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesEditChatCreatorRequest) TypeID() uint32 { + return MessagesEditChatCreatorRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesEditChatCreatorRequest) TypeName() string { + return "messages.editChatCreator" +} + +// TypeInfo returns info about TL type. +func (e *MessagesEditChatCreatorRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.editChatCreator", + ID: MessagesEditChatCreatorRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Password", + SchemaName: "password", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *MessagesEditChatCreatorRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.editChatCreator#f743b857 as nil") + } + b.PutID(MessagesEditChatCreatorRequestTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *MessagesEditChatCreatorRequest) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.editChatCreator#f743b857 as nil") + } + if e.Peer == nil { + return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field peer is nil") + } + if err := e.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field peer: %w", err) + } + if e.UserID == nil { + return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field user_id is nil") + } + if err := e.UserID.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field user_id: %w", err) + } + if e.Password == nil { + return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field password is nil") + } + if err := e.Password.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field password: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (e *MessagesEditChatCreatorRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.editChatCreator#f743b857 to nil") + } + if err := b.ConsumeID(MessagesEditChatCreatorRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *MessagesEditChatCreatorRequest) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.editChatCreator#f743b857 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: field peer: %w", err) + } + e.Peer = value + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: field user_id: %w", err) + } + e.UserID = value + } + { + value, err := DecodeInputCheckPasswordSRP(b) + if err != nil { + return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: field password: %w", err) + } + e.Password = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (e *MessagesEditChatCreatorRequest) GetPeer() (value InputPeerClass) { + if e == nil { + return + } + return e.Peer +} + +// GetUserID returns value of UserID field. +func (e *MessagesEditChatCreatorRequest) GetUserID() (value InputUserClass) { + if e == nil { + return + } + return e.UserID +} + +// GetPassword returns value of Password field. +func (e *MessagesEditChatCreatorRequest) GetPassword() (value InputCheckPasswordSRPClass) { + if e == nil { + return + } + return e.Password +} + +// GetPasswordAsNotEmpty returns mapped value of Password field. +func (e *MessagesEditChatCreatorRequest) GetPasswordAsNotEmpty() (*InputCheckPasswordSRP, bool) { + return e.Password.AsNotEmpty() +} + +// MessagesEditChatCreator invokes method messages.editChatCreator#f743b857 returning error if any. +// +// See https://core.telegram.org/method/messages.editChatCreator for reference. +func (c *Client) MessagesEditChatCreator(ctx context.Context, request *MessagesEditChatCreatorRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/pkg/gotd/tg/tl_messages_edit_chat_creator_slices_gen.go b/pkg/gotd/tg/tl_messages_edit_chat_creator_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_edit_chat_creator_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_messages_edit_chat_participant_rank_gen.go b/pkg/gotd/tg/tl_messages_edit_chat_participant_rank_gen.go new file mode 100644 index 00000000..694bd4ee --- /dev/null +++ b/pkg/gotd/tg/tl_messages_edit_chat_participant_rank_gen.go @@ -0,0 +1,237 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesEditChatParticipantRankRequest represents TL type `messages.editChatParticipantRank#a00f32b0`. +// +// See https://core.telegram.org/method/messages.editChatParticipantRank for reference. +type MessagesEditChatParticipantRankRequest struct { + // Peer field of MessagesEditChatParticipantRankRequest. + Peer InputPeerClass + // Participant field of MessagesEditChatParticipantRankRequest. + Participant InputPeerClass + // Rank field of MessagesEditChatParticipantRankRequest. + Rank string +} + +// MessagesEditChatParticipantRankRequestTypeID is TL type id of MessagesEditChatParticipantRankRequest. +const MessagesEditChatParticipantRankRequestTypeID = 0xa00f32b0 + +// Ensuring interfaces in compile-time for MessagesEditChatParticipantRankRequest. +var ( + _ bin.Encoder = &MessagesEditChatParticipantRankRequest{} + _ bin.Decoder = &MessagesEditChatParticipantRankRequest{} + _ bin.BareEncoder = &MessagesEditChatParticipantRankRequest{} + _ bin.BareDecoder = &MessagesEditChatParticipantRankRequest{} +) + +func (e *MessagesEditChatParticipantRankRequest) Zero() bool { + if e == nil { + return true + } + if !(e.Peer == nil) { + return false + } + if !(e.Participant == nil) { + return false + } + if !(e.Rank == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *MessagesEditChatParticipantRankRequest) String() string { + if e == nil { + return "MessagesEditChatParticipantRankRequest(nil)" + } + type Alias MessagesEditChatParticipantRankRequest + return fmt.Sprintf("MessagesEditChatParticipantRankRequest%+v", Alias(*e)) +} + +// FillFrom fills MessagesEditChatParticipantRankRequest from given interface. +func (e *MessagesEditChatParticipantRankRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetParticipant() (value InputPeerClass) + GetRank() (value string) +}) { + e.Peer = from.GetPeer() + e.Participant = from.GetParticipant() + e.Rank = from.GetRank() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesEditChatParticipantRankRequest) TypeID() uint32 { + return MessagesEditChatParticipantRankRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesEditChatParticipantRankRequest) TypeName() string { + return "messages.editChatParticipantRank" +} + +// TypeInfo returns info about TL type. +func (e *MessagesEditChatParticipantRankRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.editChatParticipantRank", + ID: MessagesEditChatParticipantRankRequestTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Participant", + SchemaName: "participant", + }, + { + Name: "Rank", + SchemaName: "rank", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *MessagesEditChatParticipantRankRequest) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.editChatParticipantRank#a00f32b0 as nil") + } + b.PutID(MessagesEditChatParticipantRankRequestTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *MessagesEditChatParticipantRankRequest) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.editChatParticipantRank#a00f32b0 as nil") + } + if e.Peer == nil { + return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field peer is nil") + } + if err := e.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field peer: %w", err) + } + if e.Participant == nil { + return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field participant is nil") + } + if err := e.Participant.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field participant: %w", err) + } + b.PutString(e.Rank) + return nil +} + +// Decode implements bin.Decoder. +func (e *MessagesEditChatParticipantRankRequest) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.editChatParticipantRank#a00f32b0 to nil") + } + if err := b.ConsumeID(MessagesEditChatParticipantRankRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *MessagesEditChatParticipantRankRequest) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.editChatParticipantRank#a00f32b0 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: field peer: %w", err) + } + e.Peer = value + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: field participant: %w", err) + } + e.Participant = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: field rank: %w", err) + } + e.Rank = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (e *MessagesEditChatParticipantRankRequest) GetPeer() (value InputPeerClass) { + if e == nil { + return + } + return e.Peer +} + +// GetParticipant returns value of Participant field. +func (e *MessagesEditChatParticipantRankRequest) GetParticipant() (value InputPeerClass) { + if e == nil { + return + } + return e.Participant +} + +// GetRank returns value of Rank field. +func (e *MessagesEditChatParticipantRankRequest) GetRank() (value string) { + if e == nil { + return + } + return e.Rank +} + +// MessagesEditChatParticipantRank invokes method messages.editChatParticipantRank#a00f32b0 returning error if any. +// +// See https://core.telegram.org/method/messages.editChatParticipantRank for reference. +func (c *Client) MessagesEditChatParticipantRank(ctx context.Context, request *MessagesEditChatParticipantRankRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/pkg/gotd/tg/tl_messages_edit_chat_participant_rank_slices_gen.go b/pkg/gotd/tg/tl_messages_edit_chat_participant_rank_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_edit_chat_participant_rank_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_messages_emoji_game_info_gen.go b/pkg/gotd/tg/tl_messages_emoji_game_info_gen.go new file mode 100644 index 00000000..fd7c326b --- /dev/null +++ b/pkg/gotd/tg/tl_messages_emoji_game_info_gen.go @@ -0,0 +1,529 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesEmojiGameUnavailable represents TL type `messages.emojiGameUnavailable#59e65335`. +// +// See https://core.telegram.org/constructor/messages.emojiGameUnavailable for reference. +type MessagesEmojiGameUnavailable struct { +} + +// MessagesEmojiGameUnavailableTypeID is TL type id of MessagesEmojiGameUnavailable. +const MessagesEmojiGameUnavailableTypeID = 0x59e65335 + +// construct implements constructor of MessagesEmojiGameInfoClass. +func (e MessagesEmojiGameUnavailable) construct() MessagesEmojiGameInfoClass { return &e } + +// Ensuring interfaces in compile-time for MessagesEmojiGameUnavailable. +var ( + _ bin.Encoder = &MessagesEmojiGameUnavailable{} + _ bin.Decoder = &MessagesEmojiGameUnavailable{} + _ bin.BareEncoder = &MessagesEmojiGameUnavailable{} + _ bin.BareDecoder = &MessagesEmojiGameUnavailable{} + + _ MessagesEmojiGameInfoClass = &MessagesEmojiGameUnavailable{} +) + +func (e *MessagesEmojiGameUnavailable) Zero() bool { + if e == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (e *MessagesEmojiGameUnavailable) String() string { + if e == nil { + return "MessagesEmojiGameUnavailable(nil)" + } + type Alias MessagesEmojiGameUnavailable + return fmt.Sprintf("MessagesEmojiGameUnavailable%+v", Alias(*e)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesEmojiGameUnavailable) TypeID() uint32 { + return MessagesEmojiGameUnavailableTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesEmojiGameUnavailable) TypeName() string { + return "messages.emojiGameUnavailable" +} + +// TypeInfo returns info about TL type. +func (e *MessagesEmojiGameUnavailable) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.emojiGameUnavailable", + ID: MessagesEmojiGameUnavailableTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (e *MessagesEmojiGameUnavailable) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.emojiGameUnavailable#59e65335 as nil") + } + b.PutID(MessagesEmojiGameUnavailableTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *MessagesEmojiGameUnavailable) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.emojiGameUnavailable#59e65335 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (e *MessagesEmojiGameUnavailable) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.emojiGameUnavailable#59e65335 to nil") + } + if err := b.ConsumeID(MessagesEmojiGameUnavailableTypeID); err != nil { + return fmt.Errorf("unable to decode messages.emojiGameUnavailable#59e65335: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *MessagesEmojiGameUnavailable) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.emojiGameUnavailable#59e65335 to nil") + } + return nil +} + +// MessagesEmojiGameDiceInfo represents TL type `messages.emojiGameDiceInfo#44e56023`. +// +// See https://core.telegram.org/constructor/messages.emojiGameDiceInfo for reference. +type MessagesEmojiGameDiceInfo struct { + // Flags field of MessagesEmojiGameDiceInfo. + Flags bin.Fields + // GameHash field of MessagesEmojiGameDiceInfo. + GameHash string + // PrevStake field of MessagesEmojiGameDiceInfo. + PrevStake int64 + // CurrentStreak field of MessagesEmojiGameDiceInfo. + CurrentStreak int + // Params field of MessagesEmojiGameDiceInfo. + Params []int + // PlaysLeft field of MessagesEmojiGameDiceInfo. + // + // Use SetPlaysLeft and GetPlaysLeft helpers. + PlaysLeft int +} + +// MessagesEmojiGameDiceInfoTypeID is TL type id of MessagesEmojiGameDiceInfo. +const MessagesEmojiGameDiceInfoTypeID = 0x44e56023 + +// construct implements constructor of MessagesEmojiGameInfoClass. +func (e MessagesEmojiGameDiceInfo) construct() MessagesEmojiGameInfoClass { return &e } + +// Ensuring interfaces in compile-time for MessagesEmojiGameDiceInfo. +var ( + _ bin.Encoder = &MessagesEmojiGameDiceInfo{} + _ bin.Decoder = &MessagesEmojiGameDiceInfo{} + _ bin.BareEncoder = &MessagesEmojiGameDiceInfo{} + _ bin.BareDecoder = &MessagesEmojiGameDiceInfo{} + + _ MessagesEmojiGameInfoClass = &MessagesEmojiGameDiceInfo{} +) + +func (e *MessagesEmojiGameDiceInfo) Zero() bool { + if e == nil { + return true + } + if !(e.Flags.Zero()) { + return false + } + if !(e.GameHash == "") { + return false + } + if !(e.PrevStake == 0) { + return false + } + if !(e.CurrentStreak == 0) { + return false + } + if !(e.Params == nil) { + return false + } + if !(e.PlaysLeft == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *MessagesEmojiGameDiceInfo) String() string { + if e == nil { + return "MessagesEmojiGameDiceInfo(nil)" + } + type Alias MessagesEmojiGameDiceInfo + return fmt.Sprintf("MessagesEmojiGameDiceInfo%+v", Alias(*e)) +} + +// FillFrom fills MessagesEmojiGameDiceInfo from given interface. +func (e *MessagesEmojiGameDiceInfo) FillFrom(from interface { + GetGameHash() (value string) + GetPrevStake() (value int64) + GetCurrentStreak() (value int) + GetParams() (value []int) + GetPlaysLeft() (value int, ok bool) +}) { + e.GameHash = from.GetGameHash() + e.PrevStake = from.GetPrevStake() + e.CurrentStreak = from.GetCurrentStreak() + e.Params = from.GetParams() + if val, ok := from.GetPlaysLeft(); ok { + e.PlaysLeft = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesEmojiGameDiceInfo) TypeID() uint32 { + return MessagesEmojiGameDiceInfoTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesEmojiGameDiceInfo) TypeName() string { + return "messages.emojiGameDiceInfo" +} + +// TypeInfo returns info about TL type. +func (e *MessagesEmojiGameDiceInfo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.emojiGameDiceInfo", + ID: MessagesEmojiGameDiceInfoTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GameHash", + SchemaName: "game_hash", + }, + { + Name: "PrevStake", + SchemaName: "prev_stake", + }, + { + Name: "CurrentStreak", + SchemaName: "current_streak", + }, + { + Name: "Params", + SchemaName: "params", + }, + { + Name: "PlaysLeft", + SchemaName: "plays_left", + Null: !e.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (e *MessagesEmojiGameDiceInfo) SetFlags() { + if !(e.PlaysLeft == 0) { + e.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (e *MessagesEmojiGameDiceInfo) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.emojiGameDiceInfo#44e56023 as nil") + } + b.PutID(MessagesEmojiGameDiceInfoTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *MessagesEmojiGameDiceInfo) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.emojiGameDiceInfo#44e56023 as nil") + } + e.SetFlags() + if err := e.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.emojiGameDiceInfo#44e56023: field flags: %w", err) + } + b.PutString(e.GameHash) + b.PutLong(e.PrevStake) + b.PutInt(e.CurrentStreak) + b.PutVectorHeader(len(e.Params)) + for _, v := range e.Params { + b.PutInt(v) + } + if e.Flags.Has(0) { + b.PutInt(e.PlaysLeft) + } + return nil +} + +// Decode implements bin.Decoder. +func (e *MessagesEmojiGameDiceInfo) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.emojiGameDiceInfo#44e56023 to nil") + } + if err := b.ConsumeID(MessagesEmojiGameDiceInfoTypeID); err != nil { + return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *MessagesEmojiGameDiceInfo) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.emojiGameDiceInfo#44e56023 to nil") + } + { + if err := e.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field flags: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field game_hash: %w", err) + } + e.GameHash = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field prev_stake: %w", err) + } + e.PrevStake = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field current_streak: %w", err) + } + e.CurrentStreak = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field params: %w", err) + } + + if headerLen > 0 { + e.Params = make([]int, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field params: %w", err) + } + e.Params = append(e.Params, value) + } + } + if e.Flags.Has(0) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field plays_left: %w", err) + } + e.PlaysLeft = value + } + return nil +} + +// GetGameHash returns value of GameHash field. +func (e *MessagesEmojiGameDiceInfo) GetGameHash() (value string) { + if e == nil { + return + } + return e.GameHash +} + +// GetPrevStake returns value of PrevStake field. +func (e *MessagesEmojiGameDiceInfo) GetPrevStake() (value int64) { + if e == nil { + return + } + return e.PrevStake +} + +// GetCurrentStreak returns value of CurrentStreak field. +func (e *MessagesEmojiGameDiceInfo) GetCurrentStreak() (value int) { + if e == nil { + return + } + return e.CurrentStreak +} + +// GetParams returns value of Params field. +func (e *MessagesEmojiGameDiceInfo) GetParams() (value []int) { + if e == nil { + return + } + return e.Params +} + +// SetPlaysLeft sets value of PlaysLeft conditional field. +func (e *MessagesEmojiGameDiceInfo) SetPlaysLeft(value int) { + e.Flags.Set(0) + e.PlaysLeft = value +} + +// GetPlaysLeft returns value of PlaysLeft conditional field and +// boolean which is true if field was set. +func (e *MessagesEmojiGameDiceInfo) GetPlaysLeft() (value int, ok bool) { + if e == nil { + return + } + if !e.Flags.Has(0) { + return value, false + } + return e.PlaysLeft, true +} + +// MessagesEmojiGameInfoClassName is schema name of MessagesEmojiGameInfoClass. +const MessagesEmojiGameInfoClassName = "messages.EmojiGameInfo" + +// MessagesEmojiGameInfoClass represents messages.EmojiGameInfo generic type. +// +// See https://core.telegram.org/type/messages.EmojiGameInfo for reference. +// +// Example: +// +// g, err := tg.DecodeMessagesEmojiGameInfo(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.MessagesEmojiGameUnavailable: // messages.emojiGameUnavailable#59e65335 +// case *tg.MessagesEmojiGameDiceInfo: // messages.emojiGameDiceInfo#44e56023 +// default: panic(v) +// } +type MessagesEmojiGameInfoClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() MessagesEmojiGameInfoClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + // AsAvailable tries to map MessagesEmojiGameInfoClass to MessagesEmojiGameDiceInfo. + AsAvailable() (*MessagesEmojiGameDiceInfo, bool) +} + +// AsAvailable tries to map MessagesEmojiGameUnavailable to MessagesEmojiGameDiceInfo. +func (e *MessagesEmojiGameUnavailable) AsAvailable() (*MessagesEmojiGameDiceInfo, bool) { + return nil, false +} + +// AsAvailable tries to map MessagesEmojiGameDiceInfo to MessagesEmojiGameDiceInfo. +func (e *MessagesEmojiGameDiceInfo) AsAvailable() (*MessagesEmojiGameDiceInfo, bool) { + return e, true +} + +// DecodeMessagesEmojiGameInfo implements binary de-serialization for MessagesEmojiGameInfoClass. +func DecodeMessagesEmojiGameInfo(buf *bin.Buffer) (MessagesEmojiGameInfoClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case MessagesEmojiGameUnavailableTypeID: + // Decoding messages.emojiGameUnavailable#59e65335. + v := MessagesEmojiGameUnavailable{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessagesEmojiGameInfoClass: %w", err) + } + return &v, nil + case MessagesEmojiGameDiceInfoTypeID: + // Decoding messages.emojiGameDiceInfo#44e56023. + v := MessagesEmojiGameDiceInfo{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessagesEmojiGameInfoClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode MessagesEmojiGameInfoClass: %w", bin.NewUnexpectedID(id)) + } +} + +// MessagesEmojiGameInfo boxes the MessagesEmojiGameInfoClass providing a helper. +type MessagesEmojiGameInfoBox struct { + EmojiGameInfo MessagesEmojiGameInfoClass +} + +// Decode implements bin.Decoder for MessagesEmojiGameInfoBox. +func (b *MessagesEmojiGameInfoBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode MessagesEmojiGameInfoBox to nil") + } + v, err := DecodeMessagesEmojiGameInfo(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.EmojiGameInfo = v + return nil +} + +// Encode implements bin.Encode for MessagesEmojiGameInfoBox. +func (b *MessagesEmojiGameInfoBox) Encode(buf *bin.Buffer) error { + if b == nil || b.EmojiGameInfo == nil { + return fmt.Errorf("unable to encode MessagesEmojiGameInfoClass as nil") + } + return b.EmojiGameInfo.Encode(buf) +} diff --git a/pkg/gotd/tg/tl_messages_emoji_game_info_slices_gen.go b/pkg/gotd/tg/tl_messages_emoji_game_info_slices_gen.go new file mode 100644 index 00000000..9f412c90 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_emoji_game_info_slices_gen.go @@ -0,0 +1,267 @@ +//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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesEmojiGameInfoClassArray is adapter for slice of MessagesEmojiGameInfoClass. +type MessagesEmojiGameInfoClassArray []MessagesEmojiGameInfoClass + +// Sort sorts slice of MessagesEmojiGameInfoClass. +func (s MessagesEmojiGameInfoClassArray) Sort(less func(a, b MessagesEmojiGameInfoClass) bool) MessagesEmojiGameInfoClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessagesEmojiGameInfoClass. +func (s MessagesEmojiGameInfoClassArray) SortStable(less func(a, b MessagesEmojiGameInfoClass) bool) MessagesEmojiGameInfoClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessagesEmojiGameInfoClass. +func (s MessagesEmojiGameInfoClassArray) Retain(keep func(x MessagesEmojiGameInfoClass) bool) MessagesEmojiGameInfoClassArray { + 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 MessagesEmojiGameInfoClassArray) First() (v MessagesEmojiGameInfoClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessagesEmojiGameInfoClassArray) Last() (v MessagesEmojiGameInfoClass, 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 *MessagesEmojiGameInfoClassArray) PopFirst() (v MessagesEmojiGameInfoClass, 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 MessagesEmojiGameInfoClass + 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 *MessagesEmojiGameInfoClassArray) Pop() (v MessagesEmojiGameInfoClass, 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 +} + +// AsMessagesEmojiGameDiceInfo returns copy with only MessagesEmojiGameDiceInfo constructors. +func (s MessagesEmojiGameInfoClassArray) AsMessagesEmojiGameDiceInfo() (to MessagesEmojiGameDiceInfoArray) { + for _, elem := range s { + value, ok := elem.(*MessagesEmojiGameDiceInfo) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AppendOnlyAvailable appends only Available constructors to +// given slice. +func (s MessagesEmojiGameInfoClassArray) AppendOnlyAvailable(to []*MessagesEmojiGameDiceInfo) []*MessagesEmojiGameDiceInfo { + for _, elem := range s { + value, ok := elem.AsAvailable() + if !ok { + continue + } + to = append(to, value) + } + + return to +} + +// AsAvailable returns copy with only Available constructors. +func (s MessagesEmojiGameInfoClassArray) AsAvailable() (to []*MessagesEmojiGameDiceInfo) { + return s.AppendOnlyAvailable(to) +} + +// FirstAsAvailable returns first element of slice (if exists). +func (s MessagesEmojiGameInfoClassArray) FirstAsAvailable() (v *MessagesEmojiGameDiceInfo, ok bool) { + value, ok := s.First() + if !ok { + return + } + return value.AsAvailable() +} + +// LastAsAvailable returns last element of slice (if exists). +func (s MessagesEmojiGameInfoClassArray) LastAsAvailable() (v *MessagesEmojiGameDiceInfo, ok bool) { + value, ok := s.Last() + if !ok { + return + } + return value.AsAvailable() +} + +// PopFirstAsAvailable returns element of slice (if exists). +func (s *MessagesEmojiGameInfoClassArray) PopFirstAsAvailable() (v *MessagesEmojiGameDiceInfo, ok bool) { + value, ok := s.PopFirst() + if !ok { + return + } + return value.AsAvailable() +} + +// PopAsAvailable returns element of slice (if exists). +func (s *MessagesEmojiGameInfoClassArray) PopAsAvailable() (v *MessagesEmojiGameDiceInfo, ok bool) { + value, ok := s.Pop() + if !ok { + return + } + return value.AsAvailable() +} + +// MessagesEmojiGameDiceInfoArray is adapter for slice of MessagesEmojiGameDiceInfo. +type MessagesEmojiGameDiceInfoArray []MessagesEmojiGameDiceInfo + +// Sort sorts slice of MessagesEmojiGameDiceInfo. +func (s MessagesEmojiGameDiceInfoArray) Sort(less func(a, b MessagesEmojiGameDiceInfo) bool) MessagesEmojiGameDiceInfoArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessagesEmojiGameDiceInfo. +func (s MessagesEmojiGameDiceInfoArray) SortStable(less func(a, b MessagesEmojiGameDiceInfo) bool) MessagesEmojiGameDiceInfoArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessagesEmojiGameDiceInfo. +func (s MessagesEmojiGameDiceInfoArray) Retain(keep func(x MessagesEmojiGameDiceInfo) bool) MessagesEmojiGameDiceInfoArray { + 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 MessagesEmojiGameDiceInfoArray) First() (v MessagesEmojiGameDiceInfo, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessagesEmojiGameDiceInfoArray) Last() (v MessagesEmojiGameDiceInfo, 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 *MessagesEmojiGameDiceInfoArray) PopFirst() (v MessagesEmojiGameDiceInfo, 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 MessagesEmojiGameDiceInfo + 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 *MessagesEmojiGameDiceInfoArray) Pop() (v MessagesEmojiGameDiceInfo, 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/pkg/gotd/tg/tl_messages_emoji_game_outcome_gen.go b/pkg/gotd/tg/tl_messages_emoji_game_outcome_gen.go new file mode 100644 index 00000000..e10c9fb1 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_emoji_game_outcome_gen.go @@ -0,0 +1,215 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesEmojiGameOutcome represents TL type `messages.emojiGameOutcome#da2ad647`. +// +// See https://core.telegram.org/constructor/messages.emojiGameOutcome for reference. +type MessagesEmojiGameOutcome struct { + // Seed field of MessagesEmojiGameOutcome. + Seed []byte + // StakeTonAmount field of MessagesEmojiGameOutcome. + StakeTonAmount int64 + // TonAmount field of MessagesEmojiGameOutcome. + TonAmount int64 +} + +// MessagesEmojiGameOutcomeTypeID is TL type id of MessagesEmojiGameOutcome. +const MessagesEmojiGameOutcomeTypeID = 0xda2ad647 + +// Ensuring interfaces in compile-time for MessagesEmojiGameOutcome. +var ( + _ bin.Encoder = &MessagesEmojiGameOutcome{} + _ bin.Decoder = &MessagesEmojiGameOutcome{} + _ bin.BareEncoder = &MessagesEmojiGameOutcome{} + _ bin.BareDecoder = &MessagesEmojiGameOutcome{} +) + +func (e *MessagesEmojiGameOutcome) Zero() bool { + if e == nil { + return true + } + if !(e.Seed == nil) { + return false + } + if !(e.StakeTonAmount == 0) { + return false + } + if !(e.TonAmount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (e *MessagesEmojiGameOutcome) String() string { + if e == nil { + return "MessagesEmojiGameOutcome(nil)" + } + type Alias MessagesEmojiGameOutcome + return fmt.Sprintf("MessagesEmojiGameOutcome%+v", Alias(*e)) +} + +// FillFrom fills MessagesEmojiGameOutcome from given interface. +func (e *MessagesEmojiGameOutcome) FillFrom(from interface { + GetSeed() (value []byte) + GetStakeTonAmount() (value int64) + GetTonAmount() (value int64) +}) { + e.Seed = from.GetSeed() + e.StakeTonAmount = from.GetStakeTonAmount() + e.TonAmount = from.GetTonAmount() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesEmojiGameOutcome) TypeID() uint32 { + return MessagesEmojiGameOutcomeTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesEmojiGameOutcome) TypeName() string { + return "messages.emojiGameOutcome" +} + +// TypeInfo returns info about TL type. +func (e *MessagesEmojiGameOutcome) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.emojiGameOutcome", + ID: MessagesEmojiGameOutcomeTypeID, + } + if e == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Seed", + SchemaName: "seed", + }, + { + Name: "StakeTonAmount", + SchemaName: "stake_ton_amount", + }, + { + Name: "TonAmount", + SchemaName: "ton_amount", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (e *MessagesEmojiGameOutcome) Encode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.emojiGameOutcome#da2ad647 as nil") + } + b.PutID(MessagesEmojiGameOutcomeTypeID) + return e.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (e *MessagesEmojiGameOutcome) EncodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't encode messages.emojiGameOutcome#da2ad647 as nil") + } + b.PutBytes(e.Seed) + b.PutLong(e.StakeTonAmount) + b.PutLong(e.TonAmount) + return nil +} + +// Decode implements bin.Decoder. +func (e *MessagesEmojiGameOutcome) Decode(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.emojiGameOutcome#da2ad647 to nil") + } + if err := b.ConsumeID(MessagesEmojiGameOutcomeTypeID); err != nil { + return fmt.Errorf("unable to decode messages.emojiGameOutcome#da2ad647: %w", err) + } + return e.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (e *MessagesEmojiGameOutcome) DecodeBare(b *bin.Buffer) error { + if e == nil { + return fmt.Errorf("can't decode messages.emojiGameOutcome#da2ad647 to nil") + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode messages.emojiGameOutcome#da2ad647: field seed: %w", err) + } + e.Seed = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.emojiGameOutcome#da2ad647: field stake_ton_amount: %w", err) + } + e.StakeTonAmount = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.emojiGameOutcome#da2ad647: field ton_amount: %w", err) + } + e.TonAmount = value + } + return nil +} + +// GetSeed returns value of Seed field. +func (e *MessagesEmojiGameOutcome) GetSeed() (value []byte) { + if e == nil { + return + } + return e.Seed +} + +// GetStakeTonAmount returns value of StakeTonAmount field. +func (e *MessagesEmojiGameOutcome) GetStakeTonAmount() (value int64) { + if e == nil { + return + } + return e.StakeTonAmount +} + +// GetTonAmount returns value of TonAmount field. +func (e *MessagesEmojiGameOutcome) GetTonAmount() (value int64) { + if e == nil { + return + } + return e.TonAmount +} diff --git a/pkg/gotd/tg/tl_messages_emoji_game_outcome_slices_gen.go b/pkg/gotd/tg/tl_messages_emoji_game_outcome_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_emoji_game_outcome_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_messages_forward_messages_gen.go b/pkg/gotd/tg/tl_messages_forward_messages_gen.go index 16137fa6..17e2a1af 100644 --- a/pkg/gotd/tg/tl_messages_forward_messages_gen.go +++ b/pkg/gotd/tg/tl_messages_forward_messages_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesForwardMessagesRequest represents TL type `messages.forwardMessages#41d41ade`. +// MessagesForwardMessagesRequest represents TL type `messages.forwardMessages#13704a7c`. // Forwards messages by their IDs. // // See https://core.telegram.org/method/messages.forwardMessages for reference. @@ -108,6 +108,10 @@ type MessagesForwardMessagesRequest struct { // // Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers. QuickReplyShortcut InputQuickReplyShortcutClass + // Effect field of MessagesForwardMessagesRequest. + // + // Use SetEffect and GetEffect helpers. + Effect int64 // Start playing the video at the specified timestamp (seconds). // // Use SetVideoTimestamp and GetVideoTimestamp helpers. @@ -131,7 +135,7 @@ type MessagesForwardMessagesRequest struct { } // MessagesForwardMessagesRequestTypeID is TL type id of MessagesForwardMessagesRequest. -const MessagesForwardMessagesRequestTypeID = 0x41d41ade +const MessagesForwardMessagesRequestTypeID = 0x13704a7c // Ensuring interfaces in compile-time for MessagesForwardMessagesRequest. var ( @@ -199,6 +203,9 @@ func (f *MessagesForwardMessagesRequest) Zero() bool { if !(f.QuickReplyShortcut == nil) { return false } + if !(f.Effect == 0) { + return false + } if !(f.VideoTimestamp == 0) { return false } @@ -240,6 +247,7 @@ func (f *MessagesForwardMessagesRequest) FillFrom(from interface { GetScheduleRepeatPeriod() (value int, ok bool) GetSendAs() (value InputPeerClass, ok bool) GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool) + GetEffect() (value int64, ok bool) GetVideoTimestamp() (value int, ok bool) GetAllowPaidStars() (value int64, ok bool) GetSuggestedPost() (value SuggestedPost, ok bool) @@ -279,6 +287,10 @@ func (f *MessagesForwardMessagesRequest) FillFrom(from interface { f.QuickReplyShortcut = val } + if val, ok := from.GetEffect(); ok { + f.Effect = val + } + if val, ok := from.GetVideoTimestamp(); ok { f.VideoTimestamp = val } @@ -397,6 +409,11 @@ func (f *MessagesForwardMessagesRequest) TypeInfo() tdp.Type { SchemaName: "quick_reply_shortcut", Null: !f.Flags.Has(17), }, + { + Name: "Effect", + SchemaName: "effect", + Null: !f.Flags.Has(18), + }, { Name: "VideoTimestamp", SchemaName: "video_timestamp", @@ -457,6 +474,9 @@ func (f *MessagesForwardMessagesRequest) SetFlags() { if !(f.QuickReplyShortcut == nil) { f.Flags.Set(17) } + if !(f.Effect == 0) { + f.Flags.Set(18) + } if !(f.VideoTimestamp == 0) { f.Flags.Set(20) } @@ -471,7 +491,7 @@ func (f *MessagesForwardMessagesRequest) SetFlags() { // Encode implements bin.Encoder. func (f *MessagesForwardMessagesRequest) Encode(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't encode messages.forwardMessages#41d41ade as nil") + return fmt.Errorf("can't encode messages.forwardMessages#13704a7c as nil") } b.PutID(MessagesForwardMessagesRequestTypeID) return f.EncodeBare(b) @@ -480,17 +500,17 @@ func (f *MessagesForwardMessagesRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't encode messages.forwardMessages#41d41ade as nil") + return fmt.Errorf("can't encode messages.forwardMessages#13704a7c as nil") } f.SetFlags() if err := f.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field flags: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field flags: %w", err) } if f.FromPeer == nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field from_peer is nil") + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field from_peer is nil") } if err := f.FromPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field from_peer: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field from_peer: %w", err) } b.PutVectorHeader(len(f.ID)) for _, v := range f.ID { @@ -501,20 +521,20 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { b.PutLong(v) } if f.ToPeer == nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field to_peer is nil") + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field to_peer is nil") } if err := f.ToPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field to_peer: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field to_peer: %w", err) } if f.Flags.Has(9) { b.PutInt(f.TopMsgID) } if f.Flags.Has(22) { if f.ReplyTo == nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field reply_to is nil") + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field reply_to is nil") } if err := f.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field reply_to: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field reply_to: %w", err) } } if f.Flags.Has(10) { @@ -525,20 +545,23 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { } if f.Flags.Has(13) { if f.SendAs == nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field send_as is nil") + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field send_as is nil") } if err := f.SendAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field send_as: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field send_as: %w", err) } } if f.Flags.Has(17) { if f.QuickReplyShortcut == nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field quick_reply_shortcut is nil") + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field quick_reply_shortcut is nil") } if err := f.QuickReplyShortcut.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field quick_reply_shortcut: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field quick_reply_shortcut: %w", err) } } + if f.Flags.Has(18) { + b.PutLong(f.Effect) + } if f.Flags.Has(20) { b.PutInt(f.VideoTimestamp) } @@ -547,7 +570,7 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { } if f.Flags.Has(23) { if err := f.SuggestedPost.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field suggested_post: %w", err) + return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field suggested_post: %w", err) } } return nil @@ -556,10 +579,10 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (f *MessagesForwardMessagesRequest) Decode(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't decode messages.forwardMessages#41d41ade to nil") + return fmt.Errorf("can't decode messages.forwardMessages#13704a7c to nil") } if err := b.ConsumeID(MessagesForwardMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: %w", err) } return f.DecodeBare(b) } @@ -567,11 +590,11 @@ func (f *MessagesForwardMessagesRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { if f == nil { - return fmt.Errorf("can't decode messages.forwardMessages#41d41ade to nil") + return fmt.Errorf("can't decode messages.forwardMessages#13704a7c to nil") } { if err := f.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field flags: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field flags: %w", err) } } f.Silent = f.Flags.Has(5) @@ -584,14 +607,14 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field from_peer: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field from_peer: %w", err) } f.FromPeer = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field id: %w", err) } if headerLen > 0 { @@ -600,7 +623,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field id: %w", err) } f.ID = append(f.ID, value) } @@ -608,7 +631,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field random_id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field random_id: %w", err) } if headerLen > 0 { @@ -617,7 +640,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field random_id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field random_id: %w", err) } f.RandomID = append(f.RandomID, value) } @@ -625,69 +648,76 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field to_peer: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field to_peer: %w", err) } f.ToPeer = value } if f.Flags.Has(9) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field top_msg_id: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field top_msg_id: %w", err) } f.TopMsgID = value } if f.Flags.Has(22) { value, err := DecodeInputReplyTo(b) if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field reply_to: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field reply_to: %w", err) } f.ReplyTo = value } if f.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field schedule_date: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field schedule_date: %w", err) } f.ScheduleDate = value } if f.Flags.Has(24) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field schedule_repeat_period: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field schedule_repeat_period: %w", err) } f.ScheduleRepeatPeriod = value } if f.Flags.Has(13) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field send_as: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field send_as: %w", err) } f.SendAs = value } if f.Flags.Has(17) { value, err := DecodeInputQuickReplyShortcut(b) if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field quick_reply_shortcut: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field quick_reply_shortcut: %w", err) } f.QuickReplyShortcut = value } + if f.Flags.Has(18) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field effect: %w", err) + } + f.Effect = value + } if f.Flags.Has(20) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field video_timestamp: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field video_timestamp: %w", err) } f.VideoTimestamp = value } if f.Flags.Has(21) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field allow_paid_stars: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field allow_paid_stars: %w", err) } f.AllowPaidStars = value } if f.Flags.Has(23) { if err := f.SuggestedPost.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field suggested_post: %w", err) + return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field suggested_post: %w", err) } } return nil @@ -966,6 +996,24 @@ func (f *MessagesForwardMessagesRequest) GetQuickReplyShortcut() (value InputQui return f.QuickReplyShortcut, true } +// SetEffect sets value of Effect conditional field. +func (f *MessagesForwardMessagesRequest) SetEffect(value int64) { + f.Flags.Set(18) + f.Effect = value +} + +// GetEffect returns value of Effect conditional field and +// boolean which is true if field was set. +func (f *MessagesForwardMessagesRequest) GetEffect() (value int64, ok bool) { + if f == nil { + return + } + if !f.Flags.Has(18) { + return value, false + } + return f.Effect, true +} + // SetVideoTimestamp sets value of VideoTimestamp conditional field. func (f *MessagesForwardMessagesRequest) SetVideoTimestamp(value int) { f.Flags.Set(20) @@ -1020,7 +1068,7 @@ func (f *MessagesForwardMessagesRequest) GetSuggestedPost() (value SuggestedPost return f.SuggestedPost, true } -// MessagesForwardMessages invokes method messages.forwardMessages#41d41ade returning error if any. +// MessagesForwardMessages invokes method messages.forwardMessages#13704a7c returning error if any. // Forwards messages by their IDs. // // Possible errors: diff --git a/pkg/gotd/tg/tl_messages_get_emoji_game_info_gen.go b/pkg/gotd/tg/tl_messages_get_emoji_game_info_gen.go new file mode 100644 index 00000000..7ffbc7f7 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_get_emoji_game_info_gen.go @@ -0,0 +1,141 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesGetEmojiGameInfoRequest represents TL type `messages.getEmojiGameInfo#fb7e8ca7`. +// +// See https://core.telegram.org/method/messages.getEmojiGameInfo for reference. +type MessagesGetEmojiGameInfoRequest struct { +} + +// MessagesGetEmojiGameInfoRequestTypeID is TL type id of MessagesGetEmojiGameInfoRequest. +const MessagesGetEmojiGameInfoRequestTypeID = 0xfb7e8ca7 + +// Ensuring interfaces in compile-time for MessagesGetEmojiGameInfoRequest. +var ( + _ bin.Encoder = &MessagesGetEmojiGameInfoRequest{} + _ bin.Decoder = &MessagesGetEmojiGameInfoRequest{} + _ bin.BareEncoder = &MessagesGetEmojiGameInfoRequest{} + _ bin.BareDecoder = &MessagesGetEmojiGameInfoRequest{} +) + +func (g *MessagesGetEmojiGameInfoRequest) Zero() bool { + if g == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (g *MessagesGetEmojiGameInfoRequest) String() string { + if g == nil { + return "MessagesGetEmojiGameInfoRequest(nil)" + } + type Alias MessagesGetEmojiGameInfoRequest + return fmt.Sprintf("MessagesGetEmojiGameInfoRequest%+v", Alias(*g)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesGetEmojiGameInfoRequest) TypeID() uint32 { + return MessagesGetEmojiGameInfoRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesGetEmojiGameInfoRequest) TypeName() string { + return "messages.getEmojiGameInfo" +} + +// TypeInfo returns info about TL type. +func (g *MessagesGetEmojiGameInfoRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.getEmojiGameInfo", + ID: MessagesGetEmojiGameInfoRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (g *MessagesGetEmojiGameInfoRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getEmojiGameInfo#fb7e8ca7 as nil") + } + b.PutID(MessagesGetEmojiGameInfoRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *MessagesGetEmojiGameInfoRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getEmojiGameInfo#fb7e8ca7 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (g *MessagesGetEmojiGameInfoRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getEmojiGameInfo#fb7e8ca7 to nil") + } + if err := b.ConsumeID(MessagesGetEmojiGameInfoRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.getEmojiGameInfo#fb7e8ca7: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *MessagesGetEmojiGameInfoRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getEmojiGameInfo#fb7e8ca7 to nil") + } + return nil +} + +// MessagesGetEmojiGameInfo invokes method messages.getEmojiGameInfo#fb7e8ca7 returning error if any. +// +// See https://core.telegram.org/method/messages.getEmojiGameInfo for reference. +func (c *Client) MessagesGetEmojiGameInfo(ctx context.Context) (MessagesEmojiGameInfoClass, error) { + var result MessagesEmojiGameInfoBox + + request := &MessagesGetEmojiGameInfoRequest{} + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.EmojiGameInfo, nil +} diff --git a/pkg/gotd/tg/tl_messages_get_emoji_game_info_slices_gen.go b/pkg/gotd/tg/tl_messages_get_emoji_game_info_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_get_emoji_game_info_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_messages_get_future_chat_creator_after_leave_gen.go b/pkg/gotd/tg/tl_messages_get_future_chat_creator_after_leave_gen.go new file mode 100644 index 00000000..9d7837ae --- /dev/null +++ b/pkg/gotd/tg/tl_messages_get_future_chat_creator_after_leave_gen.go @@ -0,0 +1,181 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesGetFutureChatCreatorAfterLeaveRequest represents TL type `messages.getFutureChatCreatorAfterLeave#3b7d0ea6`. +// +// See https://core.telegram.org/method/messages.getFutureChatCreatorAfterLeave for reference. +type MessagesGetFutureChatCreatorAfterLeaveRequest struct { + // Peer field of MessagesGetFutureChatCreatorAfterLeaveRequest. + Peer InputPeerClass +} + +// MessagesGetFutureChatCreatorAfterLeaveRequestTypeID is TL type id of MessagesGetFutureChatCreatorAfterLeaveRequest. +const MessagesGetFutureChatCreatorAfterLeaveRequestTypeID = 0x3b7d0ea6 + +// Ensuring interfaces in compile-time for MessagesGetFutureChatCreatorAfterLeaveRequest. +var ( + _ bin.Encoder = &MessagesGetFutureChatCreatorAfterLeaveRequest{} + _ bin.Decoder = &MessagesGetFutureChatCreatorAfterLeaveRequest{} + _ bin.BareEncoder = &MessagesGetFutureChatCreatorAfterLeaveRequest{} + _ bin.BareDecoder = &MessagesGetFutureChatCreatorAfterLeaveRequest{} +) + +func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Peer == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) String() string { + if g == nil { + return "MessagesGetFutureChatCreatorAfterLeaveRequest(nil)" + } + type Alias MessagesGetFutureChatCreatorAfterLeaveRequest + return fmt.Sprintf("MessagesGetFutureChatCreatorAfterLeaveRequest%+v", Alias(*g)) +} + +// FillFrom fills MessagesGetFutureChatCreatorAfterLeaveRequest from given interface. +func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) +}) { + g.Peer = from.GetPeer() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesGetFutureChatCreatorAfterLeaveRequest) TypeID() uint32 { + return MessagesGetFutureChatCreatorAfterLeaveRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesGetFutureChatCreatorAfterLeaveRequest) TypeName() string { + return "messages.getFutureChatCreatorAfterLeave" +} + +// TypeInfo returns info about TL type. +func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.getFutureChatCreatorAfterLeave", + ID: MessagesGetFutureChatCreatorAfterLeaveRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getFutureChatCreatorAfterLeave#3b7d0ea6 as nil") + } + b.PutID(MessagesGetFutureChatCreatorAfterLeaveRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getFutureChatCreatorAfterLeave#3b7d0ea6 as nil") + } + if g.Peer == nil { + return fmt.Errorf("unable to encode messages.getFutureChatCreatorAfterLeave#3b7d0ea6: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.getFutureChatCreatorAfterLeave#3b7d0ea6: field peer: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getFutureChatCreatorAfterLeave#3b7d0ea6 to nil") + } + if err := b.ConsumeID(MessagesGetFutureChatCreatorAfterLeaveRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.getFutureChatCreatorAfterLeave#3b7d0ea6: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getFutureChatCreatorAfterLeave#3b7d0ea6 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.getFutureChatCreatorAfterLeave#3b7d0ea6: field peer: %w", err) + } + g.Peer = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// MessagesGetFutureChatCreatorAfterLeave invokes method messages.getFutureChatCreatorAfterLeave#3b7d0ea6 returning error if any. +// +// See https://core.telegram.org/method/messages.getFutureChatCreatorAfterLeave for reference. +func (c *Client) MessagesGetFutureChatCreatorAfterLeave(ctx context.Context, peer InputPeerClass) (UserClass, error) { + var result UserBox + + request := &MessagesGetFutureChatCreatorAfterLeaveRequest{ + Peer: peer, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.User, nil +} diff --git a/pkg/gotd/tg/tl_messages_get_future_chat_creator_after_leave_slices_gen.go b/pkg/gotd/tg/tl_messages_get_future_chat_creator_after_leave_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_get_future_chat_creator_after_leave_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_messages_request_url_auth_gen.go b/pkg/gotd/tg/tl_messages_request_url_auth_gen.go index 83bf8810..fca0729d 100644 --- a/pkg/gotd/tg/tl_messages_request_url_auth_gen.go +++ b/pkg/gotd/tg/tl_messages_request_url_auth_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesRequestURLAuthRequest represents TL type `messages.requestUrlAuth#198fb446`. +// MessagesRequestURLAuthRequest represents TL type `messages.requestUrlAuth#894cc99c`. // Get more info about a Seamless Telegram Login authorization request, for more info // click here »¹ // @@ -64,10 +64,14 @@ type MessagesRequestURLAuthRequest struct { // // Use SetURL and GetURL helpers. URL string + // InAppOrigin field of MessagesRequestURLAuthRequest. + // + // Use SetInAppOrigin and GetInAppOrigin helpers. + InAppOrigin string } // MessagesRequestURLAuthRequestTypeID is TL type id of MessagesRequestURLAuthRequest. -const MessagesRequestURLAuthRequestTypeID = 0x198fb446 +const MessagesRequestURLAuthRequestTypeID = 0x894cc99c // Ensuring interfaces in compile-time for MessagesRequestURLAuthRequest. var ( @@ -96,6 +100,9 @@ func (r *MessagesRequestURLAuthRequest) Zero() bool { if !(r.URL == "") { return false } + if !(r.InAppOrigin == "") { + return false + } return true } @@ -115,6 +122,7 @@ func (r *MessagesRequestURLAuthRequest) FillFrom(from interface { GetMsgID() (value int, ok bool) GetButtonID() (value int, ok bool) GetURL() (value string, ok bool) + GetInAppOrigin() (value string, ok bool) }) { if val, ok := from.GetPeer(); ok { r.Peer = val @@ -132,6 +140,10 @@ func (r *MessagesRequestURLAuthRequest) FillFrom(from interface { r.URL = val } + if val, ok := from.GetInAppOrigin(); ok { + r.InAppOrigin = val + } + } // TypeID returns type id in TL schema. @@ -177,6 +189,11 @@ func (r *MessagesRequestURLAuthRequest) TypeInfo() tdp.Type { SchemaName: "url", Null: !r.Flags.Has(2), }, + { + Name: "InAppOrigin", + SchemaName: "in_app_origin", + Null: !r.Flags.Has(3), + }, } return typ } @@ -195,12 +212,15 @@ func (r *MessagesRequestURLAuthRequest) SetFlags() { if !(r.URL == "") { r.Flags.Set(2) } + if !(r.InAppOrigin == "") { + r.Flags.Set(3) + } } // Encode implements bin.Encoder. func (r *MessagesRequestURLAuthRequest) Encode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode messages.requestUrlAuth#198fb446 as nil") + return fmt.Errorf("can't encode messages.requestUrlAuth#894cc99c as nil") } b.PutID(MessagesRequestURLAuthRequestTypeID) return r.EncodeBare(b) @@ -209,18 +229,18 @@ func (r *MessagesRequestURLAuthRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (r *MessagesRequestURLAuthRequest) EncodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't encode messages.requestUrlAuth#198fb446 as nil") + return fmt.Errorf("can't encode messages.requestUrlAuth#894cc99c as nil") } r.SetFlags() if err := r.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestUrlAuth#198fb446: field flags: %w", err) + return fmt.Errorf("unable to encode messages.requestUrlAuth#894cc99c: field flags: %w", err) } if r.Flags.Has(1) { if r.Peer == nil { - return fmt.Errorf("unable to encode messages.requestUrlAuth#198fb446: field peer is nil") + return fmt.Errorf("unable to encode messages.requestUrlAuth#894cc99c: field peer is nil") } if err := r.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.requestUrlAuth#198fb446: field peer: %w", err) + return fmt.Errorf("unable to encode messages.requestUrlAuth#894cc99c: field peer: %w", err) } } if r.Flags.Has(1) { @@ -232,16 +252,19 @@ func (r *MessagesRequestURLAuthRequest) EncodeBare(b *bin.Buffer) error { if r.Flags.Has(2) { b.PutString(r.URL) } + if r.Flags.Has(3) { + b.PutString(r.InAppOrigin) + } return nil } // Decode implements bin.Decoder. func (r *MessagesRequestURLAuthRequest) Decode(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode messages.requestUrlAuth#198fb446 to nil") + return fmt.Errorf("can't decode messages.requestUrlAuth#894cc99c to nil") } if err := b.ConsumeID(MessagesRequestURLAuthRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: %w", err) } return r.DecodeBare(b) } @@ -249,41 +272,48 @@ func (r *MessagesRequestURLAuthRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (r *MessagesRequestURLAuthRequest) DecodeBare(b *bin.Buffer) error { if r == nil { - return fmt.Errorf("can't decode messages.requestUrlAuth#198fb446 to nil") + return fmt.Errorf("can't decode messages.requestUrlAuth#894cc99c to nil") } { if err := r.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field flags: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field flags: %w", err) } } if r.Flags.Has(1) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field peer: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field peer: %w", err) } r.Peer = value } if r.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field msg_id: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field msg_id: %w", err) } r.MsgID = value } if r.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field button_id: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field button_id: %w", err) } r.ButtonID = value } if r.Flags.Has(2) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field url: %w", err) + return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field url: %w", err) } r.URL = value } + if r.Flags.Has(3) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field in_app_origin: %w", err) + } + r.InAppOrigin = value + } return nil } @@ -359,7 +389,25 @@ func (r *MessagesRequestURLAuthRequest) GetURL() (value string, ok bool) { return r.URL, true } -// MessagesRequestURLAuth invokes method messages.requestUrlAuth#198fb446 returning error if any. +// SetInAppOrigin sets value of InAppOrigin conditional field. +func (r *MessagesRequestURLAuthRequest) SetInAppOrigin(value string) { + r.Flags.Set(3) + r.InAppOrigin = value +} + +// GetInAppOrigin returns value of InAppOrigin conditional field and +// boolean which is true if field was set. +func (r *MessagesRequestURLAuthRequest) GetInAppOrigin() (value string, ok bool) { + if r == nil { + return + } + if !r.Flags.Has(3) { + return value, false + } + return r.InAppOrigin, true +} + +// MessagesRequestURLAuth invokes method messages.requestUrlAuth#894cc99c returning error if any. // Get more info about a Seamless Telegram Login authorization request, for more info // click here »¹ // diff --git a/pkg/gotd/tg/tl_messages_summarize_text_gen.go b/pkg/gotd/tg/tl_messages_summarize_text_gen.go new file mode 100644 index 00000000..a491e78c --- /dev/null +++ b/pkg/gotd/tg/tl_messages_summarize_text_gen.go @@ -0,0 +1,271 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// MessagesSummarizeTextRequest represents TL type `messages.summarizeText#9d4104e2`. +// +// See https://core.telegram.org/method/messages.summarizeText for reference. +type MessagesSummarizeTextRequest struct { + // Flags field of MessagesSummarizeTextRequest. + Flags bin.Fields + // Peer field of MessagesSummarizeTextRequest. + Peer InputPeerClass + // ID field of MessagesSummarizeTextRequest. + ID int + // ToLang field of MessagesSummarizeTextRequest. + // + // Use SetToLang and GetToLang helpers. + ToLang string +} + +// MessagesSummarizeTextRequestTypeID is TL type id of MessagesSummarizeTextRequest. +const MessagesSummarizeTextRequestTypeID = 0x9d4104e2 + +// Ensuring interfaces in compile-time for MessagesSummarizeTextRequest. +var ( + _ bin.Encoder = &MessagesSummarizeTextRequest{} + _ bin.Decoder = &MessagesSummarizeTextRequest{} + _ bin.BareEncoder = &MessagesSummarizeTextRequest{} + _ bin.BareDecoder = &MessagesSummarizeTextRequest{} +) + +func (s *MessagesSummarizeTextRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Peer == nil) { + return false + } + if !(s.ID == 0) { + return false + } + if !(s.ToLang == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *MessagesSummarizeTextRequest) String() string { + if s == nil { + return "MessagesSummarizeTextRequest(nil)" + } + type Alias MessagesSummarizeTextRequest + return fmt.Sprintf("MessagesSummarizeTextRequest%+v", Alias(*s)) +} + +// FillFrom fills MessagesSummarizeTextRequest from given interface. +func (s *MessagesSummarizeTextRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetID() (value int) + GetToLang() (value string, ok bool) +}) { + s.Peer = from.GetPeer() + s.ID = from.GetID() + if val, ok := from.GetToLang(); ok { + s.ToLang = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesSummarizeTextRequest) TypeID() uint32 { + return MessagesSummarizeTextRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesSummarizeTextRequest) TypeName() string { + return "messages.summarizeText" +} + +// TypeInfo returns info about TL type. +func (s *MessagesSummarizeTextRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.summarizeText", + ID: MessagesSummarizeTextRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "ToLang", + SchemaName: "to_lang", + Null: !s.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *MessagesSummarizeTextRequest) SetFlags() { + if !(s.ToLang == "") { + s.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (s *MessagesSummarizeTextRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.summarizeText#9d4104e2 as nil") + } + b.PutID(MessagesSummarizeTextRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *MessagesSummarizeTextRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.summarizeText#9d4104e2 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.summarizeText#9d4104e2: field flags: %w", err) + } + if s.Peer == nil { + return fmt.Errorf("unable to encode messages.summarizeText#9d4104e2: field peer is nil") + } + if err := s.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.summarizeText#9d4104e2: field peer: %w", err) + } + b.PutInt(s.ID) + if s.Flags.Has(0) { + b.PutString(s.ToLang) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *MessagesSummarizeTextRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.summarizeText#9d4104e2 to nil") + } + if err := b.ConsumeID(MessagesSummarizeTextRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *MessagesSummarizeTextRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.summarizeText#9d4104e2 to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field flags: %w", err) + } + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field peer: %w", err) + } + s.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field id: %w", err) + } + s.ID = value + } + if s.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field to_lang: %w", err) + } + s.ToLang = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (s *MessagesSummarizeTextRequest) GetPeer() (value InputPeerClass) { + if s == nil { + return + } + return s.Peer +} + +// GetID returns value of ID field. +func (s *MessagesSummarizeTextRequest) GetID() (value int) { + if s == nil { + return + } + return s.ID +} + +// SetToLang sets value of ToLang conditional field. +func (s *MessagesSummarizeTextRequest) SetToLang(value string) { + s.Flags.Set(0) + s.ToLang = value +} + +// GetToLang returns value of ToLang conditional field and +// boolean which is true if field was set. +func (s *MessagesSummarizeTextRequest) GetToLang() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(0) { + return value, false + } + return s.ToLang, true +} + +// MessagesSummarizeText invokes method messages.summarizeText#9d4104e2 returning error if any. +// +// See https://core.telegram.org/method/messages.summarizeText for reference. +func (c *Client) MessagesSummarizeText(ctx context.Context, request *MessagesSummarizeTextRequest) (*TextWithEntities, error) { + var result TextWithEntities + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/pkg/gotd/tg/tl_messages_summarize_text_slices_gen.go b/pkg/gotd/tg/tl_messages_summarize_text_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_messages_summarize_text_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_messages_toggle_no_forwards_gen.go b/pkg/gotd/tg/tl_messages_toggle_no_forwards_gen.go index b61719bf..d76b2f8c 100644 --- a/pkg/gotd/tg/tl_messages_toggle_no_forwards_gen.go +++ b/pkg/gotd/tg/tl_messages_toggle_no_forwards_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesToggleNoForwardsRequest represents TL type `messages.toggleNoForwards#b11eafa2`. +// MessagesToggleNoForwardsRequest represents TL type `messages.toggleNoForwards#b2081a35`. // Enable or disable content protection¹ on a channel or chat // // Links: @@ -39,14 +39,20 @@ var ( // // See https://core.telegram.org/method/messages.toggleNoForwards for reference. type MessagesToggleNoForwardsRequest struct { + // Flags field of MessagesToggleNoForwardsRequest. + Flags bin.Fields // The chat or channel Peer InputPeerClass // Enable or disable content protection Enabled bool + // RequestMsgID field of MessagesToggleNoForwardsRequest. + // + // Use SetRequestMsgID and GetRequestMsgID helpers. + RequestMsgID int } // MessagesToggleNoForwardsRequestTypeID is TL type id of MessagesToggleNoForwardsRequest. -const MessagesToggleNoForwardsRequestTypeID = 0xb11eafa2 +const MessagesToggleNoForwardsRequestTypeID = 0xb2081a35 // Ensuring interfaces in compile-time for MessagesToggleNoForwardsRequest. var ( @@ -60,12 +66,18 @@ func (t *MessagesToggleNoForwardsRequest) Zero() bool { if t == nil { return true } + if !(t.Flags.Zero()) { + return false + } if !(t.Peer == nil) { return false } if !(t.Enabled == false) { return false } + if !(t.RequestMsgID == 0) { + return false + } return true } @@ -83,9 +95,14 @@ func (t *MessagesToggleNoForwardsRequest) String() string { func (t *MessagesToggleNoForwardsRequest) FillFrom(from interface { GetPeer() (value InputPeerClass) GetEnabled() (value bool) + GetRequestMsgID() (value int, ok bool) }) { t.Peer = from.GetPeer() t.Enabled = from.GetEnabled() + if val, ok := from.GetRequestMsgID(); ok { + t.RequestMsgID = val + } + } // TypeID returns type id in TL schema. @@ -119,14 +136,26 @@ func (t *MessagesToggleNoForwardsRequest) TypeInfo() tdp.Type { Name: "Enabled", SchemaName: "enabled", }, + { + Name: "RequestMsgID", + SchemaName: "request_msg_id", + Null: !t.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (t *MessagesToggleNoForwardsRequest) SetFlags() { + if !(t.RequestMsgID == 0) { + t.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (t *MessagesToggleNoForwardsRequest) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode messages.toggleNoForwards#b11eafa2 as nil") + return fmt.Errorf("can't encode messages.toggleNoForwards#b2081a35 as nil") } b.PutID(MessagesToggleNoForwardsRequestTypeID) return t.EncodeBare(b) @@ -135,25 +164,32 @@ func (t *MessagesToggleNoForwardsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (t *MessagesToggleNoForwardsRequest) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode messages.toggleNoForwards#b11eafa2 as nil") + return fmt.Errorf("can't encode messages.toggleNoForwards#b2081a35 as nil") + } + t.SetFlags() + if err := t.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.toggleNoForwards#b2081a35: field flags: %w", err) } if t.Peer == nil { - return fmt.Errorf("unable to encode messages.toggleNoForwards#b11eafa2: field peer is nil") + return fmt.Errorf("unable to encode messages.toggleNoForwards#b2081a35: field peer is nil") } if err := t.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.toggleNoForwards#b11eafa2: field peer: %w", err) + return fmt.Errorf("unable to encode messages.toggleNoForwards#b2081a35: field peer: %w", err) } b.PutBool(t.Enabled) + if t.Flags.Has(0) { + b.PutInt(t.RequestMsgID) + } return nil } // Decode implements bin.Decoder. func (t *MessagesToggleNoForwardsRequest) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode messages.toggleNoForwards#b11eafa2 to nil") + return fmt.Errorf("can't decode messages.toggleNoForwards#b2081a35 to nil") } if err := b.ConsumeID(MessagesToggleNoForwardsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.toggleNoForwards#b11eafa2: %w", err) + return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: %w", err) } return t.DecodeBare(b) } @@ -161,22 +197,34 @@ func (t *MessagesToggleNoForwardsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (t *MessagesToggleNoForwardsRequest) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode messages.toggleNoForwards#b11eafa2 to nil") + return fmt.Errorf("can't decode messages.toggleNoForwards#b2081a35 to nil") + } + { + if err := t.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: field flags: %w", err) + } } { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.toggleNoForwards#b11eafa2: field peer: %w", err) + return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: field peer: %w", err) } t.Peer = value } { value, err := b.Bool() if err != nil { - return fmt.Errorf("unable to decode messages.toggleNoForwards#b11eafa2: field enabled: %w", err) + return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: field enabled: %w", err) } t.Enabled = value } + if t.Flags.Has(0) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: field request_msg_id: %w", err) + } + t.RequestMsgID = value + } return nil } @@ -196,7 +244,25 @@ func (t *MessagesToggleNoForwardsRequest) GetEnabled() (value bool) { return t.Enabled } -// MessagesToggleNoForwards invokes method messages.toggleNoForwards#b11eafa2 returning error if any. +// SetRequestMsgID sets value of RequestMsgID conditional field. +func (t *MessagesToggleNoForwardsRequest) SetRequestMsgID(value int) { + t.Flags.Set(0) + t.RequestMsgID = value +} + +// GetRequestMsgID returns value of RequestMsgID conditional field and +// boolean which is true if field was set. +func (t *MessagesToggleNoForwardsRequest) GetRequestMsgID() (value int, ok bool) { + if t == nil { + return + } + if !t.Flags.Has(0) { + return value, false + } + return t.RequestMsgID, true +} + +// MessagesToggleNoForwards invokes method messages.toggleNoForwards#b2081a35 returning error if any. // Enable or disable content protection¹ on a channel or chat // // Links: diff --git a/pkg/gotd/tg/tl_passkey_gen.go b/pkg/gotd/tg/tl_passkey_gen.go new file mode 100644 index 00000000..86cb6a25 --- /dev/null +++ b/pkg/gotd/tg/tl_passkey_gen.go @@ -0,0 +1,329 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// Passkey represents TL type `passkey#98613ebf`. +// +// See https://core.telegram.org/constructor/passkey for reference. +type Passkey struct { + // Flags field of Passkey. + Flags bin.Fields + // ID field of Passkey. + ID string + // Name field of Passkey. + Name string + // Date field of Passkey. + Date int + // SoftwareEmojiID field of Passkey. + // + // Use SetSoftwareEmojiID and GetSoftwareEmojiID helpers. + SoftwareEmojiID int64 + // LastUsageDate field of Passkey. + // + // Use SetLastUsageDate and GetLastUsageDate helpers. + LastUsageDate int +} + +// PasskeyTypeID is TL type id of Passkey. +const PasskeyTypeID = 0x98613ebf + +// Ensuring interfaces in compile-time for Passkey. +var ( + _ bin.Encoder = &Passkey{} + _ bin.Decoder = &Passkey{} + _ bin.BareEncoder = &Passkey{} + _ bin.BareDecoder = &Passkey{} +) + +func (p *Passkey) Zero() bool { + if p == nil { + return true + } + if !(p.Flags.Zero()) { + return false + } + if !(p.ID == "") { + return false + } + if !(p.Name == "") { + return false + } + if !(p.Date == 0) { + return false + } + if !(p.SoftwareEmojiID == 0) { + return false + } + if !(p.LastUsageDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *Passkey) String() string { + if p == nil { + return "Passkey(nil)" + } + type Alias Passkey + return fmt.Sprintf("Passkey%+v", Alias(*p)) +} + +// FillFrom fills Passkey from given interface. +func (p *Passkey) FillFrom(from interface { + GetID() (value string) + GetName() (value string) + GetDate() (value int) + GetSoftwareEmojiID() (value int64, ok bool) + GetLastUsageDate() (value int, ok bool) +}) { + p.ID = from.GetID() + p.Name = from.GetName() + p.Date = from.GetDate() + if val, ok := from.GetSoftwareEmojiID(); ok { + p.SoftwareEmojiID = val + } + + if val, ok := from.GetLastUsageDate(); ok { + p.LastUsageDate = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*Passkey) TypeID() uint32 { + return PasskeyTypeID +} + +// TypeName returns name of type in TL schema. +func (*Passkey) TypeName() string { + return "passkey" +} + +// TypeInfo returns info about TL type. +func (p *Passkey) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "passkey", + ID: PasskeyTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "Name", + SchemaName: "name", + }, + { + Name: "Date", + SchemaName: "date", + }, + { + Name: "SoftwareEmojiID", + SchemaName: "software_emoji_id", + Null: !p.Flags.Has(0), + }, + { + Name: "LastUsageDate", + SchemaName: "last_usage_date", + Null: !p.Flags.Has(1), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (p *Passkey) SetFlags() { + if !(p.SoftwareEmojiID == 0) { + p.Flags.Set(0) + } + if !(p.LastUsageDate == 0) { + p.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (p *Passkey) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode passkey#98613ebf as nil") + } + b.PutID(PasskeyTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *Passkey) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode passkey#98613ebf as nil") + } + p.SetFlags() + if err := p.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode passkey#98613ebf: field flags: %w", err) + } + b.PutString(p.ID) + b.PutString(p.Name) + b.PutInt(p.Date) + if p.Flags.Has(0) { + b.PutLong(p.SoftwareEmojiID) + } + if p.Flags.Has(1) { + b.PutInt(p.LastUsageDate) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *Passkey) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode passkey#98613ebf to nil") + } + if err := b.ConsumeID(PasskeyTypeID); err != nil { + return fmt.Errorf("unable to decode passkey#98613ebf: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *Passkey) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode passkey#98613ebf to nil") + } + { + if err := p.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode passkey#98613ebf: field flags: %w", err) + } + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode passkey#98613ebf: field id: %w", err) + } + p.ID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode passkey#98613ebf: field name: %w", err) + } + p.Name = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode passkey#98613ebf: field date: %w", err) + } + p.Date = value + } + if p.Flags.Has(0) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode passkey#98613ebf: field software_emoji_id: %w", err) + } + p.SoftwareEmojiID = value + } + if p.Flags.Has(1) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode passkey#98613ebf: field last_usage_date: %w", err) + } + p.LastUsageDate = value + } + return nil +} + +// GetID returns value of ID field. +func (p *Passkey) GetID() (value string) { + if p == nil { + return + } + return p.ID +} + +// GetName returns value of Name field. +func (p *Passkey) GetName() (value string) { + if p == nil { + return + } + return p.Name +} + +// GetDate returns value of Date field. +func (p *Passkey) GetDate() (value int) { + if p == nil { + return + } + return p.Date +} + +// SetSoftwareEmojiID sets value of SoftwareEmojiID conditional field. +func (p *Passkey) SetSoftwareEmojiID(value int64) { + p.Flags.Set(0) + p.SoftwareEmojiID = value +} + +// GetSoftwareEmojiID returns value of SoftwareEmojiID conditional field and +// boolean which is true if field was set. +func (p *Passkey) GetSoftwareEmojiID() (value int64, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(0) { + return value, false + } + return p.SoftwareEmojiID, true +} + +// SetLastUsageDate sets value of LastUsageDate conditional field. +func (p *Passkey) SetLastUsageDate(value int) { + p.Flags.Set(1) + p.LastUsageDate = value +} + +// GetLastUsageDate returns value of LastUsageDate conditional field and +// boolean which is true if field was set. +func (p *Passkey) GetLastUsageDate() (value int, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(1) { + return value, false + } + return p.LastUsageDate, true +} diff --git a/pkg/gotd/tg/tl_passkey_slices_gen.go b/pkg/gotd/tg/tl_passkey_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_passkey_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_payments_craft_star_gift_gen.go b/pkg/gotd/tg/tl_payments_craft_star_gift_gen.go new file mode 100644 index 00000000..bee8bb42 --- /dev/null +++ b/pkg/gotd/tg/tl_payments_craft_star_gift_gen.go @@ -0,0 +1,199 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// PaymentsCraftStarGiftRequest represents TL type `payments.craftStarGift#b0f9684f`. +// +// See https://core.telegram.org/method/payments.craftStarGift for reference. +type PaymentsCraftStarGiftRequest struct { + // Stargift field of PaymentsCraftStarGiftRequest. + Stargift []InputSavedStarGiftClass +} + +// PaymentsCraftStarGiftRequestTypeID is TL type id of PaymentsCraftStarGiftRequest. +const PaymentsCraftStarGiftRequestTypeID = 0xb0f9684f + +// Ensuring interfaces in compile-time for PaymentsCraftStarGiftRequest. +var ( + _ bin.Encoder = &PaymentsCraftStarGiftRequest{} + _ bin.Decoder = &PaymentsCraftStarGiftRequest{} + _ bin.BareEncoder = &PaymentsCraftStarGiftRequest{} + _ bin.BareDecoder = &PaymentsCraftStarGiftRequest{} +) + +func (c *PaymentsCraftStarGiftRequest) Zero() bool { + if c == nil { + return true + } + if !(c.Stargift == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *PaymentsCraftStarGiftRequest) String() string { + if c == nil { + return "PaymentsCraftStarGiftRequest(nil)" + } + type Alias PaymentsCraftStarGiftRequest + return fmt.Sprintf("PaymentsCraftStarGiftRequest%+v", Alias(*c)) +} + +// FillFrom fills PaymentsCraftStarGiftRequest from given interface. +func (c *PaymentsCraftStarGiftRequest) FillFrom(from interface { + GetStargift() (value []InputSavedStarGiftClass) +}) { + c.Stargift = from.GetStargift() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsCraftStarGiftRequest) TypeID() uint32 { + return PaymentsCraftStarGiftRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsCraftStarGiftRequest) TypeName() string { + return "payments.craftStarGift" +} + +// TypeInfo returns info about TL type. +func (c *PaymentsCraftStarGiftRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.craftStarGift", + ID: PaymentsCraftStarGiftRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Stargift", + SchemaName: "stargift", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *PaymentsCraftStarGiftRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode payments.craftStarGift#b0f9684f as nil") + } + b.PutID(PaymentsCraftStarGiftRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *PaymentsCraftStarGiftRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode payments.craftStarGift#b0f9684f as nil") + } + b.PutVectorHeader(len(c.Stargift)) + for idx, v := range c.Stargift { + if v == nil { + return fmt.Errorf("unable to encode payments.craftStarGift#b0f9684f: field stargift element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.craftStarGift#b0f9684f: field stargift element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (c *PaymentsCraftStarGiftRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode payments.craftStarGift#b0f9684f to nil") + } + if err := b.ConsumeID(PaymentsCraftStarGiftRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.craftStarGift#b0f9684f: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *PaymentsCraftStarGiftRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode payments.craftStarGift#b0f9684f to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode payments.craftStarGift#b0f9684f: field stargift: %w", err) + } + + if headerLen > 0 { + c.Stargift = make([]InputSavedStarGiftClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInputSavedStarGift(b) + if err != nil { + return fmt.Errorf("unable to decode payments.craftStarGift#b0f9684f: field stargift: %w", err) + } + c.Stargift = append(c.Stargift, value) + } + } + return nil +} + +// GetStargift returns value of Stargift field. +func (c *PaymentsCraftStarGiftRequest) GetStargift() (value []InputSavedStarGiftClass) { + if c == nil { + return + } + return c.Stargift +} + +// MapStargift returns field Stargift wrapped in InputSavedStarGiftClassArray helper. +func (c *PaymentsCraftStarGiftRequest) MapStargift() (value InputSavedStarGiftClassArray) { + return InputSavedStarGiftClassArray(c.Stargift) +} + +// PaymentsCraftStarGift invokes method payments.craftStarGift#b0f9684f returning error if any. +// +// See https://core.telegram.org/method/payments.craftStarGift for reference. +func (c *Client) PaymentsCraftStarGift(ctx context.Context, stargift []InputSavedStarGiftClass) (UpdatesClass, error) { + var result UpdatesBox + + request := &PaymentsCraftStarGiftRequest{ + Stargift: stargift, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/pkg/gotd/tg/tl_payments_craft_star_gift_slices_gen.go b/pkg/gotd/tg/tl_payments_craft_star_gift_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_payments_craft_star_gift_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_payments_get_craft_star_gifts_gen.go b/pkg/gotd/tg/tl_payments_get_craft_star_gifts_gen.go new file mode 100644 index 00000000..9b6fcb0b --- /dev/null +++ b/pkg/gotd/tg/tl_payments_get_craft_star_gifts_gen.go @@ -0,0 +1,227 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// PaymentsGetCraftStarGiftsRequest represents TL type `payments.getCraftStarGifts#fd05dd00`. +// +// See https://core.telegram.org/method/payments.getCraftStarGifts for reference. +type PaymentsGetCraftStarGiftsRequest struct { + // GiftID field of PaymentsGetCraftStarGiftsRequest. + GiftID int64 + // Offset field of PaymentsGetCraftStarGiftsRequest. + Offset string + // Limit field of PaymentsGetCraftStarGiftsRequest. + Limit int +} + +// PaymentsGetCraftStarGiftsRequestTypeID is TL type id of PaymentsGetCraftStarGiftsRequest. +const PaymentsGetCraftStarGiftsRequestTypeID = 0xfd05dd00 + +// Ensuring interfaces in compile-time for PaymentsGetCraftStarGiftsRequest. +var ( + _ bin.Encoder = &PaymentsGetCraftStarGiftsRequest{} + _ bin.Decoder = &PaymentsGetCraftStarGiftsRequest{} + _ bin.BareEncoder = &PaymentsGetCraftStarGiftsRequest{} + _ bin.BareDecoder = &PaymentsGetCraftStarGiftsRequest{} +) + +func (g *PaymentsGetCraftStarGiftsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.GiftID == 0) { + return false + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PaymentsGetCraftStarGiftsRequest) String() string { + if g == nil { + return "PaymentsGetCraftStarGiftsRequest(nil)" + } + type Alias PaymentsGetCraftStarGiftsRequest + return fmt.Sprintf("PaymentsGetCraftStarGiftsRequest%+v", Alias(*g)) +} + +// FillFrom fills PaymentsGetCraftStarGiftsRequest from given interface. +func (g *PaymentsGetCraftStarGiftsRequest) FillFrom(from interface { + GetGiftID() (value int64) + GetOffset() (value string) + GetLimit() (value int) +}) { + g.GiftID = from.GetGiftID() + g.Offset = from.GetOffset() + g.Limit = from.GetLimit() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsGetCraftStarGiftsRequest) TypeID() uint32 { + return PaymentsGetCraftStarGiftsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsGetCraftStarGiftsRequest) TypeName() string { + return "payments.getCraftStarGifts" +} + +// TypeInfo returns info about TL type. +func (g *PaymentsGetCraftStarGiftsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.getCraftStarGifts", + ID: PaymentsGetCraftStarGiftsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GiftID", + SchemaName: "gift_id", + }, + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *PaymentsGetCraftStarGiftsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getCraftStarGifts#fd05dd00 as nil") + } + b.PutID(PaymentsGetCraftStarGiftsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PaymentsGetCraftStarGiftsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getCraftStarGifts#fd05dd00 as nil") + } + b.PutLong(g.GiftID) + b.PutString(g.Offset) + b.PutInt(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *PaymentsGetCraftStarGiftsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getCraftStarGifts#fd05dd00 to nil") + } + if err := b.ConsumeID(PaymentsGetCraftStarGiftsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PaymentsGetCraftStarGiftsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getCraftStarGifts#fd05dd00 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: field gift_id: %w", err) + } + g.GiftID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// GetGiftID returns value of GiftID field. +func (g *PaymentsGetCraftStarGiftsRequest) GetGiftID() (value int64) { + if g == nil { + return + } + return g.GiftID +} + +// GetOffset returns value of Offset field. +func (g *PaymentsGetCraftStarGiftsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// GetLimit returns value of Limit field. +func (g *PaymentsGetCraftStarGiftsRequest) GetLimit() (value int) { + if g == nil { + return + } + return g.Limit +} + +// PaymentsGetCraftStarGifts invokes method payments.getCraftStarGifts#fd05dd00 returning error if any. +// +// See https://core.telegram.org/method/payments.getCraftStarGifts for reference. +func (c *Client) PaymentsGetCraftStarGifts(ctx context.Context, request *PaymentsGetCraftStarGiftsRequest) (*PaymentsSavedStarGifts, error) { + var result PaymentsSavedStarGifts + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/pkg/gotd/tg/tl_payments_get_craft_star_gifts_slices_gen.go b/pkg/gotd/tg/tl_payments_get_craft_star_gifts_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_payments_get_craft_star_gifts_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_payments_get_resale_star_gifts_gen.go b/pkg/gotd/tg/tl_payments_get_resale_star_gifts_gen.go index 58f3a2d6..edf29050 100644 --- a/pkg/gotd/tg/tl_payments_get_resale_star_gifts_gen.go +++ b/pkg/gotd/tg/tl_payments_get_resale_star_gifts_gen.go @@ -54,6 +54,8 @@ type PaymentsGetResaleStarGiftsRequest struct { SortByPrice bool // Sort gifts by number (ascending). SortByNum bool + // ForCraft field of PaymentsGetResaleStarGiftsRequest. + ForCraft bool // If a previous call to the method was made and payments.resaleStarGifts¹ // attributes_hash was set, pass it here to avoid returning any results if they haven't // changed. Otherwise, set this flag and pass 0 to return payments.resaleStarGifts² @@ -112,6 +114,9 @@ func (g *PaymentsGetResaleStarGiftsRequest) Zero() bool { if !(g.SortByNum == false) { return false } + if !(g.ForCraft == false) { + return false + } if !(g.AttributesHash == 0) { return false } @@ -144,6 +149,7 @@ func (g *PaymentsGetResaleStarGiftsRequest) String() string { func (g *PaymentsGetResaleStarGiftsRequest) FillFrom(from interface { GetSortByPrice() (value bool) GetSortByNum() (value bool) + GetForCraft() (value bool) GetAttributesHash() (value int64, ok bool) GetGiftID() (value int64) GetAttributes() (value []StarGiftAttributeIDClass, ok bool) @@ -152,6 +158,7 @@ func (g *PaymentsGetResaleStarGiftsRequest) FillFrom(from interface { }) { g.SortByPrice = from.GetSortByPrice() g.SortByNum = from.GetSortByNum() + g.ForCraft = from.GetForCraft() if val, ok := from.GetAttributesHash(); ok { g.AttributesHash = val } @@ -198,6 +205,11 @@ func (g *PaymentsGetResaleStarGiftsRequest) TypeInfo() tdp.Type { SchemaName: "sort_by_num", Null: !g.Flags.Has(2), }, + { + Name: "ForCraft", + SchemaName: "for_craft", + Null: !g.Flags.Has(4), + }, { Name: "AttributesHash", SchemaName: "attributes_hash", @@ -232,6 +244,9 @@ func (g *PaymentsGetResaleStarGiftsRequest) SetFlags() { if !(g.SortByNum == false) { g.Flags.Set(2) } + if !(g.ForCraft == false) { + g.Flags.Set(4) + } if !(g.AttributesHash == 0) { g.Flags.Set(0) } @@ -301,6 +316,7 @@ func (g *PaymentsGetResaleStarGiftsRequest) DecodeBare(b *bin.Buffer) error { } g.SortByPrice = g.Flags.Has(1) g.SortByNum = g.Flags.Has(2) + g.ForCraft = g.Flags.Has(4) if g.Flags.Has(0) { value, err := b.Long() if err != nil { @@ -387,6 +403,25 @@ func (g *PaymentsGetResaleStarGiftsRequest) GetSortByNum() (value bool) { return g.Flags.Has(2) } +// SetForCraft sets value of ForCraft conditional field. +func (g *PaymentsGetResaleStarGiftsRequest) SetForCraft(value bool) { + if value { + g.Flags.Set(4) + g.ForCraft = true + } else { + g.Flags.Unset(4) + g.ForCraft = false + } +} + +// GetForCraft returns value of ForCraft conditional field. +func (g *PaymentsGetResaleStarGiftsRequest) GetForCraft() (value bool) { + if g == nil { + return + } + return g.Flags.Has(4) +} + // SetAttributesHash sets value of AttributesHash conditional field. func (g *PaymentsGetResaleStarGiftsRequest) SetAttributesHash(value int64) { g.Flags.Set(0) diff --git a/pkg/gotd/tg/tl_payments_get_star_gift_upgrade_attributes_gen.go b/pkg/gotd/tg/tl_payments_get_star_gift_upgrade_attributes_gen.go new file mode 100644 index 00000000..b3db811f --- /dev/null +++ b/pkg/gotd/tg/tl_payments_get_star_gift_upgrade_attributes_gen.go @@ -0,0 +1,176 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// PaymentsGetStarGiftUpgradeAttributesRequest represents TL type `payments.getStarGiftUpgradeAttributes#6d038b58`. +// +// See https://core.telegram.org/method/payments.getStarGiftUpgradeAttributes for reference. +type PaymentsGetStarGiftUpgradeAttributesRequest struct { + // GiftID field of PaymentsGetStarGiftUpgradeAttributesRequest. + GiftID int64 +} + +// PaymentsGetStarGiftUpgradeAttributesRequestTypeID is TL type id of PaymentsGetStarGiftUpgradeAttributesRequest. +const PaymentsGetStarGiftUpgradeAttributesRequestTypeID = 0x6d038b58 + +// Ensuring interfaces in compile-time for PaymentsGetStarGiftUpgradeAttributesRequest. +var ( + _ bin.Encoder = &PaymentsGetStarGiftUpgradeAttributesRequest{} + _ bin.Decoder = &PaymentsGetStarGiftUpgradeAttributesRequest{} + _ bin.BareEncoder = &PaymentsGetStarGiftUpgradeAttributesRequest{} + _ bin.BareDecoder = &PaymentsGetStarGiftUpgradeAttributesRequest{} +) + +func (g *PaymentsGetStarGiftUpgradeAttributesRequest) Zero() bool { + if g == nil { + return true + } + if !(g.GiftID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PaymentsGetStarGiftUpgradeAttributesRequest) String() string { + if g == nil { + return "PaymentsGetStarGiftUpgradeAttributesRequest(nil)" + } + type Alias PaymentsGetStarGiftUpgradeAttributesRequest + return fmt.Sprintf("PaymentsGetStarGiftUpgradeAttributesRequest%+v", Alias(*g)) +} + +// FillFrom fills PaymentsGetStarGiftUpgradeAttributesRequest from given interface. +func (g *PaymentsGetStarGiftUpgradeAttributesRequest) FillFrom(from interface { + GetGiftID() (value int64) +}) { + g.GiftID = from.GetGiftID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsGetStarGiftUpgradeAttributesRequest) TypeID() uint32 { + return PaymentsGetStarGiftUpgradeAttributesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsGetStarGiftUpgradeAttributesRequest) TypeName() string { + return "payments.getStarGiftUpgradeAttributes" +} + +// TypeInfo returns info about TL type. +func (g *PaymentsGetStarGiftUpgradeAttributesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.getStarGiftUpgradeAttributes", + ID: PaymentsGetStarGiftUpgradeAttributesRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "GiftID", + SchemaName: "gift_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *PaymentsGetStarGiftUpgradeAttributesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarGiftUpgradeAttributes#6d038b58 as nil") + } + b.PutID(PaymentsGetStarGiftUpgradeAttributesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PaymentsGetStarGiftUpgradeAttributesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode payments.getStarGiftUpgradeAttributes#6d038b58 as nil") + } + b.PutLong(g.GiftID) + return nil +} + +// Decode implements bin.Decoder. +func (g *PaymentsGetStarGiftUpgradeAttributesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarGiftUpgradeAttributes#6d038b58 to nil") + } + if err := b.ConsumeID(PaymentsGetStarGiftUpgradeAttributesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.getStarGiftUpgradeAttributes#6d038b58: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PaymentsGetStarGiftUpgradeAttributesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode payments.getStarGiftUpgradeAttributes#6d038b58 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode payments.getStarGiftUpgradeAttributes#6d038b58: field gift_id: %w", err) + } + g.GiftID = value + } + return nil +} + +// GetGiftID returns value of GiftID field. +func (g *PaymentsGetStarGiftUpgradeAttributesRequest) GetGiftID() (value int64) { + if g == nil { + return + } + return g.GiftID +} + +// PaymentsGetStarGiftUpgradeAttributes invokes method payments.getStarGiftUpgradeAttributes#6d038b58 returning error if any. +// +// See https://core.telegram.org/method/payments.getStarGiftUpgradeAttributes for reference. +func (c *Client) PaymentsGetStarGiftUpgradeAttributes(ctx context.Context, giftid int64) (*PaymentsStarGiftUpgradeAttributes, error) { + var result PaymentsStarGiftUpgradeAttributes + + request := &PaymentsGetStarGiftUpgradeAttributesRequest{ + GiftID: giftid, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/pkg/gotd/tg/tl_payments_get_star_gift_upgrade_attributes_slices_gen.go b/pkg/gotd/tg/tl_payments_get_star_gift_upgrade_attributes_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_payments_get_star_gift_upgrade_attributes_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_payments_resolve_star_gift_offer_gen.go b/pkg/gotd/tg/tl_payments_resolve_star_gift_offer_gen.go new file mode 100644 index 00000000..52e0c479 --- /dev/null +++ b/pkg/gotd/tg/tl_payments_resolve_star_gift_offer_gen.go @@ -0,0 +1,226 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// PaymentsResolveStarGiftOfferRequest represents TL type `payments.resolveStarGiftOffer#e9ce781c`. +// +// See https://core.telegram.org/method/payments.resolveStarGiftOffer for reference. +type PaymentsResolveStarGiftOfferRequest struct { + // Flags field of PaymentsResolveStarGiftOfferRequest. + Flags bin.Fields + // Decline field of PaymentsResolveStarGiftOfferRequest. + Decline bool + // OfferMsgID field of PaymentsResolveStarGiftOfferRequest. + OfferMsgID int +} + +// PaymentsResolveStarGiftOfferRequestTypeID is TL type id of PaymentsResolveStarGiftOfferRequest. +const PaymentsResolveStarGiftOfferRequestTypeID = 0xe9ce781c + +// Ensuring interfaces in compile-time for PaymentsResolveStarGiftOfferRequest. +var ( + _ bin.Encoder = &PaymentsResolveStarGiftOfferRequest{} + _ bin.Decoder = &PaymentsResolveStarGiftOfferRequest{} + _ bin.BareEncoder = &PaymentsResolveStarGiftOfferRequest{} + _ bin.BareDecoder = &PaymentsResolveStarGiftOfferRequest{} +) + +func (r *PaymentsResolveStarGiftOfferRequest) Zero() bool { + if r == nil { + return true + } + if !(r.Flags.Zero()) { + return false + } + if !(r.Decline == false) { + return false + } + if !(r.OfferMsgID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *PaymentsResolveStarGiftOfferRequest) String() string { + if r == nil { + return "PaymentsResolveStarGiftOfferRequest(nil)" + } + type Alias PaymentsResolveStarGiftOfferRequest + return fmt.Sprintf("PaymentsResolveStarGiftOfferRequest%+v", Alias(*r)) +} + +// FillFrom fills PaymentsResolveStarGiftOfferRequest from given interface. +func (r *PaymentsResolveStarGiftOfferRequest) FillFrom(from interface { + GetDecline() (value bool) + GetOfferMsgID() (value int) +}) { + r.Decline = from.GetDecline() + r.OfferMsgID = from.GetOfferMsgID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsResolveStarGiftOfferRequest) TypeID() uint32 { + return PaymentsResolveStarGiftOfferRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsResolveStarGiftOfferRequest) TypeName() string { + return "payments.resolveStarGiftOffer" +} + +// TypeInfo returns info about TL type. +func (r *PaymentsResolveStarGiftOfferRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.resolveStarGiftOffer", + ID: PaymentsResolveStarGiftOfferRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Decline", + SchemaName: "decline", + Null: !r.Flags.Has(0), + }, + { + Name: "OfferMsgID", + SchemaName: "offer_msg_id", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (r *PaymentsResolveStarGiftOfferRequest) SetFlags() { + if !(r.Decline == false) { + r.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (r *PaymentsResolveStarGiftOfferRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode payments.resolveStarGiftOffer#e9ce781c as nil") + } + b.PutID(PaymentsResolveStarGiftOfferRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *PaymentsResolveStarGiftOfferRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode payments.resolveStarGiftOffer#e9ce781c as nil") + } + r.SetFlags() + if err := r.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.resolveStarGiftOffer#e9ce781c: field flags: %w", err) + } + b.PutInt(r.OfferMsgID) + return nil +} + +// Decode implements bin.Decoder. +func (r *PaymentsResolveStarGiftOfferRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode payments.resolveStarGiftOffer#e9ce781c to nil") + } + if err := b.ConsumeID(PaymentsResolveStarGiftOfferRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.resolveStarGiftOffer#e9ce781c: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *PaymentsResolveStarGiftOfferRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode payments.resolveStarGiftOffer#e9ce781c to nil") + } + { + if err := r.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode payments.resolveStarGiftOffer#e9ce781c: field flags: %w", err) + } + } + r.Decline = r.Flags.Has(0) + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode payments.resolveStarGiftOffer#e9ce781c: field offer_msg_id: %w", err) + } + r.OfferMsgID = value + } + return nil +} + +// SetDecline sets value of Decline conditional field. +func (r *PaymentsResolveStarGiftOfferRequest) SetDecline(value bool) { + if value { + r.Flags.Set(0) + r.Decline = true + } else { + r.Flags.Unset(0) + r.Decline = false + } +} + +// GetDecline returns value of Decline conditional field. +func (r *PaymentsResolveStarGiftOfferRequest) GetDecline() (value bool) { + if r == nil { + return + } + return r.Flags.Has(0) +} + +// GetOfferMsgID returns value of OfferMsgID field. +func (r *PaymentsResolveStarGiftOfferRequest) GetOfferMsgID() (value int) { + if r == nil { + return + } + return r.OfferMsgID +} + +// PaymentsResolveStarGiftOffer invokes method payments.resolveStarGiftOffer#e9ce781c returning error if any. +// +// See https://core.telegram.org/method/payments.resolveStarGiftOffer for reference. +func (c *Client) PaymentsResolveStarGiftOffer(ctx context.Context, request *PaymentsResolveStarGiftOfferRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/pkg/gotd/tg/tl_payments_resolve_star_gift_offer_slices_gen.go b/pkg/gotd/tg/tl_payments_resolve_star_gift_offer_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_payments_resolve_star_gift_offer_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_payments_send_star_gift_offer_gen.go b/pkg/gotd/tg/tl_payments_send_star_gift_offer_gen.go new file mode 100644 index 00000000..cec3e750 --- /dev/null +++ b/pkg/gotd/tg/tl_payments_send_star_gift_offer_gen.go @@ -0,0 +1,357 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// PaymentsSendStarGiftOfferRequest represents TL type `payments.sendStarGiftOffer#8fb86b41`. +// +// See https://core.telegram.org/method/payments.sendStarGiftOffer for reference. +type PaymentsSendStarGiftOfferRequest struct { + // Flags field of PaymentsSendStarGiftOfferRequest. + Flags bin.Fields + // Peer field of PaymentsSendStarGiftOfferRequest. + Peer InputPeerClass + // Slug field of PaymentsSendStarGiftOfferRequest. + Slug string + // Price field of PaymentsSendStarGiftOfferRequest. + Price StarsAmountClass + // Duration field of PaymentsSendStarGiftOfferRequest. + Duration int + // RandomID field of PaymentsSendStarGiftOfferRequest. + RandomID int64 + // AllowPaidStars field of PaymentsSendStarGiftOfferRequest. + // + // Use SetAllowPaidStars and GetAllowPaidStars helpers. + AllowPaidStars int64 +} + +// PaymentsSendStarGiftOfferRequestTypeID is TL type id of PaymentsSendStarGiftOfferRequest. +const PaymentsSendStarGiftOfferRequestTypeID = 0x8fb86b41 + +// Ensuring interfaces in compile-time for PaymentsSendStarGiftOfferRequest. +var ( + _ bin.Encoder = &PaymentsSendStarGiftOfferRequest{} + _ bin.Decoder = &PaymentsSendStarGiftOfferRequest{} + _ bin.BareEncoder = &PaymentsSendStarGiftOfferRequest{} + _ bin.BareDecoder = &PaymentsSendStarGiftOfferRequest{} +) + +func (s *PaymentsSendStarGiftOfferRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Peer == nil) { + return false + } + if !(s.Slug == "") { + return false + } + if !(s.Price == nil) { + return false + } + if !(s.Duration == 0) { + return false + } + if !(s.RandomID == 0) { + return false + } + if !(s.AllowPaidStars == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *PaymentsSendStarGiftOfferRequest) String() string { + if s == nil { + return "PaymentsSendStarGiftOfferRequest(nil)" + } + type Alias PaymentsSendStarGiftOfferRequest + return fmt.Sprintf("PaymentsSendStarGiftOfferRequest%+v", Alias(*s)) +} + +// FillFrom fills PaymentsSendStarGiftOfferRequest from given interface. +func (s *PaymentsSendStarGiftOfferRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetSlug() (value string) + GetPrice() (value StarsAmountClass) + GetDuration() (value int) + GetRandomID() (value int64) + GetAllowPaidStars() (value int64, ok bool) +}) { + s.Peer = from.GetPeer() + s.Slug = from.GetSlug() + s.Price = from.GetPrice() + s.Duration = from.GetDuration() + s.RandomID = from.GetRandomID() + if val, ok := from.GetAllowPaidStars(); ok { + s.AllowPaidStars = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsSendStarGiftOfferRequest) TypeID() uint32 { + return PaymentsSendStarGiftOfferRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsSendStarGiftOfferRequest) TypeName() string { + return "payments.sendStarGiftOffer" +} + +// TypeInfo returns info about TL type. +func (s *PaymentsSendStarGiftOfferRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.sendStarGiftOffer", + ID: PaymentsSendStarGiftOfferRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Slug", + SchemaName: "slug", + }, + { + Name: "Price", + SchemaName: "price", + }, + { + Name: "Duration", + SchemaName: "duration", + }, + { + Name: "RandomID", + SchemaName: "random_id", + }, + { + Name: "AllowPaidStars", + SchemaName: "allow_paid_stars", + Null: !s.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *PaymentsSendStarGiftOfferRequest) SetFlags() { + if !(s.AllowPaidStars == 0) { + s.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (s *PaymentsSendStarGiftOfferRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.sendStarGiftOffer#8fb86b41 as nil") + } + b.PutID(PaymentsSendStarGiftOfferRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *PaymentsSendStarGiftOfferRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.sendStarGiftOffer#8fb86b41 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field flags: %w", err) + } + if s.Peer == nil { + return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field peer is nil") + } + if err := s.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field peer: %w", err) + } + b.PutString(s.Slug) + if s.Price == nil { + return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field price is nil") + } + if err := s.Price.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field price: %w", err) + } + b.PutInt(s.Duration) + b.PutLong(s.RandomID) + if s.Flags.Has(0) { + b.PutLong(s.AllowPaidStars) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *PaymentsSendStarGiftOfferRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.sendStarGiftOffer#8fb86b41 to nil") + } + if err := b.ConsumeID(PaymentsSendStarGiftOfferRequestTypeID); err != nil { + return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *PaymentsSendStarGiftOfferRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.sendStarGiftOffer#8fb86b41 to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field flags: %w", err) + } + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field peer: %w", err) + } + s.Peer = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field slug: %w", err) + } + s.Slug = value + } + { + value, err := DecodeStarsAmount(b) + if err != nil { + return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field price: %w", err) + } + s.Price = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field duration: %w", err) + } + s.Duration = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field random_id: %w", err) + } + s.RandomID = value + } + if s.Flags.Has(0) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field allow_paid_stars: %w", err) + } + s.AllowPaidStars = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (s *PaymentsSendStarGiftOfferRequest) GetPeer() (value InputPeerClass) { + if s == nil { + return + } + return s.Peer +} + +// GetSlug returns value of Slug field. +func (s *PaymentsSendStarGiftOfferRequest) GetSlug() (value string) { + if s == nil { + return + } + return s.Slug +} + +// GetPrice returns value of Price field. +func (s *PaymentsSendStarGiftOfferRequest) GetPrice() (value StarsAmountClass) { + if s == nil { + return + } + return s.Price +} + +// GetDuration returns value of Duration field. +func (s *PaymentsSendStarGiftOfferRequest) GetDuration() (value int) { + if s == nil { + return + } + return s.Duration +} + +// GetRandomID returns value of RandomID field. +func (s *PaymentsSendStarGiftOfferRequest) GetRandomID() (value int64) { + if s == nil { + return + } + return s.RandomID +} + +// SetAllowPaidStars sets value of AllowPaidStars conditional field. +func (s *PaymentsSendStarGiftOfferRequest) SetAllowPaidStars(value int64) { + s.Flags.Set(0) + s.AllowPaidStars = value +} + +// GetAllowPaidStars returns value of AllowPaidStars conditional field and +// boolean which is true if field was set. +func (s *PaymentsSendStarGiftOfferRequest) GetAllowPaidStars() (value int64, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(0) { + return value, false + } + return s.AllowPaidStars, true +} + +// PaymentsSendStarGiftOffer invokes method payments.sendStarGiftOffer#8fb86b41 returning error if any. +// +// See https://core.telegram.org/method/payments.sendStarGiftOffer for reference. +func (c *Client) PaymentsSendStarGiftOffer(ctx context.Context, request *PaymentsSendStarGiftOfferRequest) (UpdatesClass, error) { + var result UpdatesBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Updates, nil +} diff --git a/pkg/gotd/tg/tl_payments_send_star_gift_offer_slices_gen.go b/pkg/gotd/tg/tl_payments_send_star_gift_offer_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_payments_send_star_gift_offer_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_payments_star_gift_active_auctions_gen.go b/pkg/gotd/tg/tl_payments_star_gift_active_auctions_gen.go index 5d778a98..8bd95a16 100644 --- a/pkg/gotd/tg/tl_payments_star_gift_active_auctions_gen.go +++ b/pkg/gotd/tg/tl_payments_star_gift_active_auctions_gen.go @@ -134,7 +134,7 @@ func (s *PaymentsStarGiftActiveAuctionsNotModified) DecodeBare(b *bin.Buffer) er return nil } -// PaymentsStarGiftActiveAuctions represents TL type `payments.starGiftActiveAuctions#97f187d8`. +// PaymentsStarGiftActiveAuctions represents TL type `payments.starGiftActiveAuctions#aef6abbc`. // // See https://core.telegram.org/constructor/payments.starGiftActiveAuctions for reference. type PaymentsStarGiftActiveAuctions struct { @@ -142,10 +142,12 @@ type PaymentsStarGiftActiveAuctions struct { Auctions []StarGiftActiveAuctionState // Users field of PaymentsStarGiftActiveAuctions. Users []UserClass + // Chats field of PaymentsStarGiftActiveAuctions. + Chats []ChatClass } // PaymentsStarGiftActiveAuctionsTypeID is TL type id of PaymentsStarGiftActiveAuctions. -const PaymentsStarGiftActiveAuctionsTypeID = 0x97f187d8 +const PaymentsStarGiftActiveAuctionsTypeID = 0xaef6abbc // construct implements constructor of PaymentsStarGiftActiveAuctionsClass. func (s PaymentsStarGiftActiveAuctions) construct() PaymentsStarGiftActiveAuctionsClass { return &s } @@ -170,6 +172,9 @@ func (s *PaymentsStarGiftActiveAuctions) Zero() bool { if !(s.Users == nil) { return false } + if !(s.Chats == nil) { + return false + } return true } @@ -187,9 +192,11 @@ func (s *PaymentsStarGiftActiveAuctions) String() string { func (s *PaymentsStarGiftActiveAuctions) FillFrom(from interface { GetAuctions() (value []StarGiftActiveAuctionState) GetUsers() (value []UserClass) + GetChats() (value []ChatClass) }) { s.Auctions = from.GetAuctions() s.Users = from.GetUsers() + s.Chats = from.GetChats() } // TypeID returns type id in TL schema. @@ -223,6 +230,10 @@ func (s *PaymentsStarGiftActiveAuctions) TypeInfo() tdp.Type { Name: "Users", SchemaName: "users", }, + { + Name: "Chats", + SchemaName: "chats", + }, } return typ } @@ -230,7 +241,7 @@ func (s *PaymentsStarGiftActiveAuctions) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *PaymentsStarGiftActiveAuctions) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode payments.starGiftActiveAuctions#97f187d8 as nil") + return fmt.Errorf("can't encode payments.starGiftActiveAuctions#aef6abbc as nil") } b.PutID(PaymentsStarGiftActiveAuctionsTypeID) return s.EncodeBare(b) @@ -239,21 +250,30 @@ func (s *PaymentsStarGiftActiveAuctions) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *PaymentsStarGiftActiveAuctions) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode payments.starGiftActiveAuctions#97f187d8 as nil") + return fmt.Errorf("can't encode payments.starGiftActiveAuctions#aef6abbc as nil") } b.PutVectorHeader(len(s.Auctions)) for idx, v := range s.Auctions { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#97f187d8: field auctions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field auctions element with index %d: %w", idx, err) } } b.PutVectorHeader(len(s.Users)) for idx, v := range s.Users { if v == nil { - return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#97f187d8: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#97f187d8: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field users element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(s.Chats)) + for idx, v := range s.Chats { + if v == nil { + return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field chats element with index %d: %w", idx, err) } } return nil @@ -262,10 +282,10 @@ func (s *PaymentsStarGiftActiveAuctions) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *PaymentsStarGiftActiveAuctions) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode payments.starGiftActiveAuctions#97f187d8 to nil") + return fmt.Errorf("can't decode payments.starGiftActiveAuctions#aef6abbc to nil") } if err := b.ConsumeID(PaymentsStarGiftActiveAuctionsTypeID); err != nil { - return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: %w", err) + return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: %w", err) } return s.DecodeBare(b) } @@ -273,12 +293,12 @@ func (s *PaymentsStarGiftActiveAuctions) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *PaymentsStarGiftActiveAuctions) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode payments.starGiftActiveAuctions#97f187d8 to nil") + return fmt.Errorf("can't decode payments.starGiftActiveAuctions#aef6abbc to nil") } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: field auctions: %w", err) + return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field auctions: %w", err) } if headerLen > 0 { @@ -287,7 +307,7 @@ func (s *PaymentsStarGiftActiveAuctions) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value StarGiftActiveAuctionState if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: field auctions: %w", err) + return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field auctions: %w", err) } s.Auctions = append(s.Auctions, value) } @@ -295,7 +315,7 @@ func (s *PaymentsStarGiftActiveAuctions) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: field users: %w", err) + return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field users: %w", err) } if headerLen > 0 { @@ -304,11 +324,28 @@ func (s *PaymentsStarGiftActiveAuctions) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeUser(b) if err != nil { - return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: field users: %w", err) + return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field users: %w", err) } s.Users = append(s.Users, value) } } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field chats: %w", err) + } + + if headerLen > 0 { + s.Chats = make([]ChatClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChat(b) + if err != nil { + return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field chats: %w", err) + } + s.Chats = append(s.Chats, value) + } + } return nil } @@ -328,11 +365,24 @@ func (s *PaymentsStarGiftActiveAuctions) GetUsers() (value []UserClass) { return s.Users } +// GetChats returns value of Chats field. +func (s *PaymentsStarGiftActiveAuctions) GetChats() (value []ChatClass) { + if s == nil { + return + } + return s.Chats +} + // MapUsers returns field Users wrapped in UserClassArray helper. func (s *PaymentsStarGiftActiveAuctions) MapUsers() (value UserClassArray) { return UserClassArray(s.Users) } +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (s *PaymentsStarGiftActiveAuctions) MapChats() (value ChatClassArray) { + return ChatClassArray(s.Chats) +} + // PaymentsStarGiftActiveAuctionsClassName is schema name of PaymentsStarGiftActiveAuctionsClass. const PaymentsStarGiftActiveAuctionsClassName = "payments.StarGiftActiveAuctions" @@ -348,7 +398,7 @@ const PaymentsStarGiftActiveAuctionsClassName = "payments.StarGiftActiveAuctions // } // switch v := g.(type) { // case *tg.PaymentsStarGiftActiveAuctionsNotModified: // payments.starGiftActiveAuctionsNotModified#db33dad0 -// case *tg.PaymentsStarGiftActiveAuctions: // payments.starGiftActiveAuctions#97f187d8 +// case *tg.PaymentsStarGiftActiveAuctions: // payments.starGiftActiveAuctions#aef6abbc // default: panic(v) // } type PaymentsStarGiftActiveAuctionsClass interface { @@ -398,7 +448,7 @@ func DecodePaymentsStarGiftActiveAuctions(buf *bin.Buffer) (PaymentsStarGiftActi } return &v, nil case PaymentsStarGiftActiveAuctionsTypeID: - // Decoding payments.starGiftActiveAuctions#97f187d8. + // Decoding payments.starGiftActiveAuctions#aef6abbc. v := PaymentsStarGiftActiveAuctions{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode PaymentsStarGiftActiveAuctionsClass: %w", err) diff --git a/pkg/gotd/tg/tl_payments_star_gift_auction_state_gen.go b/pkg/gotd/tg/tl_payments_star_gift_auction_state_gen.go index 261f3752..cc613efd 100644 --- a/pkg/gotd/tg/tl_payments_star_gift_auction_state_gen.go +++ b/pkg/gotd/tg/tl_payments_star_gift_auction_state_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// PaymentsStarGiftAuctionState represents TL type `payments.starGiftAuctionState#e98e474`. +// PaymentsStarGiftAuctionState represents TL type `payments.starGiftAuctionState#6b39f4ec`. // // See https://core.telegram.org/constructor/payments.starGiftAuctionState for reference. type PaymentsStarGiftAuctionState struct { @@ -45,10 +45,12 @@ type PaymentsStarGiftAuctionState struct { Timeout int // Users field of PaymentsStarGiftAuctionState. Users []UserClass + // Chats field of PaymentsStarGiftAuctionState. + Chats []ChatClass } // PaymentsStarGiftAuctionStateTypeID is TL type id of PaymentsStarGiftAuctionState. -const PaymentsStarGiftAuctionStateTypeID = 0xe98e474 +const PaymentsStarGiftAuctionStateTypeID = 0x6b39f4ec // Ensuring interfaces in compile-time for PaymentsStarGiftAuctionState. var ( @@ -77,6 +79,9 @@ func (s *PaymentsStarGiftAuctionState) Zero() bool { if !(s.Users == nil) { return false } + if !(s.Chats == nil) { + return false + } return true } @@ -97,12 +102,14 @@ func (s *PaymentsStarGiftAuctionState) FillFrom(from interface { GetUserState() (value StarGiftAuctionUserState) GetTimeout() (value int) GetUsers() (value []UserClass) + GetChats() (value []ChatClass) }) { s.Gift = from.GetGift() s.State = from.GetState() s.UserState = from.GetUserState() s.Timeout = from.GetTimeout() s.Users = from.GetUsers() + s.Chats = from.GetChats() } // TypeID returns type id in TL schema. @@ -148,6 +155,10 @@ func (s *PaymentsStarGiftAuctionState) TypeInfo() tdp.Type { Name: "Users", SchemaName: "users", }, + { + Name: "Chats", + SchemaName: "chats", + }, } return typ } @@ -155,7 +166,7 @@ func (s *PaymentsStarGiftAuctionState) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *PaymentsStarGiftAuctionState) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode payments.starGiftAuctionState#e98e474 as nil") + return fmt.Errorf("can't encode payments.starGiftAuctionState#6b39f4ec as nil") } b.PutID(PaymentsStarGiftAuctionStateTypeID) return s.EncodeBare(b) @@ -164,31 +175,40 @@ func (s *PaymentsStarGiftAuctionState) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *PaymentsStarGiftAuctionState) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode payments.starGiftAuctionState#e98e474 as nil") + return fmt.Errorf("can't encode payments.starGiftAuctionState#6b39f4ec as nil") } if s.Gift == nil { - return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field gift is nil") + return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field gift is nil") } if err := s.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field gift: %w", err) + return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field gift: %w", err) } if s.State == nil { - return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field state is nil") + return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field state is nil") } if err := s.State.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field state: %w", err) + return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field state: %w", err) } if err := s.UserState.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field user_state: %w", err) + return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field user_state: %w", err) } b.PutInt(s.Timeout) b.PutVectorHeader(len(s.Users)) for idx, v := range s.Users { if v == nil { - return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field users element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(s.Chats)) + for idx, v := range s.Chats { + if v == nil { + return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field chats element with index %d: %w", idx, err) } } return nil @@ -197,10 +217,10 @@ func (s *PaymentsStarGiftAuctionState) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *PaymentsStarGiftAuctionState) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode payments.starGiftAuctionState#e98e474 to nil") + return fmt.Errorf("can't decode payments.starGiftAuctionState#6b39f4ec to nil") } if err := b.ConsumeID(PaymentsStarGiftAuctionStateTypeID); err != nil { - return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: %w", err) + return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: %w", err) } return s.DecodeBare(b) } @@ -208,38 +228,38 @@ func (s *PaymentsStarGiftAuctionState) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *PaymentsStarGiftAuctionState) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode payments.starGiftAuctionState#e98e474 to nil") + return fmt.Errorf("can't decode payments.starGiftAuctionState#6b39f4ec to nil") } { value, err := DecodeStarGift(b) if err != nil { - return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field gift: %w", err) + return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field gift: %w", err) } s.Gift = value } { value, err := DecodeStarGiftAuctionState(b) if err != nil { - return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field state: %w", err) + return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field state: %w", err) } s.State = value } { if err := s.UserState.Decode(b); err != nil { - return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field user_state: %w", err) + return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field user_state: %w", err) } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field timeout: %w", err) + return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field timeout: %w", err) } s.Timeout = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field users: %w", err) + return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field users: %w", err) } if headerLen > 0 { @@ -248,11 +268,28 @@ func (s *PaymentsStarGiftAuctionState) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeUser(b) if err != nil { - return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field users: %w", err) + return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field users: %w", err) } s.Users = append(s.Users, value) } } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field chats: %w", err) + } + + if headerLen > 0 { + s.Chats = make([]ChatClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChat(b) + if err != nil { + return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field chats: %w", err) + } + s.Chats = append(s.Chats, value) + } + } return nil } @@ -296,6 +333,14 @@ func (s *PaymentsStarGiftAuctionState) GetUsers() (value []UserClass) { return s.Users } +// GetChats returns value of Chats field. +func (s *PaymentsStarGiftAuctionState) GetChats() (value []ChatClass) { + if s == nil { + return + } + return s.Chats +} + // GetStateAsModified returns mapped value of State field. func (s *PaymentsStarGiftAuctionState) GetStateAsModified() (ModifiedStarGiftAuctionState, bool) { return s.State.AsModified() @@ -305,3 +350,8 @@ func (s *PaymentsStarGiftAuctionState) GetStateAsModified() (ModifiedStarGiftAuc func (s *PaymentsStarGiftAuctionState) MapUsers() (value UserClassArray) { return UserClassArray(s.Users) } + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (s *PaymentsStarGiftAuctionState) MapChats() (value ChatClassArray) { + return ChatClassArray(s.Chats) +} diff --git a/pkg/gotd/tg/tl_payments_star_gift_upgrade_attributes_gen.go b/pkg/gotd/tg/tl_payments_star_gift_upgrade_attributes_gen.go new file mode 100644 index 00000000..e28f6c6d --- /dev/null +++ b/pkg/gotd/tg/tl_payments_star_gift_upgrade_attributes_gen.go @@ -0,0 +1,184 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// PaymentsStarGiftUpgradeAttributes represents TL type `payments.starGiftUpgradeAttributes#46c6e36f`. +// +// See https://core.telegram.org/constructor/payments.starGiftUpgradeAttributes for reference. +type PaymentsStarGiftUpgradeAttributes struct { + // Attributes field of PaymentsStarGiftUpgradeAttributes. + Attributes []StarGiftAttributeClass +} + +// PaymentsStarGiftUpgradeAttributesTypeID is TL type id of PaymentsStarGiftUpgradeAttributes. +const PaymentsStarGiftUpgradeAttributesTypeID = 0x46c6e36f + +// Ensuring interfaces in compile-time for PaymentsStarGiftUpgradeAttributes. +var ( + _ bin.Encoder = &PaymentsStarGiftUpgradeAttributes{} + _ bin.Decoder = &PaymentsStarGiftUpgradeAttributes{} + _ bin.BareEncoder = &PaymentsStarGiftUpgradeAttributes{} + _ bin.BareDecoder = &PaymentsStarGiftUpgradeAttributes{} +) + +func (s *PaymentsStarGiftUpgradeAttributes) Zero() bool { + if s == nil { + return true + } + if !(s.Attributes == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *PaymentsStarGiftUpgradeAttributes) String() string { + if s == nil { + return "PaymentsStarGiftUpgradeAttributes(nil)" + } + type Alias PaymentsStarGiftUpgradeAttributes + return fmt.Sprintf("PaymentsStarGiftUpgradeAttributes%+v", Alias(*s)) +} + +// FillFrom fills PaymentsStarGiftUpgradeAttributes from given interface. +func (s *PaymentsStarGiftUpgradeAttributes) FillFrom(from interface { + GetAttributes() (value []StarGiftAttributeClass) +}) { + s.Attributes = from.GetAttributes() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PaymentsStarGiftUpgradeAttributes) TypeID() uint32 { + return PaymentsStarGiftUpgradeAttributesTypeID +} + +// TypeName returns name of type in TL schema. +func (*PaymentsStarGiftUpgradeAttributes) TypeName() string { + return "payments.starGiftUpgradeAttributes" +} + +// TypeInfo returns info about TL type. +func (s *PaymentsStarGiftUpgradeAttributes) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "payments.starGiftUpgradeAttributes", + ID: PaymentsStarGiftUpgradeAttributesTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Attributes", + SchemaName: "attributes", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *PaymentsStarGiftUpgradeAttributes) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.starGiftUpgradeAttributes#46c6e36f as nil") + } + b.PutID(PaymentsStarGiftUpgradeAttributesTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *PaymentsStarGiftUpgradeAttributes) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode payments.starGiftUpgradeAttributes#46c6e36f as nil") + } + b.PutVectorHeader(len(s.Attributes)) + for idx, v := range s.Attributes { + if v == nil { + return fmt.Errorf("unable to encode payments.starGiftUpgradeAttributes#46c6e36f: field attributes element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.starGiftUpgradeAttributes#46c6e36f: field attributes element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (s *PaymentsStarGiftUpgradeAttributes) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.starGiftUpgradeAttributes#46c6e36f to nil") + } + if err := b.ConsumeID(PaymentsStarGiftUpgradeAttributesTypeID); err != nil { + return fmt.Errorf("unable to decode payments.starGiftUpgradeAttributes#46c6e36f: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *PaymentsStarGiftUpgradeAttributes) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode payments.starGiftUpgradeAttributes#46c6e36f to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode payments.starGiftUpgradeAttributes#46c6e36f: field attributes: %w", err) + } + + if headerLen > 0 { + s.Attributes = make([]StarGiftAttributeClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeStarGiftAttribute(b) + if err != nil { + return fmt.Errorf("unable to decode payments.starGiftUpgradeAttributes#46c6e36f: field attributes: %w", err) + } + s.Attributes = append(s.Attributes, value) + } + } + return nil +} + +// GetAttributes returns value of Attributes field. +func (s *PaymentsStarGiftUpgradeAttributes) GetAttributes() (value []StarGiftAttributeClass) { + if s == nil { + return + } + return s.Attributes +} + +// MapAttributes returns field Attributes wrapped in StarGiftAttributeClassArray helper. +func (s *PaymentsStarGiftUpgradeAttributes) MapAttributes() (value StarGiftAttributeClassArray) { + return StarGiftAttributeClassArray(s.Attributes) +} diff --git a/pkg/gotd/tg/tl_payments_star_gift_upgrade_attributes_slices_gen.go b/pkg/gotd/tg/tl_payments_star_gift_upgrade_attributes_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_payments_star_gift_upgrade_attributes_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_registry_gen.go b/pkg/gotd/tg/tl_registry_gen.go index 99cbd30c..fa7628cc 100644 --- a/pkg/gotd/tg/tl_registry_gen.go +++ b/pkg/gotd/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 218 +const Layer = 223 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -76,6 +76,7 @@ func TypesMap() map[uint32]string { InputMediaWebPageTypeID: "inputMediaWebPage#c21b8849", InputMediaPaidMediaTypeID: "inputMediaPaidMedia#c4103386", InputMediaTodoTypeID: "inputMediaTodo#9fc55fde", + InputMediaStakeDiceTypeID: "inputMediaStakeDice#f3a9244a", InputChatPhotoEmptyTypeID: "inputChatPhotoEmpty#1ca48f57", InputChatUploadedPhotoTypeID: "inputChatUploadedPhoto#bdcdaec0", InputChatPhotoTypeID: "inputChatPhoto#8953ad37", @@ -123,15 +124,15 @@ func TypesMap() map[uint32]string { ChannelForbiddenTypeID: "channelForbidden#17d493d5", ChatFullTypeID: "chatFull#2633421b", ChannelFullTypeID: "channelFull#e4e0b29d", - ChatParticipantTypeID: "chatParticipant#c02d4007", - ChatParticipantCreatorTypeID: "chatParticipantCreator#e46bcee4", - ChatParticipantAdminTypeID: "chatParticipantAdmin#a0933f5b", + ChatParticipantTypeID: "chatParticipant#38e79fde", + ChatParticipantCreatorTypeID: "chatParticipantCreator#e1f867b8", + ChatParticipantAdminTypeID: "chatParticipantAdmin#360d5d2", ChatParticipantsForbiddenTypeID: "chatParticipantsForbidden#8763d3e1", ChatParticipantsTypeID: "chatParticipants#3cbc93f8", ChatPhotoEmptyTypeID: "chatPhotoEmpty#37c1011c", ChatPhotoTypeID: "chatPhoto#1c6e1c11", MessageEmptyTypeID: "messageEmpty#90a6ca84", - MessageTypeID: "message#b92f76cf", + MessageTypeID: "message#3ae56482", MessageServiceTypeID: "messageService#7a800e0a", MessageMediaEmptyTypeID: "messageMediaEmpty#3ded6320", MessageMediaPhotoTypeID: "messageMediaPhoto#695150d7", @@ -145,7 +146,7 @@ func TypesMap() map[uint32]string { MessageMediaInvoiceTypeID: "messageMediaInvoice#f6a548d3", MessageMediaGeoLiveTypeID: "messageMediaGeoLive#b940c666", MessageMediaPollTypeID: "messageMediaPoll#4bd6e798", - MessageMediaDiceTypeID: "messageMediaDice#3f7ee58b", + MessageMediaDiceTypeID: "messageMediaDice#8cbec07", MessageMediaStoryTypeID: "messageMediaStory#68cb6283", MessageMediaGiveawayTypeID: "messageMediaGiveaway#aa073beb", MessageMediaGiveawayResultsTypeID: "messageMediaGiveawayResults#ceaa3ea1", @@ -198,8 +199,8 @@ func TypesMap() map[uint32]string { MessageActionPaymentRefundedTypeID: "messageActionPaymentRefunded#41b3e202", MessageActionGiftStarsTypeID: "messageActionGiftStars#45d5b021", MessageActionPrizeStarsTypeID: "messageActionPrizeStars#b00c47a2", - MessageActionStarGiftTypeID: "messageActionStarGift#db596550", - MessageActionStarGiftUniqueTypeID: "messageActionStarGiftUnique#95728543", + MessageActionStarGiftTypeID: "messageActionStarGift#ea2c31d3", + MessageActionStarGiftUniqueTypeID: "messageActionStarGiftUnique#e6c31522", MessageActionPaidMessagesRefundedTypeID: "messageActionPaidMessagesRefunded#ac1f1fcd", MessageActionPaidMessagesPriceTypeID: "messageActionPaidMessagesPrice#84b88578", MessageActionConferenceCallTypeID: "messageActionConferenceCall#2ffe2f7a", @@ -210,6 +211,12 @@ func TypesMap() map[uint32]string { MessageActionSuggestedPostRefundTypeID: "messageActionSuggestedPostRefund#69f916f8", MessageActionGiftTonTypeID: "messageActionGiftTon#a8a3c699", MessageActionSuggestBirthdayTypeID: "messageActionSuggestBirthday#2c8f2a25", + MessageActionStarGiftPurchaseOfferTypeID: "messageActionStarGiftPurchaseOffer#774278d4", + MessageActionStarGiftPurchaseOfferDeclinedTypeID: "messageActionStarGiftPurchaseOfferDeclined#73ada76b", + MessageActionNewCreatorPendingTypeID: "messageActionNewCreatorPending#b07ed085", + MessageActionChangeCreatorTypeID: "messageActionChangeCreator#e188503b", + MessageActionNoForwardsToggleTypeID: "messageActionNoForwardsToggle#bf7d6572", + MessageActionNoForwardsRequestTypeID: "messageActionNoForwardsRequest#3e2793ba", DialogTypeID: "dialog#d58a08c6", DialogFolderTypeID: "dialogFolder#71bd134c", PhotoEmptyTypeID: "photoEmpty#2331b22d", @@ -435,6 +442,9 @@ func TypesMap() map[uint32]string { UpdateDeleteGroupCallMessagesTypeID: "updateDeleteGroupCallMessages#3e85e92c", UpdateStarGiftAuctionStateTypeID: "updateStarGiftAuctionState#48e246c2", UpdateStarGiftAuctionUserStateTypeID: "updateStarGiftAuctionUserState#dc58f31e", + UpdateEmojiGameInfoTypeID: "updateEmojiGameInfo#fb9c547a", + UpdateStarGiftCraftFailTypeID: "updateStarGiftCraftFail#ac072444", + UpdateChatParticipantRankTypeID: "updateChatParticipantRank#bd8367b9", UpdatesStateTypeID: "updates.state#a56c2a3e", UpdatesDifferenceEmptyTypeID: "updates.differenceEmpty#5d75a138", UpdatesDifferenceTypeID: "updates.difference#f49ca0", @@ -607,24 +617,24 @@ func TypesMap() map[uint32]string { MessagesStickerSetNotModifiedTypeID: "messages.stickerSetNotModified#d3f924eb", BotCommandTypeID: "botCommand#c27ac8c7", BotInfoTypeID: "botInfo#4d8a0299", - KeyboardButtonTypeID: "keyboardButton#a2fa4880", - KeyboardButtonURLTypeID: "keyboardButtonUrl#258aff05", - KeyboardButtonCallbackTypeID: "keyboardButtonCallback#35bbdb6b", - KeyboardButtonRequestPhoneTypeID: "keyboardButtonRequestPhone#b16a6c29", - KeyboardButtonRequestGeoLocationTypeID: "keyboardButtonRequestGeoLocation#fc796b3f", - KeyboardButtonSwitchInlineTypeID: "keyboardButtonSwitchInline#93b9fbb5", - KeyboardButtonGameTypeID: "keyboardButtonGame#50f41ccf", - KeyboardButtonBuyTypeID: "keyboardButtonBuy#afd93fbb", - KeyboardButtonURLAuthTypeID: "keyboardButtonUrlAuth#10b78d29", - InputKeyboardButtonURLAuthTypeID: "inputKeyboardButtonUrlAuth#d02e7fd4", - KeyboardButtonRequestPollTypeID: "keyboardButtonRequestPoll#bbc7515d", - InputKeyboardButtonUserProfileTypeID: "inputKeyboardButtonUserProfile#e988037b", - KeyboardButtonUserProfileTypeID: "keyboardButtonUserProfile#308660c1", - KeyboardButtonWebViewTypeID: "keyboardButtonWebView#13767230", - KeyboardButtonSimpleWebViewTypeID: "keyboardButtonSimpleWebView#a0c0505c", - KeyboardButtonRequestPeerTypeID: "keyboardButtonRequestPeer#53d7bfd8", - InputKeyboardButtonRequestPeerTypeID: "inputKeyboardButtonRequestPeer#c9662d05", - KeyboardButtonCopyTypeID: "keyboardButtonCopy#75d2698e", + KeyboardButtonTypeID: "keyboardButton#7d170cff", + KeyboardButtonURLTypeID: "keyboardButtonUrl#d80c25ec", + KeyboardButtonCallbackTypeID: "keyboardButtonCallback#e62bc960", + KeyboardButtonRequestPhoneTypeID: "keyboardButtonRequestPhone#417efd8f", + KeyboardButtonRequestGeoLocationTypeID: "keyboardButtonRequestGeoLocation#aa40f94d", + KeyboardButtonSwitchInlineTypeID: "keyboardButtonSwitchInline#991399fc", + KeyboardButtonGameTypeID: "keyboardButtonGame#89c590f9", + KeyboardButtonBuyTypeID: "keyboardButtonBuy#3fa53905", + KeyboardButtonURLAuthTypeID: "keyboardButtonUrlAuth#f51006f9", + InputKeyboardButtonURLAuthTypeID: "inputKeyboardButtonUrlAuth#68013e72", + KeyboardButtonRequestPollTypeID: "keyboardButtonRequestPoll#7a11d782", + InputKeyboardButtonUserProfileTypeID: "inputKeyboardButtonUserProfile#7d5e07c7", + KeyboardButtonUserProfileTypeID: "keyboardButtonUserProfile#c0fd5d09", + KeyboardButtonWebViewTypeID: "keyboardButtonWebView#e846b1a0", + KeyboardButtonSimpleWebViewTypeID: "keyboardButtonSimpleWebView#e15c4370", + KeyboardButtonRequestPeerTypeID: "keyboardButtonRequestPeer#5b0f15f5", + InputKeyboardButtonRequestPeerTypeID: "inputKeyboardButtonRequestPeer#2b78156", + KeyboardButtonCopyTypeID: "keyboardButtonCopy#bcc4af10", KeyboardButtonRowTypeID: "keyboardButtonRow#77608b83", ReplyKeyboardHideTypeID: "replyKeyboardHide#a03e5b85", ReplyKeyboardForceReplyTypeID: "replyKeyboardForceReply#86b40b08", @@ -651,6 +661,7 @@ func TypesMap() map[uint32]string { MessageEntitySpoilerTypeID: "messageEntitySpoiler#32ca960f", MessageEntityCustomEmojiTypeID: "messageEntityCustomEmoji#c8cf05f8", MessageEntityBlockquoteTypeID: "messageEntityBlockquote#f1ccaaac", + MessageEntityFormattedDateTypeID: "messageEntityFormattedDate#904ac7c7", InputChannelEmptyTypeID: "inputChannelEmpty#ee8c1e86", InputChannelTypeID: "inputChannel#f35aec28", InputChannelFromMessageTypeID: "inputChannelFromMessage#5b934f9d", @@ -661,11 +672,11 @@ func TypesMap() map[uint32]string { UpdatesChannelDifferenceTypeID: "updates.channelDifference#2064674e", ChannelMessagesFilterEmptyTypeID: "channelMessagesFilterEmpty#94d42ee7", ChannelMessagesFilterTypeID: "channelMessagesFilter#cd77d957", - ChannelParticipantTypeID: "channelParticipant#cb397619", - ChannelParticipantSelfTypeID: "channelParticipantSelf#4f607bef", + ChannelParticipantTypeID: "channelParticipant#1bd54456", + ChannelParticipantSelfTypeID: "channelParticipantSelf#a9478a1a", ChannelParticipantCreatorTypeID: "channelParticipantCreator#2fe601d3", ChannelParticipantAdminTypeID: "channelParticipantAdmin#34c3bb53", - ChannelParticipantBannedTypeID: "channelParticipantBanned#6df8014e", + ChannelParticipantBannedTypeID: "channelParticipantBanned#d5f0ad91", ChannelParticipantLeftTypeID: "channelParticipantLeft#1b03f006", ChannelParticipantsRecentTypeID: "channelParticipantsRecent#de3f3c79", ChannelParticipantsAdminsTypeID: "channelParticipantsAdmins#b4608969", @@ -913,6 +924,7 @@ func TypesMap() map[uint32]string { ChannelAdminLogEventActionToggleSignatureProfilesTypeID: "channelAdminLogEventActionToggleSignatureProfiles#60a79c79", ChannelAdminLogEventActionParticipantSubExtendTypeID: "channelAdminLogEventActionParticipantSubExtend#64642db3", ChannelAdminLogEventActionToggleAutotranslationTypeID: "channelAdminLogEventActionToggleAutotranslation#c517f77e", + ChannelAdminLogEventActionParticipantEditRankTypeID: "channelAdminLogEventActionParticipantEditRank#5806b4ec", ChannelAdminLogEventTypeID: "channelAdminLogEvent#1fad68cd", ChannelsAdminLogResultsTypeID: "channels.adminLogResults#ed8af74d", ChannelAdminLogEventsFilterTypeID: "channelAdminLogEventsFilter#ea107ae4", @@ -1039,8 +1051,8 @@ func TypesMap() map[uint32]string { InputFolderPeerTypeID: "inputFolderPeer#fbd2c296", FolderPeerTypeID: "folderPeer#e9baa668", MessagesSearchCounterTypeID: "messages.searchCounter#e844ebff", - URLAuthResultRequestTypeID: "urlAuthResultRequest#92d33a0e", - URLAuthResultAcceptedTypeID: "urlAuthResultAccepted#8f8c0e4e", + URLAuthResultRequestTypeID: "urlAuthResultRequest#f8f8eb1e", + URLAuthResultAcceptedTypeID: "urlAuthResultAccepted#623a8fa0", URLAuthResultDefaultTypeID: "urlAuthResultDefault#a9d6db1f", ChannelLocationEmptyTypeID: "channelLocationEmpty#bfb5ad8b", ChannelLocationTypeID: "channelLocation#209b82db", @@ -1069,7 +1081,7 @@ func TypesMap() map[uint32]string { WebPageAttributeStickerSetTypeID: "webPageAttributeStickerSet#50cc03d3", WebPageAttributeUniqueStarGiftTypeID: "webPageAttributeUniqueStarGift#cf6f6db8", WebPageAttributeStarGiftCollectionTypeID: "webPageAttributeStarGiftCollection#31cad303", - WebPageAttributeStarGiftAuctionTypeID: "webPageAttributeStarGiftAuction#34986ab", + WebPageAttributeStarGiftAuctionTypeID: "webPageAttributeStarGiftAuction#1c641c2", MessagesVotesListTypeID: "messages.votesList#4899484e", BankCardOpenURLTypeID: "bankCardOpenUrl#f568028a", PaymentsBankCardDataTypeID: "payments.bankCardData#3e24e573", @@ -1446,8 +1458,8 @@ func TypesMap() map[uint32]string { MessageReactorTypeID: "messageReactor#4ba3a95a", StarsGiveawayOptionTypeID: "starsGiveawayOption#94ce852a", StarsGiveawayWinnersOptionTypeID: "starsGiveawayWinnersOption#54236209", - StarGiftTypeID: "starGift#1b9a4d7f", - StarGiftUniqueTypeID: "starGiftUnique#b0bf741b", + StarGiftTypeID: "starGift#313a9547", + StarGiftUniqueTypeID: "starGiftUnique#85f0a9cd", PaymentsStarGiftsNotModifiedTypeID: "payments.starGiftsNotModified#a388a368", PaymentsStarGiftsTypeID: "payments.starGifts#2ed82995", MessageReportOptionTypeID: "messageReportOption#7903e3d9", @@ -1467,16 +1479,16 @@ func TypesMap() map[uint32]string { MessagesFoundStickersTypeID: "messages.foundStickers#82c9e290", BotVerifierSettingsTypeID: "botVerifierSettings#b0cd6617", BotVerificationTypeID: "botVerification#f93cd45c", - StarGiftAttributeModelTypeID: "starGiftAttributeModel#39d99013", - StarGiftAttributePatternTypeID: "starGiftAttributePattern#13acff19", - StarGiftAttributeBackdropTypeID: "starGiftAttributeBackdrop#d93d859c", + StarGiftAttributeModelTypeID: "starGiftAttributeModel#565251e2", + StarGiftAttributePatternTypeID: "starGiftAttributePattern#4e7085ea", + StarGiftAttributeBackdropTypeID: "starGiftAttributeBackdrop#9f2504e4", StarGiftAttributeOriginalDetailsTypeID: "starGiftAttributeOriginalDetails#e0bff26c", PaymentsStarGiftUpgradePreviewTypeID: "payments.starGiftUpgradePreview#3de1dfed", UsersUsersTypeID: "users.users#62d706b8", UsersUsersSliceTypeID: "users.usersSlice#315a4974", PaymentsUniqueStarGiftTypeID: "payments.uniqueStarGift#416c56e8", MessagesWebPagePreviewTypeID: "messages.webPagePreview#8c9a88ac", - SavedStarGiftTypeID: "savedStarGift#8983a452", + SavedStarGiftTypeID: "savedStarGift#41df43fc", PaymentsSavedStarGiftsTypeID: "payments.savedStarGifts#95f389b1", InputSavedStarGiftUserTypeID: "inputSavedStarGiftUser#69279795", InputSavedStarGiftChatTypeID: "inputSavedStarGiftChat#f101aa7f", @@ -1538,17 +1550,38 @@ func TypesMap() map[uint32]string { RecentStoryTypeID: "recentStory#711d692d", AuctionBidLevelTypeID: "auctionBidLevel#310240cc", StarGiftAuctionStateNotModifiedTypeID: "starGiftAuctionStateNotModified#fe333952", - StarGiftAuctionStateTypeID: "starGiftAuctionState#5db04f4b", - StarGiftAuctionStateFinishedTypeID: "starGiftAuctionStateFinished#7d967c3a", + StarGiftAuctionStateTypeID: "starGiftAuctionState#771a4e66", + StarGiftAuctionStateFinishedTypeID: "starGiftAuctionStateFinished#972dabbf", StarGiftAuctionUserStateTypeID: "starGiftAuctionUserState#2eeed1c4", - PaymentsStarGiftAuctionStateTypeID: "payments.starGiftAuctionState#e98e474", - StarGiftAuctionAcquiredGiftTypeID: "starGiftAuctionAcquiredGift#ab60e20b", + PaymentsStarGiftAuctionStateTypeID: "payments.starGiftAuctionState#6b39f4ec", + StarGiftAuctionAcquiredGiftTypeID: "starGiftAuctionAcquiredGift#42b00348", PaymentsStarGiftAuctionAcquiredGiftsTypeID: "payments.starGiftAuctionAcquiredGifts#7d5bd1f0", StarGiftActiveAuctionStateTypeID: "starGiftActiveAuctionState#d31bc45d", PaymentsStarGiftActiveAuctionsNotModifiedTypeID: "payments.starGiftActiveAuctionsNotModified#db33dad0", - PaymentsStarGiftActiveAuctionsTypeID: "payments.starGiftActiveAuctions#97f187d8", + PaymentsStarGiftActiveAuctionsTypeID: "payments.starGiftActiveAuctions#aef6abbc", InputStarGiftAuctionTypeID: "inputStarGiftAuction#2e16c98", InputStarGiftAuctionSlugTypeID: "inputStarGiftAuctionSlug#7ab58308", + PasskeyTypeID: "passkey#98613ebf", + AccountPasskeysTypeID: "account.passkeys#f8e0aa1c", + AccountPasskeyRegistrationOptionsTypeID: "account.passkeyRegistrationOptions#e16b5ce1", + AuthPasskeyLoginOptionsTypeID: "auth.passkeyLoginOptions#e2037789", + InputPasskeyResponseRegisterTypeID: "inputPasskeyResponseRegister#3e63935c", + InputPasskeyResponseLoginTypeID: "inputPasskeyResponseLogin#c31fc14a", + InputPasskeyCredentialPublicKeyTypeID: "inputPasskeyCredentialPublicKey#3c27b78f", + InputPasskeyCredentialFirebasePNVTypeID: "inputPasskeyCredentialFirebasePNV#5b1ccb28", + StarGiftBackgroundTypeID: "starGiftBackground#aff56398", + StarGiftAuctionRoundTypeID: "starGiftAuctionRound#3aae0528", + StarGiftAuctionRoundExtendableTypeID: "starGiftAuctionRoundExtendable#aa021e5", + PaymentsStarGiftUpgradeAttributesTypeID: "payments.starGiftUpgradeAttributes#46c6e36f", + MessagesEmojiGameOutcomeTypeID: "messages.emojiGameOutcome#da2ad647", + MessagesEmojiGameUnavailableTypeID: "messages.emojiGameUnavailable#59e65335", + MessagesEmojiGameDiceInfoTypeID: "messages.emojiGameDiceInfo#44e56023", + StarGiftAttributeRarityTypeID: "starGiftAttributeRarity#36437737", + StarGiftAttributeRarityUncommonTypeID: "starGiftAttributeRarityUncommon#dbce6389", + StarGiftAttributeRarityRareTypeID: "starGiftAttributeRarityRare#f08d516b", + StarGiftAttributeRarityEpicTypeID: "starGiftAttributeRarityEpic#78fbf3a8", + StarGiftAttributeRarityLegendaryTypeID: "starGiftAttributeRarityLegendary#cef7e7a8", + KeyboardButtonStyleTypeID: "keyboardButtonStyle#4fdd3430", InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d", InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0", InitConnectionRequestTypeID: "initConnection#c1cd5ea9", @@ -1584,6 +1617,8 @@ func TypesMap() map[uint32]string { AuthResetLoginEmailRequestTypeID: "auth.resetLoginEmail#7e960193", AuthReportMissingCodeRequestTypeID: "auth.reportMissingCode#cb9deff6", AuthCheckPaidAuthRequestTypeID: "auth.checkPaidAuth#56e59f9c", + AuthInitPasskeyLoginRequestTypeID: "auth.initPasskeyLogin#518ad0b7", + AuthFinishPasskeyLoginRequestTypeID: "auth.finishPasskeyLogin#9857ad07", AccountRegisterDeviceRequestTypeID: "account.registerDevice#ec86017a", AccountUnregisterDeviceRequestTypeID: "account.unregisterDevice#6a0d3206", AccountUpdateNotifySettingsRequestTypeID: "account.updateNotifySettings#84be5b93", @@ -1703,6 +1738,10 @@ func TypesMap() map[uint32]string { AccountSaveMusicRequestTypeID: "account.saveMusic#b26732a9", AccountGetSavedMusicIDsRequestTypeID: "account.getSavedMusicIds#e09d5faf", AccountGetUniqueGiftChatThemesRequestTypeID: "account.getUniqueGiftChatThemes#e42ce9c9", + AccountInitPasskeyRegistrationRequestTypeID: "account.initPasskeyRegistration#429547e8", + AccountRegisterPasskeyRequestTypeID: "account.registerPasskey#55b41fd6", + AccountGetPasskeysRequestTypeID: "account.getPasskeys#ea1f0c52", + AccountDeletePasskeyRequestTypeID: "account.deletePasskey#f5b5563f", UsersGetUsersRequestTypeID: "users.getUsers#d91a548", UsersGetFullUserRequestTypeID: "users.getFullUser#b60f5918", UsersSetSecureValueErrorsRequestTypeID: "users.setSecureValueErrors#90c894b5", @@ -1749,7 +1788,7 @@ func TypesMap() map[uint32]string { MessagesSetTypingRequestTypeID: "messages.setTyping#58943ee2", MessagesSendMessageRequestTypeID: "messages.sendMessage#545cd15a", MessagesSendMediaRequestTypeID: "messages.sendMedia#330e77f", - MessagesForwardMessagesRequestTypeID: "messages.forwardMessages#41d41ade", + MessagesForwardMessagesRequestTypeID: "messages.forwardMessages#13704a7c", MessagesReportSpamRequestTypeID: "messages.reportSpam#cf1592db", MessagesGetPeerSettingsRequestTypeID: "messages.getPeerSettings#efd9a6a2", MessagesReportRequestTypeID: "messages.report#fc78af9b", @@ -1845,8 +1884,8 @@ func TypesMap() map[uint32]string { MessagesGetEmojiKeywordsLanguagesRequestTypeID: "messages.getEmojiKeywordsLanguages#4e9963b2", MessagesGetEmojiURLRequestTypeID: "messages.getEmojiURL#d5b10c26", MessagesGetSearchCountersRequestTypeID: "messages.getSearchCounters#1bbcf300", - MessagesRequestURLAuthRequestTypeID: "messages.requestUrlAuth#198fb446", - MessagesAcceptURLAuthRequestTypeID: "messages.acceptUrlAuth#b12c7125", + MessagesRequestURLAuthRequestTypeID: "messages.requestUrlAuth#894cc99c", + MessagesAcceptURLAuthRequestTypeID: "messages.acceptUrlAuth#67a3f0de", MessagesHidePeerSettingsBarRequestTypeID: "messages.hidePeerSettingsBar#4facb138", MessagesGetScheduledHistoryRequestTypeID: "messages.getScheduledHistory#f516760b", MessagesGetScheduledMessagesRequestTypeID: "messages.getScheduledMessages#bdbb0464", @@ -1884,7 +1923,7 @@ func TypesMap() map[uint32]string { MessagesGetSearchResultsPositionsRequestTypeID: "messages.getSearchResultsPositions#9c7f2f10", MessagesHideChatJoinRequestRequestTypeID: "messages.hideChatJoinRequest#7fe7e815", MessagesHideAllChatJoinRequestsRequestTypeID: "messages.hideAllChatJoinRequests#e085f4ea", - MessagesToggleNoForwardsRequestTypeID: "messages.toggleNoForwards#b11eafa2", + MessagesToggleNoForwardsRequestTypeID: "messages.toggleNoForwards#b2081a35", MessagesSaveDefaultSendAsRequestTypeID: "messages.saveDefaultSendAs#ccfddf96", MessagesSendReactionRequestTypeID: "messages.sendReaction#d30d78d4", MessagesGetMessagesReactionsRequestTypeID: "messages.getMessagesReactions#8bba90e6", @@ -1975,6 +2014,13 @@ func TypesMap() map[uint32]string { MessagesReorderPinnedForumTopicsRequestTypeID: "messages.reorderPinnedForumTopics#e7841f0", MessagesCreateForumTopicRequestTypeID: "messages.createForumTopic#2f98c3d5", MessagesDeleteTopicHistoryRequestTypeID: "messages.deleteTopicHistory#d2816f10", + MessagesGetEmojiGameInfoRequestTypeID: "messages.getEmojiGameInfo#fb7e8ca7", + MessagesSummarizeTextRequestTypeID: "messages.summarizeText#9d4104e2", + MessagesEditChatCreatorRequestTypeID: "messages.editChatCreator#f743b857", + MessagesGetFutureChatCreatorAfterLeaveRequestTypeID: "messages.getFutureChatCreatorAfterLeave#3b7d0ea6", + MessagesEditChatParticipantRankRequestTypeID: "messages.editChatParticipantRank#a00f32b0", + MessagesDeclineURLAuthRequestTypeID: "messages.declineUrlAuth#35436bbc", + MessagesCheckURLAuthMatchCodeRequestTypeID: "messages.checkUrlAuthMatchCode#c9a47b0b", UpdatesGetStateRequestTypeID: "updates.getState#edd4882a", UpdatesGetDifferenceRequestTypeID: "updates.getDifference#19c2f763", UpdatesGetChannelDifferenceRequestTypeID: "updates.getChannelDifference#3173d78", @@ -2025,7 +2071,7 @@ func TypesMap() map[uint32]string { ChannelsGetChannelsRequestTypeID: "channels.getChannels#a7f6bbb", ChannelsGetFullChannelRequestTypeID: "channels.getFullChannel#8736a09", ChannelsCreateChannelRequestTypeID: "channels.createChannel#91006707", - ChannelsEditAdminRequestTypeID: "channels.editAdmin#d33c8902", + ChannelsEditAdminRequestTypeID: "channels.editAdmin#9a98ad68", ChannelsEditTitleRequestTypeID: "channels.editTitle#566decd0", ChannelsEditPhotoRequestTypeID: "channels.editPhoto#f12e57c9", ChannelsCheckUsernameRequestTypeID: "channels.checkUsername#10e6bd2c", @@ -2046,7 +2092,6 @@ func TypesMap() map[uint32]string { ChannelsGetLeftChannelsRequestTypeID: "channels.getLeftChannels#8341ecc0", ChannelsGetGroupsForDiscussionRequestTypeID: "channels.getGroupsForDiscussion#f5dad378", ChannelsSetDiscussionGroupRequestTypeID: "channels.setDiscussionGroup#40582bb2", - ChannelsEditCreatorRequestTypeID: "channels.editCreator#8f38cd1f", ChannelsEditLocationRequestTypeID: "channels.editLocation#58e63f6d", ChannelsToggleSlowModeRequestTypeID: "channels.toggleSlowMode#edd49ef0", ChannelsGetInactiveChannelsRequestTypeID: "channels.getInactiveChannels#11e831ee", @@ -2165,6 +2210,11 @@ func TypesMap() map[uint32]string { PaymentsGetStarGiftAuctionStateRequestTypeID: "payments.getStarGiftAuctionState#5c9ff4d6", PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID: "payments.getStarGiftAuctionAcquiredGifts#6ba2cbec", PaymentsGetStarGiftActiveAuctionsRequestTypeID: "payments.getStarGiftActiveAuctions#a5d0514d", + PaymentsResolveStarGiftOfferRequestTypeID: "payments.resolveStarGiftOffer#e9ce781c", + PaymentsSendStarGiftOfferRequestTypeID: "payments.sendStarGiftOffer#8fb86b41", + PaymentsGetStarGiftUpgradeAttributesRequestTypeID: "payments.getStarGiftUpgradeAttributes#6d038b58", + PaymentsGetCraftStarGiftsRequestTypeID: "payments.getCraftStarGifts#fd05dd00", + PaymentsCraftStarGiftRequestTypeID: "payments.craftStarGift#b0f9684f", StickersCreateStickerSetRequestTypeID: "stickers.createStickerSet#9021ab67", StickersRemoveStickerFromSetRequestTypeID: "stickers.removeStickerFromSet#f7760f51", StickersChangeStickerPositionRequestTypeID: "stickers.changeStickerPosition#ffb6d4ca", @@ -2347,6 +2397,7 @@ func NamesMap() map[string]uint32 { "inputMediaWebPage": InputMediaWebPageTypeID, "inputMediaPaidMedia": InputMediaPaidMediaTypeID, "inputMediaTodo": InputMediaTodoTypeID, + "inputMediaStakeDice": InputMediaStakeDiceTypeID, "inputChatPhotoEmpty": InputChatPhotoEmptyTypeID, "inputChatUploadedPhoto": InputChatUploadedPhotoTypeID, "inputChatPhoto": InputChatPhotoTypeID, @@ -2481,6 +2532,12 @@ func NamesMap() map[string]uint32 { "messageActionSuggestedPostRefund": MessageActionSuggestedPostRefundTypeID, "messageActionGiftTon": MessageActionGiftTonTypeID, "messageActionSuggestBirthday": MessageActionSuggestBirthdayTypeID, + "messageActionStarGiftPurchaseOffer": MessageActionStarGiftPurchaseOfferTypeID, + "messageActionStarGiftPurchaseOfferDeclined": MessageActionStarGiftPurchaseOfferDeclinedTypeID, + "messageActionNewCreatorPending": MessageActionNewCreatorPendingTypeID, + "messageActionChangeCreator": MessageActionChangeCreatorTypeID, + "messageActionNoForwardsToggle": MessageActionNoForwardsToggleTypeID, + "messageActionNoForwardsRequest": MessageActionNoForwardsRequestTypeID, "dialog": DialogTypeID, "dialogFolder": DialogFolderTypeID, "photoEmpty": PhotoEmptyTypeID, @@ -2706,6 +2763,9 @@ func NamesMap() map[string]uint32 { "updateDeleteGroupCallMessages": UpdateDeleteGroupCallMessagesTypeID, "updateStarGiftAuctionState": UpdateStarGiftAuctionStateTypeID, "updateStarGiftAuctionUserState": UpdateStarGiftAuctionUserStateTypeID, + "updateEmojiGameInfo": UpdateEmojiGameInfoTypeID, + "updateStarGiftCraftFail": UpdateStarGiftCraftFailTypeID, + "updateChatParticipantRank": UpdateChatParticipantRankTypeID, "updates.state": UpdatesStateTypeID, "updates.differenceEmpty": UpdatesDifferenceEmptyTypeID, "updates.difference": UpdatesDifferenceTypeID, @@ -2922,6 +2982,7 @@ func NamesMap() map[string]uint32 { "messageEntitySpoiler": MessageEntitySpoilerTypeID, "messageEntityCustomEmoji": MessageEntityCustomEmojiTypeID, "messageEntityBlockquote": MessageEntityBlockquoteTypeID, + "messageEntityFormattedDate": MessageEntityFormattedDateTypeID, "inputChannelEmpty": InputChannelEmptyTypeID, "inputChannel": InputChannelTypeID, "inputChannelFromMessage": InputChannelFromMessageTypeID, @@ -3184,6 +3245,7 @@ func NamesMap() map[string]uint32 { "channelAdminLogEventActionToggleSignatureProfiles": ChannelAdminLogEventActionToggleSignatureProfilesTypeID, "channelAdminLogEventActionParticipantSubExtend": ChannelAdminLogEventActionParticipantSubExtendTypeID, "channelAdminLogEventActionToggleAutotranslation": ChannelAdminLogEventActionToggleAutotranslationTypeID, + "channelAdminLogEventActionParticipantEditRank": ChannelAdminLogEventActionParticipantEditRankTypeID, "channelAdminLogEvent": ChannelAdminLogEventTypeID, "channels.adminLogResults": ChannelsAdminLogResultsTypeID, "channelAdminLogEventsFilter": ChannelAdminLogEventsFilterTypeID, @@ -3820,6 +3882,27 @@ func NamesMap() map[string]uint32 { "payments.starGiftActiveAuctions": PaymentsStarGiftActiveAuctionsTypeID, "inputStarGiftAuction": InputStarGiftAuctionTypeID, "inputStarGiftAuctionSlug": InputStarGiftAuctionSlugTypeID, + "passkey": PasskeyTypeID, + "account.passkeys": AccountPasskeysTypeID, + "account.passkeyRegistrationOptions": AccountPasskeyRegistrationOptionsTypeID, + "auth.passkeyLoginOptions": AuthPasskeyLoginOptionsTypeID, + "inputPasskeyResponseRegister": InputPasskeyResponseRegisterTypeID, + "inputPasskeyResponseLogin": InputPasskeyResponseLoginTypeID, + "inputPasskeyCredentialPublicKey": InputPasskeyCredentialPublicKeyTypeID, + "inputPasskeyCredentialFirebasePNV": InputPasskeyCredentialFirebasePNVTypeID, + "starGiftBackground": StarGiftBackgroundTypeID, + "starGiftAuctionRound": StarGiftAuctionRoundTypeID, + "starGiftAuctionRoundExtendable": StarGiftAuctionRoundExtendableTypeID, + "payments.starGiftUpgradeAttributes": PaymentsStarGiftUpgradeAttributesTypeID, + "messages.emojiGameOutcome": MessagesEmojiGameOutcomeTypeID, + "messages.emojiGameUnavailable": MessagesEmojiGameUnavailableTypeID, + "messages.emojiGameDiceInfo": MessagesEmojiGameDiceInfoTypeID, + "starGiftAttributeRarity": StarGiftAttributeRarityTypeID, + "starGiftAttributeRarityUncommon": StarGiftAttributeRarityUncommonTypeID, + "starGiftAttributeRarityRare": StarGiftAttributeRarityRareTypeID, + "starGiftAttributeRarityEpic": StarGiftAttributeRarityEpicTypeID, + "starGiftAttributeRarityLegendary": StarGiftAttributeRarityLegendaryTypeID, + "keyboardButtonStyle": KeyboardButtonStyleTypeID, "invokeAfterMsg": InvokeAfterMsgRequestTypeID, "invokeAfterMsgs": InvokeAfterMsgsRequestTypeID, "initConnection": InitConnectionRequestTypeID, @@ -3855,6 +3938,8 @@ func NamesMap() map[string]uint32 { "auth.resetLoginEmail": AuthResetLoginEmailRequestTypeID, "auth.reportMissingCode": AuthReportMissingCodeRequestTypeID, "auth.checkPaidAuth": AuthCheckPaidAuthRequestTypeID, + "auth.initPasskeyLogin": AuthInitPasskeyLoginRequestTypeID, + "auth.finishPasskeyLogin": AuthFinishPasskeyLoginRequestTypeID, "account.registerDevice": AccountRegisterDeviceRequestTypeID, "account.unregisterDevice": AccountUnregisterDeviceRequestTypeID, "account.updateNotifySettings": AccountUpdateNotifySettingsRequestTypeID, @@ -3974,6 +4059,10 @@ func NamesMap() map[string]uint32 { "account.saveMusic": AccountSaveMusicRequestTypeID, "account.getSavedMusicIds": AccountGetSavedMusicIDsRequestTypeID, "account.getUniqueGiftChatThemes": AccountGetUniqueGiftChatThemesRequestTypeID, + "account.initPasskeyRegistration": AccountInitPasskeyRegistrationRequestTypeID, + "account.registerPasskey": AccountRegisterPasskeyRequestTypeID, + "account.getPasskeys": AccountGetPasskeysRequestTypeID, + "account.deletePasskey": AccountDeletePasskeyRequestTypeID, "users.getUsers": UsersGetUsersRequestTypeID, "users.getFullUser": UsersGetFullUserRequestTypeID, "users.setSecureValueErrors": UsersSetSecureValueErrorsRequestTypeID, @@ -4246,6 +4335,13 @@ func NamesMap() map[string]uint32 { "messages.reorderPinnedForumTopics": MessagesReorderPinnedForumTopicsRequestTypeID, "messages.createForumTopic": MessagesCreateForumTopicRequestTypeID, "messages.deleteTopicHistory": MessagesDeleteTopicHistoryRequestTypeID, + "messages.getEmojiGameInfo": MessagesGetEmojiGameInfoRequestTypeID, + "messages.summarizeText": MessagesSummarizeTextRequestTypeID, + "messages.editChatCreator": MessagesEditChatCreatorRequestTypeID, + "messages.getFutureChatCreatorAfterLeave": MessagesGetFutureChatCreatorAfterLeaveRequestTypeID, + "messages.editChatParticipantRank": MessagesEditChatParticipantRankRequestTypeID, + "messages.declineUrlAuth": MessagesDeclineURLAuthRequestTypeID, + "messages.checkUrlAuthMatchCode": MessagesCheckURLAuthMatchCodeRequestTypeID, "updates.getState": UpdatesGetStateRequestTypeID, "updates.getDifference": UpdatesGetDifferenceRequestTypeID, "updates.getChannelDifference": UpdatesGetChannelDifferenceRequestTypeID, @@ -4317,7 +4413,6 @@ func NamesMap() map[string]uint32 { "channels.getLeftChannels": ChannelsGetLeftChannelsRequestTypeID, "channels.getGroupsForDiscussion": ChannelsGetGroupsForDiscussionRequestTypeID, "channels.setDiscussionGroup": ChannelsSetDiscussionGroupRequestTypeID, - "channels.editCreator": ChannelsEditCreatorRequestTypeID, "channels.editLocation": ChannelsEditLocationRequestTypeID, "channels.toggleSlowMode": ChannelsToggleSlowModeRequestTypeID, "channels.getInactiveChannels": ChannelsGetInactiveChannelsRequestTypeID, @@ -4436,6 +4531,11 @@ func NamesMap() map[string]uint32 { "payments.getStarGiftAuctionState": PaymentsGetStarGiftAuctionStateRequestTypeID, "payments.getStarGiftAuctionAcquiredGifts": PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID, "payments.getStarGiftActiveAuctions": PaymentsGetStarGiftActiveAuctionsRequestTypeID, + "payments.resolveStarGiftOffer": PaymentsResolveStarGiftOfferRequestTypeID, + "payments.sendStarGiftOffer": PaymentsSendStarGiftOfferRequestTypeID, + "payments.getStarGiftUpgradeAttributes": PaymentsGetStarGiftUpgradeAttributesRequestTypeID, + "payments.getCraftStarGifts": PaymentsGetCraftStarGiftsRequestTypeID, + "payments.craftStarGift": PaymentsCraftStarGiftRequestTypeID, "stickers.createStickerSet": StickersCreateStickerSetRequestTypeID, "stickers.removeStickerFromSet": StickersRemoveStickerFromSetRequestTypeID, "stickers.changeStickerPosition": StickersChangeStickerPositionRequestTypeID, @@ -4618,6 +4718,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputMediaWebPageTypeID: func() bin.Object { return &InputMediaWebPage{} }, InputMediaPaidMediaTypeID: func() bin.Object { return &InputMediaPaidMedia{} }, InputMediaTodoTypeID: func() bin.Object { return &InputMediaTodo{} }, + InputMediaStakeDiceTypeID: func() bin.Object { return &InputMediaStakeDice{} }, InputChatPhotoEmptyTypeID: func() bin.Object { return &InputChatPhotoEmpty{} }, InputChatUploadedPhotoTypeID: func() bin.Object { return &InputChatUploadedPhoto{} }, InputChatPhotoTypeID: func() bin.Object { return &InputChatPhoto{} }, @@ -4752,6 +4853,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageActionSuggestedPostRefundTypeID: func() bin.Object { return &MessageActionSuggestedPostRefund{} }, MessageActionGiftTonTypeID: func() bin.Object { return &MessageActionGiftTon{} }, MessageActionSuggestBirthdayTypeID: func() bin.Object { return &MessageActionSuggestBirthday{} }, + MessageActionStarGiftPurchaseOfferTypeID: func() bin.Object { return &MessageActionStarGiftPurchaseOffer{} }, + MessageActionStarGiftPurchaseOfferDeclinedTypeID: func() bin.Object { return &MessageActionStarGiftPurchaseOfferDeclined{} }, + MessageActionNewCreatorPendingTypeID: func() bin.Object { return &MessageActionNewCreatorPending{} }, + MessageActionChangeCreatorTypeID: func() bin.Object { return &MessageActionChangeCreator{} }, + MessageActionNoForwardsToggleTypeID: func() bin.Object { return &MessageActionNoForwardsToggle{} }, + MessageActionNoForwardsRequestTypeID: func() bin.Object { return &MessageActionNoForwardsRequest{} }, DialogTypeID: func() bin.Object { return &Dialog{} }, DialogFolderTypeID: func() bin.Object { return &DialogFolder{} }, PhotoEmptyTypeID: func() bin.Object { return &PhotoEmpty{} }, @@ -4977,6 +5084,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateDeleteGroupCallMessagesTypeID: func() bin.Object { return &UpdateDeleteGroupCallMessages{} }, UpdateStarGiftAuctionStateTypeID: func() bin.Object { return &UpdateStarGiftAuctionState{} }, UpdateStarGiftAuctionUserStateTypeID: func() bin.Object { return &UpdateStarGiftAuctionUserState{} }, + UpdateEmojiGameInfoTypeID: func() bin.Object { return &UpdateEmojiGameInfo{} }, + UpdateStarGiftCraftFailTypeID: func() bin.Object { return &UpdateStarGiftCraftFail{} }, + UpdateChatParticipantRankTypeID: func() bin.Object { return &UpdateChatParticipantRank{} }, UpdatesStateTypeID: func() bin.Object { return &UpdatesState{} }, UpdatesDifferenceEmptyTypeID: func() bin.Object { return &UpdatesDifferenceEmpty{} }, UpdatesDifferenceTypeID: func() bin.Object { return &UpdatesDifference{} }, @@ -5193,6 +5303,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageEntitySpoilerTypeID: func() bin.Object { return &MessageEntitySpoiler{} }, MessageEntityCustomEmojiTypeID: func() bin.Object { return &MessageEntityCustomEmoji{} }, MessageEntityBlockquoteTypeID: func() bin.Object { return &MessageEntityBlockquote{} }, + MessageEntityFormattedDateTypeID: func() bin.Object { return &MessageEntityFormattedDate{} }, InputChannelEmptyTypeID: func() bin.Object { return &InputChannelEmpty{} }, InputChannelTypeID: func() bin.Object { return &InputChannel{} }, InputChannelFromMessageTypeID: func() bin.Object { return &InputChannelFromMessage{} }, @@ -5455,6 +5566,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelAdminLogEventActionToggleSignatureProfilesTypeID: func() bin.Object { return &ChannelAdminLogEventActionToggleSignatureProfiles{} }, ChannelAdminLogEventActionParticipantSubExtendTypeID: func() bin.Object { return &ChannelAdminLogEventActionParticipantSubExtend{} }, ChannelAdminLogEventActionToggleAutotranslationTypeID: func() bin.Object { return &ChannelAdminLogEventActionToggleAutotranslation{} }, + ChannelAdminLogEventActionParticipantEditRankTypeID: func() bin.Object { return &ChannelAdminLogEventActionParticipantEditRank{} }, ChannelAdminLogEventTypeID: func() bin.Object { return &ChannelAdminLogEvent{} }, ChannelsAdminLogResultsTypeID: func() bin.Object { return &ChannelsAdminLogResults{} }, ChannelAdminLogEventsFilterTypeID: func() bin.Object { return &ChannelAdminLogEventsFilter{} }, @@ -6091,6 +6203,27 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PaymentsStarGiftActiveAuctionsTypeID: func() bin.Object { return &PaymentsStarGiftActiveAuctions{} }, InputStarGiftAuctionTypeID: func() bin.Object { return &InputStarGiftAuction{} }, InputStarGiftAuctionSlugTypeID: func() bin.Object { return &InputStarGiftAuctionSlug{} }, + PasskeyTypeID: func() bin.Object { return &Passkey{} }, + AccountPasskeysTypeID: func() bin.Object { return &AccountPasskeys{} }, + AccountPasskeyRegistrationOptionsTypeID: func() bin.Object { return &AccountPasskeyRegistrationOptions{} }, + AuthPasskeyLoginOptionsTypeID: func() bin.Object { return &AuthPasskeyLoginOptions{} }, + InputPasskeyResponseRegisterTypeID: func() bin.Object { return &InputPasskeyResponseRegister{} }, + InputPasskeyResponseLoginTypeID: func() bin.Object { return &InputPasskeyResponseLogin{} }, + InputPasskeyCredentialPublicKeyTypeID: func() bin.Object { return &InputPasskeyCredentialPublicKey{} }, + InputPasskeyCredentialFirebasePNVTypeID: func() bin.Object { return &InputPasskeyCredentialFirebasePNV{} }, + StarGiftBackgroundTypeID: func() bin.Object { return &StarGiftBackground{} }, + StarGiftAuctionRoundTypeID: func() bin.Object { return &StarGiftAuctionRound{} }, + StarGiftAuctionRoundExtendableTypeID: func() bin.Object { return &StarGiftAuctionRoundExtendable{} }, + PaymentsStarGiftUpgradeAttributesTypeID: func() bin.Object { return &PaymentsStarGiftUpgradeAttributes{} }, + MessagesEmojiGameOutcomeTypeID: func() bin.Object { return &MessagesEmojiGameOutcome{} }, + MessagesEmojiGameUnavailableTypeID: func() bin.Object { return &MessagesEmojiGameUnavailable{} }, + MessagesEmojiGameDiceInfoTypeID: func() bin.Object { return &MessagesEmojiGameDiceInfo{} }, + StarGiftAttributeRarityTypeID: func() bin.Object { return &StarGiftAttributeRarity{} }, + StarGiftAttributeRarityUncommonTypeID: func() bin.Object { return &StarGiftAttributeRarityUncommon{} }, + StarGiftAttributeRarityRareTypeID: func() bin.Object { return &StarGiftAttributeRarityRare{} }, + StarGiftAttributeRarityEpicTypeID: func() bin.Object { return &StarGiftAttributeRarityEpic{} }, + StarGiftAttributeRarityLegendaryTypeID: func() bin.Object { return &StarGiftAttributeRarityLegendary{} }, + KeyboardButtonStyleTypeID: func() bin.Object { return &KeyboardButtonStyle{} }, InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} }, InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} }, InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} }, @@ -6126,6 +6259,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AuthResetLoginEmailRequestTypeID: func() bin.Object { return &AuthResetLoginEmailRequest{} }, AuthReportMissingCodeRequestTypeID: func() bin.Object { return &AuthReportMissingCodeRequest{} }, AuthCheckPaidAuthRequestTypeID: func() bin.Object { return &AuthCheckPaidAuthRequest{} }, + AuthInitPasskeyLoginRequestTypeID: func() bin.Object { return &AuthInitPasskeyLoginRequest{} }, + AuthFinishPasskeyLoginRequestTypeID: func() bin.Object { return &AuthFinishPasskeyLoginRequest{} }, AccountRegisterDeviceRequestTypeID: func() bin.Object { return &AccountRegisterDeviceRequest{} }, AccountUnregisterDeviceRequestTypeID: func() bin.Object { return &AccountUnregisterDeviceRequest{} }, AccountUpdateNotifySettingsRequestTypeID: func() bin.Object { return &AccountUpdateNotifySettingsRequest{} }, @@ -6245,6 +6380,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AccountSaveMusicRequestTypeID: func() bin.Object { return &AccountSaveMusicRequest{} }, AccountGetSavedMusicIDsRequestTypeID: func() bin.Object { return &AccountGetSavedMusicIDsRequest{} }, AccountGetUniqueGiftChatThemesRequestTypeID: func() bin.Object { return &AccountGetUniqueGiftChatThemesRequest{} }, + AccountInitPasskeyRegistrationRequestTypeID: func() bin.Object { return &AccountInitPasskeyRegistrationRequest{} }, + AccountRegisterPasskeyRequestTypeID: func() bin.Object { return &AccountRegisterPasskeyRequest{} }, + AccountGetPasskeysRequestTypeID: func() bin.Object { return &AccountGetPasskeysRequest{} }, + AccountDeletePasskeyRequestTypeID: func() bin.Object { return &AccountDeletePasskeyRequest{} }, UsersGetUsersRequestTypeID: func() bin.Object { return &UsersGetUsersRequest{} }, UsersGetFullUserRequestTypeID: func() bin.Object { return &UsersGetFullUserRequest{} }, UsersSetSecureValueErrorsRequestTypeID: func() bin.Object { return &UsersSetSecureValueErrorsRequest{} }, @@ -6517,6 +6656,13 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagesReorderPinnedForumTopicsRequestTypeID: func() bin.Object { return &MessagesReorderPinnedForumTopicsRequest{} }, MessagesCreateForumTopicRequestTypeID: func() bin.Object { return &MessagesCreateForumTopicRequest{} }, MessagesDeleteTopicHistoryRequestTypeID: func() bin.Object { return &MessagesDeleteTopicHistoryRequest{} }, + MessagesGetEmojiGameInfoRequestTypeID: func() bin.Object { return &MessagesGetEmojiGameInfoRequest{} }, + MessagesSummarizeTextRequestTypeID: func() bin.Object { return &MessagesSummarizeTextRequest{} }, + MessagesEditChatCreatorRequestTypeID: func() bin.Object { return &MessagesEditChatCreatorRequest{} }, + MessagesGetFutureChatCreatorAfterLeaveRequestTypeID: func() bin.Object { return &MessagesGetFutureChatCreatorAfterLeaveRequest{} }, + MessagesEditChatParticipantRankRequestTypeID: func() bin.Object { return &MessagesEditChatParticipantRankRequest{} }, + MessagesDeclineURLAuthRequestTypeID: func() bin.Object { return &MessagesDeclineURLAuthRequest{} }, + MessagesCheckURLAuthMatchCodeRequestTypeID: func() bin.Object { return &MessagesCheckURLAuthMatchCodeRequest{} }, UpdatesGetStateRequestTypeID: func() bin.Object { return &UpdatesGetStateRequest{} }, UpdatesGetDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetDifferenceRequest{} }, UpdatesGetChannelDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} }, @@ -6588,7 +6734,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelsGetLeftChannelsRequestTypeID: func() bin.Object { return &ChannelsGetLeftChannelsRequest{} }, ChannelsGetGroupsForDiscussionRequestTypeID: func() bin.Object { return &ChannelsGetGroupsForDiscussionRequest{} }, ChannelsSetDiscussionGroupRequestTypeID: func() bin.Object { return &ChannelsSetDiscussionGroupRequest{} }, - ChannelsEditCreatorRequestTypeID: func() bin.Object { return &ChannelsEditCreatorRequest{} }, ChannelsEditLocationRequestTypeID: func() bin.Object { return &ChannelsEditLocationRequest{} }, ChannelsToggleSlowModeRequestTypeID: func() bin.Object { return &ChannelsToggleSlowModeRequest{} }, ChannelsGetInactiveChannelsRequestTypeID: func() bin.Object { return &ChannelsGetInactiveChannelsRequest{} }, @@ -6707,6 +6852,11 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PaymentsGetStarGiftAuctionStateRequestTypeID: func() bin.Object { return &PaymentsGetStarGiftAuctionStateRequest{} }, PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID: func() bin.Object { return &PaymentsGetStarGiftAuctionAcquiredGiftsRequest{} }, PaymentsGetStarGiftActiveAuctionsRequestTypeID: func() bin.Object { return &PaymentsGetStarGiftActiveAuctionsRequest{} }, + PaymentsResolveStarGiftOfferRequestTypeID: func() bin.Object { return &PaymentsResolveStarGiftOfferRequest{} }, + PaymentsSendStarGiftOfferRequestTypeID: func() bin.Object { return &PaymentsSendStarGiftOfferRequest{} }, + PaymentsGetStarGiftUpgradeAttributesRequestTypeID: func() bin.Object { return &PaymentsGetStarGiftUpgradeAttributesRequest{} }, + PaymentsGetCraftStarGiftsRequestTypeID: func() bin.Object { return &PaymentsGetCraftStarGiftsRequest{} }, + PaymentsCraftStarGiftRequestTypeID: func() bin.Object { return &PaymentsCraftStarGiftRequest{} }, StickersCreateStickerSetRequestTypeID: func() bin.Object { return &StickersCreateStickerSetRequest{} }, StickersRemoveStickerFromSetRequestTypeID: func() bin.Object { return &StickersRemoveStickerFromSetRequest{} }, StickersChangeStickerPositionRequestTypeID: func() bin.Object { return &StickersChangeStickerPositionRequest{} }, @@ -7031,6 +7181,7 @@ func ClassConstructorsMap() map[string][]uint32 { ChannelAdminLogEventActionToggleSignatureProfilesTypeID, ChannelAdminLogEventActionParticipantSubExtendTypeID, ChannelAdminLogEventActionToggleAutotranslationTypeID, + ChannelAdminLogEventActionParticipantEditRankTypeID, }, ChannelLocationClassName: { ChannelLocationEmptyTypeID, @@ -7403,6 +7554,7 @@ func ClassConstructorsMap() map[string][]uint32 { InputMediaWebPageTypeID, InputMediaPaidMediaTypeID, InputMediaTodoTypeID, + InputMediaStakeDiceTypeID, }, InputMessageClassName: { InputMessageIDTypeID, @@ -7417,6 +7569,14 @@ func ClassConstructorsMap() map[string][]uint32 { InputNotifyBroadcastsTypeID, InputNotifyForumTopicTypeID, }, + InputPasskeyCredentialClassName: { + InputPasskeyCredentialPublicKeyTypeID, + InputPasskeyCredentialFirebasePNVTypeID, + }, + InputPasskeyResponseClassName: { + InputPasskeyResponseRegisterTypeID, + InputPasskeyResponseLoginTypeID, + }, InputPaymentCredentialsClassName: { InputPaymentCredentialsSavedTypeID, InputPaymentCredentialsTypeID, @@ -7639,6 +7799,12 @@ func ClassConstructorsMap() map[string][]uint32 { MessageActionSuggestedPostRefundTypeID, MessageActionGiftTonTypeID, MessageActionSuggestBirthdayTypeID, + MessageActionStarGiftPurchaseOfferTypeID, + MessageActionStarGiftPurchaseOfferDeclinedTypeID, + MessageActionNewCreatorPendingTypeID, + MessageActionChangeCreatorTypeID, + MessageActionNoForwardsToggleTypeID, + MessageActionNoForwardsRequestTypeID, }, MessageClassName: { MessageEmptyTypeID, @@ -7667,6 +7833,7 @@ func ClassConstructorsMap() map[string][]uint32 { MessageEntitySpoilerTypeID, MessageEntityCustomEmojiTypeID, MessageEntityBlockquoteTypeID, + MessageEntityFormattedDateTypeID, }, MessageExtendedMediaClassName: { MessageExtendedMediaPreviewTypeID, @@ -7727,6 +7894,10 @@ func ClassConstructorsMap() map[string][]uint32 { MessagesDialogsSliceTypeID, MessagesDialogsNotModifiedTypeID, }, + MessagesEmojiGameInfoClassName: { + MessagesEmojiGameUnavailableTypeID, + MessagesEmojiGameDiceInfoTypeID, + }, MessagesEmojiGroupsClassName: { MessagesEmojiGroupsNotModifiedTypeID, MessagesEmojiGroupsTypeID, @@ -8168,6 +8339,17 @@ func ClassConstructorsMap() map[string][]uint32 { StarGiftAttributeIDPatternTypeID, StarGiftAttributeIDBackdropTypeID, }, + StarGiftAttributeRarityClassName: { + StarGiftAttributeRarityTypeID, + StarGiftAttributeRarityUncommonTypeID, + StarGiftAttributeRarityRareTypeID, + StarGiftAttributeRarityEpicTypeID, + StarGiftAttributeRarityLegendaryTypeID, + }, + StarGiftAuctionRoundClassName: { + StarGiftAuctionRoundTypeID, + StarGiftAuctionRoundExtendableTypeID, + }, StarGiftAuctionStateClassName: { StarGiftAuctionStateNotModifiedTypeID, StarGiftAuctionStateTypeID, @@ -8404,6 +8586,9 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateDeleteGroupCallMessagesTypeID, UpdateStarGiftAuctionStateTypeID, UpdateStarGiftAuctionUserStateTypeID, + UpdateEmojiGameInfoTypeID, + UpdateStarGiftCraftFailTypeID, + UpdateChatParticipantRankTypeID, }, UpdatesChannelDifferenceClassName: { UpdatesChannelDifferenceEmptyTypeID, diff --git a/pkg/gotd/tg/tl_saved_star_gift_gen.go b/pkg/gotd/tg/tl_saved_star_gift_gen.go index eb27bb50..b8b36b1f 100644 --- a/pkg/gotd/tg/tl_saved_star_gift_gen.go +++ b/pkg/gotd/tg/tl_saved_star_gift_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SavedStarGift represents TL type `savedStarGift#8983a452`. +// SavedStarGift represents TL type `savedStarGift#41df43fc`. // Represents a gift¹ owned by a peer. // // Links: @@ -160,10 +160,18 @@ type SavedStarGift struct { // // Use SetDropOriginalDetailsStars and GetDropOriginalDetailsStars helpers. DropOriginalDetailsStars int64 + // GiftNum field of SavedStarGift. + // + // Use SetGiftNum and GetGiftNum helpers. + GiftNum int + // CanCraftAt field of SavedStarGift. + // + // Use SetCanCraftAt and GetCanCraftAt helpers. + CanCraftAt int } // SavedStarGiftTypeID is TL type id of SavedStarGift. -const SavedStarGiftTypeID = 0x8983a452 +const SavedStarGiftTypeID = 0x41df43fc // Ensuring interfaces in compile-time for SavedStarGift. var ( @@ -243,6 +251,12 @@ func (s *SavedStarGift) Zero() bool { if !(s.DropOriginalDetailsStars == 0) { return false } + if !(s.GiftNum == 0) { + return false + } + if !(s.CanCraftAt == 0) { + return false + } return true } @@ -279,6 +293,8 @@ func (s *SavedStarGift) FillFrom(from interface { GetCollectionID() (value []int, ok bool) GetPrepaidUpgradeHash() (value string, ok bool) GetDropOriginalDetailsStars() (value int64, ok bool) + GetGiftNum() (value int, ok bool) + GetCanCraftAt() (value int, ok bool) }) { s.NameHidden = from.GetNameHidden() s.Unsaved = from.GetUnsaved() @@ -340,6 +356,14 @@ func (s *SavedStarGift) FillFrom(from interface { s.DropOriginalDetailsStars = val } + if val, ok := from.GetGiftNum(); ok { + s.GiftNum = val + } + + if val, ok := from.GetCanCraftAt(); ok { + s.CanCraftAt = val + } + } // TypeID returns type id in TL schema. @@ -468,6 +492,16 @@ func (s *SavedStarGift) TypeInfo() tdp.Type { SchemaName: "drop_original_details_stars", Null: !s.Flags.Has(18), }, + { + Name: "GiftNum", + SchemaName: "gift_num", + Null: !s.Flags.Has(19), + }, + { + Name: "CanCraftAt", + SchemaName: "can_craft_at", + Null: !s.Flags.Has(20), + }, } return typ } @@ -531,12 +565,18 @@ func (s *SavedStarGift) SetFlags() { if !(s.DropOriginalDetailsStars == 0) { s.Flags.Set(18) } + if !(s.GiftNum == 0) { + s.Flags.Set(19) + } + if !(s.CanCraftAt == 0) { + s.Flags.Set(20) + } } // Encode implements bin.Encoder. func (s *SavedStarGift) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode savedStarGift#8983a452 as nil") + return fmt.Errorf("can't encode savedStarGift#41df43fc as nil") } b.PutID(SavedStarGiftTypeID) return s.EncodeBare(b) @@ -545,30 +585,30 @@ func (s *SavedStarGift) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SavedStarGift) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode savedStarGift#8983a452 as nil") + return fmt.Errorf("can't encode savedStarGift#41df43fc as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode savedStarGift#8983a452: field flags: %w", err) + return fmt.Errorf("unable to encode savedStarGift#41df43fc: field flags: %w", err) } if s.Flags.Has(1) { if s.FromID == nil { - return fmt.Errorf("unable to encode savedStarGift#8983a452: field from_id is nil") + return fmt.Errorf("unable to encode savedStarGift#41df43fc: field from_id is nil") } if err := s.FromID.Encode(b); err != nil { - return fmt.Errorf("unable to encode savedStarGift#8983a452: field from_id: %w", err) + return fmt.Errorf("unable to encode savedStarGift#41df43fc: field from_id: %w", err) } } b.PutInt(s.Date) if s.Gift == nil { - return fmt.Errorf("unable to encode savedStarGift#8983a452: field gift is nil") + return fmt.Errorf("unable to encode savedStarGift#41df43fc: field gift is nil") } if err := s.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode savedStarGift#8983a452: field gift: %w", err) + return fmt.Errorf("unable to encode savedStarGift#41df43fc: field gift: %w", err) } if s.Flags.Has(2) { if err := s.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode savedStarGift#8983a452: field message: %w", err) + return fmt.Errorf("unable to encode savedStarGift#41df43fc: field message: %w", err) } } if s.Flags.Has(3) { @@ -607,16 +647,22 @@ func (s *SavedStarGift) EncodeBare(b *bin.Buffer) error { if s.Flags.Has(18) { b.PutLong(s.DropOriginalDetailsStars) } + if s.Flags.Has(19) { + b.PutInt(s.GiftNum) + } + if s.Flags.Has(20) { + b.PutInt(s.CanCraftAt) + } return nil } // Decode implements bin.Decoder. func (s *SavedStarGift) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode savedStarGift#8983a452 to nil") + return fmt.Errorf("can't decode savedStarGift#41df43fc to nil") } if err := b.ConsumeID(SavedStarGiftTypeID); err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: %w", err) } return s.DecodeBare(b) } @@ -624,11 +670,11 @@ func (s *SavedStarGift) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SavedStarGift) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode savedStarGift#8983a452 to nil") + return fmt.Errorf("can't decode savedStarGift#41df43fc to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field flags: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field flags: %w", err) } } s.NameHidden = s.Flags.Has(0) @@ -640,89 +686,89 @@ func (s *SavedStarGift) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(1) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field from_id: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field from_id: %w", err) } s.FromID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field date: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field date: %w", err) } s.Date = value } { value, err := DecodeStarGift(b) if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field gift: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field gift: %w", err) } s.Gift = value } if s.Flags.Has(2) { if err := s.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field message: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field message: %w", err) } } if s.Flags.Has(3) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field msg_id: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field msg_id: %w", err) } s.MsgID = value } if s.Flags.Has(11) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field saved_id: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field saved_id: %w", err) } s.SavedID = value } if s.Flags.Has(4) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field convert_stars: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field convert_stars: %w", err) } s.ConvertStars = value } if s.Flags.Has(6) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field upgrade_stars: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field upgrade_stars: %w", err) } s.UpgradeStars = value } if s.Flags.Has(7) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field can_export_at: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_export_at: %w", err) } s.CanExportAt = value } if s.Flags.Has(8) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field transfer_stars: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field transfer_stars: %w", err) } s.TransferStars = value } if s.Flags.Has(13) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field can_transfer_at: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_transfer_at: %w", err) } s.CanTransferAt = value } if s.Flags.Has(14) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field can_resell_at: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_resell_at: %w", err) } s.CanResellAt = value } if s.Flags.Has(15) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field collection_id: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field collection_id: %w", err) } if headerLen > 0 { @@ -731,7 +777,7 @@ func (s *SavedStarGift) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field collection_id: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field collection_id: %w", err) } s.CollectionID = append(s.CollectionID, value) } @@ -739,17 +785,31 @@ func (s *SavedStarGift) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(16) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field prepaid_upgrade_hash: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field prepaid_upgrade_hash: %w", err) } s.PrepaidUpgradeHash = value } if s.Flags.Has(18) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode savedStarGift#8983a452: field drop_original_details_stars: %w", err) + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field drop_original_details_stars: %w", err) } s.DropOriginalDetailsStars = value } + if s.Flags.Has(19) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field gift_num: %w", err) + } + s.GiftNum = value + } + if s.Flags.Has(20) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_craft_at: %w", err) + } + s.CanCraftAt = value + } return nil } @@ -1116,3 +1176,39 @@ func (s *SavedStarGift) GetDropOriginalDetailsStars() (value int64, ok bool) { } return s.DropOriginalDetailsStars, true } + +// SetGiftNum sets value of GiftNum conditional field. +func (s *SavedStarGift) SetGiftNum(value int) { + s.Flags.Set(19) + s.GiftNum = value +} + +// GetGiftNum returns value of GiftNum conditional field and +// boolean which is true if field was set. +func (s *SavedStarGift) GetGiftNum() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(19) { + return value, false + } + return s.GiftNum, true +} + +// SetCanCraftAt sets value of CanCraftAt conditional field. +func (s *SavedStarGift) SetCanCraftAt(value int) { + s.Flags.Set(20) + s.CanCraftAt = value +} + +// GetCanCraftAt returns value of CanCraftAt conditional field and +// boolean which is true if field was set. +func (s *SavedStarGift) GetCanCraftAt() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(20) { + return value, false + } + return s.CanCraftAt, true +} diff --git a/pkg/gotd/tg/tl_server_gen.go b/pkg/gotd/tg/tl_server_gen.go index 634faf0f..e54ee28b 100644 --- a/pkg/gotd/tg/tl_server_gen.go +++ b/pkg/gotd/tg/tl_server_gen.go @@ -493,6 +493,40 @@ func (s *ServerDispatcher) OnAuthCheckPaidAuth(f func(ctx context.Context, reque s.handlers[AuthCheckPaidAuthRequestTypeID] = handler } +func (s *ServerDispatcher) OnAuthInitPasskeyLogin(f func(ctx context.Context, request *AuthInitPasskeyLoginRequest) (*AuthPasskeyLoginOptions, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AuthInitPasskeyLoginRequest + 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[AuthInitPasskeyLoginRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAuthFinishPasskeyLogin(f func(ctx context.Context, request *AuthFinishPasskeyLoginRequest) (AuthAuthorizationClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AuthFinishPasskeyLoginRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &AuthAuthorizationBox{Authorization: response}, nil + } + + s.handlers[AuthFinishPasskeyLoginRequestTypeID] = handler +} + func (s *ServerDispatcher) OnAccountRegisterDevice(f func(ctx context.Context, request *AccountRegisterDeviceRequest) (bool, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request AccountRegisterDeviceRequest @@ -2744,6 +2778,78 @@ func (s *ServerDispatcher) OnAccountGetUniqueGiftChatThemes(f func(ctx context.C s.handlers[AccountGetUniqueGiftChatThemesRequestTypeID] = handler } +func (s *ServerDispatcher) OnAccountInitPasskeyRegistration(f func(ctx context.Context) (*AccountPasskeyRegistrationOptions, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountInitPasskeyRegistrationRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[AccountInitPasskeyRegistrationRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAccountRegisterPasskey(f func(ctx context.Context, credential InputPasskeyCredentialClass) (*Passkey, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountRegisterPasskeyRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Credential) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[AccountRegisterPasskeyRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAccountGetPasskeys(f func(ctx context.Context) (*AccountPasskeys, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountGetPasskeysRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[AccountGetPasskeysRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAccountDeletePasskey(f func(ctx context.Context, id string) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountDeletePasskeyRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.ID) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[AccountDeletePasskeyRequestTypeID] = handler +} + func (s *ServerDispatcher) OnUsersGetUsers(f func(ctx context.Context, id []InputUserClass) ([]UserClass, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request UsersGetUsersRequest @@ -7636,6 +7742,133 @@ func (s *ServerDispatcher) OnMessagesDeleteTopicHistory(f func(ctx context.Conte s.handlers[MessagesDeleteTopicHistoryRequestTypeID] = handler } +func (s *ServerDispatcher) OnMessagesGetEmojiGameInfo(f func(ctx context.Context) (MessagesEmojiGameInfoClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesGetEmojiGameInfoRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx) + if err != nil { + return nil, err + } + return &MessagesEmojiGameInfoBox{EmojiGameInfo: response}, nil + } + + s.handlers[MessagesGetEmojiGameInfoRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesSummarizeText(f func(ctx context.Context, request *MessagesSummarizeTextRequest) (*TextWithEntities, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesSummarizeTextRequest + 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[MessagesSummarizeTextRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesEditChatCreator(f func(ctx context.Context, request *MessagesEditChatCreatorRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesEditChatCreatorRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[MessagesEditChatCreatorRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesGetFutureChatCreatorAfterLeave(f func(ctx context.Context, peer InputPeerClass) (UserClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesGetFutureChatCreatorAfterLeaveRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Peer) + if err != nil { + return nil, err + } + return &UserBox{User: response}, nil + } + + s.handlers[MessagesGetFutureChatCreatorAfterLeaveRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesEditChatParticipantRank(f func(ctx context.Context, request *MessagesEditChatParticipantRankRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesEditChatParticipantRankRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[MessagesEditChatParticipantRankRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesDeclineURLAuth(f func(ctx context.Context, url string) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesDeclineURLAuthRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.URL) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesDeclineURLAuthRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesCheckURLAuthMatchCode(f func(ctx context.Context, request *MessagesCheckURLAuthMatchCodeRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesCheckURLAuthMatchCodeRequest + 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[MessagesCheckURLAuthMatchCodeRequestTypeID] = 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 @@ -8899,23 +9132,6 @@ func (s *ServerDispatcher) OnChannelsSetDiscussionGroup(f func(ctx context.Conte s.handlers[ChannelsSetDiscussionGroupRequestTypeID] = handler } -func (s *ServerDispatcher) OnChannelsEditCreator(f func(ctx context.Context, request *ChannelsEditCreatorRequest) (UpdatesClass, error)) { - handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { - var request ChannelsEditCreatorRequest - if err := request.Decode(b); err != nil { - return nil, err - } - - response, err := f(ctx, &request) - if err != nil { - return nil, err - } - return &UpdatesBox{Updates: response}, nil - } - - s.handlers[ChannelsEditCreatorRequestTypeID] = handler -} - func (s *ServerDispatcher) OnChannelsEditLocation(f func(ctx context.Context, request *ChannelsEditLocationRequest) (bool, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request ChannelsEditLocationRequest @@ -11058,6 +11274,91 @@ func (s *ServerDispatcher) OnPaymentsGetStarGiftActiveAuctions(f func(ctx contex s.handlers[PaymentsGetStarGiftActiveAuctionsRequestTypeID] = handler } +func (s *ServerDispatcher) OnPaymentsResolveStarGiftOffer(f func(ctx context.Context, request *PaymentsResolveStarGiftOfferRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsResolveStarGiftOfferRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[PaymentsResolveStarGiftOfferRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsSendStarGiftOffer(f func(ctx context.Context, request *PaymentsSendStarGiftOfferRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsSendStarGiftOfferRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[PaymentsSendStarGiftOfferRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsGetStarGiftUpgradeAttributes(f func(ctx context.Context, giftid int64) (*PaymentsStarGiftUpgradeAttributes, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsGetStarGiftUpgradeAttributesRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.GiftID) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[PaymentsGetStarGiftUpgradeAttributesRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsGetCraftStarGifts(f func(ctx context.Context, request *PaymentsGetCraftStarGiftsRequest) (*PaymentsSavedStarGifts, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsGetCraftStarGiftsRequest + 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[PaymentsGetCraftStarGiftsRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnPaymentsCraftStarGift(f func(ctx context.Context, stargift []InputSavedStarGiftClass) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PaymentsCraftStarGiftRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Stargift) + if err != nil { + return nil, err + } + return &UpdatesBox{Updates: response}, nil + } + + s.handlers[PaymentsCraftStarGiftRequestTypeID] = 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/pkg/gotd/tg/tl_star_gift_attribute_gen.go b/pkg/gotd/tg/tl_star_gift_attribute_gen.go index 1b90b099..80b5c058 100644 --- a/pkg/gotd/tg/tl_star_gift_attribute_gen.go +++ b/pkg/gotd/tg/tl_star_gift_attribute_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StarGiftAttributeModel represents TL type `starGiftAttributeModel#39d99013`. +// StarGiftAttributeModel represents TL type `starGiftAttributeModel#565251e2`. // The model of a collectible gift »¹. // // Links: @@ -39,6 +39,10 @@ var ( // // See https://core.telegram.org/constructor/starGiftAttributeModel for reference. type StarGiftAttributeModel struct { + // Flags field of StarGiftAttributeModel. + Flags bin.Fields + // Crafted field of StarGiftAttributeModel. + Crafted bool // Name of the model Name string // The sticker¹ representing the upgraded gift @@ -46,12 +50,12 @@ type StarGiftAttributeModel struct { // Links: // 1) https://core.telegram.org/api/stickers Document DocumentClass - // The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. - RarityPermille int + // Rarity field of StarGiftAttributeModel. + Rarity StarGiftAttributeRarityClass } // StarGiftAttributeModelTypeID is TL type id of StarGiftAttributeModel. -const StarGiftAttributeModelTypeID = 0x39d99013 +const StarGiftAttributeModelTypeID = 0x565251e2 // construct implements constructor of StarGiftAttributeClass. func (s StarGiftAttributeModel) construct() StarGiftAttributeClass { return &s } @@ -70,13 +74,19 @@ func (s *StarGiftAttributeModel) Zero() bool { if s == nil { return true } + if !(s.Flags.Zero()) { + return false + } + if !(s.Crafted == false) { + return false + } if !(s.Name == "") { return false } if !(s.Document == nil) { return false } - if !(s.RarityPermille == 0) { + if !(s.Rarity == nil) { return false } @@ -94,13 +104,15 @@ func (s *StarGiftAttributeModel) String() string { // FillFrom fills StarGiftAttributeModel from given interface. func (s *StarGiftAttributeModel) FillFrom(from interface { + GetCrafted() (value bool) GetName() (value string) GetDocument() (value DocumentClass) - GetRarityPermille() (value int) + GetRarity() (value StarGiftAttributeRarityClass) }) { + s.Crafted = from.GetCrafted() s.Name = from.GetName() s.Document = from.GetDocument() - s.RarityPermille = from.GetRarityPermille() + s.Rarity = from.GetRarity() } // TypeID returns type id in TL schema. @@ -126,6 +138,11 @@ func (s *StarGiftAttributeModel) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Crafted", + SchemaName: "crafted", + Null: !s.Flags.Has(0), + }, { Name: "Name", SchemaName: "name", @@ -135,17 +152,24 @@ func (s *StarGiftAttributeModel) TypeInfo() tdp.Type { SchemaName: "document", }, { - Name: "RarityPermille", - SchemaName: "rarity_permille", + Name: "Rarity", + SchemaName: "rarity", }, } return typ } +// SetFlags sets flags for non-zero fields. +func (s *StarGiftAttributeModel) SetFlags() { + if !(s.Crafted == false) { + s.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (s *StarGiftAttributeModel) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAttributeModel#39d99013 as nil") + return fmt.Errorf("can't encode starGiftAttributeModel#565251e2 as nil") } b.PutID(StarGiftAttributeModelTypeID) return s.EncodeBare(b) @@ -154,26 +178,35 @@ func (s *StarGiftAttributeModel) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarGiftAttributeModel) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAttributeModel#39d99013 as nil") + return fmt.Errorf("can't encode starGiftAttributeModel#565251e2 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field flags: %w", err) } b.PutString(s.Name) if s.Document == nil { - return fmt.Errorf("unable to encode starGiftAttributeModel#39d99013: field document is nil") + return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field document is nil") } if err := s.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftAttributeModel#39d99013: field document: %w", err) + return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field document: %w", err) + } + if s.Rarity == nil { + return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field rarity is nil") + } + if err := s.Rarity.Encode(b); err != nil { + return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field rarity: %w", err) } - b.PutInt(s.RarityPermille) return nil } // Decode implements bin.Decoder. func (s *StarGiftAttributeModel) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAttributeModel#39d99013 to nil") + return fmt.Errorf("can't decode starGiftAttributeModel#565251e2 to nil") } if err := b.ConsumeID(StarGiftAttributeModelTypeID); err != nil { - return fmt.Errorf("unable to decode starGiftAttributeModel#39d99013: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: %w", err) } return s.DecodeBare(b) } @@ -181,32 +214,57 @@ func (s *StarGiftAttributeModel) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarGiftAttributeModel) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAttributeModel#39d99013 to nil") + return fmt.Errorf("can't decode starGiftAttributeModel#565251e2 to nil") } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: field flags: %w", err) + } + } + s.Crafted = s.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeModel#39d99013: field name: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: field name: %w", err) } s.Name = value } { value, err := DecodeDocument(b) if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeModel#39d99013: field document: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: field document: %w", err) } s.Document = value } { - value, err := b.Int() + value, err := DecodeStarGiftAttributeRarity(b) if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeModel#39d99013: field rarity_permille: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: field rarity: %w", err) } - s.RarityPermille = value + s.Rarity = value } return nil } +// SetCrafted sets value of Crafted conditional field. +func (s *StarGiftAttributeModel) SetCrafted(value bool) { + if value { + s.Flags.Set(0) + s.Crafted = true + } else { + s.Flags.Unset(0) + s.Crafted = false + } +} + +// GetCrafted returns value of Crafted conditional field. +func (s *StarGiftAttributeModel) GetCrafted() (value bool) { + if s == nil { + return + } + return s.Flags.Has(0) +} + // GetName returns value of Name field. func (s *StarGiftAttributeModel) GetName() (value string) { if s == nil { @@ -223,15 +281,15 @@ func (s *StarGiftAttributeModel) GetDocument() (value DocumentClass) { return s.Document } -// GetRarityPermille returns value of RarityPermille field. -func (s *StarGiftAttributeModel) GetRarityPermille() (value int) { +// GetRarity returns value of Rarity field. +func (s *StarGiftAttributeModel) GetRarity() (value StarGiftAttributeRarityClass) { if s == nil { return } - return s.RarityPermille + return s.Rarity } -// StarGiftAttributePattern represents TL type `starGiftAttributePattern#13acff19`. +// StarGiftAttributePattern represents TL type `starGiftAttributePattern#4e7085ea`. // A sticker¹ applied on the backdrop of a collectible gift »² using a repeating // pattern. // @@ -245,12 +303,12 @@ type StarGiftAttributePattern struct { Name string // The symbol Document DocumentClass - // The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. - RarityPermille int + // Rarity field of StarGiftAttributePattern. + Rarity StarGiftAttributeRarityClass } // StarGiftAttributePatternTypeID is TL type id of StarGiftAttributePattern. -const StarGiftAttributePatternTypeID = 0x13acff19 +const StarGiftAttributePatternTypeID = 0x4e7085ea // construct implements constructor of StarGiftAttributeClass. func (s StarGiftAttributePattern) construct() StarGiftAttributeClass { return &s } @@ -275,7 +333,7 @@ func (s *StarGiftAttributePattern) Zero() bool { if !(s.Document == nil) { return false } - if !(s.RarityPermille == 0) { + if !(s.Rarity == nil) { return false } @@ -295,11 +353,11 @@ func (s *StarGiftAttributePattern) String() string { func (s *StarGiftAttributePattern) FillFrom(from interface { GetName() (value string) GetDocument() (value DocumentClass) - GetRarityPermille() (value int) + GetRarity() (value StarGiftAttributeRarityClass) }) { s.Name = from.GetName() s.Document = from.GetDocument() - s.RarityPermille = from.GetRarityPermille() + s.Rarity = from.GetRarity() } // TypeID returns type id in TL schema. @@ -334,8 +392,8 @@ func (s *StarGiftAttributePattern) TypeInfo() tdp.Type { SchemaName: "document", }, { - Name: "RarityPermille", - SchemaName: "rarity_permille", + Name: "Rarity", + SchemaName: "rarity", }, } return typ @@ -344,7 +402,7 @@ func (s *StarGiftAttributePattern) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *StarGiftAttributePattern) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAttributePattern#13acff19 as nil") + return fmt.Errorf("can't encode starGiftAttributePattern#4e7085ea as nil") } b.PutID(StarGiftAttributePatternTypeID) return s.EncodeBare(b) @@ -353,26 +411,31 @@ func (s *StarGiftAttributePattern) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarGiftAttributePattern) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAttributePattern#13acff19 as nil") + return fmt.Errorf("can't encode starGiftAttributePattern#4e7085ea as nil") } b.PutString(s.Name) if s.Document == nil { - return fmt.Errorf("unable to encode starGiftAttributePattern#13acff19: field document is nil") + return fmt.Errorf("unable to encode starGiftAttributePattern#4e7085ea: field document is nil") } if err := s.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftAttributePattern#13acff19: field document: %w", err) + return fmt.Errorf("unable to encode starGiftAttributePattern#4e7085ea: field document: %w", err) + } + if s.Rarity == nil { + return fmt.Errorf("unable to encode starGiftAttributePattern#4e7085ea: field rarity is nil") + } + if err := s.Rarity.Encode(b); err != nil { + return fmt.Errorf("unable to encode starGiftAttributePattern#4e7085ea: field rarity: %w", err) } - b.PutInt(s.RarityPermille) return nil } // Decode implements bin.Decoder. func (s *StarGiftAttributePattern) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAttributePattern#13acff19 to nil") + return fmt.Errorf("can't decode starGiftAttributePattern#4e7085ea to nil") } if err := b.ConsumeID(StarGiftAttributePatternTypeID); err != nil { - return fmt.Errorf("unable to decode starGiftAttributePattern#13acff19: %w", err) + return fmt.Errorf("unable to decode starGiftAttributePattern#4e7085ea: %w", err) } return s.DecodeBare(b) } @@ -380,28 +443,28 @@ func (s *StarGiftAttributePattern) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarGiftAttributePattern) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAttributePattern#13acff19 to nil") + return fmt.Errorf("can't decode starGiftAttributePattern#4e7085ea to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGiftAttributePattern#13acff19: field name: %w", err) + return fmt.Errorf("unable to decode starGiftAttributePattern#4e7085ea: field name: %w", err) } s.Name = value } { value, err := DecodeDocument(b) if err != nil { - return fmt.Errorf("unable to decode starGiftAttributePattern#13acff19: field document: %w", err) + return fmt.Errorf("unable to decode starGiftAttributePattern#4e7085ea: field document: %w", err) } s.Document = value } { - value, err := b.Int() + value, err := DecodeStarGiftAttributeRarity(b) if err != nil { - return fmt.Errorf("unable to decode starGiftAttributePattern#13acff19: field rarity_permille: %w", err) + return fmt.Errorf("unable to decode starGiftAttributePattern#4e7085ea: field rarity: %w", err) } - s.RarityPermille = value + s.Rarity = value } return nil } @@ -422,15 +485,15 @@ func (s *StarGiftAttributePattern) GetDocument() (value DocumentClass) { return s.Document } -// GetRarityPermille returns value of RarityPermille field. -func (s *StarGiftAttributePattern) GetRarityPermille() (value int) { +// GetRarity returns value of Rarity field. +func (s *StarGiftAttributePattern) GetRarity() (value StarGiftAttributeRarityClass) { if s == nil { return } - return s.RarityPermille + return s.Rarity } -// StarGiftAttributeBackdrop represents TL type `starGiftAttributeBackdrop#d93d859c`. +// StarGiftAttributeBackdrop represents TL type `starGiftAttributeBackdrop#9f2504e4`. // The backdrop of a collectible gift »¹. // // Links: @@ -453,12 +516,12 @@ type StarGiftAttributeBackdrop struct { PatternColor int // Color of the text on the backdrop in RGB24 format. TextColor int - // The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. - RarityPermille int + // Rarity field of StarGiftAttributeBackdrop. + Rarity StarGiftAttributeRarityClass } // StarGiftAttributeBackdropTypeID is TL type id of StarGiftAttributeBackdrop. -const StarGiftAttributeBackdropTypeID = 0xd93d859c +const StarGiftAttributeBackdropTypeID = 0x9f2504e4 // construct implements constructor of StarGiftAttributeClass. func (s StarGiftAttributeBackdrop) construct() StarGiftAttributeClass { return &s } @@ -495,7 +558,7 @@ func (s *StarGiftAttributeBackdrop) Zero() bool { if !(s.TextColor == 0) { return false } - if !(s.RarityPermille == 0) { + if !(s.Rarity == nil) { return false } @@ -519,7 +582,7 @@ func (s *StarGiftAttributeBackdrop) FillFrom(from interface { GetEdgeColor() (value int) GetPatternColor() (value int) GetTextColor() (value int) - GetRarityPermille() (value int) + GetRarity() (value StarGiftAttributeRarityClass) }) { s.Name = from.GetName() s.BackdropID = from.GetBackdropID() @@ -527,7 +590,7 @@ func (s *StarGiftAttributeBackdrop) FillFrom(from interface { s.EdgeColor = from.GetEdgeColor() s.PatternColor = from.GetPatternColor() s.TextColor = from.GetTextColor() - s.RarityPermille = from.GetRarityPermille() + s.Rarity = from.GetRarity() } // TypeID returns type id in TL schema. @@ -578,8 +641,8 @@ func (s *StarGiftAttributeBackdrop) TypeInfo() tdp.Type { SchemaName: "text_color", }, { - Name: "RarityPermille", - SchemaName: "rarity_permille", + Name: "Rarity", + SchemaName: "rarity", }, } return typ @@ -588,7 +651,7 @@ func (s *StarGiftAttributeBackdrop) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *StarGiftAttributeBackdrop) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAttributeBackdrop#d93d859c as nil") + return fmt.Errorf("can't encode starGiftAttributeBackdrop#9f2504e4 as nil") } b.PutID(StarGiftAttributeBackdropTypeID) return s.EncodeBare(b) @@ -597,7 +660,7 @@ func (s *StarGiftAttributeBackdrop) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarGiftAttributeBackdrop) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAttributeBackdrop#d93d859c as nil") + return fmt.Errorf("can't encode starGiftAttributeBackdrop#9f2504e4 as nil") } b.PutString(s.Name) b.PutInt(s.BackdropID) @@ -605,17 +668,22 @@ func (s *StarGiftAttributeBackdrop) EncodeBare(b *bin.Buffer) error { b.PutInt(s.EdgeColor) b.PutInt(s.PatternColor) b.PutInt(s.TextColor) - b.PutInt(s.RarityPermille) + if s.Rarity == nil { + return fmt.Errorf("unable to encode starGiftAttributeBackdrop#9f2504e4: field rarity is nil") + } + if err := s.Rarity.Encode(b); err != nil { + return fmt.Errorf("unable to encode starGiftAttributeBackdrop#9f2504e4: field rarity: %w", err) + } return nil } // Decode implements bin.Decoder. func (s *StarGiftAttributeBackdrop) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAttributeBackdrop#d93d859c to nil") + return fmt.Errorf("can't decode starGiftAttributeBackdrop#9f2504e4 to nil") } if err := b.ConsumeID(StarGiftAttributeBackdropTypeID); err != nil { - return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: %w", err) } return s.DecodeBare(b) } @@ -623,56 +691,56 @@ func (s *StarGiftAttributeBackdrop) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarGiftAttributeBackdrop) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAttributeBackdrop#d93d859c to nil") + return fmt.Errorf("can't decode starGiftAttributeBackdrop#9f2504e4 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field name: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field name: %w", err) } s.Name = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field backdrop_id: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field backdrop_id: %w", err) } s.BackdropID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field center_color: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field center_color: %w", err) } s.CenterColor = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field edge_color: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field edge_color: %w", err) } s.EdgeColor = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field pattern_color: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field pattern_color: %w", err) } s.PatternColor = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field text_color: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field text_color: %w", err) } s.TextColor = value } { - value, err := b.Int() + value, err := DecodeStarGiftAttributeRarity(b) if err != nil { - return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field rarity_permille: %w", err) + return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field rarity: %w", err) } - s.RarityPermille = value + s.Rarity = value } return nil } @@ -725,12 +793,12 @@ func (s *StarGiftAttributeBackdrop) GetTextColor() (value int) { return s.TextColor } -// GetRarityPermille returns value of RarityPermille field. -func (s *StarGiftAttributeBackdrop) GetRarityPermille() (value int) { +// GetRarity returns value of Rarity field. +func (s *StarGiftAttributeBackdrop) GetRarity() (value StarGiftAttributeRarityClass) { if s == nil { return } - return s.RarityPermille + return s.Rarity } // StarGiftAttributeOriginalDetails represents TL type `starGiftAttributeOriginalDetails#e0bff26c`. @@ -1041,9 +1109,9 @@ const StarGiftAttributeClassName = "StarGiftAttribute" // panic(err) // } // switch v := g.(type) { -// case *tg.StarGiftAttributeModel: // starGiftAttributeModel#39d99013 -// case *tg.StarGiftAttributePattern: // starGiftAttributePattern#13acff19 -// case *tg.StarGiftAttributeBackdrop: // starGiftAttributeBackdrop#d93d859c +// case *tg.StarGiftAttributeModel: // starGiftAttributeModel#565251e2 +// case *tg.StarGiftAttributePattern: // starGiftAttributePattern#4e7085ea +// case *tg.StarGiftAttributeBackdrop: // starGiftAttributeBackdrop#9f2504e4 // case *tg.StarGiftAttributeOriginalDetails: // starGiftAttributeOriginalDetails#e0bff26c // default: panic(v) // } @@ -1074,21 +1142,21 @@ func DecodeStarGiftAttribute(buf *bin.Buffer) (StarGiftAttributeClass, error) { } switch id { case StarGiftAttributeModelTypeID: - // Decoding starGiftAttributeModel#39d99013. + // Decoding starGiftAttributeModel#565251e2. v := StarGiftAttributeModel{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StarGiftAttributeClass: %w", err) } return &v, nil case StarGiftAttributePatternTypeID: - // Decoding starGiftAttributePattern#13acff19. + // Decoding starGiftAttributePattern#4e7085ea. v := StarGiftAttributePattern{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StarGiftAttributeClass: %w", err) } return &v, nil case StarGiftAttributeBackdropTypeID: - // Decoding starGiftAttributeBackdrop#d93d859c. + // Decoding starGiftAttributeBackdrop#9f2504e4. v := StarGiftAttributeBackdrop{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StarGiftAttributeClass: %w", err) diff --git a/pkg/gotd/tg/tl_star_gift_attribute_rarity_gen.go b/pkg/gotd/tg/tl_star_gift_attribute_rarity_gen.go new file mode 100644 index 00000000..092a27f6 --- /dev/null +++ b/pkg/gotd/tg/tl_star_gift_attribute_rarity_gen.go @@ -0,0 +1,683 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// StarGiftAttributeRarity represents TL type `starGiftAttributeRarity#36437737`. +// +// See https://core.telegram.org/constructor/starGiftAttributeRarity for reference. +type StarGiftAttributeRarity struct { + // Permille field of StarGiftAttributeRarity. + Permille int +} + +// StarGiftAttributeRarityTypeID is TL type id of StarGiftAttributeRarity. +const StarGiftAttributeRarityTypeID = 0x36437737 + +// construct implements constructor of StarGiftAttributeRarityClass. +func (s StarGiftAttributeRarity) construct() StarGiftAttributeRarityClass { return &s } + +// Ensuring interfaces in compile-time for StarGiftAttributeRarity. +var ( + _ bin.Encoder = &StarGiftAttributeRarity{} + _ bin.Decoder = &StarGiftAttributeRarity{} + _ bin.BareEncoder = &StarGiftAttributeRarity{} + _ bin.BareDecoder = &StarGiftAttributeRarity{} + + _ StarGiftAttributeRarityClass = &StarGiftAttributeRarity{} +) + +func (s *StarGiftAttributeRarity) Zero() bool { + if s == nil { + return true + } + if !(s.Permille == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiftAttributeRarity) String() string { + if s == nil { + return "StarGiftAttributeRarity(nil)" + } + type Alias StarGiftAttributeRarity + return fmt.Sprintf("StarGiftAttributeRarity%+v", Alias(*s)) +} + +// FillFrom fills StarGiftAttributeRarity from given interface. +func (s *StarGiftAttributeRarity) FillFrom(from interface { + GetPermille() (value int) +}) { + s.Permille = from.GetPermille() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiftAttributeRarity) TypeID() uint32 { + return StarGiftAttributeRarityTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiftAttributeRarity) TypeName() string { + return "starGiftAttributeRarity" +} + +// TypeInfo returns info about TL type. +func (s *StarGiftAttributeRarity) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiftAttributeRarity", + ID: StarGiftAttributeRarityTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Permille", + SchemaName: "permille", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiftAttributeRarity) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarity#36437737 as nil") + } + b.PutID(StarGiftAttributeRarityTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiftAttributeRarity) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarity#36437737 as nil") + } + b.PutInt(s.Permille) + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiftAttributeRarity) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarity#36437737 to nil") + } + if err := b.ConsumeID(StarGiftAttributeRarityTypeID); err != nil { + return fmt.Errorf("unable to decode starGiftAttributeRarity#36437737: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiftAttributeRarity) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarity#36437737 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAttributeRarity#36437737: field permille: %w", err) + } + s.Permille = value + } + return nil +} + +// GetPermille returns value of Permille field. +func (s *StarGiftAttributeRarity) GetPermille() (value int) { + if s == nil { + return + } + return s.Permille +} + +// StarGiftAttributeRarityUncommon represents TL type `starGiftAttributeRarityUncommon#dbce6389`. +// +// See https://core.telegram.org/constructor/starGiftAttributeRarityUncommon for reference. +type StarGiftAttributeRarityUncommon struct { +} + +// StarGiftAttributeRarityUncommonTypeID is TL type id of StarGiftAttributeRarityUncommon. +const StarGiftAttributeRarityUncommonTypeID = 0xdbce6389 + +// construct implements constructor of StarGiftAttributeRarityClass. +func (s StarGiftAttributeRarityUncommon) construct() StarGiftAttributeRarityClass { return &s } + +// Ensuring interfaces in compile-time for StarGiftAttributeRarityUncommon. +var ( + _ bin.Encoder = &StarGiftAttributeRarityUncommon{} + _ bin.Decoder = &StarGiftAttributeRarityUncommon{} + _ bin.BareEncoder = &StarGiftAttributeRarityUncommon{} + _ bin.BareDecoder = &StarGiftAttributeRarityUncommon{} + + _ StarGiftAttributeRarityClass = &StarGiftAttributeRarityUncommon{} +) + +func (s *StarGiftAttributeRarityUncommon) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiftAttributeRarityUncommon) String() string { + if s == nil { + return "StarGiftAttributeRarityUncommon(nil)" + } + type Alias StarGiftAttributeRarityUncommon + return fmt.Sprintf("StarGiftAttributeRarityUncommon%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiftAttributeRarityUncommon) TypeID() uint32 { + return StarGiftAttributeRarityUncommonTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiftAttributeRarityUncommon) TypeName() string { + return "starGiftAttributeRarityUncommon" +} + +// TypeInfo returns info about TL type. +func (s *StarGiftAttributeRarityUncommon) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiftAttributeRarityUncommon", + ID: StarGiftAttributeRarityUncommonTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiftAttributeRarityUncommon) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarityUncommon#dbce6389 as nil") + } + b.PutID(StarGiftAttributeRarityUncommonTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiftAttributeRarityUncommon) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarityUncommon#dbce6389 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiftAttributeRarityUncommon) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarityUncommon#dbce6389 to nil") + } + if err := b.ConsumeID(StarGiftAttributeRarityUncommonTypeID); err != nil { + return fmt.Errorf("unable to decode starGiftAttributeRarityUncommon#dbce6389: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiftAttributeRarityUncommon) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarityUncommon#dbce6389 to nil") + } + return nil +} + +// StarGiftAttributeRarityRare represents TL type `starGiftAttributeRarityRare#f08d516b`. +// +// See https://core.telegram.org/constructor/starGiftAttributeRarityRare for reference. +type StarGiftAttributeRarityRare struct { +} + +// StarGiftAttributeRarityRareTypeID is TL type id of StarGiftAttributeRarityRare. +const StarGiftAttributeRarityRareTypeID = 0xf08d516b + +// construct implements constructor of StarGiftAttributeRarityClass. +func (s StarGiftAttributeRarityRare) construct() StarGiftAttributeRarityClass { return &s } + +// Ensuring interfaces in compile-time for StarGiftAttributeRarityRare. +var ( + _ bin.Encoder = &StarGiftAttributeRarityRare{} + _ bin.Decoder = &StarGiftAttributeRarityRare{} + _ bin.BareEncoder = &StarGiftAttributeRarityRare{} + _ bin.BareDecoder = &StarGiftAttributeRarityRare{} + + _ StarGiftAttributeRarityClass = &StarGiftAttributeRarityRare{} +) + +func (s *StarGiftAttributeRarityRare) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiftAttributeRarityRare) String() string { + if s == nil { + return "StarGiftAttributeRarityRare(nil)" + } + type Alias StarGiftAttributeRarityRare + return fmt.Sprintf("StarGiftAttributeRarityRare%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiftAttributeRarityRare) TypeID() uint32 { + return StarGiftAttributeRarityRareTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiftAttributeRarityRare) TypeName() string { + return "starGiftAttributeRarityRare" +} + +// TypeInfo returns info about TL type. +func (s *StarGiftAttributeRarityRare) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiftAttributeRarityRare", + ID: StarGiftAttributeRarityRareTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiftAttributeRarityRare) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarityRare#f08d516b as nil") + } + b.PutID(StarGiftAttributeRarityRareTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiftAttributeRarityRare) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarityRare#f08d516b as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiftAttributeRarityRare) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarityRare#f08d516b to nil") + } + if err := b.ConsumeID(StarGiftAttributeRarityRareTypeID); err != nil { + return fmt.Errorf("unable to decode starGiftAttributeRarityRare#f08d516b: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiftAttributeRarityRare) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarityRare#f08d516b to nil") + } + return nil +} + +// StarGiftAttributeRarityEpic represents TL type `starGiftAttributeRarityEpic#78fbf3a8`. +// +// See https://core.telegram.org/constructor/starGiftAttributeRarityEpic for reference. +type StarGiftAttributeRarityEpic struct { +} + +// StarGiftAttributeRarityEpicTypeID is TL type id of StarGiftAttributeRarityEpic. +const StarGiftAttributeRarityEpicTypeID = 0x78fbf3a8 + +// construct implements constructor of StarGiftAttributeRarityClass. +func (s StarGiftAttributeRarityEpic) construct() StarGiftAttributeRarityClass { return &s } + +// Ensuring interfaces in compile-time for StarGiftAttributeRarityEpic. +var ( + _ bin.Encoder = &StarGiftAttributeRarityEpic{} + _ bin.Decoder = &StarGiftAttributeRarityEpic{} + _ bin.BareEncoder = &StarGiftAttributeRarityEpic{} + _ bin.BareDecoder = &StarGiftAttributeRarityEpic{} + + _ StarGiftAttributeRarityClass = &StarGiftAttributeRarityEpic{} +) + +func (s *StarGiftAttributeRarityEpic) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiftAttributeRarityEpic) String() string { + if s == nil { + return "StarGiftAttributeRarityEpic(nil)" + } + type Alias StarGiftAttributeRarityEpic + return fmt.Sprintf("StarGiftAttributeRarityEpic%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiftAttributeRarityEpic) TypeID() uint32 { + return StarGiftAttributeRarityEpicTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiftAttributeRarityEpic) TypeName() string { + return "starGiftAttributeRarityEpic" +} + +// TypeInfo returns info about TL type. +func (s *StarGiftAttributeRarityEpic) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiftAttributeRarityEpic", + ID: StarGiftAttributeRarityEpicTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiftAttributeRarityEpic) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarityEpic#78fbf3a8 as nil") + } + b.PutID(StarGiftAttributeRarityEpicTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiftAttributeRarityEpic) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarityEpic#78fbf3a8 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiftAttributeRarityEpic) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarityEpic#78fbf3a8 to nil") + } + if err := b.ConsumeID(StarGiftAttributeRarityEpicTypeID); err != nil { + return fmt.Errorf("unable to decode starGiftAttributeRarityEpic#78fbf3a8: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiftAttributeRarityEpic) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarityEpic#78fbf3a8 to nil") + } + return nil +} + +// StarGiftAttributeRarityLegendary represents TL type `starGiftAttributeRarityLegendary#cef7e7a8`. +// +// See https://core.telegram.org/constructor/starGiftAttributeRarityLegendary for reference. +type StarGiftAttributeRarityLegendary struct { +} + +// StarGiftAttributeRarityLegendaryTypeID is TL type id of StarGiftAttributeRarityLegendary. +const StarGiftAttributeRarityLegendaryTypeID = 0xcef7e7a8 + +// construct implements constructor of StarGiftAttributeRarityClass. +func (s StarGiftAttributeRarityLegendary) construct() StarGiftAttributeRarityClass { return &s } + +// Ensuring interfaces in compile-time for StarGiftAttributeRarityLegendary. +var ( + _ bin.Encoder = &StarGiftAttributeRarityLegendary{} + _ bin.Decoder = &StarGiftAttributeRarityLegendary{} + _ bin.BareEncoder = &StarGiftAttributeRarityLegendary{} + _ bin.BareDecoder = &StarGiftAttributeRarityLegendary{} + + _ StarGiftAttributeRarityClass = &StarGiftAttributeRarityLegendary{} +) + +func (s *StarGiftAttributeRarityLegendary) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiftAttributeRarityLegendary) String() string { + if s == nil { + return "StarGiftAttributeRarityLegendary(nil)" + } + type Alias StarGiftAttributeRarityLegendary + return fmt.Sprintf("StarGiftAttributeRarityLegendary%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiftAttributeRarityLegendary) TypeID() uint32 { + return StarGiftAttributeRarityLegendaryTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiftAttributeRarityLegendary) TypeName() string { + return "starGiftAttributeRarityLegendary" +} + +// TypeInfo returns info about TL type. +func (s *StarGiftAttributeRarityLegendary) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiftAttributeRarityLegendary", + ID: StarGiftAttributeRarityLegendaryTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiftAttributeRarityLegendary) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarityLegendary#cef7e7a8 as nil") + } + b.PutID(StarGiftAttributeRarityLegendaryTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiftAttributeRarityLegendary) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAttributeRarityLegendary#cef7e7a8 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiftAttributeRarityLegendary) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarityLegendary#cef7e7a8 to nil") + } + if err := b.ConsumeID(StarGiftAttributeRarityLegendaryTypeID); err != nil { + return fmt.Errorf("unable to decode starGiftAttributeRarityLegendary#cef7e7a8: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiftAttributeRarityLegendary) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAttributeRarityLegendary#cef7e7a8 to nil") + } + return nil +} + +// StarGiftAttributeRarityClassName is schema name of StarGiftAttributeRarityClass. +const StarGiftAttributeRarityClassName = "StarGiftAttributeRarity" + +// StarGiftAttributeRarityClass represents StarGiftAttributeRarity generic type. +// +// See https://core.telegram.org/type/StarGiftAttributeRarity for reference. +// +// Example: +// +// g, err := tg.DecodeStarGiftAttributeRarity(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.StarGiftAttributeRarity: // starGiftAttributeRarity#36437737 +// case *tg.StarGiftAttributeRarityUncommon: // starGiftAttributeRarityUncommon#dbce6389 +// case *tg.StarGiftAttributeRarityRare: // starGiftAttributeRarityRare#f08d516b +// case *tg.StarGiftAttributeRarityEpic: // starGiftAttributeRarityEpic#78fbf3a8 +// case *tg.StarGiftAttributeRarityLegendary: // starGiftAttributeRarityLegendary#cef7e7a8 +// default: panic(v) +// } +type StarGiftAttributeRarityClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() StarGiftAttributeRarityClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool +} + +// DecodeStarGiftAttributeRarity implements binary de-serialization for StarGiftAttributeRarityClass. +func DecodeStarGiftAttributeRarity(buf *bin.Buffer) (StarGiftAttributeRarityClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case StarGiftAttributeRarityTypeID: + // Decoding starGiftAttributeRarity#36437737. + v := StarGiftAttributeRarity{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err) + } + return &v, nil + case StarGiftAttributeRarityUncommonTypeID: + // Decoding starGiftAttributeRarityUncommon#dbce6389. + v := StarGiftAttributeRarityUncommon{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err) + } + return &v, nil + case StarGiftAttributeRarityRareTypeID: + // Decoding starGiftAttributeRarityRare#f08d516b. + v := StarGiftAttributeRarityRare{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err) + } + return &v, nil + case StarGiftAttributeRarityEpicTypeID: + // Decoding starGiftAttributeRarityEpic#78fbf3a8. + v := StarGiftAttributeRarityEpic{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err) + } + return &v, nil + case StarGiftAttributeRarityLegendaryTypeID: + // Decoding starGiftAttributeRarityLegendary#cef7e7a8. + v := StarGiftAttributeRarityLegendary{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", bin.NewUnexpectedID(id)) + } +} + +// StarGiftAttributeRarity boxes the StarGiftAttributeRarityClass providing a helper. +type StarGiftAttributeRarityBox struct { + StarGiftAttributeRarity StarGiftAttributeRarityClass +} + +// Decode implements bin.Decoder for StarGiftAttributeRarityBox. +func (b *StarGiftAttributeRarityBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode StarGiftAttributeRarityBox to nil") + } + v, err := DecodeStarGiftAttributeRarity(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StarGiftAttributeRarity = v + return nil +} + +// Encode implements bin.Encode for StarGiftAttributeRarityBox. +func (b *StarGiftAttributeRarityBox) Encode(buf *bin.Buffer) error { + if b == nil || b.StarGiftAttributeRarity == nil { + return fmt.Errorf("unable to encode StarGiftAttributeRarityClass as nil") + } + return b.StarGiftAttributeRarity.Encode(buf) +} diff --git a/pkg/gotd/tg/tl_star_gift_attribute_rarity_slices_gen.go b/pkg/gotd/tg/tl_star_gift_attribute_rarity_slices_gen.go new file mode 100644 index 00000000..9b1d617d --- /dev/null +++ b/pkg/gotd/tg/tl_star_gift_attribute_rarity_slices_gen.go @@ -0,0 +1,212 @@ +//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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// StarGiftAttributeRarityClassArray is adapter for slice of StarGiftAttributeRarityClass. +type StarGiftAttributeRarityClassArray []StarGiftAttributeRarityClass + +// Sort sorts slice of StarGiftAttributeRarityClass. +func (s StarGiftAttributeRarityClassArray) Sort(less func(a, b StarGiftAttributeRarityClass) bool) StarGiftAttributeRarityClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StarGiftAttributeRarityClass. +func (s StarGiftAttributeRarityClassArray) SortStable(less func(a, b StarGiftAttributeRarityClass) bool) StarGiftAttributeRarityClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StarGiftAttributeRarityClass. +func (s StarGiftAttributeRarityClassArray) Retain(keep func(x StarGiftAttributeRarityClass) bool) StarGiftAttributeRarityClassArray { + 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 StarGiftAttributeRarityClassArray) First() (v StarGiftAttributeRarityClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StarGiftAttributeRarityClassArray) Last() (v StarGiftAttributeRarityClass, 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 *StarGiftAttributeRarityClassArray) PopFirst() (v StarGiftAttributeRarityClass, 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 StarGiftAttributeRarityClass + 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 *StarGiftAttributeRarityClassArray) Pop() (v StarGiftAttributeRarityClass, 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 +} + +// AsStarGiftAttributeRarity returns copy with only StarGiftAttributeRarity constructors. +func (s StarGiftAttributeRarityClassArray) AsStarGiftAttributeRarity() (to StarGiftAttributeRarityArray) { + for _, elem := range s { + value, ok := elem.(*StarGiftAttributeRarity) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// StarGiftAttributeRarityArray is adapter for slice of StarGiftAttributeRarity. +type StarGiftAttributeRarityArray []StarGiftAttributeRarity + +// Sort sorts slice of StarGiftAttributeRarity. +func (s StarGiftAttributeRarityArray) Sort(less func(a, b StarGiftAttributeRarity) bool) StarGiftAttributeRarityArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StarGiftAttributeRarity. +func (s StarGiftAttributeRarityArray) SortStable(less func(a, b StarGiftAttributeRarity) bool) StarGiftAttributeRarityArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StarGiftAttributeRarity. +func (s StarGiftAttributeRarityArray) Retain(keep func(x StarGiftAttributeRarity) bool) StarGiftAttributeRarityArray { + 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 StarGiftAttributeRarityArray) First() (v StarGiftAttributeRarity, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StarGiftAttributeRarityArray) Last() (v StarGiftAttributeRarity, 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 *StarGiftAttributeRarityArray) PopFirst() (v StarGiftAttributeRarity, 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 StarGiftAttributeRarity + 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 *StarGiftAttributeRarityArray) Pop() (v StarGiftAttributeRarity, 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/pkg/gotd/tg/tl_star_gift_auction_acquired_gift_gen.go b/pkg/gotd/tg/tl_star_gift_auction_acquired_gift_gen.go index 6a3484f5..8181bb69 100644 --- a/pkg/gotd/tg/tl_star_gift_auction_acquired_gift_gen.go +++ b/pkg/gotd/tg/tl_star_gift_auction_acquired_gift_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StarGiftAuctionAcquiredGift represents TL type `starGiftAuctionAcquiredGift#ab60e20b`. +// StarGiftAuctionAcquiredGift represents TL type `starGiftAuctionAcquiredGift#42b00348`. // // See https://core.telegram.org/constructor/starGiftAuctionAcquiredGift for reference. type StarGiftAuctionAcquiredGift struct { @@ -53,10 +53,14 @@ type StarGiftAuctionAcquiredGift struct { // // Use SetMessage and GetMessage helpers. Message TextWithEntities + // GiftNum field of StarGiftAuctionAcquiredGift. + // + // Use SetGiftNum and GetGiftNum helpers. + GiftNum int } // StarGiftAuctionAcquiredGiftTypeID is TL type id of StarGiftAuctionAcquiredGift. -const StarGiftAuctionAcquiredGiftTypeID = 0xab60e20b +const StarGiftAuctionAcquiredGiftTypeID = 0x42b00348 // Ensuring interfaces in compile-time for StarGiftAuctionAcquiredGift. var ( @@ -94,6 +98,9 @@ func (s *StarGiftAuctionAcquiredGift) Zero() bool { if !(s.Message.Zero()) { return false } + if !(s.GiftNum == 0) { + return false + } return true } @@ -116,6 +123,7 @@ func (s *StarGiftAuctionAcquiredGift) FillFrom(from interface { GetRound() (value int) GetPos() (value int) GetMessage() (value TextWithEntities, ok bool) + GetGiftNum() (value int, ok bool) }) { s.NameHidden = from.GetNameHidden() s.Peer = from.GetPeer() @@ -127,6 +135,10 @@ func (s *StarGiftAuctionAcquiredGift) FillFrom(from interface { s.Message = val } + if val, ok := from.GetGiftNum(); ok { + s.GiftNum = val + } + } // TypeID returns type id in TL schema. @@ -182,6 +194,11 @@ func (s *StarGiftAuctionAcquiredGift) TypeInfo() tdp.Type { SchemaName: "message", Null: !s.Flags.Has(1), }, + { + Name: "GiftNum", + SchemaName: "gift_num", + Null: !s.Flags.Has(2), + }, } return typ } @@ -194,12 +211,15 @@ func (s *StarGiftAuctionAcquiredGift) SetFlags() { if !(s.Message.Zero()) { s.Flags.Set(1) } + if !(s.GiftNum == 0) { + s.Flags.Set(2) + } } // Encode implements bin.Encoder. func (s *StarGiftAuctionAcquiredGift) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAuctionAcquiredGift#ab60e20b as nil") + return fmt.Errorf("can't encode starGiftAuctionAcquiredGift#42b00348 as nil") } b.PutID(StarGiftAuctionAcquiredGiftTypeID) return s.EncodeBare(b) @@ -208,17 +228,17 @@ func (s *StarGiftAuctionAcquiredGift) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarGiftAuctionAcquiredGift) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAuctionAcquiredGift#ab60e20b as nil") + return fmt.Errorf("can't encode starGiftAuctionAcquiredGift#42b00348 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#ab60e20b: field flags: %w", err) + return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#42b00348: field flags: %w", err) } if s.Peer == nil { - return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#ab60e20b: field peer is nil") + return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#42b00348: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#ab60e20b: field peer: %w", err) + return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#42b00348: field peer: %w", err) } b.PutInt(s.Date) b.PutLong(s.BidAmount) @@ -226,19 +246,22 @@ func (s *StarGiftAuctionAcquiredGift) EncodeBare(b *bin.Buffer) error { b.PutInt(s.Pos) if s.Flags.Has(1) { if err := s.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#ab60e20b: field message: %w", err) + return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#42b00348: field message: %w", err) } } + if s.Flags.Has(2) { + b.PutInt(s.GiftNum) + } return nil } // Decode implements bin.Decoder. func (s *StarGiftAuctionAcquiredGift) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAuctionAcquiredGift#ab60e20b to nil") + return fmt.Errorf("can't decode starGiftAuctionAcquiredGift#42b00348 to nil") } if err := b.ConsumeID(StarGiftAuctionAcquiredGiftTypeID); err != nil { - return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: %w", err) } return s.DecodeBare(b) } @@ -246,54 +269,61 @@ func (s *StarGiftAuctionAcquiredGift) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarGiftAuctionAcquiredGift) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAuctionAcquiredGift#ab60e20b to nil") + return fmt.Errorf("can't decode starGiftAuctionAcquiredGift#42b00348 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field flags: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field flags: %w", err) } } s.NameHidden = s.Flags.Has(0) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field peer: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field peer: %w", err) } s.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field date: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field date: %w", err) } s.Date = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field bid_amount: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field bid_amount: %w", err) } s.BidAmount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field round: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field round: %w", err) } s.Round = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field pos: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field pos: %w", err) } s.Pos = value } if s.Flags.Has(1) { if err := s.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field message: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field message: %w", err) } } + if s.Flags.Has(2) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field gift_num: %w", err) + } + s.GiftNum = value + } return nil } @@ -373,3 +403,21 @@ func (s *StarGiftAuctionAcquiredGift) GetMessage() (value TextWithEntities, ok b } return s.Message, true } + +// SetGiftNum sets value of GiftNum conditional field. +func (s *StarGiftAuctionAcquiredGift) SetGiftNum(value int) { + s.Flags.Set(2) + s.GiftNum = value +} + +// GetGiftNum returns value of GiftNum conditional field and +// boolean which is true if field was set. +func (s *StarGiftAuctionAcquiredGift) GetGiftNum() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(2) { + return value, false + } + return s.GiftNum, true +} diff --git a/pkg/gotd/tg/tl_star_gift_auction_round_gen.go b/pkg/gotd/tg/tl_star_gift_auction_round_gen.go new file mode 100644 index 00000000..30736ae5 --- /dev/null +++ b/pkg/gotd/tg/tl_star_gift_auction_round_gen.go @@ -0,0 +1,503 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// StarGiftAuctionRound represents TL type `starGiftAuctionRound#3aae0528`. +// +// See https://core.telegram.org/constructor/starGiftAuctionRound for reference. +type StarGiftAuctionRound struct { + // Num field of StarGiftAuctionRound. + Num int + // Duration field of StarGiftAuctionRound. + Duration int +} + +// StarGiftAuctionRoundTypeID is TL type id of StarGiftAuctionRound. +const StarGiftAuctionRoundTypeID = 0x3aae0528 + +// construct implements constructor of StarGiftAuctionRoundClass. +func (s StarGiftAuctionRound) construct() StarGiftAuctionRoundClass { return &s } + +// Ensuring interfaces in compile-time for StarGiftAuctionRound. +var ( + _ bin.Encoder = &StarGiftAuctionRound{} + _ bin.Decoder = &StarGiftAuctionRound{} + _ bin.BareEncoder = &StarGiftAuctionRound{} + _ bin.BareDecoder = &StarGiftAuctionRound{} + + _ StarGiftAuctionRoundClass = &StarGiftAuctionRound{} +) + +func (s *StarGiftAuctionRound) Zero() bool { + if s == nil { + return true + } + if !(s.Num == 0) { + return false + } + if !(s.Duration == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiftAuctionRound) String() string { + if s == nil { + return "StarGiftAuctionRound(nil)" + } + type Alias StarGiftAuctionRound + return fmt.Sprintf("StarGiftAuctionRound%+v", Alias(*s)) +} + +// FillFrom fills StarGiftAuctionRound from given interface. +func (s *StarGiftAuctionRound) FillFrom(from interface { + GetNum() (value int) + GetDuration() (value int) +}) { + s.Num = from.GetNum() + s.Duration = from.GetDuration() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiftAuctionRound) TypeID() uint32 { + return StarGiftAuctionRoundTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiftAuctionRound) TypeName() string { + return "starGiftAuctionRound" +} + +// TypeInfo returns info about TL type. +func (s *StarGiftAuctionRound) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiftAuctionRound", + ID: StarGiftAuctionRoundTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Num", + SchemaName: "num", + }, + { + Name: "Duration", + SchemaName: "duration", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiftAuctionRound) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAuctionRound#3aae0528 as nil") + } + b.PutID(StarGiftAuctionRoundTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiftAuctionRound) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAuctionRound#3aae0528 as nil") + } + b.PutInt(s.Num) + b.PutInt(s.Duration) + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiftAuctionRound) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAuctionRound#3aae0528 to nil") + } + if err := b.ConsumeID(StarGiftAuctionRoundTypeID); err != nil { + return fmt.Errorf("unable to decode starGiftAuctionRound#3aae0528: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiftAuctionRound) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAuctionRound#3aae0528 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionRound#3aae0528: field num: %w", err) + } + s.Num = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionRound#3aae0528: field duration: %w", err) + } + s.Duration = value + } + return nil +} + +// GetNum returns value of Num field. +func (s *StarGiftAuctionRound) GetNum() (value int) { + if s == nil { + return + } + return s.Num +} + +// GetDuration returns value of Duration field. +func (s *StarGiftAuctionRound) GetDuration() (value int) { + if s == nil { + return + } + return s.Duration +} + +// StarGiftAuctionRoundExtendable represents TL type `starGiftAuctionRoundExtendable#aa021e5`. +// +// See https://core.telegram.org/constructor/starGiftAuctionRoundExtendable for reference. +type StarGiftAuctionRoundExtendable struct { + // Num field of StarGiftAuctionRoundExtendable. + Num int + // Duration field of StarGiftAuctionRoundExtendable. + Duration int + // ExtendTop field of StarGiftAuctionRoundExtendable. + ExtendTop int + // ExtendWindow field of StarGiftAuctionRoundExtendable. + ExtendWindow int +} + +// StarGiftAuctionRoundExtendableTypeID is TL type id of StarGiftAuctionRoundExtendable. +const StarGiftAuctionRoundExtendableTypeID = 0xaa021e5 + +// construct implements constructor of StarGiftAuctionRoundClass. +func (s StarGiftAuctionRoundExtendable) construct() StarGiftAuctionRoundClass { return &s } + +// Ensuring interfaces in compile-time for StarGiftAuctionRoundExtendable. +var ( + _ bin.Encoder = &StarGiftAuctionRoundExtendable{} + _ bin.Decoder = &StarGiftAuctionRoundExtendable{} + _ bin.BareEncoder = &StarGiftAuctionRoundExtendable{} + _ bin.BareDecoder = &StarGiftAuctionRoundExtendable{} + + _ StarGiftAuctionRoundClass = &StarGiftAuctionRoundExtendable{} +) + +func (s *StarGiftAuctionRoundExtendable) Zero() bool { + if s == nil { + return true + } + if !(s.Num == 0) { + return false + } + if !(s.Duration == 0) { + return false + } + if !(s.ExtendTop == 0) { + return false + } + if !(s.ExtendWindow == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiftAuctionRoundExtendable) String() string { + if s == nil { + return "StarGiftAuctionRoundExtendable(nil)" + } + type Alias StarGiftAuctionRoundExtendable + return fmt.Sprintf("StarGiftAuctionRoundExtendable%+v", Alias(*s)) +} + +// FillFrom fills StarGiftAuctionRoundExtendable from given interface. +func (s *StarGiftAuctionRoundExtendable) FillFrom(from interface { + GetNum() (value int) + GetDuration() (value int) + GetExtendTop() (value int) + GetExtendWindow() (value int) +}) { + s.Num = from.GetNum() + s.Duration = from.GetDuration() + s.ExtendTop = from.GetExtendTop() + s.ExtendWindow = from.GetExtendWindow() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiftAuctionRoundExtendable) TypeID() uint32 { + return StarGiftAuctionRoundExtendableTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiftAuctionRoundExtendable) TypeName() string { + return "starGiftAuctionRoundExtendable" +} + +// TypeInfo returns info about TL type. +func (s *StarGiftAuctionRoundExtendable) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiftAuctionRoundExtendable", + ID: StarGiftAuctionRoundExtendableTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Num", + SchemaName: "num", + }, + { + Name: "Duration", + SchemaName: "duration", + }, + { + Name: "ExtendTop", + SchemaName: "extend_top", + }, + { + Name: "ExtendWindow", + SchemaName: "extend_window", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiftAuctionRoundExtendable) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAuctionRoundExtendable#aa021e5 as nil") + } + b.PutID(StarGiftAuctionRoundExtendableTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiftAuctionRoundExtendable) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftAuctionRoundExtendable#aa021e5 as nil") + } + b.PutInt(s.Num) + b.PutInt(s.Duration) + b.PutInt(s.ExtendTop) + b.PutInt(s.ExtendWindow) + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiftAuctionRoundExtendable) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAuctionRoundExtendable#aa021e5 to nil") + } + if err := b.ConsumeID(StarGiftAuctionRoundExtendableTypeID); err != nil { + return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiftAuctionRoundExtendable) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftAuctionRoundExtendable#aa021e5 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: field num: %w", err) + } + s.Num = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: field duration: %w", err) + } + s.Duration = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: field extend_top: %w", err) + } + s.ExtendTop = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: field extend_window: %w", err) + } + s.ExtendWindow = value + } + return nil +} + +// GetNum returns value of Num field. +func (s *StarGiftAuctionRoundExtendable) GetNum() (value int) { + if s == nil { + return + } + return s.Num +} + +// GetDuration returns value of Duration field. +func (s *StarGiftAuctionRoundExtendable) GetDuration() (value int) { + if s == nil { + return + } + return s.Duration +} + +// GetExtendTop returns value of ExtendTop field. +func (s *StarGiftAuctionRoundExtendable) GetExtendTop() (value int) { + if s == nil { + return + } + return s.ExtendTop +} + +// GetExtendWindow returns value of ExtendWindow field. +func (s *StarGiftAuctionRoundExtendable) GetExtendWindow() (value int) { + if s == nil { + return + } + return s.ExtendWindow +} + +// StarGiftAuctionRoundClassName is schema name of StarGiftAuctionRoundClass. +const StarGiftAuctionRoundClassName = "StarGiftAuctionRound" + +// StarGiftAuctionRoundClass represents StarGiftAuctionRound generic type. +// +// See https://core.telegram.org/type/StarGiftAuctionRound for reference. +// +// Example: +// +// g, err := tg.DecodeStarGiftAuctionRound(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.StarGiftAuctionRound: // starGiftAuctionRound#3aae0528 +// case *tg.StarGiftAuctionRoundExtendable: // starGiftAuctionRoundExtendable#aa021e5 +// default: panic(v) +// } +type StarGiftAuctionRoundClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() StarGiftAuctionRoundClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + // Num field of StarGiftAuctionRound. + GetNum() (value int) + + // Duration field of StarGiftAuctionRound. + GetDuration() (value int) +} + +// DecodeStarGiftAuctionRound implements binary de-serialization for StarGiftAuctionRoundClass. +func DecodeStarGiftAuctionRound(buf *bin.Buffer) (StarGiftAuctionRoundClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case StarGiftAuctionRoundTypeID: + // Decoding starGiftAuctionRound#3aae0528. + v := StarGiftAuctionRound{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarGiftAuctionRoundClass: %w", err) + } + return &v, nil + case StarGiftAuctionRoundExtendableTypeID: + // Decoding starGiftAuctionRoundExtendable#aa021e5. + v := StarGiftAuctionRoundExtendable{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarGiftAuctionRoundClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StarGiftAuctionRoundClass: %w", bin.NewUnexpectedID(id)) + } +} + +// StarGiftAuctionRound boxes the StarGiftAuctionRoundClass providing a helper. +type StarGiftAuctionRoundBox struct { + StarGiftAuctionRound StarGiftAuctionRoundClass +} + +// Decode implements bin.Decoder for StarGiftAuctionRoundBox. +func (b *StarGiftAuctionRoundBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode StarGiftAuctionRoundBox to nil") + } + v, err := DecodeStarGiftAuctionRound(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StarGiftAuctionRound = v + return nil +} + +// Encode implements bin.Encode for StarGiftAuctionRoundBox. +func (b *StarGiftAuctionRoundBox) Encode(buf *bin.Buffer) error { + if b == nil || b.StarGiftAuctionRound == nil { + return fmt.Errorf("unable to encode StarGiftAuctionRoundClass as nil") + } + return b.StarGiftAuctionRound.Encode(buf) +} diff --git a/pkg/gotd/tg/tl_star_gift_auction_round_slices_gen.go b/pkg/gotd/tg/tl_star_gift_auction_round_slices_gen.go new file mode 100644 index 00000000..14957e61 --- /dev/null +++ b/pkg/gotd/tg/tl_star_gift_auction_round_slices_gen.go @@ -0,0 +1,307 @@ +//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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// StarGiftAuctionRoundClassArray is adapter for slice of StarGiftAuctionRoundClass. +type StarGiftAuctionRoundClassArray []StarGiftAuctionRoundClass + +// Sort sorts slice of StarGiftAuctionRoundClass. +func (s StarGiftAuctionRoundClassArray) Sort(less func(a, b StarGiftAuctionRoundClass) bool) StarGiftAuctionRoundClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StarGiftAuctionRoundClass. +func (s StarGiftAuctionRoundClassArray) SortStable(less func(a, b StarGiftAuctionRoundClass) bool) StarGiftAuctionRoundClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StarGiftAuctionRoundClass. +func (s StarGiftAuctionRoundClassArray) Retain(keep func(x StarGiftAuctionRoundClass) bool) StarGiftAuctionRoundClassArray { + 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 StarGiftAuctionRoundClassArray) First() (v StarGiftAuctionRoundClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StarGiftAuctionRoundClassArray) Last() (v StarGiftAuctionRoundClass, 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 *StarGiftAuctionRoundClassArray) PopFirst() (v StarGiftAuctionRoundClass, 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 StarGiftAuctionRoundClass + 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 *StarGiftAuctionRoundClassArray) Pop() (v StarGiftAuctionRoundClass, 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 +} + +// AsStarGiftAuctionRound returns copy with only StarGiftAuctionRound constructors. +func (s StarGiftAuctionRoundClassArray) AsStarGiftAuctionRound() (to StarGiftAuctionRoundArray) { + for _, elem := range s { + value, ok := elem.(*StarGiftAuctionRound) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsStarGiftAuctionRoundExtendable returns copy with only StarGiftAuctionRoundExtendable constructors. +func (s StarGiftAuctionRoundClassArray) AsStarGiftAuctionRoundExtendable() (to StarGiftAuctionRoundExtendableArray) { + for _, elem := range s { + value, ok := elem.(*StarGiftAuctionRoundExtendable) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// StarGiftAuctionRoundArray is adapter for slice of StarGiftAuctionRound. +type StarGiftAuctionRoundArray []StarGiftAuctionRound + +// Sort sorts slice of StarGiftAuctionRound. +func (s StarGiftAuctionRoundArray) Sort(less func(a, b StarGiftAuctionRound) bool) StarGiftAuctionRoundArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StarGiftAuctionRound. +func (s StarGiftAuctionRoundArray) SortStable(less func(a, b StarGiftAuctionRound) bool) StarGiftAuctionRoundArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StarGiftAuctionRound. +func (s StarGiftAuctionRoundArray) Retain(keep func(x StarGiftAuctionRound) bool) StarGiftAuctionRoundArray { + 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 StarGiftAuctionRoundArray) First() (v StarGiftAuctionRound, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StarGiftAuctionRoundArray) Last() (v StarGiftAuctionRound, 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 *StarGiftAuctionRoundArray) PopFirst() (v StarGiftAuctionRound, 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 StarGiftAuctionRound + 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 *StarGiftAuctionRoundArray) Pop() (v StarGiftAuctionRound, 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 +} + +// StarGiftAuctionRoundExtendableArray is adapter for slice of StarGiftAuctionRoundExtendable. +type StarGiftAuctionRoundExtendableArray []StarGiftAuctionRoundExtendable + +// Sort sorts slice of StarGiftAuctionRoundExtendable. +func (s StarGiftAuctionRoundExtendableArray) Sort(less func(a, b StarGiftAuctionRoundExtendable) bool) StarGiftAuctionRoundExtendableArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StarGiftAuctionRoundExtendable. +func (s StarGiftAuctionRoundExtendableArray) SortStable(less func(a, b StarGiftAuctionRoundExtendable) bool) StarGiftAuctionRoundExtendableArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StarGiftAuctionRoundExtendable. +func (s StarGiftAuctionRoundExtendableArray) Retain(keep func(x StarGiftAuctionRoundExtendable) bool) StarGiftAuctionRoundExtendableArray { + 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 StarGiftAuctionRoundExtendableArray) First() (v StarGiftAuctionRoundExtendable, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StarGiftAuctionRoundExtendableArray) Last() (v StarGiftAuctionRoundExtendable, 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 *StarGiftAuctionRoundExtendableArray) PopFirst() (v StarGiftAuctionRoundExtendable, 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 StarGiftAuctionRoundExtendable + 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 *StarGiftAuctionRoundExtendableArray) Pop() (v StarGiftAuctionRoundExtendable, 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/pkg/gotd/tg/tl_star_gift_auction_state_gen.go b/pkg/gotd/tg/tl_star_gift_auction_state_gen.go index 90455d8f..f5bcb960 100644 --- a/pkg/gotd/tg/tl_star_gift_auction_state_gen.go +++ b/pkg/gotd/tg/tl_star_gift_auction_state_gen.go @@ -132,7 +132,7 @@ func (s *StarGiftAuctionStateNotModified) DecodeBare(b *bin.Buffer) error { return nil } -// StarGiftAuctionState represents TL type `starGiftAuctionState#5db04f4b`. +// StarGiftAuctionState represents TL type `starGiftAuctionState#771a4e66`. // // See https://core.telegram.org/constructor/starGiftAuctionState for reference. type StarGiftAuctionState struct { @@ -150,16 +150,20 @@ type StarGiftAuctionState struct { TopBidders []int64 // NextRoundAt field of StarGiftAuctionState. NextRoundAt int + // LastGiftNum field of StarGiftAuctionState. + LastGiftNum int // GiftsLeft field of StarGiftAuctionState. GiftsLeft int // CurrentRound field of StarGiftAuctionState. CurrentRound int // TotalRounds field of StarGiftAuctionState. TotalRounds int + // Rounds field of StarGiftAuctionState. + Rounds []StarGiftAuctionRoundClass } // StarGiftAuctionStateTypeID is TL type id of StarGiftAuctionState. -const StarGiftAuctionStateTypeID = 0x5db04f4b +const StarGiftAuctionStateTypeID = 0x771a4e66 // construct implements constructor of StarGiftAuctionStateClass. func (s StarGiftAuctionState) construct() StarGiftAuctionStateClass { return &s } @@ -199,6 +203,9 @@ func (s *StarGiftAuctionState) Zero() bool { if !(s.NextRoundAt == 0) { return false } + if !(s.LastGiftNum == 0) { + return false + } if !(s.GiftsLeft == 0) { return false } @@ -208,6 +215,9 @@ func (s *StarGiftAuctionState) Zero() bool { if !(s.TotalRounds == 0) { return false } + if !(s.Rounds == nil) { + return false + } return true } @@ -230,9 +240,11 @@ func (s *StarGiftAuctionState) FillFrom(from interface { GetBidLevels() (value []AuctionBidLevel) GetTopBidders() (value []int64) GetNextRoundAt() (value int) + GetLastGiftNum() (value int) GetGiftsLeft() (value int) GetCurrentRound() (value int) GetTotalRounds() (value int) + GetRounds() (value []StarGiftAuctionRoundClass) }) { s.Version = from.GetVersion() s.StartDate = from.GetStartDate() @@ -241,9 +253,11 @@ func (s *StarGiftAuctionState) FillFrom(from interface { s.BidLevels = from.GetBidLevels() s.TopBidders = from.GetTopBidders() s.NextRoundAt = from.GetNextRoundAt() + s.LastGiftNum = from.GetLastGiftNum() s.GiftsLeft = from.GetGiftsLeft() s.CurrentRound = from.GetCurrentRound() s.TotalRounds = from.GetTotalRounds() + s.Rounds = from.GetRounds() } // TypeID returns type id in TL schema. @@ -297,6 +311,10 @@ func (s *StarGiftAuctionState) TypeInfo() tdp.Type { Name: "NextRoundAt", SchemaName: "next_round_at", }, + { + Name: "LastGiftNum", + SchemaName: "last_gift_num", + }, { Name: "GiftsLeft", SchemaName: "gifts_left", @@ -309,6 +327,10 @@ func (s *StarGiftAuctionState) TypeInfo() tdp.Type { Name: "TotalRounds", SchemaName: "total_rounds", }, + { + Name: "Rounds", + SchemaName: "rounds", + }, } return typ } @@ -316,7 +338,7 @@ func (s *StarGiftAuctionState) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *StarGiftAuctionState) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAuctionState#5db04f4b as nil") + return fmt.Errorf("can't encode starGiftAuctionState#771a4e66 as nil") } b.PutID(StarGiftAuctionStateTypeID) return s.EncodeBare(b) @@ -325,7 +347,7 @@ func (s *StarGiftAuctionState) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarGiftAuctionState) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAuctionState#5db04f4b as nil") + return fmt.Errorf("can't encode starGiftAuctionState#771a4e66 as nil") } b.PutInt(s.Version) b.PutInt(s.StartDate) @@ -334,7 +356,7 @@ func (s *StarGiftAuctionState) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(s.BidLevels)) for idx, v := range s.BidLevels { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftAuctionState#5db04f4b: field bid_levels element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode starGiftAuctionState#771a4e66: field bid_levels element with index %d: %w", idx, err) } } b.PutVectorHeader(len(s.TopBidders)) @@ -342,19 +364,29 @@ func (s *StarGiftAuctionState) EncodeBare(b *bin.Buffer) error { b.PutLong(v) } b.PutInt(s.NextRoundAt) + b.PutInt(s.LastGiftNum) b.PutInt(s.GiftsLeft) b.PutInt(s.CurrentRound) b.PutInt(s.TotalRounds) + b.PutVectorHeader(len(s.Rounds)) + for idx, v := range s.Rounds { + if v == nil { + return fmt.Errorf("unable to encode starGiftAuctionState#771a4e66: field rounds element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode starGiftAuctionState#771a4e66: field rounds element with index %d: %w", idx, err) + } + } return nil } // Decode implements bin.Decoder. func (s *StarGiftAuctionState) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAuctionState#5db04f4b to nil") + return fmt.Errorf("can't decode starGiftAuctionState#771a4e66 to nil") } if err := b.ConsumeID(StarGiftAuctionStateTypeID); err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: %w", err) } return s.DecodeBare(b) } @@ -362,40 +394,40 @@ func (s *StarGiftAuctionState) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAuctionState#5db04f4b to nil") + return fmt.Errorf("can't decode starGiftAuctionState#771a4e66 to nil") } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field version: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field version: %w", err) } s.Version = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field start_date: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field start_date: %w", err) } s.StartDate = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field end_date: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field end_date: %w", err) } s.EndDate = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field min_bid_amount: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field min_bid_amount: %w", err) } s.MinBidAmount = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field bid_levels: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field bid_levels: %w", err) } if headerLen > 0 { @@ -404,7 +436,7 @@ func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value AuctionBidLevel if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field bid_levels: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field bid_levels: %w", err) } s.BidLevels = append(s.BidLevels, value) } @@ -412,7 +444,7 @@ func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field top_bidders: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field top_bidders: %w", err) } if headerLen > 0 { @@ -421,7 +453,7 @@ func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field top_bidders: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field top_bidders: %w", err) } s.TopBidders = append(s.TopBidders, value) } @@ -429,31 +461,55 @@ func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field next_round_at: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field next_round_at: %w", err) } s.NextRoundAt = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field gifts_left: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field last_gift_num: %w", err) + } + s.LastGiftNum = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field gifts_left: %w", err) } s.GiftsLeft = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field current_round: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field current_round: %w", err) } s.CurrentRound = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field total_rounds: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field total_rounds: %w", err) } s.TotalRounds = value } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field rounds: %w", err) + } + + if headerLen > 0 { + s.Rounds = make([]StarGiftAuctionRoundClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeStarGiftAuctionRound(b) + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field rounds: %w", err) + } + s.Rounds = append(s.Rounds, value) + } + } return nil } @@ -513,6 +569,14 @@ func (s *StarGiftAuctionState) GetNextRoundAt() (value int) { return s.NextRoundAt } +// GetLastGiftNum returns value of LastGiftNum field. +func (s *StarGiftAuctionState) GetLastGiftNum() (value int) { + if s == nil { + return + } + return s.LastGiftNum +} + // GetGiftsLeft returns value of GiftsLeft field. func (s *StarGiftAuctionState) GetGiftsLeft() (value int) { if s == nil { @@ -537,20 +601,47 @@ func (s *StarGiftAuctionState) GetTotalRounds() (value int) { return s.TotalRounds } -// StarGiftAuctionStateFinished represents TL type `starGiftAuctionStateFinished#7d967c3a`. +// GetRounds returns value of Rounds field. +func (s *StarGiftAuctionState) GetRounds() (value []StarGiftAuctionRoundClass) { + if s == nil { + return + } + return s.Rounds +} + +// MapRounds returns field Rounds wrapped in StarGiftAuctionRoundClassArray helper. +func (s *StarGiftAuctionState) MapRounds() (value StarGiftAuctionRoundClassArray) { + return StarGiftAuctionRoundClassArray(s.Rounds) +} + +// StarGiftAuctionStateFinished represents TL type `starGiftAuctionStateFinished#972dabbf`. // // See https://core.telegram.org/constructor/starGiftAuctionStateFinished for reference. type StarGiftAuctionStateFinished struct { + // Flags field of StarGiftAuctionStateFinished. + Flags bin.Fields // StartDate field of StarGiftAuctionStateFinished. StartDate int // EndDate field of StarGiftAuctionStateFinished. EndDate int // AveragePrice field of StarGiftAuctionStateFinished. AveragePrice int64 + // ListedCount field of StarGiftAuctionStateFinished. + // + // Use SetListedCount and GetListedCount helpers. + ListedCount int + // FragmentListedCount field of StarGiftAuctionStateFinished. + // + // Use SetFragmentListedCount and GetFragmentListedCount helpers. + FragmentListedCount int + // FragmentListedURL field of StarGiftAuctionStateFinished. + // + // Use SetFragmentListedURL and GetFragmentListedURL helpers. + FragmentListedURL string } // StarGiftAuctionStateFinishedTypeID is TL type id of StarGiftAuctionStateFinished. -const StarGiftAuctionStateFinishedTypeID = 0x7d967c3a +const StarGiftAuctionStateFinishedTypeID = 0x972dabbf // construct implements constructor of StarGiftAuctionStateClass. func (s StarGiftAuctionStateFinished) construct() StarGiftAuctionStateClass { return &s } @@ -569,6 +660,9 @@ func (s *StarGiftAuctionStateFinished) Zero() bool { if s == nil { return true } + if !(s.Flags.Zero()) { + return false + } if !(s.StartDate == 0) { return false } @@ -578,6 +672,15 @@ func (s *StarGiftAuctionStateFinished) Zero() bool { if !(s.AveragePrice == 0) { return false } + if !(s.ListedCount == 0) { + return false + } + if !(s.FragmentListedCount == 0) { + return false + } + if !(s.FragmentListedURL == "") { + return false + } return true } @@ -596,10 +699,25 @@ func (s *StarGiftAuctionStateFinished) FillFrom(from interface { GetStartDate() (value int) GetEndDate() (value int) GetAveragePrice() (value int64) + GetListedCount() (value int, ok bool) + GetFragmentListedCount() (value int, ok bool) + GetFragmentListedURL() (value string, ok bool) }) { s.StartDate = from.GetStartDate() s.EndDate = from.GetEndDate() s.AveragePrice = from.GetAveragePrice() + if val, ok := from.GetListedCount(); ok { + s.ListedCount = val + } + + if val, ok := from.GetFragmentListedCount(); ok { + s.FragmentListedCount = val + } + + if val, ok := from.GetFragmentListedURL(); ok { + s.FragmentListedURL = val + } + } // TypeID returns type id in TL schema. @@ -637,14 +755,42 @@ func (s *StarGiftAuctionStateFinished) TypeInfo() tdp.Type { Name: "AveragePrice", SchemaName: "average_price", }, + { + Name: "ListedCount", + SchemaName: "listed_count", + Null: !s.Flags.Has(0), + }, + { + Name: "FragmentListedCount", + SchemaName: "fragment_listed_count", + Null: !s.Flags.Has(1), + }, + { + Name: "FragmentListedURL", + SchemaName: "fragment_listed_url", + Null: !s.Flags.Has(1), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (s *StarGiftAuctionStateFinished) SetFlags() { + if !(s.ListedCount == 0) { + s.Flags.Set(0) + } + if !(s.FragmentListedCount == 0) { + s.Flags.Set(1) + } + if !(s.FragmentListedURL == "") { + s.Flags.Set(1) + } +} + // Encode implements bin.Encoder. func (s *StarGiftAuctionStateFinished) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAuctionStateFinished#7d967c3a as nil") + return fmt.Errorf("can't encode starGiftAuctionStateFinished#972dabbf as nil") } b.PutID(StarGiftAuctionStateFinishedTypeID) return s.EncodeBare(b) @@ -653,21 +799,34 @@ func (s *StarGiftAuctionStateFinished) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarGiftAuctionStateFinished) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftAuctionStateFinished#7d967c3a as nil") + return fmt.Errorf("can't encode starGiftAuctionStateFinished#972dabbf as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode starGiftAuctionStateFinished#972dabbf: field flags: %w", err) } b.PutInt(s.StartDate) b.PutInt(s.EndDate) b.PutLong(s.AveragePrice) + if s.Flags.Has(0) { + b.PutInt(s.ListedCount) + } + if s.Flags.Has(1) { + b.PutInt(s.FragmentListedCount) + } + if s.Flags.Has(1) { + b.PutString(s.FragmentListedURL) + } return nil } // Decode implements bin.Decoder. func (s *StarGiftAuctionStateFinished) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAuctionStateFinished#7d967c3a to nil") + return fmt.Errorf("can't decode starGiftAuctionStateFinished#972dabbf to nil") } if err := b.ConsumeID(StarGiftAuctionStateFinishedTypeID); err != nil { - return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: %w", err) } return s.DecodeBare(b) } @@ -675,29 +834,55 @@ func (s *StarGiftAuctionStateFinished) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarGiftAuctionStateFinished) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftAuctionStateFinished#7d967c3a to nil") + return fmt.Errorf("can't decode starGiftAuctionStateFinished#972dabbf to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field flags: %w", err) + } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: field start_date: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field start_date: %w", err) } s.StartDate = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: field end_date: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field end_date: %w", err) } s.EndDate = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: field average_price: %w", err) + return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field average_price: %w", err) } s.AveragePrice = value } + if s.Flags.Has(0) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field listed_count: %w", err) + } + s.ListedCount = value + } + if s.Flags.Has(1) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field fragment_listed_count: %w", err) + } + s.FragmentListedCount = value + } + if s.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field fragment_listed_url: %w", err) + } + s.FragmentListedURL = value + } return nil } @@ -725,6 +910,60 @@ func (s *StarGiftAuctionStateFinished) GetAveragePrice() (value int64) { return s.AveragePrice } +// SetListedCount sets value of ListedCount conditional field. +func (s *StarGiftAuctionStateFinished) SetListedCount(value int) { + s.Flags.Set(0) + s.ListedCount = value +} + +// GetListedCount returns value of ListedCount conditional field and +// boolean which is true if field was set. +func (s *StarGiftAuctionStateFinished) GetListedCount() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(0) { + return value, false + } + return s.ListedCount, true +} + +// SetFragmentListedCount sets value of FragmentListedCount conditional field. +func (s *StarGiftAuctionStateFinished) SetFragmentListedCount(value int) { + s.Flags.Set(1) + s.FragmentListedCount = value +} + +// GetFragmentListedCount returns value of FragmentListedCount conditional field and +// boolean which is true if field was set. +func (s *StarGiftAuctionStateFinished) GetFragmentListedCount() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(1) { + return value, false + } + return s.FragmentListedCount, true +} + +// SetFragmentListedURL sets value of FragmentListedURL conditional field. +func (s *StarGiftAuctionStateFinished) SetFragmentListedURL(value string) { + s.Flags.Set(1) + s.FragmentListedURL = value +} + +// GetFragmentListedURL returns value of FragmentListedURL conditional field and +// boolean which is true if field was set. +func (s *StarGiftAuctionStateFinished) GetFragmentListedURL() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(1) { + return value, false + } + return s.FragmentListedURL, true +} + // StarGiftAuctionStateClassName is schema name of StarGiftAuctionStateClass. const StarGiftAuctionStateClassName = "StarGiftAuctionState" @@ -740,8 +979,8 @@ const StarGiftAuctionStateClassName = "StarGiftAuctionState" // } // switch v := g.(type) { // case *tg.StarGiftAuctionStateNotModified: // starGiftAuctionStateNotModified#fe333952 -// case *tg.StarGiftAuctionState: // starGiftAuctionState#5db04f4b -// case *tg.StarGiftAuctionStateFinished: // starGiftAuctionStateFinished#7d967c3a +// case *tg.StarGiftAuctionState: // starGiftAuctionState#771a4e66 +// case *tg.StarGiftAuctionStateFinished: // starGiftAuctionStateFinished#972dabbf // default: panic(v) // } type StarGiftAuctionStateClass interface { @@ -825,14 +1064,14 @@ func DecodeStarGiftAuctionState(buf *bin.Buffer) (StarGiftAuctionStateClass, err } return &v, nil case StarGiftAuctionStateTypeID: - // Decoding starGiftAuctionState#5db04f4b. + // Decoding starGiftAuctionState#771a4e66. v := StarGiftAuctionState{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StarGiftAuctionStateClass: %w", err) } return &v, nil case StarGiftAuctionStateFinishedTypeID: - // Decoding starGiftAuctionStateFinished#7d967c3a. + // Decoding starGiftAuctionStateFinished#972dabbf. v := StarGiftAuctionStateFinished{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StarGiftAuctionStateClass: %w", err) diff --git a/pkg/gotd/tg/tl_star_gift_background_gen.go b/pkg/gotd/tg/tl_star_gift_background_gen.go new file mode 100644 index 00000000..f92dfff3 --- /dev/null +++ b/pkg/gotd/tg/tl_star_gift_background_gen.go @@ -0,0 +1,215 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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{} +) + +// StarGiftBackground represents TL type `starGiftBackground#aff56398`. +// +// See https://core.telegram.org/constructor/starGiftBackground for reference. +type StarGiftBackground struct { + // CenterColor field of StarGiftBackground. + CenterColor int + // EdgeColor field of StarGiftBackground. + EdgeColor int + // TextColor field of StarGiftBackground. + TextColor int +} + +// StarGiftBackgroundTypeID is TL type id of StarGiftBackground. +const StarGiftBackgroundTypeID = 0xaff56398 + +// Ensuring interfaces in compile-time for StarGiftBackground. +var ( + _ bin.Encoder = &StarGiftBackground{} + _ bin.Decoder = &StarGiftBackground{} + _ bin.BareEncoder = &StarGiftBackground{} + _ bin.BareDecoder = &StarGiftBackground{} +) + +func (s *StarGiftBackground) Zero() bool { + if s == nil { + return true + } + if !(s.CenterColor == 0) { + return false + } + if !(s.EdgeColor == 0) { + return false + } + if !(s.TextColor == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarGiftBackground) String() string { + if s == nil { + return "StarGiftBackground(nil)" + } + type Alias StarGiftBackground + return fmt.Sprintf("StarGiftBackground%+v", Alias(*s)) +} + +// FillFrom fills StarGiftBackground from given interface. +func (s *StarGiftBackground) FillFrom(from interface { + GetCenterColor() (value int) + GetEdgeColor() (value int) + GetTextColor() (value int) +}) { + s.CenterColor = from.GetCenterColor() + s.EdgeColor = from.GetEdgeColor() + s.TextColor = from.GetTextColor() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarGiftBackground) TypeID() uint32 { + return StarGiftBackgroundTypeID +} + +// TypeName returns name of type in TL schema. +func (*StarGiftBackground) TypeName() string { + return "starGiftBackground" +} + +// TypeInfo returns info about TL type. +func (s *StarGiftBackground) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starGiftBackground", + ID: StarGiftBackgroundTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "CenterColor", + SchemaName: "center_color", + }, + { + Name: "EdgeColor", + SchemaName: "edge_color", + }, + { + Name: "TextColor", + SchemaName: "text_color", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StarGiftBackground) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftBackground#aff56398 as nil") + } + b.PutID(StarGiftBackgroundTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarGiftBackground) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starGiftBackground#aff56398 as nil") + } + b.PutInt(s.CenterColor) + b.PutInt(s.EdgeColor) + b.PutInt(s.TextColor) + return nil +} + +// Decode implements bin.Decoder. +func (s *StarGiftBackground) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftBackground#aff56398 to nil") + } + if err := b.ConsumeID(StarGiftBackgroundTypeID); err != nil { + return fmt.Errorf("unable to decode starGiftBackground#aff56398: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarGiftBackground) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starGiftBackground#aff56398 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftBackground#aff56398: field center_color: %w", err) + } + s.CenterColor = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftBackground#aff56398: field edge_color: %w", err) + } + s.EdgeColor = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftBackground#aff56398: field text_color: %w", err) + } + s.TextColor = value + } + return nil +} + +// GetCenterColor returns value of CenterColor field. +func (s *StarGiftBackground) GetCenterColor() (value int) { + if s == nil { + return + } + return s.CenterColor +} + +// GetEdgeColor returns value of EdgeColor field. +func (s *StarGiftBackground) GetEdgeColor() (value int) { + if s == nil { + return + } + return s.EdgeColor +} + +// GetTextColor returns value of TextColor field. +func (s *StarGiftBackground) GetTextColor() (value int) { + if s == nil { + return + } + return s.TextColor +} diff --git a/pkg/gotd/tg/tl_star_gift_background_slices_gen.go b/pkg/gotd/tg/tl_star_gift_background_slices_gen.go new file mode 100644 index 00000000..ad362638 --- /dev/null +++ b/pkg/gotd/tg/tl_star_gift_background_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" + + "go.mau.fi/mautrix-telegram/pkg/gotd/bin" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" + "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" + "go.mau.fi/mautrix-telegram/pkg/gotd/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/pkg/gotd/tg/tl_star_gift_gen.go b/pkg/gotd/tg/tl_star_gift_gen.go index b84d243e..2792bccd 100644 --- a/pkg/gotd/tg/tl_star_gift_gen.go +++ b/pkg/gotd/tg/tl_star_gift_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StarGift represents TL type `starGift#1b9a4d7f`. +// StarGift represents TL type `starGift#313a9547`. // Represents a star gift, see here »¹ for more info. // // Links: @@ -154,10 +154,22 @@ type StarGift struct { // // Use SetGiftsPerRound and GetGiftsPerRound helpers. GiftsPerRound int + // AuctionStartDate field of StarGift. + // + // Use SetAuctionStartDate and GetAuctionStartDate helpers. + AuctionStartDate int + // UpgradeVariants field of StarGift. + // + // Use SetUpgradeVariants and GetUpgradeVariants helpers. + UpgradeVariants int + // Background field of StarGift. + // + // Use SetBackground and GetBackground helpers. + Background StarGiftBackground } // StarGiftTypeID is TL type id of StarGift. -const StarGiftTypeID = 0x1b9a4d7f +const StarGiftTypeID = 0x313a9547 // construct implements constructor of StarGiftClass. func (s StarGift) construct() StarGiftClass { return &s } @@ -254,6 +266,15 @@ func (s *StarGift) Zero() bool { if !(s.GiftsPerRound == 0) { return false } + if !(s.AuctionStartDate == 0) { + return false + } + if !(s.UpgradeVariants == 0) { + return false + } + if !(s.Background.Zero()) { + return false + } return true } @@ -294,6 +315,9 @@ func (s *StarGift) FillFrom(from interface { GetLockedUntilDate() (value int, ok bool) GetAuctionSlug() (value string, ok bool) GetGiftsPerRound() (value int, ok bool) + GetAuctionStartDate() (value int, ok bool) + GetUpgradeVariants() (value int, ok bool) + GetBackground() (value StarGiftBackground, ok bool) }) { s.Limited = from.GetLimited() s.SoldOut = from.GetSoldOut() @@ -362,6 +386,18 @@ func (s *StarGift) FillFrom(from interface { s.GiftsPerRound = val } + if val, ok := from.GetAuctionStartDate(); ok { + s.AuctionStartDate = val + } + + if val, ok := from.GetUpgradeVariants(); ok { + s.UpgradeVariants = val + } + + if val, ok := from.GetBackground(); ok { + s.Background = val + } + } // TypeID returns type id in TL schema. @@ -508,6 +544,21 @@ func (s *StarGift) TypeInfo() tdp.Type { SchemaName: "gifts_per_round", Null: !s.Flags.Has(11), }, + { + Name: "AuctionStartDate", + SchemaName: "auction_start_date", + Null: !s.Flags.Has(11), + }, + { + Name: "UpgradeVariants", + SchemaName: "upgrade_variants", + Null: !s.Flags.Has(12), + }, + { + Name: "Background", + SchemaName: "background", + Null: !s.Flags.Has(13), + }, } return typ } @@ -577,12 +628,21 @@ func (s *StarGift) SetFlags() { if !(s.GiftsPerRound == 0) { s.Flags.Set(11) } + if !(s.AuctionStartDate == 0) { + s.Flags.Set(11) + } + if !(s.UpgradeVariants == 0) { + s.Flags.Set(12) + } + if !(s.Background.Zero()) { + s.Flags.Set(13) + } } // Encode implements bin.Encoder. func (s *StarGift) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGift#1b9a4d7f as nil") + return fmt.Errorf("can't encode starGift#313a9547 as nil") } b.PutID(StarGiftTypeID) return s.EncodeBare(b) @@ -591,18 +651,18 @@ func (s *StarGift) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarGift) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGift#1b9a4d7f as nil") + return fmt.Errorf("can't encode starGift#313a9547 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGift#1b9a4d7f: field flags: %w", err) + return fmt.Errorf("unable to encode starGift#313a9547: field flags: %w", err) } b.PutLong(s.ID) if s.Sticker == nil { - return fmt.Errorf("unable to encode starGift#1b9a4d7f: field sticker is nil") + return fmt.Errorf("unable to encode starGift#313a9547: field sticker is nil") } if err := s.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGift#1b9a4d7f: field sticker: %w", err) + return fmt.Errorf("unable to encode starGift#313a9547: field sticker: %w", err) } b.PutLong(s.Stars) if s.Flags.Has(0) { @@ -632,10 +692,10 @@ func (s *StarGift) EncodeBare(b *bin.Buffer) error { } if s.Flags.Has(6) { if s.ReleasedBy == nil { - return fmt.Errorf("unable to encode starGift#1b9a4d7f: field released_by is nil") + return fmt.Errorf("unable to encode starGift#313a9547: field released_by is nil") } if err := s.ReleasedBy.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGift#1b9a4d7f: field released_by: %w", err) + return fmt.Errorf("unable to encode starGift#313a9547: field released_by: %w", err) } } if s.Flags.Has(8) { @@ -653,16 +713,27 @@ func (s *StarGift) EncodeBare(b *bin.Buffer) error { if s.Flags.Has(11) { b.PutInt(s.GiftsPerRound) } + if s.Flags.Has(11) { + b.PutInt(s.AuctionStartDate) + } + if s.Flags.Has(12) { + b.PutInt(s.UpgradeVariants) + } + if s.Flags.Has(13) { + if err := s.Background.Encode(b); err != nil { + return fmt.Errorf("unable to encode starGift#313a9547: field background: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (s *StarGift) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGift#1b9a4d7f to nil") + return fmt.Errorf("can't decode starGift#313a9547 to nil") } if err := b.ConsumeID(StarGiftTypeID); err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: %w", err) } return s.DecodeBare(b) } @@ -670,11 +741,11 @@ func (s *StarGift) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarGift) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGift#1b9a4d7f to nil") + return fmt.Errorf("can't decode starGift#313a9547 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field flags: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field flags: %w", err) } } s.Limited = s.Flags.Has(0) @@ -687,129 +758,148 @@ func (s *StarGift) DecodeBare(b *bin.Buffer) error { { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field id: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field id: %w", err) } s.ID = value } { value, err := DecodeDocument(b) if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field sticker: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field sticker: %w", err) } s.Sticker = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field stars: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field stars: %w", err) } s.Stars = value } if s.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field availability_remains: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field availability_remains: %w", err) } s.AvailabilityRemains = value } if s.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field availability_total: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field availability_total: %w", err) } s.AvailabilityTotal = value } if s.Flags.Has(4) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field availability_resale: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field availability_resale: %w", err) } s.AvailabilityResale = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field convert_stars: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field convert_stars: %w", err) } s.ConvertStars = value } if s.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field first_sale_date: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field first_sale_date: %w", err) } s.FirstSaleDate = value } if s.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field last_sale_date: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field last_sale_date: %w", err) } s.LastSaleDate = value } if s.Flags.Has(3) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field upgrade_stars: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field upgrade_stars: %w", err) } s.UpgradeStars = value } if s.Flags.Has(4) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field resell_min_stars: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field resell_min_stars: %w", err) } s.ResellMinStars = value } if s.Flags.Has(5) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field title: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field title: %w", err) } s.Title = value } if s.Flags.Has(6) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field released_by: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field released_by: %w", err) } s.ReleasedBy = value } if s.Flags.Has(8) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field per_user_total: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field per_user_total: %w", err) } s.PerUserTotal = value } if s.Flags.Has(8) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field per_user_remains: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field per_user_remains: %w", err) } s.PerUserRemains = value } if s.Flags.Has(9) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field locked_until_date: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field locked_until_date: %w", err) } s.LockedUntilDate = value } if s.Flags.Has(11) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field auction_slug: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field auction_slug: %w", err) } s.AuctionSlug = value } if s.Flags.Has(11) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#1b9a4d7f: field gifts_per_round: %w", err) + return fmt.Errorf("unable to decode starGift#313a9547: field gifts_per_round: %w", err) } s.GiftsPerRound = value } + if s.Flags.Has(11) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGift#313a9547: field auction_start_date: %w", err) + } + s.AuctionStartDate = value + } + if s.Flags.Has(12) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGift#313a9547: field upgrade_variants: %w", err) + } + s.UpgradeVariants = value + } + if s.Flags.Has(13) { + if err := s.Background.Decode(b); err != nil { + return fmt.Errorf("unable to decode starGift#313a9547: field background: %w", err) + } + } return nil } @@ -1230,7 +1320,61 @@ func (s *StarGift) GetGiftsPerRound() (value int, ok bool) { return s.GiftsPerRound, true } -// StarGiftUnique represents TL type `starGiftUnique#b0bf741b`. +// SetAuctionStartDate sets value of AuctionStartDate conditional field. +func (s *StarGift) SetAuctionStartDate(value int) { + s.Flags.Set(11) + s.AuctionStartDate = value +} + +// GetAuctionStartDate returns value of AuctionStartDate conditional field and +// boolean which is true if field was set. +func (s *StarGift) GetAuctionStartDate() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(11) { + return value, false + } + return s.AuctionStartDate, true +} + +// SetUpgradeVariants sets value of UpgradeVariants conditional field. +func (s *StarGift) SetUpgradeVariants(value int) { + s.Flags.Set(12) + s.UpgradeVariants = value +} + +// GetUpgradeVariants returns value of UpgradeVariants conditional field and +// boolean which is true if field was set. +func (s *StarGift) GetUpgradeVariants() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(12) { + return value, false + } + return s.UpgradeVariants, true +} + +// SetBackground sets value of Background conditional field. +func (s *StarGift) SetBackground(value StarGiftBackground) { + s.Flags.Set(13) + s.Background = value +} + +// GetBackground returns value of Background conditional field and +// boolean which is true if field was set. +func (s *StarGift) GetBackground() (value StarGiftBackground, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(13) { + return value, false + } + return s.Background, true +} + +// StarGiftUnique represents TL type `starGiftUnique#85f0a9cd`. // Represents a collectible star gift, see here »¹ for more info. // The sticker that represents the gift is contained in a starGiftAttributeModel¹ object // in attributes. @@ -1259,6 +1403,10 @@ type StarGiftUnique struct { // Links: // 1) https://core.telegram.org/api/themes#chat-themes ThemeAvailable bool + // Burned field of StarGiftUnique. + Burned bool + // Crafted field of StarGiftUnique. + Crafted bool // Identifier of the collectible gift. ID int64 // Unique ID of the gift. @@ -1326,6 +1474,10 @@ type StarGiftUnique struct { // // Use SetValueCurrency and GetValueCurrency helpers. ValueCurrency string + // ValueUsdAmount field of StarGiftUnique. + // + // Use SetValueUsdAmount and GetValueUsdAmount helpers. + ValueUsdAmount int64 // The current chat where the associated chat theme¹ is installed, if any (gift-based // themes can only be installed in one chat at a time). // @@ -1342,10 +1494,18 @@ type StarGiftUnique struct { // // Use SetHostID and GetHostID helpers. HostID PeerClass + // OfferMinStars field of StarGiftUnique. + // + // Use SetOfferMinStars and GetOfferMinStars helpers. + OfferMinStars int + // CraftChancePermille field of StarGiftUnique. + // + // Use SetCraftChancePermille and GetCraftChancePermille helpers. + CraftChancePermille int } // StarGiftUniqueTypeID is TL type id of StarGiftUnique. -const StarGiftUniqueTypeID = 0xb0bf741b +const StarGiftUniqueTypeID = 0x85f0a9cd // construct implements constructor of StarGiftClass. func (s StarGiftUnique) construct() StarGiftClass { return &s } @@ -1376,6 +1536,12 @@ func (s *StarGiftUnique) Zero() bool { if !(s.ThemeAvailable == false) { return false } + if !(s.Burned == false) { + return false + } + if !(s.Crafted == false) { + return false + } if !(s.ID == 0) { return false } @@ -1424,6 +1590,9 @@ func (s *StarGiftUnique) Zero() bool { if !(s.ValueCurrency == "") { return false } + if !(s.ValueUsdAmount == 0) { + return false + } if !(s.ThemePeer == nil) { return false } @@ -1433,6 +1602,12 @@ func (s *StarGiftUnique) Zero() bool { if !(s.HostID == nil) { return false } + if !(s.OfferMinStars == 0) { + return false + } + if !(s.CraftChancePermille == 0) { + return false + } return true } @@ -1451,6 +1626,8 @@ func (s *StarGiftUnique) FillFrom(from interface { GetRequirePremium() (value bool) GetResaleTonOnly() (value bool) GetThemeAvailable() (value bool) + GetBurned() (value bool) + GetCrafted() (value bool) GetID() (value int64) GetGiftID() (value int64) GetTitle() (value string) @@ -1467,13 +1644,18 @@ func (s *StarGiftUnique) FillFrom(from interface { GetReleasedBy() (value PeerClass, ok bool) GetValueAmount() (value int64, ok bool) GetValueCurrency() (value string, ok bool) + GetValueUsdAmount() (value int64, ok bool) GetThemePeer() (value PeerClass, ok bool) GetPeerColor() (value PeerColorClass, ok bool) GetHostID() (value PeerClass, ok bool) + GetOfferMinStars() (value int, ok bool) + GetCraftChancePermille() (value int, ok bool) }) { s.RequirePremium = from.GetRequirePremium() s.ResaleTonOnly = from.GetResaleTonOnly() s.ThemeAvailable = from.GetThemeAvailable() + s.Burned = from.GetBurned() + s.Crafted = from.GetCrafted() s.ID = from.GetID() s.GiftID = from.GetGiftID() s.Title = from.GetTitle() @@ -1514,6 +1696,10 @@ func (s *StarGiftUnique) FillFrom(from interface { s.ValueCurrency = val } + if val, ok := from.GetValueUsdAmount(); ok { + s.ValueUsdAmount = val + } + if val, ok := from.GetThemePeer(); ok { s.ThemePeer = val } @@ -1526,6 +1712,14 @@ func (s *StarGiftUnique) FillFrom(from interface { s.HostID = val } + if val, ok := from.GetOfferMinStars(); ok { + s.OfferMinStars = val + } + + if val, ok := from.GetCraftChancePermille(); ok { + s.CraftChancePermille = val + } + } // TypeID returns type id in TL schema. @@ -1566,6 +1760,16 @@ func (s *StarGiftUnique) TypeInfo() tdp.Type { SchemaName: "theme_available", Null: !s.Flags.Has(9), }, + { + Name: "Burned", + SchemaName: "burned", + Null: !s.Flags.Has(14), + }, + { + Name: "Crafted", + SchemaName: "crafted", + Null: !s.Flags.Has(15), + }, { Name: "ID", SchemaName: "id", @@ -1638,6 +1842,11 @@ func (s *StarGiftUnique) TypeInfo() tdp.Type { SchemaName: "value_currency", Null: !s.Flags.Has(8), }, + { + Name: "ValueUsdAmount", + SchemaName: "value_usd_amount", + Null: !s.Flags.Has(8), + }, { Name: "ThemePeer", SchemaName: "theme_peer", @@ -1653,6 +1862,16 @@ func (s *StarGiftUnique) TypeInfo() tdp.Type { SchemaName: "host_id", Null: !s.Flags.Has(12), }, + { + Name: "OfferMinStars", + SchemaName: "offer_min_stars", + Null: !s.Flags.Has(13), + }, + { + Name: "CraftChancePermille", + SchemaName: "craft_chance_permille", + Null: !s.Flags.Has(16), + }, } return typ } @@ -1668,6 +1887,12 @@ func (s *StarGiftUnique) SetFlags() { if !(s.ThemeAvailable == false) { s.Flags.Set(9) } + if !(s.Burned == false) { + s.Flags.Set(14) + } + if !(s.Crafted == false) { + s.Flags.Set(15) + } if !(s.OwnerID == nil) { s.Flags.Set(0) } @@ -1692,6 +1917,9 @@ func (s *StarGiftUnique) SetFlags() { if !(s.ValueCurrency == "") { s.Flags.Set(8) } + if !(s.ValueUsdAmount == 0) { + s.Flags.Set(8) + } if !(s.ThemePeer == nil) { s.Flags.Set(10) } @@ -1701,12 +1929,18 @@ func (s *StarGiftUnique) SetFlags() { if !(s.HostID == nil) { s.Flags.Set(12) } + if !(s.OfferMinStars == 0) { + s.Flags.Set(13) + } + if !(s.CraftChancePermille == 0) { + s.Flags.Set(16) + } } // Encode implements bin.Encoder. func (s *StarGiftUnique) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftUnique#b0bf741b as nil") + return fmt.Errorf("can't encode starGiftUnique#85f0a9cd as nil") } b.PutID(StarGiftUniqueTypeID) return s.EncodeBare(b) @@ -1715,11 +1949,11 @@ func (s *StarGiftUnique) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarGiftUnique) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGiftUnique#b0bf741b as nil") + return fmt.Errorf("can't encode starGiftUnique#85f0a9cd as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field flags: %w", err) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field flags: %w", err) } b.PutLong(s.ID) b.PutLong(s.GiftID) @@ -1728,10 +1962,10 @@ func (s *StarGiftUnique) EncodeBare(b *bin.Buffer) error { b.PutInt(s.Num) if s.Flags.Has(0) { if s.OwnerID == nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field owner_id is nil") + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field owner_id is nil") } if err := s.OwnerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field owner_id: %w", err) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field owner_id: %w", err) } } if s.Flags.Has(1) { @@ -1743,10 +1977,10 @@ func (s *StarGiftUnique) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(s.Attributes)) for idx, v := range s.Attributes { if v == nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field attributes element with index %d is nil", idx) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field attributes element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field attributes element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field attributes element with index %d: %w", idx, err) } } b.PutInt(s.AvailabilityIssued) @@ -1758,19 +1992,19 @@ func (s *StarGiftUnique) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(s.ResellAmount)) for idx, v := range s.ResellAmount { if v == nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field resell_amount element with index %d is nil", idx) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field resell_amount element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field resell_amount element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field resell_amount element with index %d: %w", idx, err) } } } if s.Flags.Has(5) { if s.ReleasedBy == nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field released_by is nil") + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field released_by is nil") } if err := s.ReleasedBy.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field released_by: %w", err) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field released_by: %w", err) } } if s.Flags.Has(8) { @@ -1779,40 +2013,49 @@ func (s *StarGiftUnique) EncodeBare(b *bin.Buffer) error { if s.Flags.Has(8) { b.PutString(s.ValueCurrency) } + if s.Flags.Has(8) { + b.PutLong(s.ValueUsdAmount) + } if s.Flags.Has(10) { if s.ThemePeer == nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field theme_peer is nil") + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field theme_peer is nil") } if err := s.ThemePeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field theme_peer: %w", err) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field theme_peer: %w", err) } } if s.Flags.Has(11) { if s.PeerColor == nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field peer_color is nil") + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field peer_color is nil") } if err := s.PeerColor.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field peer_color: %w", err) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field peer_color: %w", err) } } if s.Flags.Has(12) { if s.HostID == nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field host_id is nil") + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field host_id is nil") } if err := s.HostID.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGiftUnique#b0bf741b: field host_id: %w", err) + return fmt.Errorf("unable to encode starGiftUnique#85f0a9cd: field host_id: %w", err) } } + if s.Flags.Has(13) { + b.PutInt(s.OfferMinStars) + } + if s.Flags.Has(16) { + b.PutInt(s.CraftChancePermille) + } return nil } // Decode implements bin.Decoder. func (s *StarGiftUnique) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftUnique#b0bf741b to nil") + return fmt.Errorf("can't decode starGiftUnique#85f0a9cd to nil") } if err := b.ConsumeID(StarGiftUniqueTypeID); err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: %w", err) } return s.DecodeBare(b) } @@ -1820,76 +2063,78 @@ func (s *StarGiftUnique) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarGiftUnique) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGiftUnique#b0bf741b to nil") + return fmt.Errorf("can't decode starGiftUnique#85f0a9cd to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field flags: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field flags: %w", err) } } s.RequirePremium = s.Flags.Has(6) s.ResaleTonOnly = s.Flags.Has(7) s.ThemeAvailable = s.Flags.Has(9) + s.Burned = s.Flags.Has(14) + s.Crafted = s.Flags.Has(15) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field id: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field id: %w", err) } s.ID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field gift_id: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field gift_id: %w", err) } s.GiftID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field title: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field title: %w", err) } s.Title = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field slug: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field slug: %w", err) } s.Slug = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field num: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field num: %w", err) } s.Num = value } if s.Flags.Has(0) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field owner_id: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field owner_id: %w", err) } s.OwnerID = value } if s.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field owner_name: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field owner_name: %w", err) } s.OwnerName = value } if s.Flags.Has(2) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field owner_address: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field owner_address: %w", err) } s.OwnerAddress = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field attributes: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field attributes: %w", err) } if headerLen > 0 { @@ -1898,7 +2143,7 @@ func (s *StarGiftUnique) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeStarGiftAttribute(b) if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field attributes: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field attributes: %w", err) } s.Attributes = append(s.Attributes, value) } @@ -1906,28 +2151,28 @@ func (s *StarGiftUnique) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field availability_issued: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field availability_issued: %w", err) } s.AvailabilityIssued = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field availability_total: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field availability_total: %w", err) } s.AvailabilityTotal = value } if s.Flags.Has(3) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field gift_address: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field gift_address: %w", err) } s.GiftAddress = value } if s.Flags.Has(4) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field resell_amount: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field resell_amount: %w", err) } if headerLen > 0 { @@ -1936,7 +2181,7 @@ func (s *StarGiftUnique) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeStarsAmount(b) if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field resell_amount: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field resell_amount: %w", err) } s.ResellAmount = append(s.ResellAmount, value) } @@ -1944,45 +2189,66 @@ func (s *StarGiftUnique) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(5) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field released_by: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field released_by: %w", err) } s.ReleasedBy = value } if s.Flags.Has(8) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field value_amount: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field value_amount: %w", err) } s.ValueAmount = value } if s.Flags.Has(8) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field value_currency: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field value_currency: %w", err) } s.ValueCurrency = value } + if s.Flags.Has(8) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field value_usd_amount: %w", err) + } + s.ValueUsdAmount = value + } if s.Flags.Has(10) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field theme_peer: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field theme_peer: %w", err) } s.ThemePeer = value } if s.Flags.Has(11) { value, err := DecodePeerColor(b) if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field peer_color: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field peer_color: %w", err) } s.PeerColor = value } if s.Flags.Has(12) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode starGiftUnique#b0bf741b: field host_id: %w", err) + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field host_id: %w", err) } s.HostID = value } + if s.Flags.Has(13) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field offer_min_stars: %w", err) + } + s.OfferMinStars = value + } + if s.Flags.Has(16) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGiftUnique#85f0a9cd: field craft_chance_permille: %w", err) + } + s.CraftChancePermille = value + } return nil } @@ -2043,6 +2309,44 @@ func (s *StarGiftUnique) GetThemeAvailable() (value bool) { return s.Flags.Has(9) } +// SetBurned sets value of Burned conditional field. +func (s *StarGiftUnique) SetBurned(value bool) { + if value { + s.Flags.Set(14) + s.Burned = true + } else { + s.Flags.Unset(14) + s.Burned = false + } +} + +// GetBurned returns value of Burned conditional field. +func (s *StarGiftUnique) GetBurned() (value bool) { + if s == nil { + return + } + return s.Flags.Has(14) +} + +// SetCrafted sets value of Crafted conditional field. +func (s *StarGiftUnique) SetCrafted(value bool) { + if value { + s.Flags.Set(15) + s.Crafted = true + } else { + s.Flags.Unset(15) + s.Crafted = false + } +} + +// GetCrafted returns value of Crafted conditional field. +func (s *StarGiftUnique) GetCrafted() (value bool) { + if s == nil { + return + } + return s.Flags.Has(15) +} + // GetID returns value of ID field. func (s *StarGiftUnique) GetID() (value int64) { if s == nil { @@ -2251,6 +2555,24 @@ func (s *StarGiftUnique) GetValueCurrency() (value string, ok bool) { return s.ValueCurrency, true } +// SetValueUsdAmount sets value of ValueUsdAmount conditional field. +func (s *StarGiftUnique) SetValueUsdAmount(value int64) { + s.Flags.Set(8) + s.ValueUsdAmount = value +} + +// GetValueUsdAmount returns value of ValueUsdAmount conditional field and +// boolean which is true if field was set. +func (s *StarGiftUnique) GetValueUsdAmount() (value int64, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(8) { + return value, false + } + return s.ValueUsdAmount, true +} + // SetThemePeer sets value of ThemePeer conditional field. func (s *StarGiftUnique) SetThemePeer(value PeerClass) { s.Flags.Set(10) @@ -2305,6 +2627,42 @@ func (s *StarGiftUnique) GetHostID() (value PeerClass, ok bool) { return s.HostID, true } +// SetOfferMinStars sets value of OfferMinStars conditional field. +func (s *StarGiftUnique) SetOfferMinStars(value int) { + s.Flags.Set(13) + s.OfferMinStars = value +} + +// GetOfferMinStars returns value of OfferMinStars conditional field and +// boolean which is true if field was set. +func (s *StarGiftUnique) GetOfferMinStars() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(13) { + return value, false + } + return s.OfferMinStars, true +} + +// SetCraftChancePermille sets value of CraftChancePermille conditional field. +func (s *StarGiftUnique) SetCraftChancePermille(value int) { + s.Flags.Set(16) + s.CraftChancePermille = value +} + +// GetCraftChancePermille returns value of CraftChancePermille conditional field and +// boolean which is true if field was set. +func (s *StarGiftUnique) GetCraftChancePermille() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(16) { + return value, false + } + return s.CraftChancePermille, true +} + // MapAttributes returns field Attributes wrapped in StarGiftAttributeClassArray helper. func (s *StarGiftUnique) MapAttributes() (value StarGiftAttributeClassArray) { return StarGiftAttributeClassArray(s.Attributes) @@ -2332,8 +2690,8 @@ const StarGiftClassName = "StarGift" // panic(err) // } // switch v := g.(type) { -// case *tg.StarGift: // starGift#1b9a4d7f -// case *tg.StarGiftUnique: // starGiftUnique#b0bf741b +// case *tg.StarGift: // starGift#313a9547 +// case *tg.StarGiftUnique: // starGiftUnique#85f0a9cd // default: panic(v) // } type StarGiftClass interface { @@ -2383,14 +2741,14 @@ func DecodeStarGift(buf *bin.Buffer) (StarGiftClass, error) { } switch id { case StarGiftTypeID: - // Decoding starGift#1b9a4d7f. + // Decoding starGift#313a9547. v := StarGift{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StarGiftClass: %w", err) } return &v, nil case StarGiftUniqueTypeID: - // Decoding starGiftUnique#b0bf741b. + // Decoding starGiftUnique#85f0a9cd. v := StarGiftUnique{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StarGiftClass: %w", err) diff --git a/pkg/gotd/tg/tl_stars_transaction_gen.go b/pkg/gotd/tg/tl_stars_transaction_gen.go index b850905b..1f097ba1 100644 --- a/pkg/gotd/tg/tl_stars_transaction_gen.go +++ b/pkg/gotd/tg/tl_stars_transaction_gen.go @@ -90,6 +90,8 @@ type StarsTransaction struct { PhonegroupMessage bool // StargiftAuctionBid field of StarsTransaction. StargiftAuctionBid bool + // Offer field of StarsTransaction. + Offer bool // Transaction ID. ID string // Amount of Telegram Stars or TON. @@ -291,6 +293,9 @@ func (s *StarsTransaction) Zero() bool { if !(s.StargiftAuctionBid == false) { return false } + if !(s.Offer == false) { + return false + } if !(s.ID == "") { return false } @@ -388,6 +393,7 @@ func (s *StarsTransaction) FillFrom(from interface { GetStargiftDropOriginalDetails() (value bool) GetPhonegroupMessage() (value bool) GetStargiftAuctionBid() (value bool) + GetOffer() (value bool) GetID() (value string) GetAmount() (value StarsAmountClass) GetDate() (value int) @@ -425,6 +431,7 @@ func (s *StarsTransaction) FillFrom(from interface { s.StargiftDropOriginalDetails = from.GetStargiftDropOriginalDetails() s.PhonegroupMessage = from.GetPhonegroupMessage() s.StargiftAuctionBid = from.GetStargiftAuctionBid() + s.Offer = from.GetOffer() s.ID = from.GetID() s.Amount = from.GetAmount() s.Date = from.GetDate() @@ -595,6 +602,11 @@ func (s *StarsTransaction) TypeInfo() tdp.Type { SchemaName: "stargift_auction_bid", Null: !s.Flags.Has(28), }, + { + Name: "Offer", + SchemaName: "offer", + Null: !s.Flags.Has(29), + }, { Name: "ID", SchemaName: "id", @@ -751,6 +763,9 @@ func (s *StarsTransaction) SetFlags() { if !(s.StargiftAuctionBid == false) { s.Flags.Set(28) } + if !(s.Offer == false) { + s.Flags.Set(29) + } if !(s.Title == "") { s.Flags.Set(0) } @@ -964,6 +979,7 @@ func (s *StarsTransaction) DecodeBare(b *bin.Buffer) error { s.StargiftDropOriginalDetails = s.Flags.Has(26) s.PhonegroupMessage = s.Flags.Has(27) s.StargiftAuctionBid = s.Flags.Has(28) + s.Offer = s.Flags.Has(29) { value, err := b.String() if err != nil { @@ -1385,6 +1401,25 @@ func (s *StarsTransaction) GetStargiftAuctionBid() (value bool) { return s.Flags.Has(28) } +// SetOffer sets value of Offer conditional field. +func (s *StarsTransaction) SetOffer(value bool) { + if value { + s.Flags.Set(29) + s.Offer = true + } else { + s.Flags.Unset(29) + s.Offer = false + } +} + +// GetOffer returns value of Offer conditional field. +func (s *StarsTransaction) GetOffer() (value bool) { + if s == nil { + return + } + return s.Flags.Has(29) +} + // GetID returns value of ID field. func (s *StarsTransaction) GetID() (value string) { if s == nil { diff --git a/pkg/gotd/tg/tl_update_gen.go b/pkg/gotd/tg/tl_update_gen.go index 00d943ec..49a2e1ba 100644 --- a/pkg/gotd/tg/tl_update_gen.go +++ b/pkg/gotd/tg/tl_update_gen.go @@ -30707,6 +30707,461 @@ func (u *UpdateStarGiftAuctionUserState) GetUserState() (value StarGiftAuctionUs return u.UserState } +// UpdateEmojiGameInfo represents TL type `updateEmojiGameInfo#fb9c547a`. +// +// See https://core.telegram.org/constructor/updateEmojiGameInfo for reference. +type UpdateEmojiGameInfo struct { + // Info field of UpdateEmojiGameInfo. + Info MessagesEmojiGameInfoClass +} + +// UpdateEmojiGameInfoTypeID is TL type id of UpdateEmojiGameInfo. +const UpdateEmojiGameInfoTypeID = 0xfb9c547a + +// construct implements constructor of UpdateClass. +func (u UpdateEmojiGameInfo) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateEmojiGameInfo. +var ( + _ bin.Encoder = &UpdateEmojiGameInfo{} + _ bin.Decoder = &UpdateEmojiGameInfo{} + _ bin.BareEncoder = &UpdateEmojiGameInfo{} + _ bin.BareDecoder = &UpdateEmojiGameInfo{} + + _ UpdateClass = &UpdateEmojiGameInfo{} +) + +func (u *UpdateEmojiGameInfo) Zero() bool { + if u == nil { + return true + } + if !(u.Info == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateEmojiGameInfo) String() string { + if u == nil { + return "UpdateEmojiGameInfo(nil)" + } + type Alias UpdateEmojiGameInfo + return fmt.Sprintf("UpdateEmojiGameInfo%+v", Alias(*u)) +} + +// FillFrom fills UpdateEmojiGameInfo from given interface. +func (u *UpdateEmojiGameInfo) FillFrom(from interface { + GetInfo() (value MessagesEmojiGameInfoClass) +}) { + u.Info = from.GetInfo() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateEmojiGameInfo) TypeID() uint32 { + return UpdateEmojiGameInfoTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateEmojiGameInfo) TypeName() string { + return "updateEmojiGameInfo" +} + +// TypeInfo returns info about TL type. +func (u *UpdateEmojiGameInfo) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateEmojiGameInfo", + ID: UpdateEmojiGameInfoTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Info", + SchemaName: "info", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateEmojiGameInfo) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateEmojiGameInfo#fb9c547a as nil") + } + b.PutID(UpdateEmojiGameInfoTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateEmojiGameInfo) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateEmojiGameInfo#fb9c547a as nil") + } + if u.Info == nil { + return fmt.Errorf("unable to encode updateEmojiGameInfo#fb9c547a: field info is nil") + } + if err := u.Info.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateEmojiGameInfo#fb9c547a: field info: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateEmojiGameInfo) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateEmojiGameInfo#fb9c547a to nil") + } + if err := b.ConsumeID(UpdateEmojiGameInfoTypeID); err != nil { + return fmt.Errorf("unable to decode updateEmojiGameInfo#fb9c547a: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateEmojiGameInfo) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateEmojiGameInfo#fb9c547a to nil") + } + { + value, err := DecodeMessagesEmojiGameInfo(b) + if err != nil { + return fmt.Errorf("unable to decode updateEmojiGameInfo#fb9c547a: field info: %w", err) + } + u.Info = value + } + return nil +} + +// GetInfo returns value of Info field. +func (u *UpdateEmojiGameInfo) GetInfo() (value MessagesEmojiGameInfoClass) { + if u == nil { + return + } + return u.Info +} + +// UpdateStarGiftCraftFail represents TL type `updateStarGiftCraftFail#ac072444`. +// +// See https://core.telegram.org/constructor/updateStarGiftCraftFail for reference. +type UpdateStarGiftCraftFail struct { +} + +// UpdateStarGiftCraftFailTypeID is TL type id of UpdateStarGiftCraftFail. +const UpdateStarGiftCraftFailTypeID = 0xac072444 + +// construct implements constructor of UpdateClass. +func (u UpdateStarGiftCraftFail) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateStarGiftCraftFail. +var ( + _ bin.Encoder = &UpdateStarGiftCraftFail{} + _ bin.Decoder = &UpdateStarGiftCraftFail{} + _ bin.BareEncoder = &UpdateStarGiftCraftFail{} + _ bin.BareDecoder = &UpdateStarGiftCraftFail{} + + _ UpdateClass = &UpdateStarGiftCraftFail{} +) + +func (u *UpdateStarGiftCraftFail) Zero() bool { + if u == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateStarGiftCraftFail) String() string { + if u == nil { + return "UpdateStarGiftCraftFail(nil)" + } + type Alias UpdateStarGiftCraftFail + return fmt.Sprintf("UpdateStarGiftCraftFail%+v", Alias(*u)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateStarGiftCraftFail) TypeID() uint32 { + return UpdateStarGiftCraftFailTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateStarGiftCraftFail) TypeName() string { + return "updateStarGiftCraftFail" +} + +// TypeInfo returns info about TL type. +func (u *UpdateStarGiftCraftFail) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateStarGiftCraftFail", + ID: UpdateStarGiftCraftFailTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateStarGiftCraftFail) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateStarGiftCraftFail#ac072444 as nil") + } + b.PutID(UpdateStarGiftCraftFailTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateStarGiftCraftFail) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateStarGiftCraftFail#ac072444 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateStarGiftCraftFail) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateStarGiftCraftFail#ac072444 to nil") + } + if err := b.ConsumeID(UpdateStarGiftCraftFailTypeID); err != nil { + return fmt.Errorf("unable to decode updateStarGiftCraftFail#ac072444: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateStarGiftCraftFail) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateStarGiftCraftFail#ac072444 to nil") + } + return nil +} + +// UpdateChatParticipantRank represents TL type `updateChatParticipantRank#bd8367b9`. +// +// See https://core.telegram.org/constructor/updateChatParticipantRank for reference. +type UpdateChatParticipantRank struct { + // ChatID field of UpdateChatParticipantRank. + ChatID int64 + // UserID field of UpdateChatParticipantRank. + UserID int64 + // Rank field of UpdateChatParticipantRank. + Rank string + // Version field of UpdateChatParticipantRank. + Version int +} + +// UpdateChatParticipantRankTypeID is TL type id of UpdateChatParticipantRank. +const UpdateChatParticipantRankTypeID = 0xbd8367b9 + +// construct implements constructor of UpdateClass. +func (u UpdateChatParticipantRank) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChatParticipantRank. +var ( + _ bin.Encoder = &UpdateChatParticipantRank{} + _ bin.Decoder = &UpdateChatParticipantRank{} + _ bin.BareEncoder = &UpdateChatParticipantRank{} + _ bin.BareDecoder = &UpdateChatParticipantRank{} + + _ UpdateClass = &UpdateChatParticipantRank{} +) + +func (u *UpdateChatParticipantRank) Zero() bool { + if u == nil { + return true + } + if !(u.ChatID == 0) { + return false + } + if !(u.UserID == 0) { + return false + } + if !(u.Rank == "") { + return false + } + if !(u.Version == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChatParticipantRank) String() string { + if u == nil { + return "UpdateChatParticipantRank(nil)" + } + type Alias UpdateChatParticipantRank + return fmt.Sprintf("UpdateChatParticipantRank%+v", Alias(*u)) +} + +// FillFrom fills UpdateChatParticipantRank from given interface. +func (u *UpdateChatParticipantRank) FillFrom(from interface { + GetChatID() (value int64) + GetUserID() (value int64) + GetRank() (value string) + GetVersion() (value int) +}) { + u.ChatID = from.GetChatID() + u.UserID = from.GetUserID() + u.Rank = from.GetRank() + u.Version = from.GetVersion() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChatParticipantRank) TypeID() uint32 { + return UpdateChatParticipantRankTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChatParticipantRank) TypeName() string { + return "updateChatParticipantRank" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChatParticipantRank) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChatParticipantRank", + ID: UpdateChatParticipantRankTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChatID", + SchemaName: "chat_id", + }, + { + Name: "UserID", + SchemaName: "user_id", + }, + { + Name: "Rank", + SchemaName: "rank", + }, + { + Name: "Version", + SchemaName: "version", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChatParticipantRank) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatParticipantRank#bd8367b9 as nil") + } + b.PutID(UpdateChatParticipantRankTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChatParticipantRank) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChatParticipantRank#bd8367b9 as nil") + } + b.PutLong(u.ChatID) + b.PutLong(u.UserID) + b.PutString(u.Rank) + b.PutInt(u.Version) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChatParticipantRank) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatParticipantRank#bd8367b9 to nil") + } + if err := b.ConsumeID(UpdateChatParticipantRankTypeID); err != nil { + return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChatParticipantRank) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChatParticipantRank#bd8367b9 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field chat_id: %w", err) + } + u.ChatID = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field user_id: %w", err) + } + u.UserID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field rank: %w", err) + } + u.Rank = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field version: %w", err) + } + u.Version = value + } + return nil +} + +// GetChatID returns value of ChatID field. +func (u *UpdateChatParticipantRank) GetChatID() (value int64) { + if u == nil { + return + } + return u.ChatID +} + +// GetUserID returns value of UserID field. +func (u *UpdateChatParticipantRank) GetUserID() (value int64) { + if u == nil { + return + } + return u.UserID +} + +// GetRank returns value of Rank field. +func (u *UpdateChatParticipantRank) GetRank() (value string) { + if u == nil { + return + } + return u.Rank +} + +// GetVersion returns value of Version field. +func (u *UpdateChatParticipantRank) GetVersion() (value int) { + if u == nil { + return + } + return u.Version +} + // UpdateClassName is schema name of UpdateClass. const UpdateClassName = "Update" @@ -30871,6 +31326,9 @@ const UpdateClassName = "Update" // case *tg.UpdateDeleteGroupCallMessages: // updateDeleteGroupCallMessages#3e85e92c // case *tg.UpdateStarGiftAuctionState: // updateStarGiftAuctionState#48e246c2 // case *tg.UpdateStarGiftAuctionUserState: // updateStarGiftAuctionUserState#dc58f31e +// case *tg.UpdateEmojiGameInfo: // updateEmojiGameInfo#fb9c547a +// case *tg.UpdateStarGiftCraftFail: // updateStarGiftCraftFail#ac072444 +// case *tg.UpdateChatParticipantRank: // updateChatParticipantRank#bd8367b9 // default: panic(v) // } type UpdateClass interface { @@ -31949,6 +32407,27 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateEmojiGameInfoTypeID: + // Decoding updateEmojiGameInfo#fb9c547a. + v := UpdateEmojiGameInfo{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateStarGiftCraftFailTypeID: + // Decoding updateStarGiftCraftFail#ac072444. + v := UpdateStarGiftCraftFail{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateChatParticipantRankTypeID: + // Decoding updateChatParticipantRank#bd8367b9. + v := UpdateChatParticipantRank{} + 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/pkg/gotd/tg/tl_update_slices_gen.go b/pkg/gotd/tg/tl_update_slices_gen.go index ef3bde21..1456d6c3 100644 --- a/pkg/gotd/tg/tl_update_slices_gen.go +++ b/pkg/gotd/tg/tl_update_slices_gen.go @@ -1858,6 +1858,32 @@ func (s UpdateClassArray) AsUpdateStarGiftAuctionUserState() (to UpdateStarGiftA return to } +// AsUpdateEmojiGameInfo returns copy with only UpdateEmojiGameInfo constructors. +func (s UpdateClassArray) AsUpdateEmojiGameInfo() (to UpdateEmojiGameInfoArray) { + for _, elem := range s { + value, ok := elem.(*UpdateEmojiGameInfo) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateChatParticipantRank returns copy with only UpdateChatParticipantRank constructors. +func (s UpdateClassArray) AsUpdateChatParticipantRank() (to UpdateChatParticipantRankArray) { + for _, elem := range s { + value, ok := elem.(*UpdateChatParticipantRank) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // UpdateNewMessageArray is adapter for slice of UpdateNewMessage. type UpdateNewMessageArray []UpdateNewMessage @@ -13111,3 +13137,167 @@ func (s *UpdateStarGiftAuctionUserStateArray) Pop() (v UpdateStarGiftAuctionUser return v, true } + +// UpdateEmojiGameInfoArray is adapter for slice of UpdateEmojiGameInfo. +type UpdateEmojiGameInfoArray []UpdateEmojiGameInfo + +// Sort sorts slice of UpdateEmojiGameInfo. +func (s UpdateEmojiGameInfoArray) Sort(less func(a, b UpdateEmojiGameInfo) bool) UpdateEmojiGameInfoArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateEmojiGameInfo. +func (s UpdateEmojiGameInfoArray) SortStable(less func(a, b UpdateEmojiGameInfo) bool) UpdateEmojiGameInfoArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateEmojiGameInfo. +func (s UpdateEmojiGameInfoArray) Retain(keep func(x UpdateEmojiGameInfo) bool) UpdateEmojiGameInfoArray { + 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 UpdateEmojiGameInfoArray) First() (v UpdateEmojiGameInfo, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateEmojiGameInfoArray) Last() (v UpdateEmojiGameInfo, 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 *UpdateEmojiGameInfoArray) PopFirst() (v UpdateEmojiGameInfo, 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 UpdateEmojiGameInfo + 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 *UpdateEmojiGameInfoArray) Pop() (v UpdateEmojiGameInfo, 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 +} + +// UpdateChatParticipantRankArray is adapter for slice of UpdateChatParticipantRank. +type UpdateChatParticipantRankArray []UpdateChatParticipantRank + +// Sort sorts slice of UpdateChatParticipantRank. +func (s UpdateChatParticipantRankArray) Sort(less func(a, b UpdateChatParticipantRank) bool) UpdateChatParticipantRankArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateChatParticipantRank. +func (s UpdateChatParticipantRankArray) SortStable(less func(a, b UpdateChatParticipantRank) bool) UpdateChatParticipantRankArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateChatParticipantRank. +func (s UpdateChatParticipantRankArray) Retain(keep func(x UpdateChatParticipantRank) bool) UpdateChatParticipantRankArray { + 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 UpdateChatParticipantRankArray) First() (v UpdateChatParticipantRank, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateChatParticipantRankArray) Last() (v UpdateChatParticipantRank, 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 *UpdateChatParticipantRankArray) PopFirst() (v UpdateChatParticipantRank, 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 UpdateChatParticipantRank + 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 *UpdateChatParticipantRankArray) Pop() (v UpdateChatParticipantRank, 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/pkg/gotd/tg/tl_url_auth_result_gen.go b/pkg/gotd/tg/tl_url_auth_result_gen.go index f04a6ea3..911c10c0 100644 --- a/pkg/gotd/tg/tl_url_auth_result_gen.go +++ b/pkg/gotd/tg/tl_url_auth_result_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// URLAuthResultRequest represents TL type `urlAuthResultRequest#92d33a0e`. +// URLAuthResultRequest represents TL type `urlAuthResultRequest#f8f8eb1e`. // Details about the authorization request, for more info click here »¹ // // Links: @@ -46,6 +46,10 @@ type URLAuthResultRequest struct { Flags bin.Fields // Whether the bot would like to send messages to the user RequestWriteAccess bool + // RequestPhoneNumber field of URLAuthResultRequest. + RequestPhoneNumber bool + // MatchCodesFirst field of URLAuthResultRequest. + MatchCodesFirst bool // Username of a bot, which will be used for user authorization. If not specified, the // current bot's username will be assumed. The url's domain must be the same as the // domain linked with the bot. See Linking your domain to the bot¹ for more details. @@ -55,10 +59,34 @@ type URLAuthResultRequest struct { Bot UserClass // The domain name of the website on which the user will log in. Domain string + // Browser field of URLAuthResultRequest. + // + // Use SetBrowser and GetBrowser helpers. + Browser string + // Platform field of URLAuthResultRequest. + // + // Use SetPlatform and GetPlatform helpers. + Platform string + // IP field of URLAuthResultRequest. + // + // Use SetIP and GetIP helpers. + IP string + // Region field of URLAuthResultRequest. + // + // Use SetRegion and GetRegion helpers. + Region string + // MatchCodes field of URLAuthResultRequest. + // + // Use SetMatchCodes and GetMatchCodes helpers. + MatchCodes []string + // UserIDHint field of URLAuthResultRequest. + // + // Use SetUserIDHint and GetUserIDHint helpers. + UserIDHint int64 } // URLAuthResultRequestTypeID is TL type id of URLAuthResultRequest. -const URLAuthResultRequestTypeID = 0x92d33a0e +const URLAuthResultRequestTypeID = 0xf8f8eb1e // construct implements constructor of URLAuthResultClass. func (u URLAuthResultRequest) construct() URLAuthResultClass { return &u } @@ -83,12 +111,36 @@ func (u *URLAuthResultRequest) Zero() bool { if !(u.RequestWriteAccess == false) { return false } + if !(u.RequestPhoneNumber == false) { + return false + } + if !(u.MatchCodesFirst == false) { + return false + } if !(u.Bot == nil) { return false } if !(u.Domain == "") { return false } + if !(u.Browser == "") { + return false + } + if !(u.Platform == "") { + return false + } + if !(u.IP == "") { + return false + } + if !(u.Region == "") { + return false + } + if !(u.MatchCodes == nil) { + return false + } + if !(u.UserIDHint == 0) { + return false + } return true } @@ -105,12 +157,46 @@ func (u *URLAuthResultRequest) String() string { // FillFrom fills URLAuthResultRequest from given interface. func (u *URLAuthResultRequest) FillFrom(from interface { GetRequestWriteAccess() (value bool) + GetRequestPhoneNumber() (value bool) + GetMatchCodesFirst() (value bool) GetBot() (value UserClass) GetDomain() (value string) + GetBrowser() (value string, ok bool) + GetPlatform() (value string, ok bool) + GetIP() (value string, ok bool) + GetRegion() (value string, ok bool) + GetMatchCodes() (value []string, ok bool) + GetUserIDHint() (value int64, ok bool) }) { u.RequestWriteAccess = from.GetRequestWriteAccess() + u.RequestPhoneNumber = from.GetRequestPhoneNumber() + u.MatchCodesFirst = from.GetMatchCodesFirst() u.Bot = from.GetBot() u.Domain = from.GetDomain() + if val, ok := from.GetBrowser(); ok { + u.Browser = val + } + + if val, ok := from.GetPlatform(); ok { + u.Platform = val + } + + if val, ok := from.GetIP(); ok { + u.IP = val + } + + if val, ok := from.GetRegion(); ok { + u.Region = val + } + + if val, ok := from.GetMatchCodes(); ok { + u.MatchCodes = val + } + + if val, ok := from.GetUserIDHint(); ok { + u.UserIDHint = val + } + } // TypeID returns type id in TL schema. @@ -141,6 +227,16 @@ func (u *URLAuthResultRequest) TypeInfo() tdp.Type { SchemaName: "request_write_access", Null: !u.Flags.Has(0), }, + { + Name: "RequestPhoneNumber", + SchemaName: "request_phone_number", + Null: !u.Flags.Has(1), + }, + { + Name: "MatchCodesFirst", + SchemaName: "match_codes_first", + Null: !u.Flags.Has(5), + }, { Name: "Bot", SchemaName: "bot", @@ -149,6 +245,36 @@ func (u *URLAuthResultRequest) TypeInfo() tdp.Type { Name: "Domain", SchemaName: "domain", }, + { + Name: "Browser", + SchemaName: "browser", + Null: !u.Flags.Has(2), + }, + { + Name: "Platform", + SchemaName: "platform", + Null: !u.Flags.Has(2), + }, + { + Name: "IP", + SchemaName: "ip", + Null: !u.Flags.Has(2), + }, + { + Name: "Region", + SchemaName: "region", + Null: !u.Flags.Has(2), + }, + { + Name: "MatchCodes", + SchemaName: "match_codes", + Null: !u.Flags.Has(3), + }, + { + Name: "UserIDHint", + SchemaName: "user_id_hint", + Null: !u.Flags.Has(4), + }, } return typ } @@ -158,12 +284,36 @@ func (u *URLAuthResultRequest) SetFlags() { if !(u.RequestWriteAccess == false) { u.Flags.Set(0) } + if !(u.RequestPhoneNumber == false) { + u.Flags.Set(1) + } + if !(u.MatchCodesFirst == false) { + u.Flags.Set(5) + } + if !(u.Browser == "") { + u.Flags.Set(2) + } + if !(u.Platform == "") { + u.Flags.Set(2) + } + if !(u.IP == "") { + u.Flags.Set(2) + } + if !(u.Region == "") { + u.Flags.Set(2) + } + if !(u.MatchCodes == nil) { + u.Flags.Set(3) + } + if !(u.UserIDHint == 0) { + u.Flags.Set(4) + } } // Encode implements bin.Encoder. func (u *URLAuthResultRequest) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode urlAuthResultRequest#92d33a0e as nil") + return fmt.Errorf("can't encode urlAuthResultRequest#f8f8eb1e as nil") } b.PutID(URLAuthResultRequestTypeID) return u.EncodeBare(b) @@ -172,29 +322,50 @@ func (u *URLAuthResultRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *URLAuthResultRequest) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode urlAuthResultRequest#92d33a0e as nil") + return fmt.Errorf("can't encode urlAuthResultRequest#f8f8eb1e as nil") } u.SetFlags() if err := u.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode urlAuthResultRequest#92d33a0e: field flags: %w", err) + return fmt.Errorf("unable to encode urlAuthResultRequest#f8f8eb1e: field flags: %w", err) } if u.Bot == nil { - return fmt.Errorf("unable to encode urlAuthResultRequest#92d33a0e: field bot is nil") + return fmt.Errorf("unable to encode urlAuthResultRequest#f8f8eb1e: field bot is nil") } if err := u.Bot.Encode(b); err != nil { - return fmt.Errorf("unable to encode urlAuthResultRequest#92d33a0e: field bot: %w", err) + return fmt.Errorf("unable to encode urlAuthResultRequest#f8f8eb1e: field bot: %w", err) } b.PutString(u.Domain) + if u.Flags.Has(2) { + b.PutString(u.Browser) + } + if u.Flags.Has(2) { + b.PutString(u.Platform) + } + if u.Flags.Has(2) { + b.PutString(u.IP) + } + if u.Flags.Has(2) { + b.PutString(u.Region) + } + if u.Flags.Has(3) { + b.PutVectorHeader(len(u.MatchCodes)) + for _, v := range u.MatchCodes { + b.PutString(v) + } + } + if u.Flags.Has(4) { + b.PutLong(u.UserIDHint) + } return nil } // Decode implements bin.Decoder. func (u *URLAuthResultRequest) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode urlAuthResultRequest#92d33a0e to nil") + return fmt.Errorf("can't decode urlAuthResultRequest#f8f8eb1e to nil") } if err := b.ConsumeID(URLAuthResultRequestTypeID); err != nil { - return fmt.Errorf("unable to decode urlAuthResultRequest#92d33a0e: %w", err) + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: %w", err) } return u.DecodeBare(b) } @@ -202,28 +373,82 @@ func (u *URLAuthResultRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *URLAuthResultRequest) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode urlAuthResultRequest#92d33a0e to nil") + return fmt.Errorf("can't decode urlAuthResultRequest#f8f8eb1e to nil") } { if err := u.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode urlAuthResultRequest#92d33a0e: field flags: %w", err) + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field flags: %w", err) } } u.RequestWriteAccess = u.Flags.Has(0) + u.RequestPhoneNumber = u.Flags.Has(1) + u.MatchCodesFirst = u.Flags.Has(5) { value, err := DecodeUser(b) if err != nil { - return fmt.Errorf("unable to decode urlAuthResultRequest#92d33a0e: field bot: %w", err) + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field bot: %w", err) } u.Bot = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode urlAuthResultRequest#92d33a0e: field domain: %w", err) + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field domain: %w", err) } u.Domain = value } + if u.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field browser: %w", err) + } + u.Browser = value + } + if u.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field platform: %w", err) + } + u.Platform = value + } + if u.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field ip: %w", err) + } + u.IP = value + } + if u.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field region: %w", err) + } + u.Region = value + } + if u.Flags.Has(3) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field match_codes: %w", err) + } + + if headerLen > 0 { + u.MatchCodes = make([]string, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field match_codes: %w", err) + } + u.MatchCodes = append(u.MatchCodes, value) + } + } + if u.Flags.Has(4) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode urlAuthResultRequest#f8f8eb1e: field user_id_hint: %w", err) + } + u.UserIDHint = value + } return nil } @@ -246,6 +471,44 @@ func (u *URLAuthResultRequest) GetRequestWriteAccess() (value bool) { return u.Flags.Has(0) } +// SetRequestPhoneNumber sets value of RequestPhoneNumber conditional field. +func (u *URLAuthResultRequest) SetRequestPhoneNumber(value bool) { + if value { + u.Flags.Set(1) + u.RequestPhoneNumber = true + } else { + u.Flags.Unset(1) + u.RequestPhoneNumber = false + } +} + +// GetRequestPhoneNumber returns value of RequestPhoneNumber conditional field. +func (u *URLAuthResultRequest) GetRequestPhoneNumber() (value bool) { + if u == nil { + return + } + return u.Flags.Has(1) +} + +// SetMatchCodesFirst sets value of MatchCodesFirst conditional field. +func (u *URLAuthResultRequest) SetMatchCodesFirst(value bool) { + if value { + u.Flags.Set(5) + u.MatchCodesFirst = true + } else { + u.Flags.Unset(5) + u.MatchCodesFirst = false + } +} + +// GetMatchCodesFirst returns value of MatchCodesFirst conditional field. +func (u *URLAuthResultRequest) GetMatchCodesFirst() (value bool) { + if u == nil { + return + } + return u.Flags.Has(5) +} + // GetBot returns value of Bot field. func (u *URLAuthResultRequest) GetBot() (value UserClass) { if u == nil { @@ -262,7 +525,115 @@ func (u *URLAuthResultRequest) GetDomain() (value string) { return u.Domain } -// URLAuthResultAccepted represents TL type `urlAuthResultAccepted#8f8c0e4e`. +// SetBrowser sets value of Browser conditional field. +func (u *URLAuthResultRequest) SetBrowser(value string) { + u.Flags.Set(2) + u.Browser = value +} + +// GetBrowser returns value of Browser conditional field and +// boolean which is true if field was set. +func (u *URLAuthResultRequest) GetBrowser() (value string, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(2) { + return value, false + } + return u.Browser, true +} + +// SetPlatform sets value of Platform conditional field. +func (u *URLAuthResultRequest) SetPlatform(value string) { + u.Flags.Set(2) + u.Platform = value +} + +// GetPlatform returns value of Platform conditional field and +// boolean which is true if field was set. +func (u *URLAuthResultRequest) GetPlatform() (value string, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(2) { + return value, false + } + return u.Platform, true +} + +// SetIP sets value of IP conditional field. +func (u *URLAuthResultRequest) SetIP(value string) { + u.Flags.Set(2) + u.IP = value +} + +// GetIP returns value of IP conditional field and +// boolean which is true if field was set. +func (u *URLAuthResultRequest) GetIP() (value string, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(2) { + return value, false + } + return u.IP, true +} + +// SetRegion sets value of Region conditional field. +func (u *URLAuthResultRequest) SetRegion(value string) { + u.Flags.Set(2) + u.Region = value +} + +// GetRegion returns value of Region conditional field and +// boolean which is true if field was set. +func (u *URLAuthResultRequest) GetRegion() (value string, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(2) { + return value, false + } + return u.Region, true +} + +// SetMatchCodes sets value of MatchCodes conditional field. +func (u *URLAuthResultRequest) SetMatchCodes(value []string) { + u.Flags.Set(3) + u.MatchCodes = value +} + +// GetMatchCodes returns value of MatchCodes conditional field and +// boolean which is true if field was set. +func (u *URLAuthResultRequest) GetMatchCodes() (value []string, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(3) { + return value, false + } + return u.MatchCodes, true +} + +// SetUserIDHint sets value of UserIDHint conditional field. +func (u *URLAuthResultRequest) SetUserIDHint(value int64) { + u.Flags.Set(4) + u.UserIDHint = value +} + +// GetUserIDHint returns value of UserIDHint conditional field and +// boolean which is true if field was set. +func (u *URLAuthResultRequest) GetUserIDHint() (value int64, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(4) { + return value, false + } + return u.UserIDHint, true +} + +// URLAuthResultAccepted represents TL type `urlAuthResultAccepted#623a8fa0`. // Details about an accepted authorization request, for more info click here »¹ // // Links: @@ -270,12 +641,16 @@ func (u *URLAuthResultRequest) GetDomain() (value string) { // // See https://core.telegram.org/constructor/urlAuthResultAccepted for reference. type URLAuthResultAccepted struct { + // Flags field of URLAuthResultAccepted. + Flags bin.Fields // The URL name of the website on which the user has logged in. + // + // Use SetURL and GetURL helpers. URL string } // URLAuthResultAcceptedTypeID is TL type id of URLAuthResultAccepted. -const URLAuthResultAcceptedTypeID = 0x8f8c0e4e +const URLAuthResultAcceptedTypeID = 0x623a8fa0 // construct implements constructor of URLAuthResultClass. func (u URLAuthResultAccepted) construct() URLAuthResultClass { return &u } @@ -294,6 +669,9 @@ func (u *URLAuthResultAccepted) Zero() bool { if u == nil { return true } + if !(u.Flags.Zero()) { + return false + } if !(u.URL == "") { return false } @@ -312,9 +690,12 @@ func (u *URLAuthResultAccepted) String() string { // FillFrom fills URLAuthResultAccepted from given interface. func (u *URLAuthResultAccepted) FillFrom(from interface { - GetURL() (value string) + GetURL() (value string, ok bool) }) { - u.URL = from.GetURL() + if val, ok := from.GetURL(); ok { + u.URL = val + } + } // TypeID returns type id in TL schema. @@ -343,15 +724,23 @@ func (u *URLAuthResultAccepted) TypeInfo() tdp.Type { { Name: "URL", SchemaName: "url", + Null: !u.Flags.Has(0), }, } return typ } +// SetFlags sets flags for non-zero fields. +func (u *URLAuthResultAccepted) SetFlags() { + if !(u.URL == "") { + u.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (u *URLAuthResultAccepted) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode urlAuthResultAccepted#8f8c0e4e as nil") + return fmt.Errorf("can't encode urlAuthResultAccepted#623a8fa0 as nil") } b.PutID(URLAuthResultAcceptedTypeID) return u.EncodeBare(b) @@ -360,19 +749,25 @@ func (u *URLAuthResultAccepted) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *URLAuthResultAccepted) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode urlAuthResultAccepted#8f8c0e4e as nil") + return fmt.Errorf("can't encode urlAuthResultAccepted#623a8fa0 as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode urlAuthResultAccepted#623a8fa0: field flags: %w", err) + } + if u.Flags.Has(0) { + b.PutString(u.URL) } - b.PutString(u.URL) return nil } // Decode implements bin.Decoder. func (u *URLAuthResultAccepted) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode urlAuthResultAccepted#8f8c0e4e to nil") + return fmt.Errorf("can't decode urlAuthResultAccepted#623a8fa0 to nil") } if err := b.ConsumeID(URLAuthResultAcceptedTypeID); err != nil { - return fmt.Errorf("unable to decode urlAuthResultAccepted#8f8c0e4e: %w", err) + return fmt.Errorf("unable to decode urlAuthResultAccepted#623a8fa0: %w", err) } return u.DecodeBare(b) } @@ -380,24 +775,39 @@ func (u *URLAuthResultAccepted) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *URLAuthResultAccepted) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode urlAuthResultAccepted#8f8c0e4e to nil") + return fmt.Errorf("can't decode urlAuthResultAccepted#623a8fa0 to nil") } { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode urlAuthResultAccepted#623a8fa0: field flags: %w", err) + } + } + if u.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode urlAuthResultAccepted#8f8c0e4e: field url: %w", err) + return fmt.Errorf("unable to decode urlAuthResultAccepted#623a8fa0: field url: %w", err) } u.URL = value } return nil } -// GetURL returns value of URL field. -func (u *URLAuthResultAccepted) GetURL() (value string) { +// SetURL sets value of URL conditional field. +func (u *URLAuthResultAccepted) SetURL(value string) { + u.Flags.Set(0) + u.URL = value +} + +// GetURL returns value of URL conditional field and +// boolean which is true if field was set. +func (u *URLAuthResultAccepted) GetURL() (value string, ok bool) { if u == nil { return } - return u.URL + if !u.Flags.Has(0) { + return value, false + } + return u.URL, true } // URLAuthResultDefault represents TL type `urlAuthResultDefault#a9d6db1f`. @@ -519,8 +929,8 @@ const URLAuthResultClassName = "UrlAuthResult" // panic(err) // } // switch v := g.(type) { -// case *tg.URLAuthResultRequest: // urlAuthResultRequest#92d33a0e -// case *tg.URLAuthResultAccepted: // urlAuthResultAccepted#8f8c0e4e +// case *tg.URLAuthResultRequest: // urlAuthResultRequest#f8f8eb1e +// case *tg.URLAuthResultAccepted: // urlAuthResultAccepted#623a8fa0 // case *tg.URLAuthResultDefault: // urlAuthResultDefault#a9d6db1f // default: panic(v) // } @@ -551,14 +961,14 @@ func DecodeURLAuthResult(buf *bin.Buffer) (URLAuthResultClass, error) { } switch id { case URLAuthResultRequestTypeID: - // Decoding urlAuthResultRequest#92d33a0e. + // Decoding urlAuthResultRequest#f8f8eb1e. v := URLAuthResultRequest{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode URLAuthResultClass: %w", err) } return &v, nil case URLAuthResultAcceptedTypeID: - // Decoding urlAuthResultAccepted#8f8c0e4e. + // Decoding urlAuthResultAccepted#623a8fa0. v := URLAuthResultAccepted{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode URLAuthResultClass: %w", err) diff --git a/pkg/gotd/tg/tl_user_full_gen.go b/pkg/gotd/tg/tl_user_full_gen.go index b0f0faae..6f64e7d5 100644 --- a/pkg/gotd/tg/tl_user_full_gen.go +++ b/pkg/gotd/tg/tl_user_full_gen.go @@ -140,6 +140,10 @@ type UserFull struct { // 2) https://core.telegram.org/api/premium // 3) https://core.telegram.org/api/gifts DisplayGiftsButton bool + // NoforwardsMyEnabled field of UserFull. + NoforwardsMyEnabled bool + // NoforwardsPeerEnabled field of UserFull. + NoforwardsPeerEnabled bool // User ID ID int64 // Bio of the user @@ -442,6 +446,12 @@ func (u *UserFull) Zero() bool { if !(u.DisplayGiftsButton == false) { return false } + if !(u.NoforwardsMyEnabled == false) { + return false + } + if !(u.NoforwardsPeerEnabled == false) { + return false + } if !(u.ID == 0) { return false } @@ -585,6 +595,8 @@ func (u *UserFull) FillFrom(from interface { GetCanViewRevenue() (value bool) GetBotCanManageEmojiStatus() (value bool) GetDisplayGiftsButton() (value bool) + GetNoforwardsMyEnabled() (value bool) + GetNoforwardsPeerEnabled() (value bool) GetID() (value int64) GetAbout() (value string, ok bool) GetSettings() (value PeerSettings) @@ -640,6 +652,8 @@ func (u *UserFull) FillFrom(from interface { u.CanViewRevenue = from.GetCanViewRevenue() u.BotCanManageEmojiStatus = from.GetBotCanManageEmojiStatus() u.DisplayGiftsButton = from.GetDisplayGiftsButton() + u.NoforwardsMyEnabled = from.GetNoforwardsMyEnabled() + u.NoforwardsPeerEnabled = from.GetNoforwardsPeerEnabled() u.ID = from.GetID() if val, ok := from.GetAbout(); ok { u.About = val @@ -886,6 +900,16 @@ func (u *UserFull) TypeInfo() tdp.Type { SchemaName: "display_gifts_button", Null: !u.Flags2.Has(16), }, + { + Name: "NoforwardsMyEnabled", + SchemaName: "noforwards_my_enabled", + Null: !u.Flags2.Has(23), + }, + { + Name: "NoforwardsPeerEnabled", + SchemaName: "noforwards_peer_enabled", + Null: !u.Flags2.Has(24), + }, { Name: "ID", SchemaName: "id", @@ -1124,6 +1148,12 @@ func (u *UserFull) SetFlags() { if !(u.DisplayGiftsButton == false) { u.Flags2.Set(16) } + if !(u.NoforwardsMyEnabled == false) { + u.Flags2.Set(23) + } + if !(u.NoforwardsPeerEnabled == false) { + u.Flags2.Set(24) + } if !(u.About == "") { u.Flags.Set(1) } @@ -1466,6 +1496,8 @@ func (u *UserFull) DecodeBare(b *bin.Buffer) error { u.CanViewRevenue = u.Flags2.Has(9) u.BotCanManageEmojiStatus = u.Flags2.Has(10) u.DisplayGiftsButton = u.Flags2.Has(16) + u.NoforwardsMyEnabled = u.Flags2.Has(23) + u.NoforwardsPeerEnabled = u.Flags2.Has(24) { value, err := b.Long() if err != nil { @@ -2015,6 +2047,44 @@ func (u *UserFull) GetDisplayGiftsButton() (value bool) { return u.Flags2.Has(16) } +// SetNoforwardsMyEnabled sets value of NoforwardsMyEnabled conditional field. +func (u *UserFull) SetNoforwardsMyEnabled(value bool) { + if value { + u.Flags2.Set(23) + u.NoforwardsMyEnabled = true + } else { + u.Flags2.Unset(23) + u.NoforwardsMyEnabled = false + } +} + +// GetNoforwardsMyEnabled returns value of NoforwardsMyEnabled conditional field. +func (u *UserFull) GetNoforwardsMyEnabled() (value bool) { + if u == nil { + return + } + return u.Flags2.Has(23) +} + +// SetNoforwardsPeerEnabled sets value of NoforwardsPeerEnabled conditional field. +func (u *UserFull) SetNoforwardsPeerEnabled(value bool) { + if value { + u.Flags2.Set(24) + u.NoforwardsPeerEnabled = true + } else { + u.Flags2.Unset(24) + u.NoforwardsPeerEnabled = false + } +} + +// GetNoforwardsPeerEnabled returns value of NoforwardsPeerEnabled conditional field. +func (u *UserFull) GetNoforwardsPeerEnabled() (value bool) { + if u == nil { + return + } + return u.Flags2.Has(24) +} + // GetID returns value of ID field. func (u *UserFull) GetID() (value int64) { if u == nil { diff --git a/pkg/gotd/tg/tl_user_gen.go b/pkg/gotd/tg/tl_user_gen.go index 0b49d5f5..09985b6e 100644 --- a/pkg/gotd/tg/tl_user_gen.go +++ b/pkg/gotd/tg/tl_user_gen.go @@ -311,6 +311,8 @@ type User struct { BotHasMainApp bool // BotForumView field of User. BotForumView bool + // BotForumCanManageTopics field of User. + BotForumCanManageTopics bool // ID of the user, see here »¹ for more info and the available ID range. // // Links: @@ -593,6 +595,9 @@ func (u *User) Zero() bool { if !(u.BotForumView == false) { return false } + if !(u.BotForumCanManageTopics == false) { + return false + } if !(u.ID == 0) { return false } @@ -694,6 +699,7 @@ func (u *User) FillFrom(from interface { GetBotBusiness() (value bool) GetBotHasMainApp() (value bool) GetBotForumView() (value bool) + GetBotForumCanManageTopics() (value bool) GetID() (value int64) GetAccessHash() (value int64, ok bool) GetFirstName() (value string, ok bool) @@ -741,6 +747,7 @@ func (u *User) FillFrom(from interface { u.BotBusiness = from.GetBotBusiness() u.BotHasMainApp = from.GetBotHasMainApp() u.BotForumView = from.GetBotForumView() + u.BotForumCanManageTopics = from.GetBotForumCanManageTopics() u.ID = from.GetID() if val, ok := from.GetAccessHash(); ok { u.AccessHash = val @@ -973,6 +980,11 @@ func (u *User) TypeInfo() tdp.Type { SchemaName: "bot_forum_view", Null: !u.Flags2.Has(16), }, + { + Name: "BotForumCanManageTopics", + SchemaName: "bot_forum_can_manage_topics", + Null: !u.Flags2.Has(17), + }, { Name: "ID", SchemaName: "id", @@ -1156,6 +1168,9 @@ func (u *User) SetFlags() { if !(u.BotForumView == false) { u.Flags2.Set(16) } + if !(u.BotForumCanManageTopics == false) { + u.Flags2.Set(17) + } if !(u.AccessHash == 0) { u.Flags.Set(0) } @@ -1386,6 +1401,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error { u.BotBusiness = u.Flags2.Has(11) u.BotHasMainApp = u.Flags2.Has(13) u.BotForumView = u.Flags2.Has(16) + u.BotForumCanManageTopics = u.Flags2.Has(17) { value, err := b.Long() if err != nil { @@ -2041,6 +2057,25 @@ func (u *User) GetBotForumView() (value bool) { return u.Flags2.Has(16) } +// SetBotForumCanManageTopics sets value of BotForumCanManageTopics conditional field. +func (u *User) SetBotForumCanManageTopics(value bool) { + if value { + u.Flags2.Set(17) + u.BotForumCanManageTopics = true + } else { + u.Flags2.Unset(17) + u.BotForumCanManageTopics = false + } +} + +// GetBotForumCanManageTopics returns value of BotForumCanManageTopics conditional field. +func (u *User) GetBotForumCanManageTopics() (value bool) { + if u == nil { + return + } + return u.Flags2.Has(17) +} + // GetID returns value of ID field. func (u *User) GetID() (value int64) { if u == nil { diff --git a/pkg/gotd/tg/tl_web_page_attribute_gen.go b/pkg/gotd/tg/tl_web_page_attribute_gen.go index 4d545bec..f40971f3 100644 --- a/pkg/gotd/tg/tl_web_page_attribute_gen.go +++ b/pkg/gotd/tg/tl_web_page_attribute_gen.go @@ -1106,7 +1106,7 @@ func (w *WebPageAttributeStarGiftCollection) MapIcons() (value DocumentClassArra return DocumentClassArray(w.Icons) } -// WebPageAttributeStarGiftAuction represents TL type `webPageAttributeStarGiftAuction#34986ab`. +// WebPageAttributeStarGiftAuction represents TL type `webPageAttributeStarGiftAuction#1c641c2`. // // See https://core.telegram.org/constructor/webPageAttributeStarGiftAuction for reference. type WebPageAttributeStarGiftAuction struct { @@ -1114,16 +1114,10 @@ type WebPageAttributeStarGiftAuction struct { Gift StarGiftClass // EndDate field of WebPageAttributeStarGiftAuction. EndDate int - // CenterColor field of WebPageAttributeStarGiftAuction. - CenterColor int - // EdgeColor field of WebPageAttributeStarGiftAuction. - EdgeColor int - // TextColor field of WebPageAttributeStarGiftAuction. - TextColor int } // WebPageAttributeStarGiftAuctionTypeID is TL type id of WebPageAttributeStarGiftAuction. -const WebPageAttributeStarGiftAuctionTypeID = 0x34986ab +const WebPageAttributeStarGiftAuctionTypeID = 0x1c641c2 // construct implements constructor of WebPageAttributeClass. func (w WebPageAttributeStarGiftAuction) construct() WebPageAttributeClass { return &w } @@ -1148,15 +1142,6 @@ func (w *WebPageAttributeStarGiftAuction) Zero() bool { if !(w.EndDate == 0) { return false } - if !(w.CenterColor == 0) { - return false - } - if !(w.EdgeColor == 0) { - return false - } - if !(w.TextColor == 0) { - return false - } return true } @@ -1174,15 +1159,9 @@ func (w *WebPageAttributeStarGiftAuction) String() string { func (w *WebPageAttributeStarGiftAuction) FillFrom(from interface { GetGift() (value StarGiftClass) GetEndDate() (value int) - GetCenterColor() (value int) - GetEdgeColor() (value int) - GetTextColor() (value int) }) { w.Gift = from.GetGift() w.EndDate = from.GetEndDate() - w.CenterColor = from.GetCenterColor() - w.EdgeColor = from.GetEdgeColor() - w.TextColor = from.GetTextColor() } // TypeID returns type id in TL schema. @@ -1216,18 +1195,6 @@ func (w *WebPageAttributeStarGiftAuction) TypeInfo() tdp.Type { Name: "EndDate", SchemaName: "end_date", }, - { - Name: "CenterColor", - SchemaName: "center_color", - }, - { - Name: "EdgeColor", - SchemaName: "edge_color", - }, - { - Name: "TextColor", - SchemaName: "text_color", - }, } return typ } @@ -1235,7 +1202,7 @@ func (w *WebPageAttributeStarGiftAuction) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (w *WebPageAttributeStarGiftAuction) Encode(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't encode webPageAttributeStarGiftAuction#34986ab as nil") + return fmt.Errorf("can't encode webPageAttributeStarGiftAuction#1c641c2 as nil") } b.PutID(WebPageAttributeStarGiftAuctionTypeID) return w.EncodeBare(b) @@ -1244,28 +1211,25 @@ func (w *WebPageAttributeStarGiftAuction) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (w *WebPageAttributeStarGiftAuction) EncodeBare(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't encode webPageAttributeStarGiftAuction#34986ab as nil") + return fmt.Errorf("can't encode webPageAttributeStarGiftAuction#1c641c2 as nil") } if w.Gift == nil { - return fmt.Errorf("unable to encode webPageAttributeStarGiftAuction#34986ab: field gift is nil") + return fmt.Errorf("unable to encode webPageAttributeStarGiftAuction#1c641c2: field gift is nil") } if err := w.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPageAttributeStarGiftAuction#34986ab: field gift: %w", err) + return fmt.Errorf("unable to encode webPageAttributeStarGiftAuction#1c641c2: field gift: %w", err) } b.PutInt(w.EndDate) - b.PutInt(w.CenterColor) - b.PutInt(w.EdgeColor) - b.PutInt(w.TextColor) return nil } // Decode implements bin.Decoder. func (w *WebPageAttributeStarGiftAuction) Decode(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't decode webPageAttributeStarGiftAuction#34986ab to nil") + return fmt.Errorf("can't decode webPageAttributeStarGiftAuction#1c641c2 to nil") } if err := b.ConsumeID(WebPageAttributeStarGiftAuctionTypeID); err != nil { - return fmt.Errorf("unable to decode webPageAttributeStarGiftAuction#34986ab: %w", err) + return fmt.Errorf("unable to decode webPageAttributeStarGiftAuction#1c641c2: %w", err) } return w.DecodeBare(b) } @@ -1273,43 +1237,22 @@ func (w *WebPageAttributeStarGiftAuction) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (w *WebPageAttributeStarGiftAuction) DecodeBare(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't decode webPageAttributeStarGiftAuction#34986ab to nil") + return fmt.Errorf("can't decode webPageAttributeStarGiftAuction#1c641c2 to nil") } { value, err := DecodeStarGift(b) if err != nil { - return fmt.Errorf("unable to decode webPageAttributeStarGiftAuction#34986ab: field gift: %w", err) + return fmt.Errorf("unable to decode webPageAttributeStarGiftAuction#1c641c2: field gift: %w", err) } w.Gift = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode webPageAttributeStarGiftAuction#34986ab: field end_date: %w", err) + return fmt.Errorf("unable to decode webPageAttributeStarGiftAuction#1c641c2: field end_date: %w", err) } w.EndDate = value } - { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode webPageAttributeStarGiftAuction#34986ab: field center_color: %w", err) - } - w.CenterColor = value - } - { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode webPageAttributeStarGiftAuction#34986ab: field edge_color: %w", err) - } - w.EdgeColor = value - } - { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode webPageAttributeStarGiftAuction#34986ab: field text_color: %w", err) - } - w.TextColor = value - } return nil } @@ -1329,30 +1272,6 @@ func (w *WebPageAttributeStarGiftAuction) GetEndDate() (value int) { return w.EndDate } -// GetCenterColor returns value of CenterColor field. -func (w *WebPageAttributeStarGiftAuction) GetCenterColor() (value int) { - if w == nil { - return - } - return w.CenterColor -} - -// GetEdgeColor returns value of EdgeColor field. -func (w *WebPageAttributeStarGiftAuction) GetEdgeColor() (value int) { - if w == nil { - return - } - return w.EdgeColor -} - -// GetTextColor returns value of TextColor field. -func (w *WebPageAttributeStarGiftAuction) GetTextColor() (value int) { - if w == nil { - return - } - return w.TextColor -} - // WebPageAttributeClassName is schema name of WebPageAttributeClass. const WebPageAttributeClassName = "WebPageAttribute" @@ -1372,7 +1291,7 @@ const WebPageAttributeClassName = "WebPageAttribute" // case *tg.WebPageAttributeStickerSet: // webPageAttributeStickerSet#50cc03d3 // case *tg.WebPageAttributeUniqueStarGift: // webPageAttributeUniqueStarGift#cf6f6db8 // case *tg.WebPageAttributeStarGiftCollection: // webPageAttributeStarGiftCollection#31cad303 -// case *tg.WebPageAttributeStarGiftAuction: // webPageAttributeStarGiftAuction#34986ab +// case *tg.WebPageAttributeStarGiftAuction: // webPageAttributeStarGiftAuction#1c641c2 // default: panic(v) // } type WebPageAttributeClass interface { @@ -1437,7 +1356,7 @@ func DecodeWebPageAttribute(buf *bin.Buffer) (WebPageAttributeClass, error) { } return &v, nil case WebPageAttributeStarGiftAuctionTypeID: - // Decoding webPageAttributeStarGiftAuction#34986ab. + // Decoding webPageAttributeStarGiftAuction#1c641c2. v := WebPageAttributeStarGiftAuction{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode WebPageAttributeClass: %w", err)