diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index 65cde4140c..6277c05822 100644 --- a/_schema/tdesktop.tl +++ b/_schema/tdesktop.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl -// Layer: 167 -// SHA256: 4313c183fe2e60588dc1323061b46db2b105347501d9a5fb33032d2fe58ecfaa +// Layer: 169 +// SHA256: af77ecca722a36320c78d681dac9a9ccdfa2ba5282c0d7426619c6d866a4865e boolFalse#bc799737 = Bool; @@ -162,13 +162,13 @@ chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5 chatForbidden#6592a1a7 id:long title:string = Chat; -channel#8e87ccd8 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 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?int color:flags2.7?PeerColor = Chat; +channel#aadfc8f 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 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?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int = 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; chatFull#c9d31138 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 = ChatFull; -channelFull#723027bd 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 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 stories:flags2.4?PeerStories = ChatFull; +channelFull#f2bcb6f 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 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 stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -218,7 +218,9 @@ messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; -messageMediaGiveaway#58260664 flags:# only_new_subscribers:flags.0?true channels:Vector countries_iso2:flags.1?Vector quantity:int months:int until_date:int = MessageMedia; +messageMediaGiveaway#daad85b0 flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector countries_iso2:flags.1?Vector prize_description:flags.3?string quantity:int months:int until_date:int = MessageMedia; + +messageMediaGiveawayResults#c6991068 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector months:int prize_description:flags.1?string until_date:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; @@ -292,11 +294,11 @@ messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; -messageActionRequestedPeer#fe77345d button_id:int peer:Peer = MessageAction; +messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAction; messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#d2cfdb0e flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string = MessageAction; +messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; messageActionGiveawayLaunch#332ba9ed = MessageAction; @@ -690,6 +692,10 @@ updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; +updateBotMessageReaction#ac21d3ce peer:Peer msg_id:int date:int actor:Peer old_reactions:Vector new_reactions:Vector qts:int = Update; + +updateBotMessageReactions#9cb7759 peer:Peer msg_id:int date:int reactions:Vector qts:int = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -990,7 +996,9 @@ inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet; inputStickerSetEmojiDefaultTopicIcons#44c1f8e9 = InputStickerSet; -stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true videos:flags.6?true emojis:flags.7?true text_color:flags.9?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; +inputStickerSetEmojiChannelDefaultStatuses#49748553 = InputStickerSet; + +stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true videos:flags.6?true emojis:flags.7?true text_color:flags.9?true channel_emoji_status:flags.10?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; messages.stickerSet#6e153f16 set:StickerSet packs:Vector keywords:Vector documents:Vector = messages.StickerSet; @@ -1030,7 +1038,7 @@ keyboardButtonWebView#13767230 text:string url:string = KeyboardButton; keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton; -keyboardButtonRequestPeer#d0b468c text:string button_id:int peer_type:RequestPeerType = KeyboardButton; +keyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -1578,9 +1586,13 @@ channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopi channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeColor#3c2b247b prev_value:int new_value:int = ChannelAdminLogEventAction; +channelAdminLogEventActionChangePeerColor#5796e780 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; + +channelAdminLogEventActionChangeProfilePeerColor#5e477b25 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeBackgroundEmoji#445fc434 prev_value:long new_value:long = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_value:WallPaper = ChannelAdminLogEventAction; + +channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; @@ -1810,7 +1822,7 @@ account.wallPapers#cdc3858c hash:long wallpapers:Vector = account.Wal codeSettings#ad253d78 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true allow_missed_call:flags.5?true allow_firebase:flags.7?true logout_tokens:flags.6?Vector token:flags.8?string app_sandbox:flags.8?Bool = CodeSettings; -wallPaperSettings#1dc1bca4 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings; +wallPaperSettings#372efcd0 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int emoticon:flags.7?string = WallPaperSettings; autoDownloadSettings#baa57628 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true stories_preload:flags.4?true photo_size_max:int video_size_max:long file_size_max:long video_upload_maxbitrate:int small_queue_active_operations_max:int large_queue_active_operations_max:int = AutoDownloadSettings; @@ -2146,7 +2158,7 @@ inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:l inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentPremiumGiveaway#7c9375e6 flags:# only_new_subscribers:flags.0?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption; @@ -2302,7 +2314,11 @@ stories.stories#5dd8c3c8 count:int stories:Vector chats:Vector storyView#b0bdeac5 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true user_id:long date:int reaction:flags.2?Reaction = StoryView; -stories.storyViewsList#46e9b9ec flags:# count:int reactions_count:int views:Vector users:Vector next_offset:flags.0?string = stories.StoryViewsList; +storyViewPublicForward#9083670b flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true message:Message = StoryView; + +storyViewPublicRepost#bd74cf49 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer story:StoryItem = StoryView; + +stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count:int reactions_count:int views:Vector chats:Vector users:Vector next_offset:flags.0?string = stories.StoryViewsList; stories.storyViews#de9eed1d views:Vector users:Vector = stories.StoryViews; @@ -2324,6 +2340,10 @@ mediaAreaGeoPoint#df8b3b22 coordinates:MediaAreaCoordinates geo:GeoPoint = Media mediaAreaSuggestedReaction#14455871 flags:# dark:flags.0?true flipped:flags.1?true coordinates:MediaAreaCoordinates reaction:Reaction = MediaArea; +mediaAreaChannelPost#770416af coordinates:MediaAreaCoordinates channel_id:long msg_id:int = MediaArea; + +inputMediaAreaChannelPost#2271f2bf coordinates:MediaAreaCoordinates channel:InputChannel msg_id:int = MediaArea; + peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector = PeerStories; stories.peerStories#cae68768 stories:PeerStories chats:Vector users:Vector = stories.PeerStories; @@ -2332,7 +2352,7 @@ messages.webPage#fd5e12bd webpage:WebPage chats:Vector users:Vector premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption; -payments.checkedGiftCode#b722f158 flags:# via_giveaway:flags.2?true from_id:Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; +payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo; @@ -2370,12 +2390,20 @@ help.peerColorSet#26219a58 colors:Vector = help.PeerColorSet; help.peerColorProfileSet#767d61eb palette_colors:Vector bg_colors:Vector story_colors:Vector = help.PeerColorSet; -help.peerColorOption#135bd42f flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet = help.PeerColorOption; +help.peerColorOption#ef8430ab flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet channel_min_level:flags.3?int = help.PeerColorOption; help.peerColorsNotModified#2ba1f5ce = help.PeerColors; help.peerColors#f8ed08 hash:int colors:Vector = help.PeerColors; +storyReaction#6090d6d5 peer_id:Peer date:int reaction:Reaction = StoryReaction; + +storyReactionPublicForward#bbab2643 message:Message = StoryReaction; + +storyReactionPublicRepost#cfcd0f13 peer_id:Peer story:StoryItem = StoryReaction; + +stories.storyReactionsList#aa5f789c flags:# count:int reactions:Vector chats:Vector users:Vector next_offset:flags.0?string = stories.StoryReactionsList; + ---functions--- @@ -2617,6 +2645,10 @@ account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; +account.getChannelDefaultEmojiStatuses#7727a7d5 hash:long = account.EmojiStatuses; + +account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; + users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -3029,7 +3061,7 @@ messages.setDefaultHistoryTTL#9eb51445 period:int = Bool; messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL; -messages.sendBotRequestedPeer#fe38d01b peer:InputPeer msg_id:int button_id:int requested_peer:InputPeer = Updates; +messages.sendBotRequestedPeer#91b2d060 peer:InputPeer msg_id:int button_id:int requested_peers:Vector = Updates; messages.getEmojiGroups#7488ce5b hash:int = messages.EmojiGroups; @@ -3091,8 +3123,6 @@ help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; -help.getAppChangelog#9010ef6f prev_app_version:string = Updates; - help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; @@ -3243,12 +3273,14 @@ channels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = U channels.clickSponsoredMessage#18afbc93 channel:InputChannel random_id:bytes = Bool; -channels.updateColor#621a201f flags:# channel:InputChannel color:int background_emoji_id:flags.0?long = Updates; +channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; channels.getChannelRecommendations#83b70d97 channel:InputChannel = messages.Chats; +channels.updateEmojiStatus#f0d3e6a8 channel:InputChannel emoji_status:EmojiStatus = Updates; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3413,7 +3445,7 @@ stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; -stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +stats.getMessagePublicForwards#5f150144 channel:InputChannel msg_id:int offset:string limit:int = stats.PublicForwards; stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; @@ -3467,7 +3499,7 @@ stories.readStories#a556dac8 peer:InputPeer max_id:int = Vector; stories.incrementStoryViews#b2028afb peer:InputPeer id:Vector = Bool; -stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; +stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true forwards_first:flags.3?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; stories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector = stories.StoryViews; @@ -3489,6 +3521,8 @@ stories.getChatsToSend#a56a8b60 = messages.Chats; stories.togglePeerStoriesHidden#bd0415c4 peer:InputPeer hidden:Bool = Bool; +stories.getStoryReactionsList#b9b2881f flags:# forwards_first:flags.2?true peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = stories.StoryReactionsList; + premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList; premium.getMyBoosts#be77b4a = premium.MyBoosts; @@ -3499,4 +3533,4 @@ premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; -// LAYER 167 +// LAYER 169 diff --git a/_schema/telegram.tl b/_schema/telegram.tl index 1a0c39eaf7..3488fdb76c 100644 --- a/_schema/telegram.tl +++ b/_schema/telegram.tl @@ -2,8 +2,8 @@ // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl // Merge: _schema/legacy.tl -// Layer: 167 -// SHA256: 4313c183fe2e60588dc1323061b46db2b105347501d9a5fb33032d2fe58ecfaa +// Layer: 169 +// SHA256: af77ecca722a36320c78d681dac9a9ccdfa2ba5282c0d7426619c6d866a4865e boolFalse#bc799737 = Bool; @@ -163,13 +163,13 @@ chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5 chatForbidden#6592a1a7 id:long title:string = Chat; -channel#8e87ccd8 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 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?int color:flags2.7?PeerColor = Chat; +channel#aadfc8f 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 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?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int = 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; chatFull#c9d31138 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 = ChatFull; -channelFull#723027bd 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 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 stories:flags2.4?PeerStories = ChatFull; +channelFull#f2bcb6f 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 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 stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -219,7 +219,9 @@ messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; -messageMediaGiveaway#58260664 flags:# only_new_subscribers:flags.0?true channels:Vector countries_iso2:flags.1?Vector quantity:int months:int until_date:int = MessageMedia; +messageMediaGiveaway#daad85b0 flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector countries_iso2:flags.1?Vector prize_description:flags.3?string quantity:int months:int until_date:int = MessageMedia; + +messageMediaGiveawayResults#c6991068 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector months:int prize_description:flags.1?string until_date:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; @@ -293,11 +295,11 @@ messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; -messageActionRequestedPeer#fe77345d button_id:int peer:Peer = MessageAction; +messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAction; messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#d2cfdb0e flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string = MessageAction; +messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; messageActionGiveawayLaunch#332ba9ed = MessageAction; @@ -691,6 +693,10 @@ updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; +updateBotMessageReaction#ac21d3ce peer:Peer msg_id:int date:int actor:Peer old_reactions:Vector new_reactions:Vector qts:int = Update; + +updateBotMessageReactions#9cb7759 peer:Peer msg_id:int date:int reactions:Vector qts:int = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -991,7 +997,9 @@ inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet; inputStickerSetEmojiDefaultTopicIcons#44c1f8e9 = InputStickerSet; -stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true videos:flags.6?true emojis:flags.7?true text_color:flags.9?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; +inputStickerSetEmojiChannelDefaultStatuses#49748553 = InputStickerSet; + +stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true videos:flags.6?true emojis:flags.7?true text_color:flags.9?true channel_emoji_status:flags.10?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; messages.stickerSet#6e153f16 set:StickerSet packs:Vector keywords:Vector documents:Vector = messages.StickerSet; @@ -1031,7 +1039,7 @@ keyboardButtonWebView#13767230 text:string url:string = KeyboardButton; keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton; -keyboardButtonRequestPeer#d0b468c text:string button_id:int peer_type:RequestPeerType = KeyboardButton; +keyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -1579,9 +1587,13 @@ channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopi channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeColor#3c2b247b prev_value:int new_value:int = ChannelAdminLogEventAction; +channelAdminLogEventActionChangePeerColor#5796e780 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; + +channelAdminLogEventActionChangeProfilePeerColor#5e477b25 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeBackgroundEmoji#445fc434 prev_value:long new_value:long = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_value:WallPaper = ChannelAdminLogEventAction; + +channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; @@ -1811,7 +1823,7 @@ account.wallPapers#cdc3858c hash:long wallpapers:Vector = account.Wal codeSettings#ad253d78 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true allow_missed_call:flags.5?true allow_firebase:flags.7?true logout_tokens:flags.6?Vector token:flags.8?string app_sandbox:flags.8?Bool = CodeSettings; -wallPaperSettings#1dc1bca4 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings; +wallPaperSettings#372efcd0 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int emoticon:flags.7?string = WallPaperSettings; autoDownloadSettings#baa57628 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true stories_preload:flags.4?true photo_size_max:int video_size_max:long file_size_max:long video_upload_maxbitrate:int small_queue_active_operations_max:int large_queue_active_operations_max:int = AutoDownloadSettings; @@ -2147,7 +2159,7 @@ inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:l inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentPremiumGiveaway#7c9375e6 flags:# only_new_subscribers:flags.0?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption; @@ -2303,7 +2315,11 @@ stories.stories#5dd8c3c8 count:int stories:Vector chats:Vector storyView#b0bdeac5 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true user_id:long date:int reaction:flags.2?Reaction = StoryView; -stories.storyViewsList#46e9b9ec flags:# count:int reactions_count:int views:Vector users:Vector next_offset:flags.0?string = stories.StoryViewsList; +storyViewPublicForward#9083670b flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true message:Message = StoryView; + +storyViewPublicRepost#bd74cf49 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer story:StoryItem = StoryView; + +stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count:int reactions_count:int views:Vector chats:Vector users:Vector next_offset:flags.0?string = stories.StoryViewsList; stories.storyViews#de9eed1d views:Vector users:Vector = stories.StoryViews; @@ -2325,6 +2341,10 @@ mediaAreaGeoPoint#df8b3b22 coordinates:MediaAreaCoordinates geo:GeoPoint = Media mediaAreaSuggestedReaction#14455871 flags:# dark:flags.0?true flipped:flags.1?true coordinates:MediaAreaCoordinates reaction:Reaction = MediaArea; +mediaAreaChannelPost#770416af coordinates:MediaAreaCoordinates channel_id:long msg_id:int = MediaArea; + +inputMediaAreaChannelPost#2271f2bf coordinates:MediaAreaCoordinates channel:InputChannel msg_id:int = MediaArea; + peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector = PeerStories; stories.peerStories#cae68768 stories:PeerStories chats:Vector users:Vector = stories.PeerStories; @@ -2333,7 +2353,7 @@ messages.webPage#fd5e12bd webpage:WebPage chats:Vector users:Vector premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption; -payments.checkedGiftCode#b722f158 flags:# via_giveaway:flags.2?true from_id:Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; +payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo; @@ -2371,12 +2391,20 @@ help.peerColorSet#26219a58 colors:Vector = help.PeerColorSet; help.peerColorProfileSet#767d61eb palette_colors:Vector bg_colors:Vector story_colors:Vector = help.PeerColorSet; -help.peerColorOption#135bd42f flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet = help.PeerColorOption; +help.peerColorOption#ef8430ab flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet channel_min_level:flags.3?int = help.PeerColorOption; help.peerColorsNotModified#2ba1f5ce = help.PeerColors; help.peerColors#f8ed08 hash:int colors:Vector = help.PeerColors; +storyReaction#6090d6d5 peer_id:Peer date:int reaction:Reaction = StoryReaction; + +storyReactionPublicForward#bbab2643 message:Message = StoryReaction; + +storyReactionPublicRepost#cfcd0f13 peer_id:Peer story:StoryItem = StoryReaction; + +stories.storyReactionsList#aa5f789c flags:# count:int reactions:Vector chats:Vector users:Vector next_offset:flags.0?string = stories.StoryReactionsList; + ---functions--- @@ -2618,6 +2646,10 @@ account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; +account.getChannelDefaultEmojiStatuses#7727a7d5 hash:long = account.EmojiStatuses; + +account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; + users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -3030,7 +3062,7 @@ messages.setDefaultHistoryTTL#9eb51445 period:int = Bool; messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL; -messages.sendBotRequestedPeer#fe38d01b peer:InputPeer msg_id:int button_id:int requested_peer:InputPeer = Updates; +messages.sendBotRequestedPeer#91b2d060 peer:InputPeer msg_id:int button_id:int requested_peers:Vector = Updates; messages.getEmojiGroups#7488ce5b hash:int = messages.EmojiGroups; @@ -3092,8 +3124,6 @@ help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; -help.getAppChangelog#9010ef6f prev_app_version:string = Updates; - help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; @@ -3244,12 +3274,14 @@ channels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = U channels.clickSponsoredMessage#18afbc93 channel:InputChannel random_id:bytes = Bool; -channels.updateColor#621a201f flags:# channel:InputChannel color:int background_emoji_id:flags.0?long = Updates; +channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; channels.getChannelRecommendations#83b70d97 channel:InputChannel = messages.Chats; +channels.updateEmojiStatus#f0d3e6a8 channel:InputChannel emoji_status:EmojiStatus = Updates; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3414,7 +3446,7 @@ stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; -stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +stats.getMessagePublicForwards#5f150144 channel:InputChannel msg_id:int offset:string limit:int = stats.PublicForwards; stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; @@ -3468,7 +3500,7 @@ stories.readStories#a556dac8 peer:InputPeer max_id:int = Vector; stories.incrementStoryViews#b2028afb peer:InputPeer id:Vector = Bool; -stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; +stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true forwards_first:flags.3?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; stories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector = stories.StoryViews; @@ -3490,6 +3522,8 @@ stories.getChatsToSend#a56a8b60 = messages.Chats; stories.togglePeerStoriesHidden#bd0415c4 peer:InputPeer hidden:Bool = Bool; +stories.getStoryReactionsList#b9b2881f flags:# forwards_first:flags.2?true peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = stories.StoryReactionsList; + premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList; premium.getMyBoosts#be77b4a = premium.MyBoosts; @@ -3532,4 +3566,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 167 +// LAYER 169 diff --git a/telegram/query/cached/queries.gen.go b/telegram/query/cached/queries.gen.go index 7d74528245..c3dc3db20c 100644 --- a/telegram/query/cached/queries.gen.go +++ b/telegram/query/cached/queries.gen.go @@ -14,6 +14,174 @@ import ( // No-op definition for keeping imports. var _ = context.Background() +type innerAccountGetChannelDefaultEmojiStatuses struct { + // Last received hash. + hash int64 + // Last received result. + value *tg.AccountEmojiStatuses +} + +type AccountGetChannelDefaultEmojiStatuses struct { + // Result state. + last atomic.Value + + // Reference to RPC client to make requests. + raw *tg.Client +} + +// NewAccountGetChannelDefaultEmojiStatuses creates new AccountGetChannelDefaultEmojiStatuses. +func NewAccountGetChannelDefaultEmojiStatuses(raw *tg.Client) *AccountGetChannelDefaultEmojiStatuses { + q := &AccountGetChannelDefaultEmojiStatuses{ + raw: raw, + } + + return q +} + +func (s *AccountGetChannelDefaultEmojiStatuses) store(v innerAccountGetChannelDefaultEmojiStatuses) { + s.last.Store(v) +} + +func (s *AccountGetChannelDefaultEmojiStatuses) load() (innerAccountGetChannelDefaultEmojiStatuses, bool) { + v, ok := s.last.Load().(innerAccountGetChannelDefaultEmojiStatuses) + return v, ok +} + +// Value returns last received result. +// NB: May be nil. Returned AccountEmojiStatuses must not be mutated. +func (s *AccountGetChannelDefaultEmojiStatuses) Value() *tg.AccountEmojiStatuses { + inner, _ := s.load() + return inner.value +} + +// Hash returns last received hash. +func (s *AccountGetChannelDefaultEmojiStatuses) Hash() int64 { + inner, _ := s.load() + return inner.hash +} + +// Get updates data if needed and returns it. +func (s *AccountGetChannelDefaultEmojiStatuses) Get(ctx context.Context) (*tg.AccountEmojiStatuses, error) { + if _, err := s.Fetch(ctx); err != nil { + return nil, err + } + + return s.Value(), nil +} + +// Fetch updates data if needed and returns true if data was modified. +func (s *AccountGetChannelDefaultEmojiStatuses) Fetch(ctx context.Context) (bool, error) { + lastHash := s.Hash() + + req := lastHash + result, err := s.raw.AccountGetChannelDefaultEmojiStatuses(ctx, req) + if err != nil { + return false, errors.Wrap(err, "execute AccountGetChannelDefaultEmojiStatuses") + } + + switch variant := result.(type) { + case *tg.AccountEmojiStatuses: + hash := variant.Hash + + s.store(innerAccountGetChannelDefaultEmojiStatuses{ + hash: hash, + value: variant, + }) + return true, nil + case *tg.AccountEmojiStatusesNotModified: + if lastHash == 0 { + return false, errors.Errorf("got unexpected %T result", result) + } + return false, nil + default: + return false, errors.Errorf("unexpected type %T", result) + } +} + +type innerAccountGetChannelRestrictedStatusEmojis struct { + // Last received hash. + hash int64 + // Last received result. + value *tg.EmojiList +} + +type AccountGetChannelRestrictedStatusEmojis struct { + // Result state. + last atomic.Value + + // Reference to RPC client to make requests. + raw *tg.Client +} + +// NewAccountGetChannelRestrictedStatusEmojis creates new AccountGetChannelRestrictedStatusEmojis. +func NewAccountGetChannelRestrictedStatusEmojis(raw *tg.Client) *AccountGetChannelRestrictedStatusEmojis { + q := &AccountGetChannelRestrictedStatusEmojis{ + raw: raw, + } + + return q +} + +func (s *AccountGetChannelRestrictedStatusEmojis) store(v innerAccountGetChannelRestrictedStatusEmojis) { + s.last.Store(v) +} + +func (s *AccountGetChannelRestrictedStatusEmojis) load() (innerAccountGetChannelRestrictedStatusEmojis, bool) { + v, ok := s.last.Load().(innerAccountGetChannelRestrictedStatusEmojis) + return v, ok +} + +// Value returns last received result. +// NB: May be nil. Returned EmojiList must not be mutated. +func (s *AccountGetChannelRestrictedStatusEmojis) Value() *tg.EmojiList { + inner, _ := s.load() + return inner.value +} + +// Hash returns last received hash. +func (s *AccountGetChannelRestrictedStatusEmojis) Hash() int64 { + inner, _ := s.load() + return inner.hash +} + +// Get updates data if needed and returns it. +func (s *AccountGetChannelRestrictedStatusEmojis) Get(ctx context.Context) (*tg.EmojiList, error) { + if _, err := s.Fetch(ctx); err != nil { + return nil, err + } + + return s.Value(), nil +} + +// Fetch updates data if needed and returns true if data was modified. +func (s *AccountGetChannelRestrictedStatusEmojis) Fetch(ctx context.Context) (bool, error) { + lastHash := s.Hash() + + req := lastHash + result, err := s.raw.AccountGetChannelRestrictedStatusEmojis(ctx, req) + if err != nil { + return false, errors.Wrap(err, "execute AccountGetChannelRestrictedStatusEmojis") + } + + switch variant := result.(type) { + case *tg.EmojiList: + hash := variant.Hash + + s.store(innerAccountGetChannelRestrictedStatusEmojis{ + hash: hash, + value: variant, + }) + return true, nil + case *tg.EmojiListNotModified: + if lastHash == 0 { + return false, errors.Errorf("got unexpected %T result", result) + } + return false, nil + default: + return false, errors.Errorf("unexpected type %T", result) + } +} + type innerAccountGetChatThemes struct { // Last received hash. hash int64 diff --git a/telegram/query/messages/queries.gen.go b/telegram/query/messages/queries.gen.go index 63875f8c2c..ac0854c94b 100644 --- a/telegram/query/messages/queries.gen.go +++ b/telegram/query/messages/queries.gen.go @@ -1228,109 +1228,3 @@ func (b *SearchSentMediaQueryBuilder) Collect(ctx context.Context) ([]Elem, erro return r, iter.Err() } - -// StatsGetMessagePublicForwardsQueryBuilder is query builder of StatsGetMessagePublicForwards. -type StatsGetMessagePublicForwardsQueryBuilder struct { - raw *tg.Client - req tg.StatsGetMessagePublicForwardsRequest - batchSize int - offsetID int - offsetPeer tg.InputPeerClass - offsetRate int -} - -// StatsGetMessagePublicForwards creates query builder of StatsGetMessagePublicForwards. -func (q *QueryBuilder) StatsGetMessagePublicForwards(paramChannel tg.InputChannelClass) *StatsGetMessagePublicForwardsQueryBuilder { - b := &StatsGetMessagePublicForwardsQueryBuilder{ - raw: q.raw, - batchSize: 1, - req: tg.StatsGetMessagePublicForwardsRequest{}, - } - - b.req.Channel = paramChannel - return b -} - -// BatchSize sets buffer of message loaded from one request. -// Be carefully, when set this limit, because Telegram does not return error if limit is too big, -// so results can be incorrect. -func (b *StatsGetMessagePublicForwardsQueryBuilder) BatchSize(batchSize int) *StatsGetMessagePublicForwardsQueryBuilder { - b.batchSize = batchSize - return b -} - -// OffsetID sets offsetID from which iterate start. -func (b *StatsGetMessagePublicForwardsQueryBuilder) OffsetID(offsetID int) *StatsGetMessagePublicForwardsQueryBuilder { - b.offsetID = offsetID - return b -} - -// Channel sets Channel field of StatsGetMessagePublicForwards query. -func (b *StatsGetMessagePublicForwardsQueryBuilder) Channel(paramChannel tg.InputChannelClass) *StatsGetMessagePublicForwardsQueryBuilder { - b.req.Channel = paramChannel - return b -} - -// MsgID sets MsgID field of StatsGetMessagePublicForwards query. -func (b *StatsGetMessagePublicForwardsQueryBuilder) MsgID(paramMsgID int) *StatsGetMessagePublicForwardsQueryBuilder { - b.req.MsgID = paramMsgID - return b -} - -// Query implements Query interface. -func (b *StatsGetMessagePublicForwardsQueryBuilder) Query(ctx context.Context, req Request) (tg.MessagesMessagesClass, error) { - r := &tg.StatsGetMessagePublicForwardsRequest{ - Limit: req.Limit, - } - - r.Channel = b.req.Channel - r.MsgID = b.req.MsgID - r.OffsetID = req.OffsetID - r.OffsetPeer = req.OffsetPeer - r.OffsetRate = req.OffsetRate - return b.raw.StatsGetMessagePublicForwards(ctx, r) -} - -// Iter returns iterator using built query. -func (b *StatsGetMessagePublicForwardsQueryBuilder) Iter() *Iterator { - iter := NewIterator(b, b.batchSize) - iter = iter.OffsetID(b.offsetID) - return iter -} - -// ForEach calls given callback on each iterator element. -func (b *StatsGetMessagePublicForwardsQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error { - iter := b.Iter() - for iter.Next(ctx) { - if err := cb(ctx, iter.Value()); err != nil { - return err - } - } - return iter.Err() -} - -// Count fetches remote state to get number of elements. -func (b *StatsGetMessagePublicForwardsQueryBuilder) Count(ctx context.Context) (int, error) { - iter := b.Iter() - c, err := iter.Total(ctx) - if err != nil { - return 0, errors.Wrap(err, "get total") - } - return c, nil -} - -// Collect creates iterator and collects all elements to slice. -func (b *StatsGetMessagePublicForwardsQueryBuilder) Collect(ctx context.Context) ([]Elem, error) { - iter := b.Iter() - c, err := iter.Total(ctx) - if err != nil { - return nil, errors.Wrap(err, "get total") - } - - r := make([]Elem, 0, c) - for iter.Next(ctx) { - r = append(r, iter.Value()) - } - - return r, iter.Err() -} diff --git a/tg/tl_account_get_channel_default_emoji_statuses_gen.go b/tg/tl_account_get_channel_default_emoji_statuses_gen.go new file mode 100644 index 0000000000..544468d1e5 --- /dev/null +++ b/tg/tl_account_get_channel_default_emoji_statuses_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" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AccountGetChannelDefaultEmojiStatusesRequest represents TL type `account.getChannelDefaultEmojiStatuses#7727a7d5`. +// +// See https://core.telegram.org/method/account.getChannelDefaultEmojiStatuses for reference. +type AccountGetChannelDefaultEmojiStatusesRequest struct { + // Hash field of AccountGetChannelDefaultEmojiStatusesRequest. + Hash int64 +} + +// AccountGetChannelDefaultEmojiStatusesRequestTypeID is TL type id of AccountGetChannelDefaultEmojiStatusesRequest. +const AccountGetChannelDefaultEmojiStatusesRequestTypeID = 0x7727a7d5 + +// Ensuring interfaces in compile-time for AccountGetChannelDefaultEmojiStatusesRequest. +var ( + _ bin.Encoder = &AccountGetChannelDefaultEmojiStatusesRequest{} + _ bin.Decoder = &AccountGetChannelDefaultEmojiStatusesRequest{} + _ bin.BareEncoder = &AccountGetChannelDefaultEmojiStatusesRequest{} + _ bin.BareDecoder = &AccountGetChannelDefaultEmojiStatusesRequest{} +) + +func (g *AccountGetChannelDefaultEmojiStatusesRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Hash == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *AccountGetChannelDefaultEmojiStatusesRequest) String() string { + if g == nil { + return "AccountGetChannelDefaultEmojiStatusesRequest(nil)" + } + type Alias AccountGetChannelDefaultEmojiStatusesRequest + return fmt.Sprintf("AccountGetChannelDefaultEmojiStatusesRequest%+v", Alias(*g)) +} + +// FillFrom fills AccountGetChannelDefaultEmojiStatusesRequest from given interface. +func (g *AccountGetChannelDefaultEmojiStatusesRequest) FillFrom(from interface { + GetHash() (value int64) +}) { + g.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountGetChannelDefaultEmojiStatusesRequest) TypeID() uint32 { + return AccountGetChannelDefaultEmojiStatusesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountGetChannelDefaultEmojiStatusesRequest) TypeName() string { + return "account.getChannelDefaultEmojiStatuses" +} + +// TypeInfo returns info about TL type. +func (g *AccountGetChannelDefaultEmojiStatusesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.getChannelDefaultEmojiStatuses", + ID: AccountGetChannelDefaultEmojiStatusesRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *AccountGetChannelDefaultEmojiStatusesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode account.getChannelDefaultEmojiStatuses#7727a7d5 as nil") + } + b.PutID(AccountGetChannelDefaultEmojiStatusesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *AccountGetChannelDefaultEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode account.getChannelDefaultEmojiStatuses#7727a7d5 as nil") + } + b.PutLong(g.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (g *AccountGetChannelDefaultEmojiStatusesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode account.getChannelDefaultEmojiStatuses#7727a7d5 to nil") + } + if err := b.ConsumeID(AccountGetChannelDefaultEmojiStatusesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.getChannelDefaultEmojiStatuses#7727a7d5: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *AccountGetChannelDefaultEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode account.getChannelDefaultEmojiStatuses#7727a7d5 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode account.getChannelDefaultEmojiStatuses#7727a7d5: field hash: %w", err) + } + g.Hash = value + } + return nil +} + +// GetHash returns value of Hash field. +func (g *AccountGetChannelDefaultEmojiStatusesRequest) GetHash() (value int64) { + if g == nil { + return + } + return g.Hash +} + +// AccountGetChannelDefaultEmojiStatuses invokes method account.getChannelDefaultEmojiStatuses#7727a7d5 returning error if any. +// +// See https://core.telegram.org/method/account.getChannelDefaultEmojiStatuses for reference. +func (c *Client) AccountGetChannelDefaultEmojiStatuses(ctx context.Context, hash int64) (AccountEmojiStatusesClass, error) { + var result AccountEmojiStatusesBox + + request := &AccountGetChannelDefaultEmojiStatusesRequest{ + Hash: hash, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.EmojiStatuses, nil +} diff --git a/tg/tl_help_get_app_changelog_slices_gen.go b/tg/tl_account_get_channel_default_emoji_statuses_slices_gen.go similarity index 100% rename from tg/tl_help_get_app_changelog_slices_gen.go rename to tg/tl_account_get_channel_default_emoji_statuses_slices_gen.go diff --git a/tg/tl_account_get_channel_restricted_status_emojis_gen.go b/tg/tl_account_get_channel_restricted_status_emojis_gen.go new file mode 100644 index 0000000000..a806efc30d --- /dev/null +++ b/tg/tl_account_get_channel_restricted_status_emojis_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" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// AccountGetChannelRestrictedStatusEmojisRequest represents TL type `account.getChannelRestrictedStatusEmojis#35a9e0d5`. +// +// See https://core.telegram.org/method/account.getChannelRestrictedStatusEmojis for reference. +type AccountGetChannelRestrictedStatusEmojisRequest struct { + // Hash field of AccountGetChannelRestrictedStatusEmojisRequest. + Hash int64 +} + +// AccountGetChannelRestrictedStatusEmojisRequestTypeID is TL type id of AccountGetChannelRestrictedStatusEmojisRequest. +const AccountGetChannelRestrictedStatusEmojisRequestTypeID = 0x35a9e0d5 + +// Ensuring interfaces in compile-time for AccountGetChannelRestrictedStatusEmojisRequest. +var ( + _ bin.Encoder = &AccountGetChannelRestrictedStatusEmojisRequest{} + _ bin.Decoder = &AccountGetChannelRestrictedStatusEmojisRequest{} + _ bin.BareEncoder = &AccountGetChannelRestrictedStatusEmojisRequest{} + _ bin.BareDecoder = &AccountGetChannelRestrictedStatusEmojisRequest{} +) + +func (g *AccountGetChannelRestrictedStatusEmojisRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Hash == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *AccountGetChannelRestrictedStatusEmojisRequest) String() string { + if g == nil { + return "AccountGetChannelRestrictedStatusEmojisRequest(nil)" + } + type Alias AccountGetChannelRestrictedStatusEmojisRequest + return fmt.Sprintf("AccountGetChannelRestrictedStatusEmojisRequest%+v", Alias(*g)) +} + +// FillFrom fills AccountGetChannelRestrictedStatusEmojisRequest from given interface. +func (g *AccountGetChannelRestrictedStatusEmojisRequest) FillFrom(from interface { + GetHash() (value int64) +}) { + g.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*AccountGetChannelRestrictedStatusEmojisRequest) TypeID() uint32 { + return AccountGetChannelRestrictedStatusEmojisRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*AccountGetChannelRestrictedStatusEmojisRequest) TypeName() string { + return "account.getChannelRestrictedStatusEmojis" +} + +// TypeInfo returns info about TL type. +func (g *AccountGetChannelRestrictedStatusEmojisRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "account.getChannelRestrictedStatusEmojis", + ID: AccountGetChannelRestrictedStatusEmojisRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *AccountGetChannelRestrictedStatusEmojisRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode account.getChannelRestrictedStatusEmojis#35a9e0d5 as nil") + } + b.PutID(AccountGetChannelRestrictedStatusEmojisRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *AccountGetChannelRestrictedStatusEmojisRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode account.getChannelRestrictedStatusEmojis#35a9e0d5 as nil") + } + b.PutLong(g.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (g *AccountGetChannelRestrictedStatusEmojisRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode account.getChannelRestrictedStatusEmojis#35a9e0d5 to nil") + } + if err := b.ConsumeID(AccountGetChannelRestrictedStatusEmojisRequestTypeID); err != nil { + return fmt.Errorf("unable to decode account.getChannelRestrictedStatusEmojis#35a9e0d5: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *AccountGetChannelRestrictedStatusEmojisRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode account.getChannelRestrictedStatusEmojis#35a9e0d5 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode account.getChannelRestrictedStatusEmojis#35a9e0d5: field hash: %w", err) + } + g.Hash = value + } + return nil +} + +// GetHash returns value of Hash field. +func (g *AccountGetChannelRestrictedStatusEmojisRequest) GetHash() (value int64) { + if g == nil { + return + } + return g.Hash +} + +// AccountGetChannelRestrictedStatusEmojis invokes method account.getChannelRestrictedStatusEmojis#35a9e0d5 returning error if any. +// +// See https://core.telegram.org/method/account.getChannelRestrictedStatusEmojis for reference. +func (c *Client) AccountGetChannelRestrictedStatusEmojis(ctx context.Context, hash int64) (EmojiListClass, error) { + var result EmojiListBox + + request := &AccountGetChannelRestrictedStatusEmojisRequest{ + Hash: hash, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.EmojiList, nil +} diff --git a/tg/tl_account_get_channel_restricted_status_emojis_slices_gen.go b/tg/tl_account_get_channel_restricted_status_emojis_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_account_get_channel_restricted_status_emojis_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_channel_admin_log_event_action_gen.go b/tg/tl_channel_admin_log_event_action_gen.go index b80a19d4e5..282428b874 100644 --- a/tg/tl_channel_admin_log_event_action_gen.go +++ b/tg/tl_channel_admin_log_event_action_gen.go @@ -6707,40 +6707,42 @@ func (c *ChannelAdminLogEventActionToggleAntiSpam) GetNewValue() (value bool) { return c.NewValue } -// ChannelAdminLogEventActionChangeColor represents TL type `channelAdminLogEventActionChangeColor#3c2b247b`. +// ChannelAdminLogEventActionChangePeerColor represents TL type `channelAdminLogEventActionChangePeerColor#5796e780`. // -// See https://core.telegram.org/constructor/channelAdminLogEventActionChangeColor for reference. -type ChannelAdminLogEventActionChangeColor struct { - // PrevValue field of ChannelAdminLogEventActionChangeColor. - PrevValue int - // NewValue field of ChannelAdminLogEventActionChangeColor. - NewValue int +// See https://core.telegram.org/constructor/channelAdminLogEventActionChangePeerColor for reference. +type ChannelAdminLogEventActionChangePeerColor struct { + // PrevValue field of ChannelAdminLogEventActionChangePeerColor. + PrevValue PeerColor + // NewValue field of ChannelAdminLogEventActionChangePeerColor. + NewValue PeerColor } -// ChannelAdminLogEventActionChangeColorTypeID is TL type id of ChannelAdminLogEventActionChangeColor. -const ChannelAdminLogEventActionChangeColorTypeID = 0x3c2b247b +// ChannelAdminLogEventActionChangePeerColorTypeID is TL type id of ChannelAdminLogEventActionChangePeerColor. +const ChannelAdminLogEventActionChangePeerColorTypeID = 0x5796e780 // construct implements constructor of ChannelAdminLogEventActionClass. -func (c ChannelAdminLogEventActionChangeColor) construct() ChannelAdminLogEventActionClass { return &c } +func (c ChannelAdminLogEventActionChangePeerColor) construct() ChannelAdminLogEventActionClass { + return &c +} -// Ensuring interfaces in compile-time for ChannelAdminLogEventActionChangeColor. +// Ensuring interfaces in compile-time for ChannelAdminLogEventActionChangePeerColor. var ( - _ bin.Encoder = &ChannelAdminLogEventActionChangeColor{} - _ bin.Decoder = &ChannelAdminLogEventActionChangeColor{} - _ bin.BareEncoder = &ChannelAdminLogEventActionChangeColor{} - _ bin.BareDecoder = &ChannelAdminLogEventActionChangeColor{} + _ bin.Encoder = &ChannelAdminLogEventActionChangePeerColor{} + _ bin.Decoder = &ChannelAdminLogEventActionChangePeerColor{} + _ bin.BareEncoder = &ChannelAdminLogEventActionChangePeerColor{} + _ bin.BareDecoder = &ChannelAdminLogEventActionChangePeerColor{} - _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionChangeColor{} + _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionChangePeerColor{} ) -func (c *ChannelAdminLogEventActionChangeColor) Zero() bool { +func (c *ChannelAdminLogEventActionChangePeerColor) Zero() bool { if c == nil { return true } - if !(c.PrevValue == 0) { + if !(c.PrevValue.Zero()) { return false } - if !(c.NewValue == 0) { + if !(c.NewValue.Zero()) { return false } @@ -6748,18 +6750,18 @@ func (c *ChannelAdminLogEventActionChangeColor) Zero() bool { } // String implements fmt.Stringer. -func (c *ChannelAdminLogEventActionChangeColor) String() string { +func (c *ChannelAdminLogEventActionChangePeerColor) String() string { if c == nil { - return "ChannelAdminLogEventActionChangeColor(nil)" + return "ChannelAdminLogEventActionChangePeerColor(nil)" } - type Alias ChannelAdminLogEventActionChangeColor - return fmt.Sprintf("ChannelAdminLogEventActionChangeColor%+v", Alias(*c)) + type Alias ChannelAdminLogEventActionChangePeerColor + return fmt.Sprintf("ChannelAdminLogEventActionChangePeerColor%+v", Alias(*c)) } -// FillFrom fills ChannelAdminLogEventActionChangeColor from given interface. -func (c *ChannelAdminLogEventActionChangeColor) FillFrom(from interface { - GetPrevValue() (value int) - GetNewValue() (value int) +// FillFrom fills ChannelAdminLogEventActionChangePeerColor from given interface. +func (c *ChannelAdminLogEventActionChangePeerColor) FillFrom(from interface { + GetPrevValue() (value PeerColor) + GetNewValue() (value PeerColor) }) { c.PrevValue = from.GetPrevValue() c.NewValue = from.GetNewValue() @@ -6768,20 +6770,20 @@ func (c *ChannelAdminLogEventActionChangeColor) FillFrom(from interface { // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChannelAdminLogEventActionChangeColor) TypeID() uint32 { - return ChannelAdminLogEventActionChangeColorTypeID +func (*ChannelAdminLogEventActionChangePeerColor) TypeID() uint32 { + return ChannelAdminLogEventActionChangePeerColorTypeID } // TypeName returns name of type in TL schema. -func (*ChannelAdminLogEventActionChangeColor) TypeName() string { - return "channelAdminLogEventActionChangeColor" +func (*ChannelAdminLogEventActionChangePeerColor) TypeName() string { + return "channelAdminLogEventActionChangePeerColor" } // TypeInfo returns info about TL type. -func (c *ChannelAdminLogEventActionChangeColor) TypeInfo() tdp.Type { +func (c *ChannelAdminLogEventActionChangePeerColor) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "channelAdminLogEventActionChangeColor", - ID: ChannelAdminLogEventActionChangeColorTypeID, + Name: "channelAdminLogEventActionChangePeerColor", + ID: ChannelAdminLogEventActionChangePeerColorTypeID, } if c == nil { typ.Null = true @@ -6801,51 +6803,387 @@ func (c *ChannelAdminLogEventActionChangeColor) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (c *ChannelAdminLogEventActionChangeColor) Encode(b *bin.Buffer) error { +func (c *ChannelAdminLogEventActionChangePeerColor) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelAdminLogEventActionChangeColor#3c2b247b as nil") + return fmt.Errorf("can't encode channelAdminLogEventActionChangePeerColor#5796e780 as nil") } - b.PutID(ChannelAdminLogEventActionChangeColorTypeID) + b.PutID(ChannelAdminLogEventActionChangePeerColorTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChannelAdminLogEventActionChangeColor) EncodeBare(b *bin.Buffer) error { +func (c *ChannelAdminLogEventActionChangePeerColor) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelAdminLogEventActionChangeColor#3c2b247b as nil") + return fmt.Errorf("can't encode channelAdminLogEventActionChangePeerColor#5796e780 as nil") + } + if err := c.PrevValue.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangePeerColor#5796e780: field prev_value: %w", err) + } + if err := c.NewValue.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangePeerColor#5796e780: field new_value: %w", err) } - b.PutInt(c.PrevValue) - b.PutInt(c.NewValue) return nil } // Decode implements bin.Decoder. -func (c *ChannelAdminLogEventActionChangeColor) Decode(b *bin.Buffer) error { +func (c *ChannelAdminLogEventActionChangePeerColor) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelAdminLogEventActionChangeColor#3c2b247b to nil") + return fmt.Errorf("can't decode channelAdminLogEventActionChangePeerColor#5796e780 to nil") } - if err := b.ConsumeID(ChannelAdminLogEventActionChangeColorTypeID); err != nil { - return fmt.Errorf("unable to decode channelAdminLogEventActionChangeColor#3c2b247b: %w", err) + if err := b.ConsumeID(ChannelAdminLogEventActionChangePeerColorTypeID); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangePeerColor#5796e780: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChannelAdminLogEventActionChangeColor) DecodeBare(b *bin.Buffer) error { +func (c *ChannelAdminLogEventActionChangePeerColor) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelAdminLogEventActionChangeColor#3c2b247b to nil") + return fmt.Errorf("can't decode channelAdminLogEventActionChangePeerColor#5796e780 to nil") } { - value, err := b.Int() + if err := c.PrevValue.Decode(b); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangePeerColor#5796e780: field prev_value: %w", err) + } + } + { + if err := c.NewValue.Decode(b); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangePeerColor#5796e780: field new_value: %w", err) + } + } + return nil +} + +// GetPrevValue returns value of PrevValue field. +func (c *ChannelAdminLogEventActionChangePeerColor) GetPrevValue() (value PeerColor) { + if c == nil { + return + } + return c.PrevValue +} + +// GetNewValue returns value of NewValue field. +func (c *ChannelAdminLogEventActionChangePeerColor) GetNewValue() (value PeerColor) { + if c == nil { + return + } + return c.NewValue +} + +// ChannelAdminLogEventActionChangeProfilePeerColor represents TL type `channelAdminLogEventActionChangeProfilePeerColor#5e477b25`. +// +// See https://core.telegram.org/constructor/channelAdminLogEventActionChangeProfilePeerColor for reference. +type ChannelAdminLogEventActionChangeProfilePeerColor struct { + // PrevValue field of ChannelAdminLogEventActionChangeProfilePeerColor. + PrevValue PeerColor + // NewValue field of ChannelAdminLogEventActionChangeProfilePeerColor. + NewValue PeerColor +} + +// ChannelAdminLogEventActionChangeProfilePeerColorTypeID is TL type id of ChannelAdminLogEventActionChangeProfilePeerColor. +const ChannelAdminLogEventActionChangeProfilePeerColorTypeID = 0x5e477b25 + +// construct implements constructor of ChannelAdminLogEventActionClass. +func (c ChannelAdminLogEventActionChangeProfilePeerColor) construct() ChannelAdminLogEventActionClass { + return &c +} + +// Ensuring interfaces in compile-time for ChannelAdminLogEventActionChangeProfilePeerColor. +var ( + _ bin.Encoder = &ChannelAdminLogEventActionChangeProfilePeerColor{} + _ bin.Decoder = &ChannelAdminLogEventActionChangeProfilePeerColor{} + _ bin.BareEncoder = &ChannelAdminLogEventActionChangeProfilePeerColor{} + _ bin.BareDecoder = &ChannelAdminLogEventActionChangeProfilePeerColor{} + + _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionChangeProfilePeerColor{} +) + +func (c *ChannelAdminLogEventActionChangeProfilePeerColor) Zero() bool { + if c == nil { + return true + } + if !(c.PrevValue.Zero()) { + return false + } + if !(c.NewValue.Zero()) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChannelAdminLogEventActionChangeProfilePeerColor) String() string { + if c == nil { + return "ChannelAdminLogEventActionChangeProfilePeerColor(nil)" + } + type Alias ChannelAdminLogEventActionChangeProfilePeerColor + return fmt.Sprintf("ChannelAdminLogEventActionChangeProfilePeerColor%+v", Alias(*c)) +} + +// FillFrom fills ChannelAdminLogEventActionChangeProfilePeerColor from given interface. +func (c *ChannelAdminLogEventActionChangeProfilePeerColor) FillFrom(from interface { + GetPrevValue() (value PeerColor) + GetNewValue() (value PeerColor) +}) { + c.PrevValue = from.GetPrevValue() + c.NewValue = from.GetNewValue() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelAdminLogEventActionChangeProfilePeerColor) TypeID() uint32 { + return ChannelAdminLogEventActionChangeProfilePeerColorTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelAdminLogEventActionChangeProfilePeerColor) TypeName() string { + return "channelAdminLogEventActionChangeProfilePeerColor" +} + +// TypeInfo returns info about TL type. +func (c *ChannelAdminLogEventActionChangeProfilePeerColor) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channelAdminLogEventActionChangeProfilePeerColor", + ID: ChannelAdminLogEventActionChangeProfilePeerColorTypeID, + } + if c == 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 (c *ChannelAdminLogEventActionChangeProfilePeerColor) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionChangeProfilePeerColor#5e477b25 as nil") + } + b.PutID(ChannelAdminLogEventActionChangeProfilePeerColorTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChannelAdminLogEventActionChangeProfilePeerColor) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionChangeProfilePeerColor#5e477b25 as nil") + } + if err := c.PrevValue.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeProfilePeerColor#5e477b25: field prev_value: %w", err) + } + if err := c.NewValue.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeProfilePeerColor#5e477b25: field new_value: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (c *ChannelAdminLogEventActionChangeProfilePeerColor) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionChangeProfilePeerColor#5e477b25 to nil") + } + if err := b.ConsumeID(ChannelAdminLogEventActionChangeProfilePeerColorTypeID); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeProfilePeerColor#5e477b25: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChannelAdminLogEventActionChangeProfilePeerColor) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionChangeProfilePeerColor#5e477b25 to nil") + } + { + if err := c.PrevValue.Decode(b); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeProfilePeerColor#5e477b25: field prev_value: %w", err) + } + } + { + if err := c.NewValue.Decode(b); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeProfilePeerColor#5e477b25: field new_value: %w", err) + } + } + return nil +} + +// GetPrevValue returns value of PrevValue field. +func (c *ChannelAdminLogEventActionChangeProfilePeerColor) GetPrevValue() (value PeerColor) { + if c == nil { + return + } + return c.PrevValue +} + +// GetNewValue returns value of NewValue field. +func (c *ChannelAdminLogEventActionChangeProfilePeerColor) GetNewValue() (value PeerColor) { + if c == nil { + return + } + return c.NewValue +} + +// ChannelAdminLogEventActionChangeWallpaper represents TL type `channelAdminLogEventActionChangeWallpaper#31bb5d52`. +// +// See https://core.telegram.org/constructor/channelAdminLogEventActionChangeWallpaper for reference. +type ChannelAdminLogEventActionChangeWallpaper struct { + // PrevValue field of ChannelAdminLogEventActionChangeWallpaper. + PrevValue WallPaperClass + // NewValue field of ChannelAdminLogEventActionChangeWallpaper. + NewValue WallPaperClass +} + +// ChannelAdminLogEventActionChangeWallpaperTypeID is TL type id of ChannelAdminLogEventActionChangeWallpaper. +const ChannelAdminLogEventActionChangeWallpaperTypeID = 0x31bb5d52 + +// construct implements constructor of ChannelAdminLogEventActionClass. +func (c ChannelAdminLogEventActionChangeWallpaper) construct() ChannelAdminLogEventActionClass { + return &c +} + +// Ensuring interfaces in compile-time for ChannelAdminLogEventActionChangeWallpaper. +var ( + _ bin.Encoder = &ChannelAdminLogEventActionChangeWallpaper{} + _ bin.Decoder = &ChannelAdminLogEventActionChangeWallpaper{} + _ bin.BareEncoder = &ChannelAdminLogEventActionChangeWallpaper{} + _ bin.BareDecoder = &ChannelAdminLogEventActionChangeWallpaper{} + + _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionChangeWallpaper{} +) + +func (c *ChannelAdminLogEventActionChangeWallpaper) Zero() bool { + if c == nil { + return true + } + if !(c.PrevValue == nil) { + return false + } + if !(c.NewValue == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChannelAdminLogEventActionChangeWallpaper) String() string { + if c == nil { + return "ChannelAdminLogEventActionChangeWallpaper(nil)" + } + type Alias ChannelAdminLogEventActionChangeWallpaper + return fmt.Sprintf("ChannelAdminLogEventActionChangeWallpaper%+v", Alias(*c)) +} + +// FillFrom fills ChannelAdminLogEventActionChangeWallpaper from given interface. +func (c *ChannelAdminLogEventActionChangeWallpaper) FillFrom(from interface { + GetPrevValue() (value WallPaperClass) + GetNewValue() (value WallPaperClass) +}) { + c.PrevValue = from.GetPrevValue() + c.NewValue = from.GetNewValue() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelAdminLogEventActionChangeWallpaper) TypeID() uint32 { + return ChannelAdminLogEventActionChangeWallpaperTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelAdminLogEventActionChangeWallpaper) TypeName() string { + return "channelAdminLogEventActionChangeWallpaper" +} + +// TypeInfo returns info about TL type. +func (c *ChannelAdminLogEventActionChangeWallpaper) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channelAdminLogEventActionChangeWallpaper", + ID: ChannelAdminLogEventActionChangeWallpaperTypeID, + } + if c == 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 (c *ChannelAdminLogEventActionChangeWallpaper) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionChangeWallpaper#31bb5d52 as nil") + } + b.PutID(ChannelAdminLogEventActionChangeWallpaperTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChannelAdminLogEventActionChangeWallpaper) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionChangeWallpaper#31bb5d52 as nil") + } + if c.PrevValue == nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeWallpaper#31bb5d52: field prev_value is nil") + } + if err := c.PrevValue.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeWallpaper#31bb5d52: field prev_value: %w", err) + } + if c.NewValue == nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeWallpaper#31bb5d52: field new_value is nil") + } + if err := c.NewValue.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeWallpaper#31bb5d52: field new_value: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (c *ChannelAdminLogEventActionChangeWallpaper) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionChangeWallpaper#31bb5d52 to nil") + } + if err := b.ConsumeID(ChannelAdminLogEventActionChangeWallpaperTypeID); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeWallpaper#31bb5d52: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChannelAdminLogEventActionChangeWallpaper) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionChangeWallpaper#31bb5d52 to nil") + } + { + value, err := DecodeWallPaper(b) if err != nil { - return fmt.Errorf("unable to decode channelAdminLogEventActionChangeColor#3c2b247b: field prev_value: %w", err) + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeWallpaper#31bb5d52: field prev_value: %w", err) } c.PrevValue = value } { - value, err := b.Int() + value, err := DecodeWallPaper(b) if err != nil { - return fmt.Errorf("unable to decode channelAdminLogEventActionChangeColor#3c2b247b: field new_value: %w", err) + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeWallpaper#31bb5d52: field new_value: %w", err) } c.NewValue = value } @@ -6853,7 +7191,7 @@ func (c *ChannelAdminLogEventActionChangeColor) DecodeBare(b *bin.Buffer) error } // GetPrevValue returns value of PrevValue field. -func (c *ChannelAdminLogEventActionChangeColor) GetPrevValue() (value int) { +func (c *ChannelAdminLogEventActionChangeWallpaper) GetPrevValue() (value WallPaperClass) { if c == nil { return } @@ -6861,49 +7199,49 @@ func (c *ChannelAdminLogEventActionChangeColor) GetPrevValue() (value int) { } // GetNewValue returns value of NewValue field. -func (c *ChannelAdminLogEventActionChangeColor) GetNewValue() (value int) { +func (c *ChannelAdminLogEventActionChangeWallpaper) GetNewValue() (value WallPaperClass) { if c == nil { return } return c.NewValue } -// ChannelAdminLogEventActionChangeBackgroundEmoji represents TL type `channelAdminLogEventActionChangeBackgroundEmoji#445fc434`. +// ChannelAdminLogEventActionChangeEmojiStatus represents TL type `channelAdminLogEventActionChangeEmojiStatus#3ea9feb1`. // -// See https://core.telegram.org/constructor/channelAdminLogEventActionChangeBackgroundEmoji for reference. -type ChannelAdminLogEventActionChangeBackgroundEmoji struct { - // PrevValue field of ChannelAdminLogEventActionChangeBackgroundEmoji. - PrevValue int64 - // NewValue field of ChannelAdminLogEventActionChangeBackgroundEmoji. - NewValue int64 +// See https://core.telegram.org/constructor/channelAdminLogEventActionChangeEmojiStatus for reference. +type ChannelAdminLogEventActionChangeEmojiStatus struct { + // PrevValue field of ChannelAdminLogEventActionChangeEmojiStatus. + PrevValue EmojiStatusClass + // NewValue field of ChannelAdminLogEventActionChangeEmojiStatus. + NewValue EmojiStatusClass } -// ChannelAdminLogEventActionChangeBackgroundEmojiTypeID is TL type id of ChannelAdminLogEventActionChangeBackgroundEmoji. -const ChannelAdminLogEventActionChangeBackgroundEmojiTypeID = 0x445fc434 +// ChannelAdminLogEventActionChangeEmojiStatusTypeID is TL type id of ChannelAdminLogEventActionChangeEmojiStatus. +const ChannelAdminLogEventActionChangeEmojiStatusTypeID = 0x3ea9feb1 // construct implements constructor of ChannelAdminLogEventActionClass. -func (c ChannelAdminLogEventActionChangeBackgroundEmoji) construct() ChannelAdminLogEventActionClass { +func (c ChannelAdminLogEventActionChangeEmojiStatus) construct() ChannelAdminLogEventActionClass { return &c } -// Ensuring interfaces in compile-time for ChannelAdminLogEventActionChangeBackgroundEmoji. +// Ensuring interfaces in compile-time for ChannelAdminLogEventActionChangeEmojiStatus. var ( - _ bin.Encoder = &ChannelAdminLogEventActionChangeBackgroundEmoji{} - _ bin.Decoder = &ChannelAdminLogEventActionChangeBackgroundEmoji{} - _ bin.BareEncoder = &ChannelAdminLogEventActionChangeBackgroundEmoji{} - _ bin.BareDecoder = &ChannelAdminLogEventActionChangeBackgroundEmoji{} + _ bin.Encoder = &ChannelAdminLogEventActionChangeEmojiStatus{} + _ bin.Decoder = &ChannelAdminLogEventActionChangeEmojiStatus{} + _ bin.BareEncoder = &ChannelAdminLogEventActionChangeEmojiStatus{} + _ bin.BareDecoder = &ChannelAdminLogEventActionChangeEmojiStatus{} - _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionChangeBackgroundEmoji{} + _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionChangeEmojiStatus{} ) -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) Zero() bool { +func (c *ChannelAdminLogEventActionChangeEmojiStatus) Zero() bool { if c == nil { return true } - if !(c.PrevValue == 0) { + if !(c.PrevValue == nil) { return false } - if !(c.NewValue == 0) { + if !(c.NewValue == nil) { return false } @@ -6911,18 +7249,18 @@ func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) Zero() bool { } // String implements fmt.Stringer. -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) String() string { +func (c *ChannelAdminLogEventActionChangeEmojiStatus) String() string { if c == nil { - return "ChannelAdminLogEventActionChangeBackgroundEmoji(nil)" + return "ChannelAdminLogEventActionChangeEmojiStatus(nil)" } - type Alias ChannelAdminLogEventActionChangeBackgroundEmoji - return fmt.Sprintf("ChannelAdminLogEventActionChangeBackgroundEmoji%+v", Alias(*c)) + type Alias ChannelAdminLogEventActionChangeEmojiStatus + return fmt.Sprintf("ChannelAdminLogEventActionChangeEmojiStatus%+v", Alias(*c)) } -// FillFrom fills ChannelAdminLogEventActionChangeBackgroundEmoji from given interface. -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) FillFrom(from interface { - GetPrevValue() (value int64) - GetNewValue() (value int64) +// FillFrom fills ChannelAdminLogEventActionChangeEmojiStatus from given interface. +func (c *ChannelAdminLogEventActionChangeEmojiStatus) FillFrom(from interface { + GetPrevValue() (value EmojiStatusClass) + GetNewValue() (value EmojiStatusClass) }) { c.PrevValue = from.GetPrevValue() c.NewValue = from.GetNewValue() @@ -6931,20 +7269,20 @@ func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) FillFrom(from interfac // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChannelAdminLogEventActionChangeBackgroundEmoji) TypeID() uint32 { - return ChannelAdminLogEventActionChangeBackgroundEmojiTypeID +func (*ChannelAdminLogEventActionChangeEmojiStatus) TypeID() uint32 { + return ChannelAdminLogEventActionChangeEmojiStatusTypeID } // TypeName returns name of type in TL schema. -func (*ChannelAdminLogEventActionChangeBackgroundEmoji) TypeName() string { - return "channelAdminLogEventActionChangeBackgroundEmoji" +func (*ChannelAdminLogEventActionChangeEmojiStatus) TypeName() string { + return "channelAdminLogEventActionChangeEmojiStatus" } // TypeInfo returns info about TL type. -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) TypeInfo() tdp.Type { +func (c *ChannelAdminLogEventActionChangeEmojiStatus) TypeInfo() tdp.Type { typ := tdp.Type{ - Name: "channelAdminLogEventActionChangeBackgroundEmoji", - ID: ChannelAdminLogEventActionChangeBackgroundEmojiTypeID, + Name: "channelAdminLogEventActionChangeEmojiStatus", + ID: ChannelAdminLogEventActionChangeEmojiStatusTypeID, } if c == nil { typ.Null = true @@ -6964,51 +7302,61 @@ func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) TypeInfo() tdp.Type { } // Encode implements bin.Encoder. -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) Encode(b *bin.Buffer) error { +func (c *ChannelAdminLogEventActionChangeEmojiStatus) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelAdminLogEventActionChangeBackgroundEmoji#445fc434 as nil") + return fmt.Errorf("can't encode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 as nil") } - b.PutID(ChannelAdminLogEventActionChangeBackgroundEmojiTypeID) + b.PutID(ChannelAdminLogEventActionChangeEmojiStatusTypeID) return c.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) EncodeBare(b *bin.Buffer) error { +func (c *ChannelAdminLogEventActionChangeEmojiStatus) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelAdminLogEventActionChangeBackgroundEmoji#445fc434 as nil") + return fmt.Errorf("can't encode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 as nil") + } + if c.PrevValue == nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1: field prev_value is nil") + } + if err := c.PrevValue.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1: field prev_value: %w", err) + } + if c.NewValue == nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1: field new_value is nil") + } + if err := c.NewValue.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1: field new_value: %w", err) } - b.PutLong(c.PrevValue) - b.PutLong(c.NewValue) return nil } // Decode implements bin.Decoder. -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) Decode(b *bin.Buffer) error { +func (c *ChannelAdminLogEventActionChangeEmojiStatus) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelAdminLogEventActionChangeBackgroundEmoji#445fc434 to nil") + return fmt.Errorf("can't decode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 to nil") } - if err := b.ConsumeID(ChannelAdminLogEventActionChangeBackgroundEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode channelAdminLogEventActionChangeBackgroundEmoji#445fc434: %w", err) + if err := b.ConsumeID(ChannelAdminLogEventActionChangeEmojiStatusTypeID); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1: %w", err) } return c.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) DecodeBare(b *bin.Buffer) error { +func (c *ChannelAdminLogEventActionChangeEmojiStatus) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelAdminLogEventActionChangeBackgroundEmoji#445fc434 to nil") + return fmt.Errorf("can't decode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 to nil") } { - value, err := b.Long() + value, err := DecodeEmojiStatus(b) if err != nil { - return fmt.Errorf("unable to decode channelAdminLogEventActionChangeBackgroundEmoji#445fc434: field prev_value: %w", err) + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1: field prev_value: %w", err) } c.PrevValue = value } { - value, err := b.Long() + value, err := DecodeEmojiStatus(b) if err != nil { - return fmt.Errorf("unable to decode channelAdminLogEventActionChangeBackgroundEmoji#445fc434: field new_value: %w", err) + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeEmojiStatus#3ea9feb1: field new_value: %w", err) } c.NewValue = value } @@ -7016,7 +7364,7 @@ func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) DecodeBare(b *bin.Buff } // GetPrevValue returns value of PrevValue field. -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) GetPrevValue() (value int64) { +func (c *ChannelAdminLogEventActionChangeEmojiStatus) GetPrevValue() (value EmojiStatusClass) { if c == nil { return } @@ -7024,7 +7372,7 @@ func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) GetPrevValue() (value } // GetNewValue returns value of NewValue field. -func (c *ChannelAdminLogEventActionChangeBackgroundEmoji) GetNewValue() (value int64) { +func (c *ChannelAdminLogEventActionChangeEmojiStatus) GetNewValue() (value EmojiStatusClass) { if c == nil { return } @@ -7088,8 +7436,10 @@ const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction" // case *tg.ChannelAdminLogEventActionDeleteTopic: // channelAdminLogEventActionDeleteTopic#ae168909 // case *tg.ChannelAdminLogEventActionPinTopic: // channelAdminLogEventActionPinTopic#5d8d353b // case *tg.ChannelAdminLogEventActionToggleAntiSpam: // channelAdminLogEventActionToggleAntiSpam#64f36dfc -// case *tg.ChannelAdminLogEventActionChangeColor: // channelAdminLogEventActionChangeColor#3c2b247b -// case *tg.ChannelAdminLogEventActionChangeBackgroundEmoji: // channelAdminLogEventActionChangeBackgroundEmoji#445fc434 +// case *tg.ChannelAdminLogEventActionChangePeerColor: // channelAdminLogEventActionChangePeerColor#5796e780 +// case *tg.ChannelAdminLogEventActionChangeProfilePeerColor: // channelAdminLogEventActionChangeProfilePeerColor#5e477b25 +// case *tg.ChannelAdminLogEventActionChangeWallpaper: // channelAdminLogEventActionChangeWallpaper#31bb5d52 +// case *tg.ChannelAdminLogEventActionChangeEmojiStatus: // channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 // default: panic(v) // } type ChannelAdminLogEventActionClass interface { @@ -7419,16 +7769,30 @@ func DecodeChannelAdminLogEventAction(buf *bin.Buffer) (ChannelAdminLogEventActi return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) } return &v, nil - case ChannelAdminLogEventActionChangeColorTypeID: - // Decoding channelAdminLogEventActionChangeColor#3c2b247b. - v := ChannelAdminLogEventActionChangeColor{} + case ChannelAdminLogEventActionChangePeerColorTypeID: + // Decoding channelAdminLogEventActionChangePeerColor#5796e780. + v := ChannelAdminLogEventActionChangePeerColor{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) + } + return &v, nil + case ChannelAdminLogEventActionChangeProfilePeerColorTypeID: + // Decoding channelAdminLogEventActionChangeProfilePeerColor#5e477b25. + v := ChannelAdminLogEventActionChangeProfilePeerColor{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) + } + return &v, nil + case ChannelAdminLogEventActionChangeWallpaperTypeID: + // Decoding channelAdminLogEventActionChangeWallpaper#31bb5d52. + v := ChannelAdminLogEventActionChangeWallpaper{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) } return &v, nil - case ChannelAdminLogEventActionChangeBackgroundEmojiTypeID: - // Decoding channelAdminLogEventActionChangeBackgroundEmoji#445fc434. - v := ChannelAdminLogEventActionChangeBackgroundEmoji{} + case ChannelAdminLogEventActionChangeEmojiStatusTypeID: + // Decoding channelAdminLogEventActionChangeEmojiStatus#3ea9feb1. + v := ChannelAdminLogEventActionChangeEmojiStatus{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) } diff --git a/tg/tl_channel_admin_log_event_action_slices_gen.go b/tg/tl_channel_admin_log_event_action_slices_gen.go index 1d8cffa7cc..8322d1487e 100644 --- a/tg/tl_channel_admin_log_event_action_slices_gen.go +++ b/tg/tl_channel_admin_log_event_action_slices_gen.go @@ -649,10 +649,10 @@ func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionToggle return to } -// AsChannelAdminLogEventActionChangeColor returns copy with only ChannelAdminLogEventActionChangeColor constructors. -func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChangeColor() (to ChannelAdminLogEventActionChangeColorArray) { +// AsChannelAdminLogEventActionChangePeerColor returns copy with only ChannelAdminLogEventActionChangePeerColor constructors. +func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChangePeerColor() (to ChannelAdminLogEventActionChangePeerColorArray) { for _, elem := range s { - value, ok := elem.(*ChannelAdminLogEventActionChangeColor) + value, ok := elem.(*ChannelAdminLogEventActionChangePeerColor) if !ok { continue } @@ -662,10 +662,36 @@ func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChange return to } -// AsChannelAdminLogEventActionChangeBackgroundEmoji returns copy with only ChannelAdminLogEventActionChangeBackgroundEmoji constructors. -func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChangeBackgroundEmoji() (to ChannelAdminLogEventActionChangeBackgroundEmojiArray) { +// AsChannelAdminLogEventActionChangeProfilePeerColor returns copy with only ChannelAdminLogEventActionChangeProfilePeerColor constructors. +func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChangeProfilePeerColor() (to ChannelAdminLogEventActionChangeProfilePeerColorArray) { for _, elem := range s { - value, ok := elem.(*ChannelAdminLogEventActionChangeBackgroundEmoji) + value, ok := elem.(*ChannelAdminLogEventActionChangeProfilePeerColor) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsChannelAdminLogEventActionChangeWallpaper returns copy with only ChannelAdminLogEventActionChangeWallpaper constructors. +func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChangeWallpaper() (to ChannelAdminLogEventActionChangeWallpaperArray) { + for _, elem := range s { + value, ok := elem.(*ChannelAdminLogEventActionChangeWallpaper) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsChannelAdminLogEventActionChangeEmojiStatus returns copy with only ChannelAdminLogEventActionChangeEmojiStatus constructors. +func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChangeEmojiStatus() (to ChannelAdminLogEventActionChangeEmojiStatusArray) { + for _, elem := range s { + value, ok := elem.(*ChannelAdminLogEventActionChangeEmojiStatus) if !ok { continue } @@ -4037,27 +4063,191 @@ func (s *ChannelAdminLogEventActionToggleAntiSpamArray) Pop() (v ChannelAdminLog return v, true } -// ChannelAdminLogEventActionChangeColorArray is adapter for slice of ChannelAdminLogEventActionChangeColor. -type ChannelAdminLogEventActionChangeColorArray []ChannelAdminLogEventActionChangeColor +// ChannelAdminLogEventActionChangePeerColorArray is adapter for slice of ChannelAdminLogEventActionChangePeerColor. +type ChannelAdminLogEventActionChangePeerColorArray []ChannelAdminLogEventActionChangePeerColor + +// Sort sorts slice of ChannelAdminLogEventActionChangePeerColor. +func (s ChannelAdminLogEventActionChangePeerColorArray) Sort(less func(a, b ChannelAdminLogEventActionChangePeerColor) bool) ChannelAdminLogEventActionChangePeerColorArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of ChannelAdminLogEventActionChangePeerColor. +func (s ChannelAdminLogEventActionChangePeerColorArray) SortStable(less func(a, b ChannelAdminLogEventActionChangePeerColor) bool) ChannelAdminLogEventActionChangePeerColorArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of ChannelAdminLogEventActionChangePeerColor. +func (s ChannelAdminLogEventActionChangePeerColorArray) Retain(keep func(x ChannelAdminLogEventActionChangePeerColor) bool) ChannelAdminLogEventActionChangePeerColorArray { + 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 ChannelAdminLogEventActionChangePeerColorArray) First() (v ChannelAdminLogEventActionChangePeerColor, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s ChannelAdminLogEventActionChangePeerColorArray) Last() (v ChannelAdminLogEventActionChangePeerColor, 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 *ChannelAdminLogEventActionChangePeerColorArray) PopFirst() (v ChannelAdminLogEventActionChangePeerColor, 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 ChannelAdminLogEventActionChangePeerColor + 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 *ChannelAdminLogEventActionChangePeerColorArray) Pop() (v ChannelAdminLogEventActionChangePeerColor, 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 +} + +// ChannelAdminLogEventActionChangeProfilePeerColorArray is adapter for slice of ChannelAdminLogEventActionChangeProfilePeerColor. +type ChannelAdminLogEventActionChangeProfilePeerColorArray []ChannelAdminLogEventActionChangeProfilePeerColor + +// Sort sorts slice of ChannelAdminLogEventActionChangeProfilePeerColor. +func (s ChannelAdminLogEventActionChangeProfilePeerColorArray) Sort(less func(a, b ChannelAdminLogEventActionChangeProfilePeerColor) bool) ChannelAdminLogEventActionChangeProfilePeerColorArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of ChannelAdminLogEventActionChangeProfilePeerColor. +func (s ChannelAdminLogEventActionChangeProfilePeerColorArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeProfilePeerColor) bool) ChannelAdminLogEventActionChangeProfilePeerColorArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of ChannelAdminLogEventActionChangeProfilePeerColor. +func (s ChannelAdminLogEventActionChangeProfilePeerColorArray) Retain(keep func(x ChannelAdminLogEventActionChangeProfilePeerColor) bool) ChannelAdminLogEventActionChangeProfilePeerColorArray { + 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 ChannelAdminLogEventActionChangeProfilePeerColorArray) First() (v ChannelAdminLogEventActionChangeProfilePeerColor, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s ChannelAdminLogEventActionChangeProfilePeerColorArray) Last() (v ChannelAdminLogEventActionChangeProfilePeerColor, 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 *ChannelAdminLogEventActionChangeProfilePeerColorArray) PopFirst() (v ChannelAdminLogEventActionChangeProfilePeerColor, 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 ChannelAdminLogEventActionChangeProfilePeerColor + 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 *ChannelAdminLogEventActionChangeProfilePeerColorArray) Pop() (v ChannelAdminLogEventActionChangeProfilePeerColor, 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 +} + +// ChannelAdminLogEventActionChangeWallpaperArray is adapter for slice of ChannelAdminLogEventActionChangeWallpaper. +type ChannelAdminLogEventActionChangeWallpaperArray []ChannelAdminLogEventActionChangeWallpaper -// Sort sorts slice of ChannelAdminLogEventActionChangeColor. -func (s ChannelAdminLogEventActionChangeColorArray) Sort(less func(a, b ChannelAdminLogEventActionChangeColor) bool) ChannelAdminLogEventActionChangeColorArray { +// Sort sorts slice of ChannelAdminLogEventActionChangeWallpaper. +func (s ChannelAdminLogEventActionChangeWallpaperArray) Sort(less func(a, b ChannelAdminLogEventActionChangeWallpaper) bool) ChannelAdminLogEventActionChangeWallpaperArray { sort.Slice(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// SortStable sorts slice of ChannelAdminLogEventActionChangeColor. -func (s ChannelAdminLogEventActionChangeColorArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeColor) bool) ChannelAdminLogEventActionChangeColorArray { +// SortStable sorts slice of ChannelAdminLogEventActionChangeWallpaper. +func (s ChannelAdminLogEventActionChangeWallpaperArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeWallpaper) bool) ChannelAdminLogEventActionChangeWallpaperArray { sort.SliceStable(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// Retain filters in-place slice of ChannelAdminLogEventActionChangeColor. -func (s ChannelAdminLogEventActionChangeColorArray) Retain(keep func(x ChannelAdminLogEventActionChangeColor) bool) ChannelAdminLogEventActionChangeColorArray { +// Retain filters in-place slice of ChannelAdminLogEventActionChangeWallpaper. +func (s ChannelAdminLogEventActionChangeWallpaperArray) Retain(keep func(x ChannelAdminLogEventActionChangeWallpaper) bool) ChannelAdminLogEventActionChangeWallpaperArray { n := 0 for _, x := range s { if keep(x) { @@ -4071,7 +4261,7 @@ func (s ChannelAdminLogEventActionChangeColorArray) Retain(keep func(x ChannelAd } // First returns first element of slice (if exists). -func (s ChannelAdminLogEventActionChangeColorArray) First() (v ChannelAdminLogEventActionChangeColor, ok bool) { +func (s ChannelAdminLogEventActionChangeWallpaperArray) First() (v ChannelAdminLogEventActionChangeWallpaper, ok bool) { if len(s) < 1 { return } @@ -4079,7 +4269,7 @@ func (s ChannelAdminLogEventActionChangeColorArray) First() (v ChannelAdminLogEv } // Last returns last element of slice (if exists). -func (s ChannelAdminLogEventActionChangeColorArray) Last() (v ChannelAdminLogEventActionChangeColor, ok bool) { +func (s ChannelAdminLogEventActionChangeWallpaperArray) Last() (v ChannelAdminLogEventActionChangeWallpaper, ok bool) { if len(s) < 1 { return } @@ -4087,7 +4277,7 @@ func (s ChannelAdminLogEventActionChangeColorArray) Last() (v ChannelAdminLogEve } // PopFirst returns first element of slice (if exists) and deletes it. -func (s *ChannelAdminLogEventActionChangeColorArray) PopFirst() (v ChannelAdminLogEventActionChangeColor, ok bool) { +func (s *ChannelAdminLogEventActionChangeWallpaperArray) PopFirst() (v ChannelAdminLogEventActionChangeWallpaper, ok bool) { if s == nil || len(*s) < 1 { return } @@ -4097,7 +4287,7 @@ func (s *ChannelAdminLogEventActionChangeColorArray) PopFirst() (v ChannelAdminL // Delete by index from SliceTricks. copy(a[0:], a[1:]) - var zero ChannelAdminLogEventActionChangeColor + var zero ChannelAdminLogEventActionChangeWallpaper a[len(a)-1] = zero a = a[:len(a)-1] *s = a @@ -4106,7 +4296,7 @@ func (s *ChannelAdminLogEventActionChangeColorArray) PopFirst() (v ChannelAdminL } // Pop returns last element of slice (if exists) and deletes it. -func (s *ChannelAdminLogEventActionChangeColorArray) Pop() (v ChannelAdminLogEventActionChangeColor, ok bool) { +func (s *ChannelAdminLogEventActionChangeWallpaperArray) Pop() (v ChannelAdminLogEventActionChangeWallpaper, ok bool) { if s == nil || len(*s) < 1 { return } @@ -4119,27 +4309,27 @@ func (s *ChannelAdminLogEventActionChangeColorArray) Pop() (v ChannelAdminLogEve return v, true } -// ChannelAdminLogEventActionChangeBackgroundEmojiArray is adapter for slice of ChannelAdminLogEventActionChangeBackgroundEmoji. -type ChannelAdminLogEventActionChangeBackgroundEmojiArray []ChannelAdminLogEventActionChangeBackgroundEmoji +// ChannelAdminLogEventActionChangeEmojiStatusArray is adapter for slice of ChannelAdminLogEventActionChangeEmojiStatus. +type ChannelAdminLogEventActionChangeEmojiStatusArray []ChannelAdminLogEventActionChangeEmojiStatus -// Sort sorts slice of ChannelAdminLogEventActionChangeBackgroundEmoji. -func (s ChannelAdminLogEventActionChangeBackgroundEmojiArray) Sort(less func(a, b ChannelAdminLogEventActionChangeBackgroundEmoji) bool) ChannelAdminLogEventActionChangeBackgroundEmojiArray { +// Sort sorts slice of ChannelAdminLogEventActionChangeEmojiStatus. +func (s ChannelAdminLogEventActionChangeEmojiStatusArray) Sort(less func(a, b ChannelAdminLogEventActionChangeEmojiStatus) bool) ChannelAdminLogEventActionChangeEmojiStatusArray { sort.Slice(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// SortStable sorts slice of ChannelAdminLogEventActionChangeBackgroundEmoji. -func (s ChannelAdminLogEventActionChangeBackgroundEmojiArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeBackgroundEmoji) bool) ChannelAdminLogEventActionChangeBackgroundEmojiArray { +// SortStable sorts slice of ChannelAdminLogEventActionChangeEmojiStatus. +func (s ChannelAdminLogEventActionChangeEmojiStatusArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeEmojiStatus) bool) ChannelAdminLogEventActionChangeEmojiStatusArray { sort.SliceStable(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// Retain filters in-place slice of ChannelAdminLogEventActionChangeBackgroundEmoji. -func (s ChannelAdminLogEventActionChangeBackgroundEmojiArray) Retain(keep func(x ChannelAdminLogEventActionChangeBackgroundEmoji) bool) ChannelAdminLogEventActionChangeBackgroundEmojiArray { +// Retain filters in-place slice of ChannelAdminLogEventActionChangeEmojiStatus. +func (s ChannelAdminLogEventActionChangeEmojiStatusArray) Retain(keep func(x ChannelAdminLogEventActionChangeEmojiStatus) bool) ChannelAdminLogEventActionChangeEmojiStatusArray { n := 0 for _, x := range s { if keep(x) { @@ -4153,7 +4343,7 @@ func (s ChannelAdminLogEventActionChangeBackgroundEmojiArray) Retain(keep func(x } // First returns first element of slice (if exists). -func (s ChannelAdminLogEventActionChangeBackgroundEmojiArray) First() (v ChannelAdminLogEventActionChangeBackgroundEmoji, ok bool) { +func (s ChannelAdminLogEventActionChangeEmojiStatusArray) First() (v ChannelAdminLogEventActionChangeEmojiStatus, ok bool) { if len(s) < 1 { return } @@ -4161,7 +4351,7 @@ func (s ChannelAdminLogEventActionChangeBackgroundEmojiArray) First() (v Channel } // Last returns last element of slice (if exists). -func (s ChannelAdminLogEventActionChangeBackgroundEmojiArray) Last() (v ChannelAdminLogEventActionChangeBackgroundEmoji, ok bool) { +func (s ChannelAdminLogEventActionChangeEmojiStatusArray) Last() (v ChannelAdminLogEventActionChangeEmojiStatus, ok bool) { if len(s) < 1 { return } @@ -4169,7 +4359,7 @@ func (s ChannelAdminLogEventActionChangeBackgroundEmojiArray) Last() (v ChannelA } // PopFirst returns first element of slice (if exists) and deletes it. -func (s *ChannelAdminLogEventActionChangeBackgroundEmojiArray) PopFirst() (v ChannelAdminLogEventActionChangeBackgroundEmoji, ok bool) { +func (s *ChannelAdminLogEventActionChangeEmojiStatusArray) PopFirst() (v ChannelAdminLogEventActionChangeEmojiStatus, ok bool) { if s == nil || len(*s) < 1 { return } @@ -4179,7 +4369,7 @@ func (s *ChannelAdminLogEventActionChangeBackgroundEmojiArray) PopFirst() (v Cha // Delete by index from SliceTricks. copy(a[0:], a[1:]) - var zero ChannelAdminLogEventActionChangeBackgroundEmoji + var zero ChannelAdminLogEventActionChangeEmojiStatus a[len(a)-1] = zero a = a[:len(a)-1] *s = a @@ -4188,7 +4378,7 @@ func (s *ChannelAdminLogEventActionChangeBackgroundEmojiArray) PopFirst() (v Cha } // Pop returns last element of slice (if exists) and deletes it. -func (s *ChannelAdminLogEventActionChangeBackgroundEmojiArray) Pop() (v ChannelAdminLogEventActionChangeBackgroundEmoji, ok bool) { +func (s *ChannelAdminLogEventActionChangeEmojiStatusArray) Pop() (v ChannelAdminLogEventActionChangeEmojiStatus, ok bool) { if s == nil || len(*s) < 1 { return } diff --git a/tg/tl_channels_update_color_gen.go b/tg/tl_channels_update_color_gen.go index 0fbb445a78..2fbdc8ac54 100644 --- a/tg/tl_channels_update_color_gen.go +++ b/tg/tl_channels_update_color_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// ChannelsUpdateColorRequest represents TL type `channels.updateColor#621a201f`. +// ChannelsUpdateColorRequest represents TL type `channels.updateColor#d8aa3671`. // Update the accent color and background custom emoji »¹ of a channel. // // Links: @@ -44,6 +44,8 @@ type ChannelsUpdateColorRequest struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields + // ForProfile field of ChannelsUpdateColorRequest. + ForProfile bool // Channel whose accent color should be changed. Channel InputChannelClass // ID of the accent color palette »¹ to use (not RGB24, see here »² for more info). @@ -51,6 +53,8 @@ type ChannelsUpdateColorRequest struct { // Links: // 1) https://core.telegram.org/api/colors // 2) https://core.telegram.org/api/colors + // + // Use SetColor and GetColor helpers. Color int // Custom emoji ID used in the accent color pattern. // @@ -59,7 +63,7 @@ type ChannelsUpdateColorRequest struct { } // ChannelsUpdateColorRequestTypeID is TL type id of ChannelsUpdateColorRequest. -const ChannelsUpdateColorRequestTypeID = 0x621a201f +const ChannelsUpdateColorRequestTypeID = 0xd8aa3671 // Ensuring interfaces in compile-time for ChannelsUpdateColorRequest. var ( @@ -76,6 +80,9 @@ func (u *ChannelsUpdateColorRequest) Zero() bool { if !(u.Flags.Zero()) { return false } + if !(u.ForProfile == false) { + return false + } if !(u.Channel == nil) { return false } @@ -100,12 +107,17 @@ func (u *ChannelsUpdateColorRequest) String() string { // FillFrom fills ChannelsUpdateColorRequest from given interface. func (u *ChannelsUpdateColorRequest) FillFrom(from interface { + GetForProfile() (value bool) GetChannel() (value InputChannelClass) - GetColor() (value int) + GetColor() (value int, ok bool) GetBackgroundEmojiID() (value int64, ok bool) }) { + u.ForProfile = from.GetForProfile() u.Channel = from.GetChannel() - u.Color = from.GetColor() + if val, ok := from.GetColor(); ok { + u.Color = val + } + if val, ok := from.GetBackgroundEmojiID(); ok { u.BackgroundEmojiID = val } @@ -135,6 +147,11 @@ func (u *ChannelsUpdateColorRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "ForProfile", + SchemaName: "for_profile", + Null: !u.Flags.Has(1), + }, { Name: "Channel", SchemaName: "channel", @@ -142,6 +159,7 @@ func (u *ChannelsUpdateColorRequest) TypeInfo() tdp.Type { { Name: "Color", SchemaName: "color", + Null: !u.Flags.Has(2), }, { Name: "BackgroundEmojiID", @@ -154,6 +172,12 @@ func (u *ChannelsUpdateColorRequest) TypeInfo() tdp.Type { // SetFlags sets flags for non-zero fields. func (u *ChannelsUpdateColorRequest) SetFlags() { + if !(u.ForProfile == false) { + u.Flags.Set(1) + } + if !(u.Color == 0) { + u.Flags.Set(2) + } if !(u.BackgroundEmojiID == 0) { u.Flags.Set(0) } @@ -162,7 +186,7 @@ func (u *ChannelsUpdateColorRequest) SetFlags() { // Encode implements bin.Encoder. func (u *ChannelsUpdateColorRequest) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode channels.updateColor#621a201f as nil") + return fmt.Errorf("can't encode channels.updateColor#d8aa3671 as nil") } b.PutID(ChannelsUpdateColorRequestTypeID) return u.EncodeBare(b) @@ -171,19 +195,21 @@ func (u *ChannelsUpdateColorRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *ChannelsUpdateColorRequest) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode channels.updateColor#621a201f as nil") + return fmt.Errorf("can't encode channels.updateColor#d8aa3671 as nil") } u.SetFlags() if err := u.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.updateColor#621a201f: field flags: %w", err) + return fmt.Errorf("unable to encode channels.updateColor#d8aa3671: field flags: %w", err) } if u.Channel == nil { - return fmt.Errorf("unable to encode channels.updateColor#621a201f: field channel is nil") + return fmt.Errorf("unable to encode channels.updateColor#d8aa3671: field channel is nil") } if err := u.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.updateColor#621a201f: field channel: %w", err) + return fmt.Errorf("unable to encode channels.updateColor#d8aa3671: field channel: %w", err) + } + if u.Flags.Has(2) { + b.PutInt(u.Color) } - b.PutInt(u.Color) if u.Flags.Has(0) { b.PutLong(u.BackgroundEmojiID) } @@ -193,10 +219,10 @@ func (u *ChannelsUpdateColorRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *ChannelsUpdateColorRequest) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode channels.updateColor#621a201f to nil") + return fmt.Errorf("can't decode channels.updateColor#d8aa3671 to nil") } if err := b.ConsumeID(ChannelsUpdateColorRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.updateColor#621a201f: %w", err) + return fmt.Errorf("unable to decode channels.updateColor#d8aa3671: %w", err) } return u.DecodeBare(b) } @@ -204,37 +230,57 @@ func (u *ChannelsUpdateColorRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *ChannelsUpdateColorRequest) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode channels.updateColor#621a201f to nil") + return fmt.Errorf("can't decode channels.updateColor#d8aa3671 to nil") } { if err := u.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channels.updateColor#621a201f: field flags: %w", err) + return fmt.Errorf("unable to decode channels.updateColor#d8aa3671: field flags: %w", err) } } + u.ForProfile = u.Flags.Has(1) { value, err := DecodeInputChannel(b) if err != nil { - return fmt.Errorf("unable to decode channels.updateColor#621a201f: field channel: %w", err) + return fmt.Errorf("unable to decode channels.updateColor#d8aa3671: field channel: %w", err) } u.Channel = value } - { + if u.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channels.updateColor#621a201f: field color: %w", err) + return fmt.Errorf("unable to decode channels.updateColor#d8aa3671: field color: %w", err) } u.Color = value } if u.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channels.updateColor#621a201f: field background_emoji_id: %w", err) + return fmt.Errorf("unable to decode channels.updateColor#d8aa3671: field background_emoji_id: %w", err) } u.BackgroundEmojiID = value } return nil } +// SetForProfile sets value of ForProfile conditional field. +func (u *ChannelsUpdateColorRequest) SetForProfile(value bool) { + if value { + u.Flags.Set(1) + u.ForProfile = true + } else { + u.Flags.Unset(1) + u.ForProfile = false + } +} + +// GetForProfile returns value of ForProfile conditional field. +func (u *ChannelsUpdateColorRequest) GetForProfile() (value bool) { + if u == nil { + return + } + return u.Flags.Has(1) +} + // GetChannel returns value of Channel field. func (u *ChannelsUpdateColorRequest) GetChannel() (value InputChannelClass) { if u == nil { @@ -243,12 +289,22 @@ func (u *ChannelsUpdateColorRequest) GetChannel() (value InputChannelClass) { return u.Channel } -// GetColor returns value of Color field. -func (u *ChannelsUpdateColorRequest) GetColor() (value int) { +// SetColor sets value of Color conditional field. +func (u *ChannelsUpdateColorRequest) SetColor(value int) { + u.Flags.Set(2) + u.Color = value +} + +// GetColor returns value of Color conditional field and +// boolean which is true if field was set. +func (u *ChannelsUpdateColorRequest) GetColor() (value int, ok bool) { if u == nil { return } - return u.Color + if !u.Flags.Has(2) { + return value, false + } + return u.Color, true } // SetBackgroundEmojiID sets value of BackgroundEmojiID conditional field. @@ -274,7 +330,7 @@ func (u *ChannelsUpdateColorRequest) GetChannelAsNotEmpty() (NotEmptyInputChanne return u.Channel.AsNotEmpty() } -// ChannelsUpdateColor invokes method channels.updateColor#621a201f returning error if any. +// ChannelsUpdateColor invokes method channels.updateColor#d8aa3671 returning error if any. // Update the accent color and background custom emoji »¹ of a channel. // // Links: diff --git a/tg/tl_channels_update_emoji_status_gen.go b/tg/tl_channels_update_emoji_status_gen.go new file mode 100644 index 0000000000..b6583048a9 --- /dev/null +++ b/tg/tl_channels_update_emoji_status_gen.go @@ -0,0 +1,220 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ChannelsUpdateEmojiStatusRequest represents TL type `channels.updateEmojiStatus#f0d3e6a8`. +// +// See https://core.telegram.org/method/channels.updateEmojiStatus for reference. +type ChannelsUpdateEmojiStatusRequest struct { + // Channel field of ChannelsUpdateEmojiStatusRequest. + Channel InputChannelClass + // EmojiStatus field of ChannelsUpdateEmojiStatusRequest. + EmojiStatus EmojiStatusClass +} + +// ChannelsUpdateEmojiStatusRequestTypeID is TL type id of ChannelsUpdateEmojiStatusRequest. +const ChannelsUpdateEmojiStatusRequestTypeID = 0xf0d3e6a8 + +// Ensuring interfaces in compile-time for ChannelsUpdateEmojiStatusRequest. +var ( + _ bin.Encoder = &ChannelsUpdateEmojiStatusRequest{} + _ bin.Decoder = &ChannelsUpdateEmojiStatusRequest{} + _ bin.BareEncoder = &ChannelsUpdateEmojiStatusRequest{} + _ bin.BareDecoder = &ChannelsUpdateEmojiStatusRequest{} +) + +func (u *ChannelsUpdateEmojiStatusRequest) Zero() bool { + if u == nil { + return true + } + if !(u.Channel == nil) { + return false + } + if !(u.EmojiStatus == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *ChannelsUpdateEmojiStatusRequest) String() string { + if u == nil { + return "ChannelsUpdateEmojiStatusRequest(nil)" + } + type Alias ChannelsUpdateEmojiStatusRequest + return fmt.Sprintf("ChannelsUpdateEmojiStatusRequest%+v", Alias(*u)) +} + +// FillFrom fills ChannelsUpdateEmojiStatusRequest from given interface. +func (u *ChannelsUpdateEmojiStatusRequest) FillFrom(from interface { + GetChannel() (value InputChannelClass) + GetEmojiStatus() (value EmojiStatusClass) +}) { + u.Channel = from.GetChannel() + u.EmojiStatus = from.GetEmojiStatus() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelsUpdateEmojiStatusRequest) TypeID() uint32 { + return ChannelsUpdateEmojiStatusRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelsUpdateEmojiStatusRequest) TypeName() string { + return "channels.updateEmojiStatus" +} + +// TypeInfo returns info about TL type. +func (u *ChannelsUpdateEmojiStatusRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channels.updateEmojiStatus", + ID: ChannelsUpdateEmojiStatusRequestTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Channel", + SchemaName: "channel", + }, + { + Name: "EmojiStatus", + SchemaName: "emoji_status", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *ChannelsUpdateEmojiStatusRequest) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode channels.updateEmojiStatus#f0d3e6a8 as nil") + } + b.PutID(ChannelsUpdateEmojiStatusRequestTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *ChannelsUpdateEmojiStatusRequest) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode channels.updateEmojiStatus#f0d3e6a8 as nil") + } + if u.Channel == nil { + return fmt.Errorf("unable to encode channels.updateEmojiStatus#f0d3e6a8: field channel is nil") + } + if err := u.Channel.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.updateEmojiStatus#f0d3e6a8: field channel: %w", err) + } + if u.EmojiStatus == nil { + return fmt.Errorf("unable to encode channels.updateEmojiStatus#f0d3e6a8: field emoji_status is nil") + } + if err := u.EmojiStatus.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.updateEmojiStatus#f0d3e6a8: field emoji_status: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (u *ChannelsUpdateEmojiStatusRequest) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode channels.updateEmojiStatus#f0d3e6a8 to nil") + } + if err := b.ConsumeID(ChannelsUpdateEmojiStatusRequestTypeID); err != nil { + return fmt.Errorf("unable to decode channels.updateEmojiStatus#f0d3e6a8: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *ChannelsUpdateEmojiStatusRequest) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode channels.updateEmojiStatus#f0d3e6a8 to nil") + } + { + value, err := DecodeInputChannel(b) + if err != nil { + return fmt.Errorf("unable to decode channels.updateEmojiStatus#f0d3e6a8: field channel: %w", err) + } + u.Channel = value + } + { + value, err := DecodeEmojiStatus(b) + if err != nil { + return fmt.Errorf("unable to decode channels.updateEmojiStatus#f0d3e6a8: field emoji_status: %w", err) + } + u.EmojiStatus = value + } + return nil +} + +// GetChannel returns value of Channel field. +func (u *ChannelsUpdateEmojiStatusRequest) GetChannel() (value InputChannelClass) { + if u == nil { + return + } + return u.Channel +} + +// GetEmojiStatus returns value of EmojiStatus field. +func (u *ChannelsUpdateEmojiStatusRequest) GetEmojiStatus() (value EmojiStatusClass) { + if u == nil { + return + } + return u.EmojiStatus +} + +// GetChannelAsNotEmpty returns mapped value of Channel field. +func (u *ChannelsUpdateEmojiStatusRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { + return u.Channel.AsNotEmpty() +} + +// GetEmojiStatusAsNotEmpty returns mapped value of EmojiStatus field. +func (u *ChannelsUpdateEmojiStatusRequest) GetEmojiStatusAsNotEmpty() (NotEmptyEmojiStatus, bool) { + return u.EmojiStatus.AsNotEmpty() +} + +// ChannelsUpdateEmojiStatus invokes method channels.updateEmojiStatus#f0d3e6a8 returning error if any. +// +// See https://core.telegram.org/method/channels.updateEmojiStatus for reference. +func (c *Client) ChannelsUpdateEmojiStatus(ctx context.Context, request *ChannelsUpdateEmojiStatusRequest) (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/tg/tl_channels_update_emoji_status_slices_gen.go b/tg/tl_channels_update_emoji_status_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_channels_update_emoji_status_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_chat_full_gen.go b/tg/tl_chat_full_gen.go index 523f32b28e..b46ddb4f39 100644 --- a/tg/tl_chat_full_gen.go +++ b/tg/tl_chat_full_gen.go @@ -1027,7 +1027,7 @@ func (c *ChatFull) GetAvailableReactions() (value ChatReactionsClass, ok bool) { return c.AvailableReactions, true } -// ChannelFull represents TL type `channelFull#723027bd`. +// ChannelFull represents TL type `channelFull#f2bcb6f`. // Full info about a channel¹, supergroup² or gigagroup³. // // Links: @@ -1263,10 +1263,14 @@ type ChannelFull struct { // // Use SetStories and GetStories helpers. Stories PeerStories + // Wallpaper field of ChannelFull. + // + // Use SetWallpaper and GetWallpaper helpers. + Wallpaper WallPaperClass } // ChannelFullTypeID is TL type id of ChannelFull. -const ChannelFullTypeID = 0x723027bd +const ChannelFullTypeID = 0xf2bcb6f // construct implements constructor of ChatFullClass. func (c ChannelFull) construct() ChatFullClass { return &c } @@ -1441,6 +1445,9 @@ func (c *ChannelFull) Zero() bool { if !(c.Stories.Zero()) { return false } + if !(c.Wallpaper == nil) { + return false + } return true } @@ -1506,6 +1513,7 @@ func (c *ChannelFull) FillFrom(from interface { GetDefaultSendAs() (value PeerClass, ok bool) GetAvailableReactions() (value ChatReactionsClass, ok bool) GetStories() (value PeerStories, ok bool) + GetWallpaper() (value WallPaperClass, ok bool) }) { c.CanViewParticipants = from.GetCanViewParticipants() c.CanSetUsername = from.GetCanSetUsername() @@ -1638,6 +1646,10 @@ func (c *ChannelFull) FillFrom(from interface { c.Stories = val } + if val, ok := from.GetWallpaper(); ok { + c.Wallpaper = val + } + } // TypeID returns type id in TL schema. @@ -1904,6 +1916,11 @@ func (c *ChannelFull) TypeInfo() tdp.Type { SchemaName: "stories", Null: !c.Flags2.Has(4), }, + { + Name: "Wallpaper", + SchemaName: "wallpaper", + Null: !c.Flags2.Has(7), + }, } return typ } @@ -2033,12 +2050,15 @@ func (c *ChannelFull) SetFlags() { if !(c.Stories.Zero()) { c.Flags2.Set(4) } + if !(c.Wallpaper == nil) { + c.Flags2.Set(7) + } } // Encode implements bin.Encoder. func (c *ChannelFull) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelFull#723027bd as nil") + return fmt.Errorf("can't encode channelFull#f2bcb6f as nil") } b.PutID(ChannelFullTypeID) return c.EncodeBare(b) @@ -2047,14 +2067,14 @@ func (c *ChannelFull) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *ChannelFull) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelFull#723027bd as nil") + return fmt.Errorf("can't encode channelFull#f2bcb6f as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field flags: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field flags: %w", err) } if err := c.Flags2.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field flags2: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field flags2: %w", err) } b.PutLong(c.ID) b.PutString(c.About) @@ -2077,26 +2097,26 @@ func (c *ChannelFull) EncodeBare(b *bin.Buffer) error { b.PutInt(c.ReadOutboxMaxID) b.PutInt(c.UnreadCount) if c.ChatPhoto == nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field chat_photo is nil") + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field chat_photo is nil") } if err := c.ChatPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field chat_photo: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field chat_photo: %w", err) } if err := c.NotifySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field notify_settings: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field notify_settings: %w", err) } if c.Flags.Has(23) { if c.ExportedInvite == nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field exported_invite is nil") + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field exported_invite is nil") } if err := c.ExportedInvite.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field exported_invite: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field exported_invite: %w", err) } } b.PutVectorHeader(len(c.BotInfo)) for idx, v := range c.BotInfo { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field bot_info element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field bot_info element with index %d: %w", idx, err) } } if c.Flags.Has(4) { @@ -2110,7 +2130,7 @@ func (c *ChannelFull) EncodeBare(b *bin.Buffer) error { } if c.Flags.Has(8) { if err := c.Stickerset.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field stickerset: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field stickerset: %w", err) } } if c.Flags.Has(9) { @@ -2124,10 +2144,10 @@ func (c *ChannelFull) EncodeBare(b *bin.Buffer) error { } if c.Flags.Has(15) { if c.Location == nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field location is nil") + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field location is nil") } if err := c.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field location: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field location: %w", err) } } if c.Flags.Has(17) { @@ -2142,7 +2162,7 @@ func (c *ChannelFull) EncodeBare(b *bin.Buffer) error { b.PutInt(c.Pts) if c.Flags.Has(21) { if err := c.Call.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field call: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field call: %w", err) } } if c.Flags.Has(24) { @@ -2156,10 +2176,10 @@ func (c *ChannelFull) EncodeBare(b *bin.Buffer) error { } if c.Flags.Has(26) { if c.GroupcallDefaultJoinAs == nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field groupcall_default_join_as is nil") + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field groupcall_default_join_as is nil") } if err := c.GroupcallDefaultJoinAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field groupcall_default_join_as: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field groupcall_default_join_as: %w", err) } } if c.Flags.Has(27) { @@ -2176,23 +2196,31 @@ func (c *ChannelFull) EncodeBare(b *bin.Buffer) error { } if c.Flags.Has(29) { if c.DefaultSendAs == nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field default_send_as is nil") + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field default_send_as is nil") } if err := c.DefaultSendAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field default_send_as: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field default_send_as: %w", err) } } if c.Flags.Has(30) { if c.AvailableReactions == nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field available_reactions is nil") + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field available_reactions is nil") } if err := c.AvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field available_reactions: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field available_reactions: %w", err) } } if c.Flags2.Has(4) { if err := c.Stories.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#723027bd: field stories: %w", err) + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field stories: %w", err) + } + } + if c.Flags2.Has(7) { + if c.Wallpaper == nil { + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field wallpaper is nil") + } + if err := c.Wallpaper.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelFull#f2bcb6f: field wallpaper: %w", err) } } return nil @@ -2201,10 +2229,10 @@ func (c *ChannelFull) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *ChannelFull) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelFull#723027bd to nil") + return fmt.Errorf("can't decode channelFull#f2bcb6f to nil") } if err := b.ConsumeID(ChannelFullTypeID); err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: %w", err) } return c.DecodeBare(b) } @@ -2212,11 +2240,11 @@ func (c *ChannelFull) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channelFull#723027bd to nil") + return fmt.Errorf("can't decode channelFull#f2bcb6f to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field flags: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field flags: %w", err) } } c.CanViewParticipants = c.Flags.Has(3) @@ -2229,7 +2257,7 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { c.Blocked = c.Flags.Has(22) { if err := c.Flags2.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field flags2: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field flags2: %w", err) } } c.CanDeleteChannel = c.Flags2.Has(0) @@ -2241,96 +2269,96 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field id: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field id: %w", err) } c.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field about: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field about: %w", err) } c.About = value } if c.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field participants_count: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field participants_count: %w", err) } c.ParticipantsCount = value } if c.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field admins_count: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field admins_count: %w", err) } c.AdminsCount = value } if c.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field kicked_count: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field kicked_count: %w", err) } c.KickedCount = value } if c.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field banned_count: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field banned_count: %w", err) } c.BannedCount = value } if c.Flags.Has(13) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field online_count: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field online_count: %w", err) } c.OnlineCount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field read_inbox_max_id: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field read_inbox_max_id: %w", err) } c.ReadInboxMaxID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field read_outbox_max_id: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field read_outbox_max_id: %w", err) } c.ReadOutboxMaxID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field unread_count: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field unread_count: %w", err) } c.UnreadCount = value } { value, err := DecodePhoto(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field chat_photo: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field chat_photo: %w", err) } c.ChatPhoto = value } { if err := c.NotifySettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field notify_settings: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field notify_settings: %w", err) } } if c.Flags.Has(23) { value, err := DecodeExportedChatInvite(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field exported_invite: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field exported_invite: %w", err) } c.ExportedInvite = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field bot_info: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field bot_info: %w", err) } if headerLen > 0 { @@ -2339,7 +2367,7 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value BotInfo if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field bot_info: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field bot_info: %w", err) } c.BotInfo = append(c.BotInfo, value) } @@ -2347,101 +2375,101 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { if c.Flags.Has(4) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field migrated_from_chat_id: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field migrated_from_chat_id: %w", err) } c.MigratedFromChatID = value } if c.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field migrated_from_max_id: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field migrated_from_max_id: %w", err) } c.MigratedFromMaxID = value } if c.Flags.Has(5) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field pinned_msg_id: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field pinned_msg_id: %w", err) } c.PinnedMsgID = value } if c.Flags.Has(8) { if err := c.Stickerset.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field stickerset: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field stickerset: %w", err) } } if c.Flags.Has(9) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field available_min_id: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field available_min_id: %w", err) } c.AvailableMinID = value } if c.Flags.Has(11) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field folder_id: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field folder_id: %w", err) } c.FolderID = value } if c.Flags.Has(14) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field linked_chat_id: %w", err) } c.LinkedChatID = value } if c.Flags.Has(15) { value, err := DecodeChannelLocation(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field location: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field location: %w", err) } c.Location = value } if c.Flags.Has(17) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field slowmode_seconds: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field slowmode_seconds: %w", err) } c.SlowmodeSeconds = value } if c.Flags.Has(18) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field slowmode_next_send_date: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field slowmode_next_send_date: %w", err) } c.SlowmodeNextSendDate = value } if c.Flags.Has(12) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field stats_dc: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field stats_dc: %w", err) } c.StatsDC = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field pts: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field pts: %w", err) } c.Pts = value } if c.Flags.Has(21) { if err := c.Call.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field call: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field call: %w", err) } } if c.Flags.Has(24) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field ttl_period: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field ttl_period: %w", err) } c.TTLPeriod = value } if c.Flags.Has(25) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field pending_suggestions: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field pending_suggestions: %w", err) } if headerLen > 0 { @@ -2450,7 +2478,7 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field pending_suggestions: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field pending_suggestions: %w", err) } c.PendingSuggestions = append(c.PendingSuggestions, value) } @@ -2458,28 +2486,28 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { if c.Flags.Has(26) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field groupcall_default_join_as: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field groupcall_default_join_as: %w", err) } c.GroupcallDefaultJoinAs = value } if c.Flags.Has(27) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field theme_emoticon: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field theme_emoticon: %w", err) } c.ThemeEmoticon = value } if c.Flags.Has(28) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field requests_pending: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field requests_pending: %w", err) } c.RequestsPending = value } if c.Flags.Has(28) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field recent_requesters: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field recent_requesters: %w", err) } if headerLen > 0 { @@ -2488,7 +2516,7 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field recent_requesters: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field recent_requesters: %w", err) } c.RecentRequesters = append(c.RecentRequesters, value) } @@ -2496,21 +2524,28 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { if c.Flags.Has(29) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field default_send_as: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field default_send_as: %w", err) } c.DefaultSendAs = value } if c.Flags.Has(30) { value, err := DecodeChatReactions(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field available_reactions: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field available_reactions: %w", err) } c.AvailableReactions = value } if c.Flags2.Has(4) { if err := c.Stories.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#723027bd: field stories: %w", err) + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field stories: %w", err) + } + } + if c.Flags2.Has(7) { + value, err := DecodeWallPaper(b) + if err != nil { + return fmt.Errorf("unable to decode channelFull#f2bcb6f: field wallpaper: %w", err) } + c.Wallpaper = value } return nil } @@ -3339,6 +3374,24 @@ func (c *ChannelFull) GetStories() (value PeerStories, ok bool) { return c.Stories, true } +// SetWallpaper sets value of Wallpaper conditional field. +func (c *ChannelFull) SetWallpaper(value WallPaperClass) { + c.Flags2.Set(7) + c.Wallpaper = value +} + +// GetWallpaper returns value of Wallpaper conditional field and +// boolean which is true if field was set. +func (c *ChannelFull) GetWallpaper() (value WallPaperClass, ok bool) { + if c == nil { + return + } + if !c.Flags2.Has(7) { + return value, false + } + return c.Wallpaper, true +} + // ChatFullClassName is schema name of ChatFullClass. const ChatFullClassName = "ChatFull" @@ -3354,7 +3407,7 @@ const ChatFullClassName = "ChatFull" // } // switch v := g.(type) { // case *tg.ChatFull: // chatFull#c9d31138 -// case *tg.ChannelFull: // channelFull#723027bd +// case *tg.ChannelFull: // channelFull#f2bcb6f // default: panic(v) // } type ChatFullClass interface { @@ -3460,7 +3513,7 @@ func DecodeChatFull(buf *bin.Buffer) (ChatFullClass, error) { } return &v, nil case ChannelFullTypeID: - // Decoding channelFull#723027bd. + // Decoding channelFull#f2bcb6f. v := ChannelFull{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatFullClass: %w", err) diff --git a/tg/tl_chat_gen.go b/tg/tl_chat_gen.go index 56b61d4695..664f32b5b6 100644 --- a/tg/tl_chat_gen.go +++ b/tg/tl_chat_gen.go @@ -999,7 +999,7 @@ func (c *ChatForbidden) GetTitle() (value string) { return c.Title } -// Channel represents TL type `channel#8e87ccd8`. +// Channel represents TL type `channel#aadfc8f`. // Channel/supergroup info // // See https://core.telegram.org/constructor/channel for reference. @@ -1156,10 +1156,22 @@ type Channel struct { // // Use SetColor and GetColor helpers. Color PeerColor + // ProfileColor field of Channel. + // + // Use SetProfileColor and GetProfileColor helpers. + ProfileColor PeerColor + // EmojiStatus field of Channel. + // + // Use SetEmojiStatus and GetEmojiStatus helpers. + EmojiStatus EmojiStatusClass + // Level field of Channel. + // + // Use SetLevel and GetLevel helpers. + Level int } // ChannelTypeID is TL type id of Channel. -const ChannelTypeID = 0x8e87ccd8 +const ChannelTypeID = 0xaadfc8f // construct implements constructor of ChatClass. func (c Channel) construct() ChatClass { return &c } @@ -1295,6 +1307,15 @@ func (c *Channel) Zero() bool { if !(c.Color.Zero()) { return false } + if !(c.ProfileColor.Zero()) { + return false + } + if !(c.EmojiStatus == nil) { + return false + } + if !(c.Level == 0) { + return false + } return true } @@ -1347,6 +1368,9 @@ func (c *Channel) FillFrom(from interface { GetUsernames() (value []Username, ok bool) GetStoriesMaxID() (value int, ok bool) GetColor() (value PeerColor, ok bool) + GetProfileColor() (value PeerColor, ok bool) + GetEmojiStatus() (value EmojiStatusClass, ok bool) + GetLevel() (value int, ok bool) }) { c.Creator = from.GetCreator() c.Left = from.GetLeft() @@ -1415,6 +1439,18 @@ func (c *Channel) FillFrom(from interface { c.Color = val } + if val, ok := from.GetProfileColor(); ok { + c.ProfileColor = val + } + + if val, ok := from.GetEmojiStatus(); ok { + c.EmojiStatus = val + } + + if val, ok := from.GetLevel(); ok { + c.Level = val + } + } // TypeID returns type id in TL schema. @@ -1621,6 +1657,21 @@ func (c *Channel) TypeInfo() tdp.Type { SchemaName: "color", Null: !c.Flags2.Has(7), }, + { + Name: "ProfileColor", + SchemaName: "profile_color", + Null: !c.Flags2.Has(8), + }, + { + Name: "EmojiStatus", + SchemaName: "emoji_status", + Null: !c.Flags2.Has(9), + }, + { + Name: "Level", + SchemaName: "level", + Null: !c.Flags2.Has(10), + }, } return typ } @@ -1726,12 +1777,21 @@ func (c *Channel) SetFlags() { if !(c.Color.Zero()) { c.Flags2.Set(7) } + if !(c.ProfileColor.Zero()) { + c.Flags2.Set(8) + } + if !(c.EmojiStatus == nil) { + c.Flags2.Set(9) + } + if !(c.Level == 0) { + c.Flags2.Set(10) + } } // Encode implements bin.Encoder. func (c *Channel) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channel#8e87ccd8 as nil") + return fmt.Errorf("can't encode channel#aadfc8f as nil") } b.PutID(ChannelTypeID) return c.EncodeBare(b) @@ -1740,14 +1800,14 @@ func (c *Channel) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *Channel) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channel#8e87ccd8 as nil") + return fmt.Errorf("can't encode channel#aadfc8f as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field flags: %w", err) + return fmt.Errorf("unable to encode channel#aadfc8f: field flags: %w", err) } if err := c.Flags2.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field flags2: %w", err) + return fmt.Errorf("unable to encode channel#aadfc8f: field flags2: %w", err) } b.PutLong(c.ID) if c.Flags.Has(13) { @@ -1758,33 +1818,33 @@ func (c *Channel) EncodeBare(b *bin.Buffer) error { b.PutString(c.Username) } if c.Photo == nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field photo is nil") + return fmt.Errorf("unable to encode channel#aadfc8f: field photo is nil") } if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field photo: %w", err) + return fmt.Errorf("unable to encode channel#aadfc8f: field photo: %w", err) } b.PutInt(c.Date) if c.Flags.Has(9) { b.PutVectorHeader(len(c.RestrictionReason)) for idx, v := range c.RestrictionReason { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field restriction_reason element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode channel#aadfc8f: field restriction_reason element with index %d: %w", idx, err) } } } if c.Flags.Has(14) { if err := c.AdminRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field admin_rights: %w", err) + return fmt.Errorf("unable to encode channel#aadfc8f: field admin_rights: %w", err) } } if c.Flags.Has(15) { if err := c.BannedRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field banned_rights: %w", err) + return fmt.Errorf("unable to encode channel#aadfc8f: field banned_rights: %w", err) } } if c.Flags.Has(18) { if err := c.DefaultBannedRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field default_banned_rights: %w", err) + return fmt.Errorf("unable to encode channel#aadfc8f: field default_banned_rights: %w", err) } } if c.Flags.Has(17) { @@ -1794,7 +1854,7 @@ func (c *Channel) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(c.Usernames)) for idx, v := range c.Usernames { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field usernames element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode channel#aadfc8f: field usernames element with index %d: %w", idx, err) } } } @@ -1803,19 +1863,35 @@ func (c *Channel) EncodeBare(b *bin.Buffer) error { } if c.Flags2.Has(7) { if err := c.Color.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#8e87ccd8: field color: %w", err) + return fmt.Errorf("unable to encode channel#aadfc8f: field color: %w", err) + } + } + if c.Flags2.Has(8) { + if err := c.ProfileColor.Encode(b); err != nil { + return fmt.Errorf("unable to encode channel#aadfc8f: field profile_color: %w", err) } } + if c.Flags2.Has(9) { + if c.EmojiStatus == nil { + return fmt.Errorf("unable to encode channel#aadfc8f: field emoji_status is nil") + } + if err := c.EmojiStatus.Encode(b); err != nil { + return fmt.Errorf("unable to encode channel#aadfc8f: field emoji_status: %w", err) + } + } + if c.Flags2.Has(10) { + b.PutInt(c.Level) + } return nil } // Decode implements bin.Decoder. func (c *Channel) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channel#8e87ccd8 to nil") + return fmt.Errorf("can't decode channel#aadfc8f to nil") } if err := b.ConsumeID(ChannelTypeID); err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: %w", err) } return c.DecodeBare(b) } @@ -1823,11 +1899,11 @@ func (c *Channel) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *Channel) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channel#8e87ccd8 to nil") + return fmt.Errorf("can't decode channel#aadfc8f to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field flags: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field flags: %w", err) } } c.Creator = c.Flags.Has(0) @@ -1852,7 +1928,7 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { c.Forum = c.Flags.Has(30) { if err := c.Flags2.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field flags2: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field flags2: %w", err) } } c.StoriesHidden = c.Flags2.Has(1) @@ -1861,49 +1937,49 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field id: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field id: %w", err) } c.ID = value } if c.Flags.Has(13) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field access_hash: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field access_hash: %w", err) } c.AccessHash = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field title: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field title: %w", err) } c.Title = value } if c.Flags.Has(6) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field username: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field username: %w", err) } c.Username = value } { value, err := DecodeChatPhoto(b) if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field photo: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field photo: %w", err) } c.Photo = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field date: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field date: %w", err) } c.Date = value } if c.Flags.Has(9) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field restriction_reason: %w", err) } if headerLen > 0 { @@ -1912,37 +1988,37 @@ func (c *Channel) 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 channel#8e87ccd8: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field restriction_reason: %w", err) } c.RestrictionReason = append(c.RestrictionReason, value) } } if c.Flags.Has(14) { if err := c.AdminRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field admin_rights: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field admin_rights: %w", err) } } if c.Flags.Has(15) { if err := c.BannedRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field banned_rights: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field banned_rights: %w", err) } } if c.Flags.Has(18) { if err := c.DefaultBannedRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field default_banned_rights: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field default_banned_rights: %w", err) } } if c.Flags.Has(17) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field participants_count: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field participants_count: %w", err) } c.ParticipantsCount = value } if c.Flags2.Has(0) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field usernames: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field usernames: %w", err) } if headerLen > 0 { @@ -1951,7 +2027,7 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value Username if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field usernames: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field usernames: %w", err) } c.Usernames = append(c.Usernames, value) } @@ -1959,14 +2035,33 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { if c.Flags2.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field stories_max_id: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field stories_max_id: %w", err) } c.StoriesMaxID = value } if c.Flags2.Has(7) { if err := c.Color.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#8e87ccd8: field color: %w", err) + return fmt.Errorf("unable to decode channel#aadfc8f: field color: %w", err) + } + } + if c.Flags2.Has(8) { + if err := c.ProfileColor.Decode(b); err != nil { + return fmt.Errorf("unable to decode channel#aadfc8f: field profile_color: %w", err) + } + } + if c.Flags2.Has(9) { + value, err := DecodeEmojiStatus(b) + if err != nil { + return fmt.Errorf("unable to decode channel#aadfc8f: field emoji_status: %w", err) } + c.EmojiStatus = value + } + if c.Flags2.Has(10) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode channel#aadfc8f: field level: %w", err) + } + c.Level = value } return nil } @@ -2620,6 +2715,60 @@ func (c *Channel) GetColor() (value PeerColor, ok bool) { return c.Color, true } +// SetProfileColor sets value of ProfileColor conditional field. +func (c *Channel) SetProfileColor(value PeerColor) { + c.Flags2.Set(8) + c.ProfileColor = value +} + +// GetProfileColor returns value of ProfileColor conditional field and +// boolean which is true if field was set. +func (c *Channel) GetProfileColor() (value PeerColor, ok bool) { + if c == nil { + return + } + if !c.Flags2.Has(8) { + return value, false + } + return c.ProfileColor, true +} + +// SetEmojiStatus sets value of EmojiStatus conditional field. +func (c *Channel) SetEmojiStatus(value EmojiStatusClass) { + c.Flags2.Set(9) + c.EmojiStatus = value +} + +// GetEmojiStatus returns value of EmojiStatus conditional field and +// boolean which is true if field was set. +func (c *Channel) GetEmojiStatus() (value EmojiStatusClass, ok bool) { + if c == nil { + return + } + if !c.Flags2.Has(9) { + return value, false + } + return c.EmojiStatus, true +} + +// SetLevel sets value of Level conditional field. +func (c *Channel) SetLevel(value int) { + c.Flags2.Set(10) + c.Level = value +} + +// GetLevel returns value of Level conditional field and +// boolean which is true if field was set. +func (c *Channel) GetLevel() (value int, ok bool) { + if c == nil { + return + } + if !c.Flags2.Has(10) { + return value, false + } + return c.Level, true +} + // ChannelForbidden represents TL type `channelForbidden#17d493d5`. // Indicates a channel/supergroup we can't access because we were banned, or for some // other reason. @@ -2966,7 +3115,7 @@ const ChatClassName = "Chat" // case *tg.ChatEmpty: // chatEmpty#29562865 // case *tg.Chat: // chat#41cbf256 // case *tg.ChatForbidden: // chatForbidden#6592a1a7 -// case *tg.Channel: // channel#8e87ccd8 +// case *tg.Channel: // channel#aadfc8f // case *tg.ChannelForbidden: // channelForbidden#17d493d5 // default: panic(v) // } @@ -3259,7 +3408,7 @@ func DecodeChat(buf *bin.Buffer) (ChatClass, error) { } return &v, nil case ChannelTypeID: - // Decoding channel#8e87ccd8. + // Decoding channel#aadfc8f. v := Channel{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatClass: %w", err) diff --git a/tg/tl_handlers_gen.go b/tg/tl_handlers_gen.go index c00f3cc11a..fd1d08edc2 100644 --- a/tg/tl_handlers_gen.go +++ b/tg/tl_handlers_gen.go @@ -1305,3 +1305,23 @@ func (u UpdateDispatcher) OnPeerWallpaper(handler PeerWallpaperHandler) { return handler(ctx, e, update.(*UpdatePeerWallpaper)) } } + +// BotMessageReactionHandler is a BotMessageReaction event handler. +type BotMessageReactionHandler func(ctx context.Context, e Entities, update *UpdateBotMessageReaction) error + +// OnBotMessageReaction sets BotMessageReaction handler. +func (u UpdateDispatcher) OnBotMessageReaction(handler BotMessageReactionHandler) { + u.handlers[UpdateBotMessageReactionTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateBotMessageReaction)) + } +} + +// BotMessageReactionsHandler is a BotMessageReactions event handler. +type BotMessageReactionsHandler func(ctx context.Context, e Entities, update *UpdateBotMessageReactions) error + +// OnBotMessageReactions sets BotMessageReactions handler. +func (u UpdateDispatcher) OnBotMessageReactions(handler BotMessageReactionsHandler) { + u.handlers[UpdateBotMessageReactionsTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateBotMessageReactions)) + } +} diff --git a/tg/tl_help_get_app_changelog_gen.go b/tg/tl_help_get_app_changelog_gen.go deleted file mode 100644 index 859b5d6661..0000000000 --- a/tg/tl_help_get_app_changelog_gen.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tg - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// HelpGetAppChangelogRequest represents TL type `help.getAppChangelog#9010ef6f`. -// Get changelog of current app. -// Typically, an updates¹ constructor will be returned, containing one or more -// updateServiceNotification² updates with app-specific changelogs. -// -// Links: -// 1. https://core.telegram.org/constructor/updates -// 2. https://core.telegram.org/constructor/updateServiceNotification -// -// See https://core.telegram.org/method/help.getAppChangelog for reference. -type HelpGetAppChangelogRequest struct { - // Previous app version - PrevAppVersion string -} - -// HelpGetAppChangelogRequestTypeID is TL type id of HelpGetAppChangelogRequest. -const HelpGetAppChangelogRequestTypeID = 0x9010ef6f - -// Ensuring interfaces in compile-time for HelpGetAppChangelogRequest. -var ( - _ bin.Encoder = &HelpGetAppChangelogRequest{} - _ bin.Decoder = &HelpGetAppChangelogRequest{} - _ bin.BareEncoder = &HelpGetAppChangelogRequest{} - _ bin.BareDecoder = &HelpGetAppChangelogRequest{} -) - -func (g *HelpGetAppChangelogRequest) Zero() bool { - if g == nil { - return true - } - if !(g.PrevAppVersion == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *HelpGetAppChangelogRequest) String() string { - if g == nil { - return "HelpGetAppChangelogRequest(nil)" - } - type Alias HelpGetAppChangelogRequest - return fmt.Sprintf("HelpGetAppChangelogRequest%+v", Alias(*g)) -} - -// FillFrom fills HelpGetAppChangelogRequest from given interface. -func (g *HelpGetAppChangelogRequest) FillFrom(from interface { - GetPrevAppVersion() (value string) -}) { - g.PrevAppVersion = from.GetPrevAppVersion() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*HelpGetAppChangelogRequest) TypeID() uint32 { - return HelpGetAppChangelogRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*HelpGetAppChangelogRequest) TypeName() string { - return "help.getAppChangelog" -} - -// TypeInfo returns info about TL type. -func (g *HelpGetAppChangelogRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "help.getAppChangelog", - ID: HelpGetAppChangelogRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PrevAppVersion", - SchemaName: "prev_app_version", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *HelpGetAppChangelogRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode help.getAppChangelog#9010ef6f as nil") - } - b.PutID(HelpGetAppChangelogRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *HelpGetAppChangelogRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode help.getAppChangelog#9010ef6f as nil") - } - b.PutString(g.PrevAppVersion) - return nil -} - -// Decode implements bin.Decoder. -func (g *HelpGetAppChangelogRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode help.getAppChangelog#9010ef6f to nil") - } - if err := b.ConsumeID(HelpGetAppChangelogRequestTypeID); err != nil { - return fmt.Errorf("unable to decode help.getAppChangelog#9010ef6f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *HelpGetAppChangelogRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode help.getAppChangelog#9010ef6f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode help.getAppChangelog#9010ef6f: field prev_app_version: %w", err) - } - g.PrevAppVersion = value - } - return nil -} - -// GetPrevAppVersion returns value of PrevAppVersion field. -func (g *HelpGetAppChangelogRequest) GetPrevAppVersion() (value string) { - if g == nil { - return - } - return g.PrevAppVersion -} - -// HelpGetAppChangelog invokes method help.getAppChangelog#9010ef6f returning error if any. -// Get changelog of current app. -// Typically, an updates¹ constructor will be returned, containing one or more -// updateServiceNotification² updates with app-specific changelogs. -// -// Links: -// 1. https://core.telegram.org/constructor/updates -// 2. https://core.telegram.org/constructor/updateServiceNotification -// -// See https://core.telegram.org/method/help.getAppChangelog for reference. -func (c *Client) HelpGetAppChangelog(ctx context.Context, prevappversion string) (UpdatesClass, error) { - var result UpdatesBox - - request := &HelpGetAppChangelogRequest{ - PrevAppVersion: prevappversion, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.Updates, nil -} diff --git a/tg/tl_help_peer_color_option_gen.go b/tg/tl_help_peer_color_option_gen.go index e36558168c..0560d3da11 100644 --- a/tg/tl_help_peer_color_option_gen.go +++ b/tg/tl_help_peer_color_option_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// HelpPeerColorOption represents TL type `help.peerColorOption#135bd42f`. +// HelpPeerColorOption represents TL type `help.peerColorOption#ef8430ab`. // // See https://core.telegram.org/constructor/help.peerColorOption for reference. type HelpPeerColorOption struct { @@ -52,10 +52,14 @@ type HelpPeerColorOption struct { // // Use SetDarkColors and GetDarkColors helpers. DarkColors HelpPeerColorSetClass + // ChannelMinLevel field of HelpPeerColorOption. + // + // Use SetChannelMinLevel and GetChannelMinLevel helpers. + ChannelMinLevel int } // HelpPeerColorOptionTypeID is TL type id of HelpPeerColorOption. -const HelpPeerColorOptionTypeID = 0x135bd42f +const HelpPeerColorOptionTypeID = 0xef8430ab // Ensuring interfaces in compile-time for HelpPeerColorOption. var ( @@ -84,6 +88,9 @@ func (p *HelpPeerColorOption) Zero() bool { if !(p.DarkColors == nil) { return false } + if !(p.ChannelMinLevel == 0) { + return false + } return true } @@ -103,6 +110,7 @@ func (p *HelpPeerColorOption) FillFrom(from interface { GetColorID() (value int) GetColors() (value HelpPeerColorSetClass, ok bool) GetDarkColors() (value HelpPeerColorSetClass, ok bool) + GetChannelMinLevel() (value int, ok bool) }) { p.Hidden = from.GetHidden() p.ColorID = from.GetColorID() @@ -114,6 +122,10 @@ func (p *HelpPeerColorOption) FillFrom(from interface { p.DarkColors = val } + if val, ok := from.GetChannelMinLevel(); ok { + p.ChannelMinLevel = val + } + } // TypeID returns type id in TL schema. @@ -158,6 +170,11 @@ func (p *HelpPeerColorOption) TypeInfo() tdp.Type { SchemaName: "dark_colors", Null: !p.Flags.Has(2), }, + { + Name: "ChannelMinLevel", + SchemaName: "channel_min_level", + Null: !p.Flags.Has(3), + }, } return typ } @@ -173,12 +190,15 @@ func (p *HelpPeerColorOption) SetFlags() { if !(p.DarkColors == nil) { p.Flags.Set(2) } + if !(p.ChannelMinLevel == 0) { + p.Flags.Set(3) + } } // Encode implements bin.Encoder. func (p *HelpPeerColorOption) Encode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode help.peerColorOption#135bd42f as nil") + return fmt.Errorf("can't encode help.peerColorOption#ef8430ab as nil") } b.PutID(HelpPeerColorOptionTypeID) return p.EncodeBare(b) @@ -187,39 +207,42 @@ func (p *HelpPeerColorOption) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (p *HelpPeerColorOption) EncodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode help.peerColorOption#135bd42f as nil") + return fmt.Errorf("can't encode help.peerColorOption#ef8430ab as nil") } p.SetFlags() if err := p.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field flags: %w", err) + return fmt.Errorf("unable to encode help.peerColorOption#ef8430ab: field flags: %w", err) } b.PutInt(p.ColorID) if p.Flags.Has(1) { if p.Colors == nil { - return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field colors is nil") + return fmt.Errorf("unable to encode help.peerColorOption#ef8430ab: field colors is nil") } if err := p.Colors.Encode(b); err != nil { - return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field colors: %w", err) + return fmt.Errorf("unable to encode help.peerColorOption#ef8430ab: field colors: %w", err) } } if p.Flags.Has(2) { if p.DarkColors == nil { - return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field dark_colors is nil") + return fmt.Errorf("unable to encode help.peerColorOption#ef8430ab: field dark_colors is nil") } if err := p.DarkColors.Encode(b); err != nil { - return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field dark_colors: %w", err) + return fmt.Errorf("unable to encode help.peerColorOption#ef8430ab: field dark_colors: %w", err) } } + if p.Flags.Has(3) { + b.PutInt(p.ChannelMinLevel) + } return nil } // Decode implements bin.Decoder. func (p *HelpPeerColorOption) Decode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode help.peerColorOption#135bd42f to nil") + return fmt.Errorf("can't decode help.peerColorOption#ef8430ab to nil") } if err := b.ConsumeID(HelpPeerColorOptionTypeID); err != nil { - return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#ef8430ab: %w", err) } return p.DecodeBare(b) } @@ -227,35 +250,42 @@ func (p *HelpPeerColorOption) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (p *HelpPeerColorOption) DecodeBare(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't decode help.peerColorOption#135bd42f to nil") + return fmt.Errorf("can't decode help.peerColorOption#ef8430ab to nil") } { if err := p.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: field flags: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#ef8430ab: field flags: %w", err) } } p.Hidden = p.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: field color_id: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#ef8430ab: field color_id: %w", err) } p.ColorID = value } if p.Flags.Has(1) { value, err := DecodeHelpPeerColorSet(b) if err != nil { - return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: field colors: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#ef8430ab: field colors: %w", err) } p.Colors = value } if p.Flags.Has(2) { value, err := DecodeHelpPeerColorSet(b) if err != nil { - return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: field dark_colors: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#ef8430ab: field dark_colors: %w", err) } p.DarkColors = value } + if p.Flags.Has(3) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorOption#ef8430ab: field channel_min_level: %w", err) + } + p.ChannelMinLevel = value + } return nil } @@ -321,3 +351,21 @@ func (p *HelpPeerColorOption) GetDarkColors() (value HelpPeerColorSetClass, ok b } return p.DarkColors, true } + +// SetChannelMinLevel sets value of ChannelMinLevel conditional field. +func (p *HelpPeerColorOption) SetChannelMinLevel(value int) { + p.Flags.Set(3) + p.ChannelMinLevel = value +} + +// GetChannelMinLevel returns value of ChannelMinLevel conditional field and +// boolean which is true if field was set. +func (p *HelpPeerColorOption) GetChannelMinLevel() (value int, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(3) { + return value, false + } + return p.ChannelMinLevel, true +} diff --git a/tg/tl_input_sticker_set_gen.go b/tg/tl_input_sticker_set_gen.go index 032f36f79f..f844560b1d 100644 --- a/tg/tl_input_sticker_set_gen.go +++ b/tg/tl_input_sticker_set_gen.go @@ -1198,6 +1198,107 @@ func (i *InputStickerSetEmojiDefaultTopicIcons) DecodeBare(b *bin.Buffer) error return nil } +// InputStickerSetEmojiChannelDefaultStatuses represents TL type `inputStickerSetEmojiChannelDefaultStatuses#49748553`. +// +// See https://core.telegram.org/constructor/inputStickerSetEmojiChannelDefaultStatuses for reference. +type InputStickerSetEmojiChannelDefaultStatuses struct { +} + +// InputStickerSetEmojiChannelDefaultStatusesTypeID is TL type id of InputStickerSetEmojiChannelDefaultStatuses. +const InputStickerSetEmojiChannelDefaultStatusesTypeID = 0x49748553 + +// construct implements constructor of InputStickerSetClass. +func (i InputStickerSetEmojiChannelDefaultStatuses) construct() InputStickerSetClass { return &i } + +// Ensuring interfaces in compile-time for InputStickerSetEmojiChannelDefaultStatuses. +var ( + _ bin.Encoder = &InputStickerSetEmojiChannelDefaultStatuses{} + _ bin.Decoder = &InputStickerSetEmojiChannelDefaultStatuses{} + _ bin.BareEncoder = &InputStickerSetEmojiChannelDefaultStatuses{} + _ bin.BareDecoder = &InputStickerSetEmojiChannelDefaultStatuses{} + + _ InputStickerSetClass = &InputStickerSetEmojiChannelDefaultStatuses{} +) + +func (i *InputStickerSetEmojiChannelDefaultStatuses) Zero() bool { + if i == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputStickerSetEmojiChannelDefaultStatuses) String() string { + if i == nil { + return "InputStickerSetEmojiChannelDefaultStatuses(nil)" + } + type Alias InputStickerSetEmojiChannelDefaultStatuses + return fmt.Sprintf("InputStickerSetEmojiChannelDefaultStatuses%+v", Alias(*i)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputStickerSetEmojiChannelDefaultStatuses) TypeID() uint32 { + return InputStickerSetEmojiChannelDefaultStatusesTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputStickerSetEmojiChannelDefaultStatuses) TypeName() string { + return "inputStickerSetEmojiChannelDefaultStatuses" +} + +// TypeInfo returns info about TL type. +func (i *InputStickerSetEmojiChannelDefaultStatuses) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputStickerSetEmojiChannelDefaultStatuses", + ID: InputStickerSetEmojiChannelDefaultStatusesTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (i *InputStickerSetEmojiChannelDefaultStatuses) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStickerSetEmojiChannelDefaultStatuses#49748553 as nil") + } + b.PutID(InputStickerSetEmojiChannelDefaultStatusesTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputStickerSetEmojiChannelDefaultStatuses) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputStickerSetEmojiChannelDefaultStatuses#49748553 as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (i *InputStickerSetEmojiChannelDefaultStatuses) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStickerSetEmojiChannelDefaultStatuses#49748553 to nil") + } + if err := b.ConsumeID(InputStickerSetEmojiChannelDefaultStatusesTypeID); err != nil { + return fmt.Errorf("unable to decode inputStickerSetEmojiChannelDefaultStatuses#49748553: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputStickerSetEmojiChannelDefaultStatuses) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputStickerSetEmojiChannelDefaultStatuses#49748553 to nil") + } + return nil +} + // InputStickerSetClassName is schema name of InputStickerSetClass. const InputStickerSetClassName = "InputStickerSet" @@ -1222,6 +1323,7 @@ const InputStickerSetClassName = "InputStickerSet" // case *tg.InputStickerSetEmojiGenericAnimations: // inputStickerSetEmojiGenericAnimations#4c4d4ce // case *tg.InputStickerSetEmojiDefaultStatuses: // inputStickerSetEmojiDefaultStatuses#29d0f5ee // case *tg.InputStickerSetEmojiDefaultTopicIcons: // inputStickerSetEmojiDefaultTopicIcons#44c1f8e9 +// case *tg.InputStickerSetEmojiChannelDefaultStatuses: // inputStickerSetEmojiChannelDefaultStatuses#49748553 // default: panic(v) // } type InputStickerSetClass interface { @@ -1320,6 +1422,13 @@ func DecodeInputStickerSet(buf *bin.Buffer) (InputStickerSetClass, error) { return nil, fmt.Errorf("unable to decode InputStickerSetClass: %w", err) } return &v, nil + case InputStickerSetEmojiChannelDefaultStatusesTypeID: + // Decoding inputStickerSetEmojiChannelDefaultStatuses#49748553. + v := InputStickerSetEmojiChannelDefaultStatuses{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode InputStickerSetClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode InputStickerSetClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_input_store_payment_purpose_gen.go b/tg/tl_input_store_payment_purpose_gen.go index 723aa877cb..20ad545a2a 100644 --- a/tg/tl_input_store_payment_purpose_gen.go +++ b/tg/tl_input_store_payment_purpose_gen.go @@ -719,7 +719,7 @@ func (i *InputStorePaymentPremiumGiftCode) MapUsers() (value InputUserClassArray return InputUserClassArray(i.Users) } -// InputStorePaymentPremiumGiveaway represents TL type `inputStorePaymentPremiumGiveaway#7c9375e6`. +// InputStorePaymentPremiumGiveaway represents TL type `inputStorePaymentPremiumGiveaway#160544ca`. // // See https://core.telegram.org/constructor/inputStorePaymentPremiumGiveaway for reference. type InputStorePaymentPremiumGiveaway struct { @@ -730,6 +730,8 @@ type InputStorePaymentPremiumGiveaway struct { Flags bin.Fields // OnlyNewSubscribers field of InputStorePaymentPremiumGiveaway. OnlyNewSubscribers bool + // WinnersAreVisible field of InputStorePaymentPremiumGiveaway. + WinnersAreVisible bool // BoostPeer field of InputStorePaymentPremiumGiveaway. BoostPeer InputPeerClass // AdditionalPeers field of InputStorePaymentPremiumGiveaway. @@ -740,6 +742,10 @@ type InputStorePaymentPremiumGiveaway struct { // // Use SetCountriesISO2 and GetCountriesISO2 helpers. CountriesISO2 []string + // PrizeDescription field of InputStorePaymentPremiumGiveaway. + // + // Use SetPrizeDescription and GetPrizeDescription helpers. + PrizeDescription string // RandomID field of InputStorePaymentPremiumGiveaway. RandomID int64 // UntilDate field of InputStorePaymentPremiumGiveaway. @@ -751,7 +757,7 @@ type InputStorePaymentPremiumGiveaway struct { } // InputStorePaymentPremiumGiveawayTypeID is TL type id of InputStorePaymentPremiumGiveaway. -const InputStorePaymentPremiumGiveawayTypeID = 0x7c9375e6 +const InputStorePaymentPremiumGiveawayTypeID = 0x160544ca // construct implements constructor of InputStorePaymentPurposeClass. func (i InputStorePaymentPremiumGiveaway) construct() InputStorePaymentPurposeClass { return &i } @@ -776,6 +782,9 @@ func (i *InputStorePaymentPremiumGiveaway) Zero() bool { if !(i.OnlyNewSubscribers == false) { return false } + if !(i.WinnersAreVisible == false) { + return false + } if !(i.BoostPeer == nil) { return false } @@ -785,6 +794,9 @@ func (i *InputStorePaymentPremiumGiveaway) Zero() bool { if !(i.CountriesISO2 == nil) { return false } + if !(i.PrizeDescription == "") { + return false + } if !(i.RandomID == 0) { return false } @@ -813,15 +825,18 @@ func (i *InputStorePaymentPremiumGiveaway) String() string { // FillFrom fills InputStorePaymentPremiumGiveaway from given interface. func (i *InputStorePaymentPremiumGiveaway) FillFrom(from interface { GetOnlyNewSubscribers() (value bool) + GetWinnersAreVisible() (value bool) GetBoostPeer() (value InputPeerClass) GetAdditionalPeers() (value []InputPeerClass, ok bool) GetCountriesISO2() (value []string, ok bool) + GetPrizeDescription() (value string, ok bool) GetRandomID() (value int64) GetUntilDate() (value int) GetCurrency() (value string) GetAmount() (value int64) }) { i.OnlyNewSubscribers = from.GetOnlyNewSubscribers() + i.WinnersAreVisible = from.GetWinnersAreVisible() i.BoostPeer = from.GetBoostPeer() if val, ok := from.GetAdditionalPeers(); ok { i.AdditionalPeers = val @@ -831,6 +846,10 @@ func (i *InputStorePaymentPremiumGiveaway) FillFrom(from interface { i.CountriesISO2 = val } + if val, ok := from.GetPrizeDescription(); ok { + i.PrizeDescription = val + } + i.RandomID = from.GetRandomID() i.UntilDate = from.GetUntilDate() i.Currency = from.GetCurrency() @@ -865,6 +884,11 @@ func (i *InputStorePaymentPremiumGiveaway) TypeInfo() tdp.Type { SchemaName: "only_new_subscribers", Null: !i.Flags.Has(0), }, + { + Name: "WinnersAreVisible", + SchemaName: "winners_are_visible", + Null: !i.Flags.Has(3), + }, { Name: "BoostPeer", SchemaName: "boost_peer", @@ -879,6 +903,11 @@ func (i *InputStorePaymentPremiumGiveaway) TypeInfo() tdp.Type { SchemaName: "countries_iso2", Null: !i.Flags.Has(2), }, + { + Name: "PrizeDescription", + SchemaName: "prize_description", + Null: !i.Flags.Has(4), + }, { Name: "RandomID", SchemaName: "random_id", @@ -904,18 +933,24 @@ func (i *InputStorePaymentPremiumGiveaway) SetFlags() { if !(i.OnlyNewSubscribers == false) { i.Flags.Set(0) } + if !(i.WinnersAreVisible == false) { + i.Flags.Set(3) + } if !(i.AdditionalPeers == nil) { i.Flags.Set(1) } if !(i.CountriesISO2 == nil) { i.Flags.Set(2) } + if !(i.PrizeDescription == "") { + i.Flags.Set(4) + } } // Encode implements bin.Encoder. func (i *InputStorePaymentPremiumGiveaway) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStorePaymentPremiumGiveaway#7c9375e6 as nil") + return fmt.Errorf("can't encode inputStorePaymentPremiumGiveaway#160544ca as nil") } b.PutID(InputStorePaymentPremiumGiveawayTypeID) return i.EncodeBare(b) @@ -924,26 +959,26 @@ func (i *InputStorePaymentPremiumGiveaway) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputStorePaymentPremiumGiveaway) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStorePaymentPremiumGiveaway#7c9375e6 as nil") + return fmt.Errorf("can't encode inputStorePaymentPremiumGiveaway#160544ca as nil") } i.SetFlags() if err := i.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#7c9375e6: field flags: %w", err) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#160544ca: field flags: %w", err) } if i.BoostPeer == nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#7c9375e6: field boost_peer is nil") + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#160544ca: field boost_peer is nil") } if err := i.BoostPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#7c9375e6: field boost_peer: %w", err) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#160544ca: field boost_peer: %w", err) } if i.Flags.Has(1) { b.PutVectorHeader(len(i.AdditionalPeers)) for idx, v := range i.AdditionalPeers { if v == nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#7c9375e6: field additional_peers element with index %d is nil", idx) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#160544ca: field additional_peers element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#7c9375e6: field additional_peers element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiveaway#160544ca: field additional_peers element with index %d: %w", idx, err) } } } @@ -953,6 +988,9 @@ func (i *InputStorePaymentPremiumGiveaway) EncodeBare(b *bin.Buffer) error { b.PutString(v) } } + if i.Flags.Has(4) { + b.PutString(i.PrizeDescription) + } b.PutLong(i.RandomID) b.PutInt(i.UntilDate) b.PutString(i.Currency) @@ -963,10 +1001,10 @@ func (i *InputStorePaymentPremiumGiveaway) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputStorePaymentPremiumGiveaway) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStorePaymentPremiumGiveaway#7c9375e6 to nil") + return fmt.Errorf("can't decode inputStorePaymentPremiumGiveaway#160544ca to nil") } if err := b.ConsumeID(InputStorePaymentPremiumGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: %w", err) } return i.DecodeBare(b) } @@ -974,25 +1012,26 @@ func (i *InputStorePaymentPremiumGiveaway) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputStorePaymentPremiumGiveaway) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStorePaymentPremiumGiveaway#7c9375e6 to nil") + return fmt.Errorf("can't decode inputStorePaymentPremiumGiveaway#160544ca to nil") } { if err := i.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field flags: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field flags: %w", err) } } i.OnlyNewSubscribers = i.Flags.Has(0) + i.WinnersAreVisible = i.Flags.Has(3) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field boost_peer: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field boost_peer: %w", err) } i.BoostPeer = value } if i.Flags.Has(1) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field additional_peers: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field additional_peers: %w", err) } if headerLen > 0 { @@ -1001,7 +1040,7 @@ func (i *InputStorePaymentPremiumGiveaway) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field additional_peers: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field additional_peers: %w", err) } i.AdditionalPeers = append(i.AdditionalPeers, value) } @@ -1009,7 +1048,7 @@ func (i *InputStorePaymentPremiumGiveaway) DecodeBare(b *bin.Buffer) error { if i.Flags.Has(2) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field countries_iso2: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field countries_iso2: %w", err) } if headerLen > 0 { @@ -1018,36 +1057,43 @@ func (i *InputStorePaymentPremiumGiveaway) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field countries_iso2: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field countries_iso2: %w", err) } i.CountriesISO2 = append(i.CountriesISO2, value) } } + if i.Flags.Has(4) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field prize_description: %w", err) + } + i.PrizeDescription = value + } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field random_id: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field random_id: %w", err) } i.RandomID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field until_date: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field until_date: %w", err) } i.UntilDate = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field currency: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field currency: %w", err) } i.Currency = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#7c9375e6: field amount: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiveaway#160544ca: field amount: %w", err) } i.Amount = value } @@ -1073,6 +1119,25 @@ func (i *InputStorePaymentPremiumGiveaway) GetOnlyNewSubscribers() (value bool) return i.Flags.Has(0) } +// SetWinnersAreVisible sets value of WinnersAreVisible conditional field. +func (i *InputStorePaymentPremiumGiveaway) SetWinnersAreVisible(value bool) { + if value { + i.Flags.Set(3) + i.WinnersAreVisible = true + } else { + i.Flags.Unset(3) + i.WinnersAreVisible = false + } +} + +// GetWinnersAreVisible returns value of WinnersAreVisible conditional field. +func (i *InputStorePaymentPremiumGiveaway) GetWinnersAreVisible() (value bool) { + if i == nil { + return + } + return i.Flags.Has(3) +} + // GetBoostPeer returns value of BoostPeer field. func (i *InputStorePaymentPremiumGiveaway) GetBoostPeer() (value InputPeerClass) { if i == nil { @@ -1117,6 +1182,24 @@ func (i *InputStorePaymentPremiumGiveaway) GetCountriesISO2() (value []string, o return i.CountriesISO2, true } +// SetPrizeDescription sets value of PrizeDescription conditional field. +func (i *InputStorePaymentPremiumGiveaway) SetPrizeDescription(value string) { + i.Flags.Set(4) + i.PrizeDescription = value +} + +// GetPrizeDescription returns value of PrizeDescription conditional field and +// boolean which is true if field was set. +func (i *InputStorePaymentPremiumGiveaway) GetPrizeDescription() (value string, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(4) { + return value, false + } + return i.PrizeDescription, true +} + // GetRandomID returns value of RandomID field. func (i *InputStorePaymentPremiumGiveaway) GetRandomID() (value int64) { if i == nil { @@ -1174,7 +1257,7 @@ const InputStorePaymentPurposeClassName = "InputStorePaymentPurpose" // case *tg.InputStorePaymentPremiumSubscription: // inputStorePaymentPremiumSubscription#a6751e66 // case *tg.InputStorePaymentGiftPremium: // inputStorePaymentGiftPremium#616f7fe8 // case *tg.InputStorePaymentPremiumGiftCode: // inputStorePaymentPremiumGiftCode#a3805f3f -// case *tg.InputStorePaymentPremiumGiveaway: // inputStorePaymentPremiumGiveaway#7c9375e6 +// case *tg.InputStorePaymentPremiumGiveaway: // inputStorePaymentPremiumGiveaway#160544ca // default: panic(v) // } type InputStorePaymentPurposeClass interface { @@ -1225,7 +1308,7 @@ func DecodeInputStorePaymentPurpose(buf *bin.Buffer) (InputStorePaymentPurposeCl } return &v, nil case InputStorePaymentPremiumGiveawayTypeID: - // Decoding inputStorePaymentPremiumGiveaway#7c9375e6. + // Decoding inputStorePaymentPremiumGiveaway#160544ca. v := InputStorePaymentPremiumGiveaway{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputStorePaymentPurposeClass: %w", err) diff --git a/tg/tl_keyboard_button_gen.go b/tg/tl_keyboard_button_gen.go index 9ca77e80d8..d606e431b7 100644 --- a/tg/tl_keyboard_button_gen.go +++ b/tg/tl_keyboard_button_gen.go @@ -2877,7 +2877,7 @@ func (k *KeyboardButtonSimpleWebView) GetURL() (value string) { return k.URL } -// KeyboardButtonRequestPeer represents TL type `keyboardButtonRequestPeer#d0b468c`. +// KeyboardButtonRequestPeer represents TL type `keyboardButtonRequestPeer#53d7bfd8`. // Prompts the user to select and share a peer with the bot using messages // sendBotRequestedPeer¹ // @@ -2898,10 +2898,12 @@ type KeyboardButtonRequestPeer struct { // option for the user to create and immediately use a peer of the specified type, if // needed. PeerType RequestPeerTypeClass + // MaxQuantity field of KeyboardButtonRequestPeer. + MaxQuantity int } // KeyboardButtonRequestPeerTypeID is TL type id of KeyboardButtonRequestPeer. -const KeyboardButtonRequestPeerTypeID = 0xd0b468c +const KeyboardButtonRequestPeerTypeID = 0x53d7bfd8 // construct implements constructor of KeyboardButtonClass. func (k KeyboardButtonRequestPeer) construct() KeyboardButtonClass { return &k } @@ -2929,6 +2931,9 @@ func (k *KeyboardButtonRequestPeer) Zero() bool { if !(k.PeerType == nil) { return false } + if !(k.MaxQuantity == 0) { + return false + } return true } @@ -2947,10 +2952,12 @@ func (k *KeyboardButtonRequestPeer) FillFrom(from interface { GetText() (value string) GetButtonID() (value int) GetPeerType() (value RequestPeerTypeClass) + GetMaxQuantity() (value int) }) { k.Text = from.GetText() k.ButtonID = from.GetButtonID() k.PeerType = from.GetPeerType() + k.MaxQuantity = from.GetMaxQuantity() } // TypeID returns type id in TL schema. @@ -2988,6 +2995,10 @@ func (k *KeyboardButtonRequestPeer) TypeInfo() tdp.Type { Name: "PeerType", SchemaName: "peer_type", }, + { + Name: "MaxQuantity", + SchemaName: "max_quantity", + }, } return typ } @@ -2995,7 +3006,7 @@ func (k *KeyboardButtonRequestPeer) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (k *KeyboardButtonRequestPeer) Encode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't encode keyboardButtonRequestPeer#d0b468c as nil") + return fmt.Errorf("can't encode keyboardButtonRequestPeer#53d7bfd8 as nil") } b.PutID(KeyboardButtonRequestPeerTypeID) return k.EncodeBare(b) @@ -3004,26 +3015,27 @@ 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#d0b468c as nil") + return fmt.Errorf("can't encode keyboardButtonRequestPeer#53d7bfd8 as nil") } b.PutString(k.Text) b.PutInt(k.ButtonID) if k.PeerType == nil { - return fmt.Errorf("unable to encode keyboardButtonRequestPeer#d0b468c: field peer_type is nil") + return fmt.Errorf("unable to encode keyboardButtonRequestPeer#53d7bfd8: field peer_type is nil") } if err := k.PeerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonRequestPeer#d0b468c: field peer_type: %w", err) + return fmt.Errorf("unable to encode keyboardButtonRequestPeer#53d7bfd8: field peer_type: %w", err) } + b.PutInt(k.MaxQuantity) return nil } // Decode implements bin.Decoder. func (k *KeyboardButtonRequestPeer) Decode(b *bin.Buffer) error { if k == nil { - return fmt.Errorf("can't decode keyboardButtonRequestPeer#d0b468c to nil") + return fmt.Errorf("can't decode keyboardButtonRequestPeer#53d7bfd8 to nil") } if err := b.ConsumeID(KeyboardButtonRequestPeerTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPeer#d0b468c: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: %w", err) } return k.DecodeBare(b) } @@ -3031,29 +3043,36 @@ 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#d0b468c to nil") + return fmt.Errorf("can't decode keyboardButtonRequestPeer#53d7bfd8 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPeer#d0b468c: field text: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field text: %w", err) } k.Text = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPeer#d0b468c: field button_id: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field button_id: %w", err) } k.ButtonID = value } { value, err := DecodeRequestPeerType(b) if err != nil { - return fmt.Errorf("unable to decode keyboardButtonRequestPeer#d0b468c: field peer_type: %w", err) + return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: 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) + } + k.MaxQuantity = value + } return nil } @@ -3081,6 +3100,14 @@ func (k *KeyboardButtonRequestPeer) GetPeerType() (value RequestPeerTypeClass) { return k.PeerType } +// GetMaxQuantity returns value of MaxQuantity field. +func (k *KeyboardButtonRequestPeer) GetMaxQuantity() (value int) { + if k == nil { + return + } + return k.MaxQuantity +} + // KeyboardButtonClassName is schema name of KeyboardButtonClass. const KeyboardButtonClassName = "KeyboardButton" @@ -3110,7 +3137,7 @@ const KeyboardButtonClassName = "KeyboardButton" // case *tg.KeyboardButtonUserProfile: // keyboardButtonUserProfile#308660c1 // case *tg.KeyboardButtonWebView: // keyboardButtonWebView#13767230 // case *tg.KeyboardButtonSimpleWebView: // keyboardButtonSimpleWebView#a0c0505c -// case *tg.KeyboardButtonRequestPeer: // keyboardButtonRequestPeer#d0b468c +// case *tg.KeyboardButtonRequestPeer: // keyboardButtonRequestPeer#53d7bfd8 // default: panic(v) // } type KeyboardButtonClass interface { @@ -3248,7 +3275,7 @@ func DecodeKeyboardButton(buf *bin.Buffer) (KeyboardButtonClass, error) { } return &v, nil case KeyboardButtonRequestPeerTypeID: - // Decoding keyboardButtonRequestPeer#d0b468c. + // Decoding keyboardButtonRequestPeer#53d7bfd8. v := KeyboardButtonRequestPeer{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", err) diff --git a/tg/tl_media_area_gen.go b/tg/tl_media_area_gen.go index d655cc2872..a5d25f3742 100644 --- a/tg/tl_media_area_gen.go +++ b/tg/tl_media_area_gen.go @@ -970,6 +970,387 @@ func (m *MediaAreaSuggestedReaction) GetReaction() (value ReactionClass) { return m.Reaction } +// MediaAreaChannelPost represents TL type `mediaAreaChannelPost#770416af`. +// +// See https://core.telegram.org/constructor/mediaAreaChannelPost for reference. +type MediaAreaChannelPost struct { + // Coordinates field of MediaAreaChannelPost. + Coordinates MediaAreaCoordinates + // ChannelID field of MediaAreaChannelPost. + ChannelID int64 + // MsgID field of MediaAreaChannelPost. + MsgID int +} + +// MediaAreaChannelPostTypeID is TL type id of MediaAreaChannelPost. +const MediaAreaChannelPostTypeID = 0x770416af + +// construct implements constructor of MediaAreaClass. +func (m MediaAreaChannelPost) construct() MediaAreaClass { return &m } + +// Ensuring interfaces in compile-time for MediaAreaChannelPost. +var ( + _ bin.Encoder = &MediaAreaChannelPost{} + _ bin.Decoder = &MediaAreaChannelPost{} + _ bin.BareEncoder = &MediaAreaChannelPost{} + _ bin.BareDecoder = &MediaAreaChannelPost{} + + _ MediaAreaClass = &MediaAreaChannelPost{} +) + +func (m *MediaAreaChannelPost) Zero() bool { + if m == nil { + return true + } + if !(m.Coordinates.Zero()) { + return false + } + if !(m.ChannelID == 0) { + return false + } + if !(m.MsgID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MediaAreaChannelPost) String() string { + if m == nil { + return "MediaAreaChannelPost(nil)" + } + type Alias MediaAreaChannelPost + return fmt.Sprintf("MediaAreaChannelPost%+v", Alias(*m)) +} + +// FillFrom fills MediaAreaChannelPost from given interface. +func (m *MediaAreaChannelPost) FillFrom(from interface { + GetCoordinates() (value MediaAreaCoordinates) + GetChannelID() (value int64) + GetMsgID() (value int) +}) { + m.Coordinates = from.GetCoordinates() + m.ChannelID = from.GetChannelID() + m.MsgID = from.GetMsgID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MediaAreaChannelPost) TypeID() uint32 { + return MediaAreaChannelPostTypeID +} + +// TypeName returns name of type in TL schema. +func (*MediaAreaChannelPost) TypeName() string { + return "mediaAreaChannelPost" +} + +// TypeInfo returns info about TL type. +func (m *MediaAreaChannelPost) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "mediaAreaChannelPost", + ID: MediaAreaChannelPostTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Coordinates", + SchemaName: "coordinates", + }, + { + Name: "ChannelID", + SchemaName: "channel_id", + }, + { + Name: "MsgID", + SchemaName: "msg_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MediaAreaChannelPost) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode mediaAreaChannelPost#770416af as nil") + } + b.PutID(MediaAreaChannelPostTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MediaAreaChannelPost) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode mediaAreaChannelPost#770416af as nil") + } + if err := m.Coordinates.Encode(b); err != nil { + return fmt.Errorf("unable to encode mediaAreaChannelPost#770416af: field coordinates: %w", err) + } + b.PutLong(m.ChannelID) + b.PutInt(m.MsgID) + return nil +} + +// Decode implements bin.Decoder. +func (m *MediaAreaChannelPost) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode mediaAreaChannelPost#770416af to nil") + } + if err := b.ConsumeID(MediaAreaChannelPostTypeID); err != nil { + return fmt.Errorf("unable to decode mediaAreaChannelPost#770416af: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MediaAreaChannelPost) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode mediaAreaChannelPost#770416af to nil") + } + { + if err := m.Coordinates.Decode(b); err != nil { + return fmt.Errorf("unable to decode mediaAreaChannelPost#770416af: field coordinates: %w", err) + } + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode mediaAreaChannelPost#770416af: field channel_id: %w", err) + } + m.ChannelID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode mediaAreaChannelPost#770416af: field msg_id: %w", err) + } + m.MsgID = value + } + return nil +} + +// GetCoordinates returns value of Coordinates field. +func (m *MediaAreaChannelPost) GetCoordinates() (value MediaAreaCoordinates) { + if m == nil { + return + } + return m.Coordinates +} + +// GetChannelID returns value of ChannelID field. +func (m *MediaAreaChannelPost) GetChannelID() (value int64) { + if m == nil { + return + } + return m.ChannelID +} + +// GetMsgID returns value of MsgID field. +func (m *MediaAreaChannelPost) GetMsgID() (value int) { + if m == nil { + return + } + return m.MsgID +} + +// InputMediaAreaChannelPost represents TL type `inputMediaAreaChannelPost#2271f2bf`. +// +// See https://core.telegram.org/constructor/inputMediaAreaChannelPost for reference. +type InputMediaAreaChannelPost struct { + // Coordinates field of InputMediaAreaChannelPost. + Coordinates MediaAreaCoordinates + // Channel field of InputMediaAreaChannelPost. + Channel InputChannelClass + // MsgID field of InputMediaAreaChannelPost. + MsgID int +} + +// InputMediaAreaChannelPostTypeID is TL type id of InputMediaAreaChannelPost. +const InputMediaAreaChannelPostTypeID = 0x2271f2bf + +// construct implements constructor of MediaAreaClass. +func (i InputMediaAreaChannelPost) construct() MediaAreaClass { return &i } + +// Ensuring interfaces in compile-time for InputMediaAreaChannelPost. +var ( + _ bin.Encoder = &InputMediaAreaChannelPost{} + _ bin.Decoder = &InputMediaAreaChannelPost{} + _ bin.BareEncoder = &InputMediaAreaChannelPost{} + _ bin.BareDecoder = &InputMediaAreaChannelPost{} + + _ MediaAreaClass = &InputMediaAreaChannelPost{} +) + +func (i *InputMediaAreaChannelPost) Zero() bool { + if i == nil { + return true + } + if !(i.Coordinates.Zero()) { + return false + } + if !(i.Channel == nil) { + return false + } + if !(i.MsgID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (i *InputMediaAreaChannelPost) String() string { + if i == nil { + return "InputMediaAreaChannelPost(nil)" + } + type Alias InputMediaAreaChannelPost + return fmt.Sprintf("InputMediaAreaChannelPost%+v", Alias(*i)) +} + +// FillFrom fills InputMediaAreaChannelPost from given interface. +func (i *InputMediaAreaChannelPost) FillFrom(from interface { + GetCoordinates() (value MediaAreaCoordinates) + GetChannel() (value InputChannelClass) + GetMsgID() (value int) +}) { + i.Coordinates = from.GetCoordinates() + i.Channel = from.GetChannel() + i.MsgID = from.GetMsgID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*InputMediaAreaChannelPost) TypeID() uint32 { + return InputMediaAreaChannelPostTypeID +} + +// TypeName returns name of type in TL schema. +func (*InputMediaAreaChannelPost) TypeName() string { + return "inputMediaAreaChannelPost" +} + +// TypeInfo returns info about TL type. +func (i *InputMediaAreaChannelPost) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "inputMediaAreaChannelPost", + ID: InputMediaAreaChannelPostTypeID, + } + if i == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Coordinates", + SchemaName: "coordinates", + }, + { + Name: "Channel", + SchemaName: "channel", + }, + { + Name: "MsgID", + SchemaName: "msg_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (i *InputMediaAreaChannelPost) Encode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputMediaAreaChannelPost#2271f2bf as nil") + } + b.PutID(InputMediaAreaChannelPostTypeID) + return i.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (i *InputMediaAreaChannelPost) EncodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't encode inputMediaAreaChannelPost#2271f2bf as nil") + } + if err := i.Coordinates.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputMediaAreaChannelPost#2271f2bf: field coordinates: %w", err) + } + if i.Channel == nil { + return fmt.Errorf("unable to encode inputMediaAreaChannelPost#2271f2bf: field channel is nil") + } + if err := i.Channel.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputMediaAreaChannelPost#2271f2bf: field channel: %w", err) + } + b.PutInt(i.MsgID) + return nil +} + +// Decode implements bin.Decoder. +func (i *InputMediaAreaChannelPost) Decode(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputMediaAreaChannelPost#2271f2bf to nil") + } + if err := b.ConsumeID(InputMediaAreaChannelPostTypeID); err != nil { + return fmt.Errorf("unable to decode inputMediaAreaChannelPost#2271f2bf: %w", err) + } + return i.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (i *InputMediaAreaChannelPost) DecodeBare(b *bin.Buffer) error { + if i == nil { + return fmt.Errorf("can't decode inputMediaAreaChannelPost#2271f2bf to nil") + } + { + if err := i.Coordinates.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputMediaAreaChannelPost#2271f2bf: field coordinates: %w", err) + } + } + { + value, err := DecodeInputChannel(b) + if err != nil { + return fmt.Errorf("unable to decode inputMediaAreaChannelPost#2271f2bf: field channel: %w", err) + } + i.Channel = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode inputMediaAreaChannelPost#2271f2bf: field msg_id: %w", err) + } + i.MsgID = value + } + return nil +} + +// GetCoordinates returns value of Coordinates field. +func (i *InputMediaAreaChannelPost) GetCoordinates() (value MediaAreaCoordinates) { + if i == nil { + return + } + return i.Coordinates +} + +// GetChannel returns value of Channel field. +func (i *InputMediaAreaChannelPost) GetChannel() (value InputChannelClass) { + if i == nil { + return + } + return i.Channel +} + +// GetMsgID returns value of MsgID field. +func (i *InputMediaAreaChannelPost) GetMsgID() (value int) { + if i == nil { + return + } + return i.MsgID +} + // MediaAreaClassName is schema name of MediaAreaClass. const MediaAreaClassName = "MediaArea" @@ -988,6 +1369,8 @@ const MediaAreaClassName = "MediaArea" // case *tg.InputMediaAreaVenue: // inputMediaAreaVenue#b282217f // case *tg.MediaAreaGeoPoint: // mediaAreaGeoPoint#df8b3b22 // case *tg.MediaAreaSuggestedReaction: // mediaAreaSuggestedReaction#14455871 +// case *tg.MediaAreaChannelPost: // mediaAreaChannelPost#770416af +// case *tg.InputMediaAreaChannelPost: // inputMediaAreaChannelPost#2271f2bf // default: panic(v) // } type MediaAreaClass interface { @@ -1048,6 +1431,20 @@ func DecodeMediaArea(buf *bin.Buffer) (MediaAreaClass, error) { return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err) } return &v, nil + case MediaAreaChannelPostTypeID: + // Decoding mediaAreaChannelPost#770416af. + v := MediaAreaChannelPost{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err) + } + return &v, nil + case InputMediaAreaChannelPostTypeID: + // Decoding inputMediaAreaChannelPost#2271f2bf. + v := InputMediaAreaChannelPost{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_media_area_slices_gen.go b/tg/tl_media_area_slices_gen.go index 0a293e7715..082b0cbe3d 100644 --- a/tg/tl_media_area_slices_gen.go +++ b/tg/tl_media_area_slices_gen.go @@ -168,6 +168,32 @@ func (s MediaAreaClassArray) AsMediaAreaSuggestedReaction() (to MediaAreaSuggest return to } +// AsMediaAreaChannelPost returns copy with only MediaAreaChannelPost constructors. +func (s MediaAreaClassArray) AsMediaAreaChannelPost() (to MediaAreaChannelPostArray) { + for _, elem := range s { + value, ok := elem.(*MediaAreaChannelPost) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsInputMediaAreaChannelPost returns copy with only InputMediaAreaChannelPost constructors. +func (s MediaAreaClassArray) AsInputMediaAreaChannelPost() (to InputMediaAreaChannelPostArray) { + for _, elem := range s { + value, ok := elem.(*InputMediaAreaChannelPost) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // MediaAreaVenueArray is adapter for slice of MediaAreaVenue. type MediaAreaVenueArray []MediaAreaVenue @@ -495,3 +521,167 @@ func (s *MediaAreaSuggestedReactionArray) Pop() (v MediaAreaSuggestedReaction, o return v, true } + +// MediaAreaChannelPostArray is adapter for slice of MediaAreaChannelPost. +type MediaAreaChannelPostArray []MediaAreaChannelPost + +// Sort sorts slice of MediaAreaChannelPost. +func (s MediaAreaChannelPostArray) Sort(less func(a, b MediaAreaChannelPost) bool) MediaAreaChannelPostArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MediaAreaChannelPost. +func (s MediaAreaChannelPostArray) SortStable(less func(a, b MediaAreaChannelPost) bool) MediaAreaChannelPostArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MediaAreaChannelPost. +func (s MediaAreaChannelPostArray) Retain(keep func(x MediaAreaChannelPost) bool) MediaAreaChannelPostArray { + 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 MediaAreaChannelPostArray) First() (v MediaAreaChannelPost, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MediaAreaChannelPostArray) Last() (v MediaAreaChannelPost, 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 *MediaAreaChannelPostArray) PopFirst() (v MediaAreaChannelPost, 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 MediaAreaChannelPost + 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 *MediaAreaChannelPostArray) Pop() (v MediaAreaChannelPost, 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 +} + +// InputMediaAreaChannelPostArray is adapter for slice of InputMediaAreaChannelPost. +type InputMediaAreaChannelPostArray []InputMediaAreaChannelPost + +// Sort sorts slice of InputMediaAreaChannelPost. +func (s InputMediaAreaChannelPostArray) Sort(less func(a, b InputMediaAreaChannelPost) bool) InputMediaAreaChannelPostArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of InputMediaAreaChannelPost. +func (s InputMediaAreaChannelPostArray) SortStable(less func(a, b InputMediaAreaChannelPost) bool) InputMediaAreaChannelPostArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of InputMediaAreaChannelPost. +func (s InputMediaAreaChannelPostArray) Retain(keep func(x InputMediaAreaChannelPost) bool) InputMediaAreaChannelPostArray { + 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 InputMediaAreaChannelPostArray) First() (v InputMediaAreaChannelPost, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s InputMediaAreaChannelPostArray) Last() (v InputMediaAreaChannelPost, 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 *InputMediaAreaChannelPostArray) PopFirst() (v InputMediaAreaChannelPost, 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 InputMediaAreaChannelPost + 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 *InputMediaAreaChannelPostArray) Pop() (v InputMediaAreaChannelPost, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_message_action_gen.go b/tg/tl_message_action_gen.go index 7dd28127f1..29aa3ac695 100644 --- a/tg/tl_message_action_gen.go +++ b/tg/tl_message_action_gen.go @@ -6452,7 +6452,7 @@ func (m *MessageActionSuggestProfilePhoto) GetPhoto() (value PhotoClass) { return m.Photo } -// MessageActionRequestedPeer represents TL type `messageActionRequestedPeer#fe77345d`. +// MessageActionRequestedPeer represents TL type `messageActionRequestedPeer#31518e9b`. // Contains info about a peer that the user shared with the bot after clicking on a // keyboardButtonRequestPeer¹ button. // @@ -6466,12 +6466,12 @@ type MessageActionRequestedPeer struct { // Links: // 1) https://core.telegram.org/constructor/keyboardButtonRequestPeer ButtonID int - // The shared peer - Peer PeerClass + // Peers field of MessageActionRequestedPeer. + Peers []PeerClass } // MessageActionRequestedPeerTypeID is TL type id of MessageActionRequestedPeer. -const MessageActionRequestedPeerTypeID = 0xfe77345d +const MessageActionRequestedPeerTypeID = 0x31518e9b // construct implements constructor of MessageActionClass. func (m MessageActionRequestedPeer) construct() MessageActionClass { return &m } @@ -6493,7 +6493,7 @@ func (m *MessageActionRequestedPeer) Zero() bool { if !(m.ButtonID == 0) { return false } - if !(m.Peer == nil) { + if !(m.Peers == nil) { return false } @@ -6512,10 +6512,10 @@ func (m *MessageActionRequestedPeer) String() string { // FillFrom fills MessageActionRequestedPeer from given interface. func (m *MessageActionRequestedPeer) FillFrom(from interface { GetButtonID() (value int) - GetPeer() (value PeerClass) + GetPeers() (value []PeerClass) }) { m.ButtonID = from.GetButtonID() - m.Peer = from.GetPeer() + m.Peers = from.GetPeers() } // TypeID returns type id in TL schema. @@ -6546,8 +6546,8 @@ func (m *MessageActionRequestedPeer) TypeInfo() tdp.Type { SchemaName: "button_id", }, { - Name: "Peer", - SchemaName: "peer", + Name: "Peers", + SchemaName: "peers", }, } return typ @@ -6556,7 +6556,7 @@ func (m *MessageActionRequestedPeer) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageActionRequestedPeer) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionRequestedPeer#fe77345d as nil") + return fmt.Errorf("can't encode messageActionRequestedPeer#31518e9b as nil") } b.PutID(MessageActionRequestedPeerTypeID) return m.EncodeBare(b) @@ -6565,14 +6565,17 @@ func (m *MessageActionRequestedPeer) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionRequestedPeer) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionRequestedPeer#fe77345d as nil") + return fmt.Errorf("can't encode messageActionRequestedPeer#31518e9b as nil") } b.PutInt(m.ButtonID) - if m.Peer == nil { - return fmt.Errorf("unable to encode messageActionRequestedPeer#fe77345d: field peer is nil") - } - if err := m.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionRequestedPeer#fe77345d: field peer: %w", err) + b.PutVectorHeader(len(m.Peers)) + for idx, v := range m.Peers { + if v == nil { + return fmt.Errorf("unable to encode messageActionRequestedPeer#31518e9b: field peers element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionRequestedPeer#31518e9b: field peers element with index %d: %w", idx, err) + } } return nil } @@ -6580,10 +6583,10 @@ func (m *MessageActionRequestedPeer) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageActionRequestedPeer) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionRequestedPeer#fe77345d to nil") + return fmt.Errorf("can't decode messageActionRequestedPeer#31518e9b to nil") } if err := b.ConsumeID(MessageActionRequestedPeerTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionRequestedPeer#fe77345d: %w", err) + return fmt.Errorf("unable to decode messageActionRequestedPeer#31518e9b: %w", err) } return m.DecodeBare(b) } @@ -6591,21 +6594,31 @@ func (m *MessageActionRequestedPeer) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionRequestedPeer) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionRequestedPeer#fe77345d to nil") + return fmt.Errorf("can't decode messageActionRequestedPeer#31518e9b to nil") } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionRequestedPeer#fe77345d: field button_id: %w", err) + return fmt.Errorf("unable to decode messageActionRequestedPeer#31518e9b: field button_id: %w", err) } m.ButtonID = value } { - value, err := DecodePeer(b) + headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messageActionRequestedPeer#fe77345d: field peer: %w", err) + return fmt.Errorf("unable to decode messageActionRequestedPeer#31518e9b: field peers: %w", err) + } + + if headerLen > 0 { + m.Peers = make([]PeerClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode messageActionRequestedPeer#31518e9b: field peers: %w", err) + } + m.Peers = append(m.Peers, value) } - m.Peer = value } return nil } @@ -6618,12 +6631,17 @@ func (m *MessageActionRequestedPeer) GetButtonID() (value int) { return m.ButtonID } -// GetPeer returns value of Peer field. -func (m *MessageActionRequestedPeer) GetPeer() (value PeerClass) { +// GetPeers returns value of Peers field. +func (m *MessageActionRequestedPeer) GetPeers() (value []PeerClass) { if m == nil { return } - return m.Peer + return m.Peers +} + +// MapPeers returns field Peers wrapped in PeerClassArray helper. +func (m *MessageActionRequestedPeer) MapPeers() (value PeerClassArray) { + return PeerClassArray(m.Peers) } // MessageActionSetChatWallPaper represents TL type `messageActionSetChatWallPaper#5060a3f4`. @@ -6863,7 +6881,7 @@ func (m *MessageActionSetChatWallPaper) GetWallpaper() (value WallPaperClass) { return m.Wallpaper } -// MessageActionGiftCode represents TL type `messageActionGiftCode#d2cfdb0e`. +// MessageActionGiftCode represents TL type `messageActionGiftCode#678c2e09`. // // See https://core.telegram.org/constructor/messageActionGiftCode for reference. type MessageActionGiftCode struct { @@ -6884,10 +6902,26 @@ type MessageActionGiftCode struct { Months int // Slug field of MessageActionGiftCode. Slug string + // Currency field of MessageActionGiftCode. + // + // Use SetCurrency and GetCurrency helpers. + Currency string + // Amount field of MessageActionGiftCode. + // + // Use SetAmount and GetAmount helpers. + Amount int64 + // CryptoCurrency field of MessageActionGiftCode. + // + // Use SetCryptoCurrency and GetCryptoCurrency helpers. + CryptoCurrency string + // CryptoAmount field of MessageActionGiftCode. + // + // Use SetCryptoAmount and GetCryptoAmount helpers. + CryptoAmount int64 } // MessageActionGiftCodeTypeID is TL type id of MessageActionGiftCode. -const MessageActionGiftCodeTypeID = 0xd2cfdb0e +const MessageActionGiftCodeTypeID = 0x678c2e09 // construct implements constructor of MessageActionClass. func (m MessageActionGiftCode) construct() MessageActionClass { return &m } @@ -6924,6 +6958,18 @@ func (m *MessageActionGiftCode) Zero() bool { if !(m.Slug == "") { return false } + if !(m.Currency == "") { + return false + } + if !(m.Amount == 0) { + return false + } + if !(m.CryptoCurrency == "") { + return false + } + if !(m.CryptoAmount == 0) { + return false + } return true } @@ -6944,6 +6990,10 @@ func (m *MessageActionGiftCode) FillFrom(from interface { GetBoostPeer() (value PeerClass, ok bool) GetMonths() (value int) GetSlug() (value string) + GetCurrency() (value string, ok bool) + GetAmount() (value int64, ok bool) + GetCryptoCurrency() (value string, ok bool) + GetCryptoAmount() (value int64, ok bool) }) { m.ViaGiveaway = from.GetViaGiveaway() m.Unclaimed = from.GetUnclaimed() @@ -6953,6 +7003,22 @@ func (m *MessageActionGiftCode) FillFrom(from interface { m.Months = from.GetMonths() m.Slug = from.GetSlug() + if val, ok := from.GetCurrency(); ok { + m.Currency = val + } + + if val, ok := from.GetAmount(); ok { + m.Amount = val + } + + if val, ok := from.GetCryptoCurrency(); ok { + m.CryptoCurrency = val + } + + if val, ok := from.GetCryptoAmount(); ok { + m.CryptoAmount = val + } + } // TypeID returns type id in TL schema. @@ -7001,6 +7067,26 @@ func (m *MessageActionGiftCode) TypeInfo() tdp.Type { Name: "Slug", SchemaName: "slug", }, + { + Name: "Currency", + SchemaName: "currency", + Null: !m.Flags.Has(2), + }, + { + Name: "Amount", + SchemaName: "amount", + Null: !m.Flags.Has(2), + }, + { + Name: "CryptoCurrency", + SchemaName: "crypto_currency", + Null: !m.Flags.Has(3), + }, + { + Name: "CryptoAmount", + SchemaName: "crypto_amount", + Null: !m.Flags.Has(3), + }, } return typ } @@ -7016,12 +7102,24 @@ func (m *MessageActionGiftCode) SetFlags() { if !(m.BoostPeer == nil) { m.Flags.Set(1) } + if !(m.Currency == "") { + m.Flags.Set(2) + } + if !(m.Amount == 0) { + m.Flags.Set(2) + } + if !(m.CryptoCurrency == "") { + m.Flags.Set(3) + } + if !(m.CryptoAmount == 0) { + m.Flags.Set(3) + } } // Encode implements bin.Encoder. func (m *MessageActionGiftCode) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftCode#d2cfdb0e as nil") + return fmt.Errorf("can't encode messageActionGiftCode#678c2e09 as nil") } b.PutID(MessageActionGiftCodeTypeID) return m.EncodeBare(b) @@ -7030,32 +7128,44 @@ func (m *MessageActionGiftCode) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionGiftCode) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftCode#d2cfdb0e as nil") + return fmt.Errorf("can't encode messageActionGiftCode#678c2e09 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionGiftCode#d2cfdb0e: field flags: %w", err) + return fmt.Errorf("unable to encode messageActionGiftCode#678c2e09: field flags: %w", err) } if m.Flags.Has(1) { if m.BoostPeer == nil { - return fmt.Errorf("unable to encode messageActionGiftCode#d2cfdb0e: field boost_peer is nil") + return fmt.Errorf("unable to encode messageActionGiftCode#678c2e09: field boost_peer is nil") } if err := m.BoostPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionGiftCode#d2cfdb0e: field boost_peer: %w", err) + return fmt.Errorf("unable to encode messageActionGiftCode#678c2e09: field boost_peer: %w", err) } } b.PutInt(m.Months) b.PutString(m.Slug) + if m.Flags.Has(2) { + b.PutString(m.Currency) + } + if m.Flags.Has(2) { + b.PutLong(m.Amount) + } + if m.Flags.Has(3) { + b.PutString(m.CryptoCurrency) + } + if m.Flags.Has(3) { + b.PutLong(m.CryptoAmount) + } return nil } // Decode implements bin.Decoder. func (m *MessageActionGiftCode) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftCode#d2cfdb0e to nil") + return fmt.Errorf("can't decode messageActionGiftCode#678c2e09 to nil") } if err := b.ConsumeID(MessageActionGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#d2cfdb0e: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: %w", err) } return m.DecodeBare(b) } @@ -7063,11 +7173,11 @@ func (m *MessageActionGiftCode) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionGiftCode) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftCode#d2cfdb0e to nil") + return fmt.Errorf("can't decode messageActionGiftCode#678c2e09 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#d2cfdb0e: field flags: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field flags: %w", err) } } m.ViaGiveaway = m.Flags.Has(0) @@ -7075,24 +7185,52 @@ func (m *MessageActionGiftCode) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(1) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#d2cfdb0e: field boost_peer: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field boost_peer: %w", err) } m.BoostPeer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#d2cfdb0e: field months: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field months: %w", err) } m.Months = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#d2cfdb0e: field slug: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field slug: %w", err) } m.Slug = value } + if m.Flags.Has(2) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field currency: %w", err) + } + m.Currency = value + } + if m.Flags.Has(2) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field amount: %w", err) + } + m.Amount = value + } + if m.Flags.Has(3) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field crypto_currency: %w", err) + } + m.CryptoCurrency = value + } + if m.Flags.Has(3) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field crypto_amount: %w", err) + } + m.CryptoAmount = value + } return nil } @@ -7168,6 +7306,78 @@ func (m *MessageActionGiftCode) GetSlug() (value string) { return m.Slug } +// SetCurrency sets value of Currency conditional field. +func (m *MessageActionGiftCode) SetCurrency(value string) { + m.Flags.Set(2) + m.Currency = value +} + +// GetCurrency returns value of Currency conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftCode) GetCurrency() (value string, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(2) { + return value, false + } + return m.Currency, true +} + +// SetAmount sets value of Amount conditional field. +func (m *MessageActionGiftCode) SetAmount(value int64) { + m.Flags.Set(2) + m.Amount = value +} + +// GetAmount returns value of Amount conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftCode) GetAmount() (value int64, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(2) { + return value, false + } + return m.Amount, true +} + +// SetCryptoCurrency sets value of CryptoCurrency conditional field. +func (m *MessageActionGiftCode) SetCryptoCurrency(value string) { + m.Flags.Set(3) + m.CryptoCurrency = value +} + +// GetCryptoCurrency returns value of CryptoCurrency conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftCode) GetCryptoCurrency() (value string, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(3) { + return value, false + } + return m.CryptoCurrency, true +} + +// SetCryptoAmount sets value of CryptoAmount conditional field. +func (m *MessageActionGiftCode) SetCryptoAmount(value int64) { + m.Flags.Set(3) + m.CryptoAmount = value +} + +// GetCryptoAmount returns value of CryptoAmount conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftCode) GetCryptoAmount() (value int64, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(3) { + return value, false + } + return m.CryptoAmount, true +} + // MessageActionGiveawayLaunch represents TL type `messageActionGiveawayLaunch#332ba9ed`. // // See https://core.telegram.org/constructor/messageActionGiveawayLaunch for reference. @@ -7480,9 +7690,9 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionTopicCreate: // messageActionTopicCreate#d999256 // case *tg.MessageActionTopicEdit: // messageActionTopicEdit#c0944820 // case *tg.MessageActionSuggestProfilePhoto: // messageActionSuggestProfilePhoto#57de635e -// case *tg.MessageActionRequestedPeer: // messageActionRequestedPeer#fe77345d +// case *tg.MessageActionRequestedPeer: // messageActionRequestedPeer#31518e9b // case *tg.MessageActionSetChatWallPaper: // messageActionSetChatWallPaper#5060a3f4 -// case *tg.MessageActionGiftCode: // messageActionGiftCode#d2cfdb0e +// case *tg.MessageActionGiftCode: // messageActionGiftCode#678c2e09 // case *tg.MessageActionGiveawayLaunch: // messageActionGiveawayLaunch#332ba9ed // case *tg.MessageActionGiveawayResults: // messageActionGiveawayResults#2a9fadc5 // default: panic(v) @@ -7766,7 +7976,7 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionRequestedPeerTypeID: - // Decoding messageActionRequestedPeer#fe77345d. + // Decoding messageActionRequestedPeer#31518e9b. v := MessageActionRequestedPeer{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) @@ -7780,7 +7990,7 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionGiftCodeTypeID: - // Decoding messageActionGiftCode#d2cfdb0e. + // Decoding messageActionGiftCode#678c2e09. v := MessageActionGiftCode{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) diff --git a/tg/tl_message_media_gen.go b/tg/tl_message_media_gen.go index e172c969d5..2638cd9c9a 100644 --- a/tg/tl_message_media_gen.go +++ b/tg/tl_message_media_gen.go @@ -3364,7 +3364,7 @@ func (m *MessageMediaStory) GetStory() (value StoryItemClass, ok bool) { return m.Story, true } -// MessageMediaGiveaway represents TL type `messageMediaGiveaway#58260664`. +// MessageMediaGiveaway represents TL type `messageMediaGiveaway#daad85b0`. // // See https://core.telegram.org/constructor/messageMediaGiveaway for reference. type MessageMediaGiveaway struct { @@ -3375,12 +3375,18 @@ type MessageMediaGiveaway struct { Flags bin.Fields // OnlyNewSubscribers field of MessageMediaGiveaway. OnlyNewSubscribers bool + // WinnersAreVisible field of MessageMediaGiveaway. + WinnersAreVisible bool // Channels field of MessageMediaGiveaway. Channels []int64 // CountriesISO2 field of MessageMediaGiveaway. // // Use SetCountriesISO2 and GetCountriesISO2 helpers. CountriesISO2 []string + // PrizeDescription field of MessageMediaGiveaway. + // + // Use SetPrizeDescription and GetPrizeDescription helpers. + PrizeDescription string // Quantity field of MessageMediaGiveaway. Quantity int // Months field of MessageMediaGiveaway. @@ -3390,7 +3396,7 @@ type MessageMediaGiveaway struct { } // MessageMediaGiveawayTypeID is TL type id of MessageMediaGiveaway. -const MessageMediaGiveawayTypeID = 0x58260664 +const MessageMediaGiveawayTypeID = 0xdaad85b0 // construct implements constructor of MessageMediaClass. func (m MessageMediaGiveaway) construct() MessageMediaClass { return &m } @@ -3415,12 +3421,18 @@ func (m *MessageMediaGiveaway) Zero() bool { if !(m.OnlyNewSubscribers == false) { return false } + if !(m.WinnersAreVisible == false) { + return false + } if !(m.Channels == nil) { return false } if !(m.CountriesISO2 == nil) { return false } + if !(m.PrizeDescription == "") { + return false + } if !(m.Quantity == 0) { return false } @@ -3446,18 +3458,25 @@ func (m *MessageMediaGiveaway) String() string { // FillFrom fills MessageMediaGiveaway from given interface. func (m *MessageMediaGiveaway) FillFrom(from interface { GetOnlyNewSubscribers() (value bool) + GetWinnersAreVisible() (value bool) GetChannels() (value []int64) GetCountriesISO2() (value []string, ok bool) + GetPrizeDescription() (value string, ok bool) GetQuantity() (value int) GetMonths() (value int) GetUntilDate() (value int) }) { m.OnlyNewSubscribers = from.GetOnlyNewSubscribers() + m.WinnersAreVisible = from.GetWinnersAreVisible() m.Channels = from.GetChannels() if val, ok := from.GetCountriesISO2(); ok { m.CountriesISO2 = val } + if val, ok := from.GetPrizeDescription(); ok { + m.PrizeDescription = val + } + m.Quantity = from.GetQuantity() m.Months = from.GetMonths() m.UntilDate = from.GetUntilDate() @@ -3491,6 +3510,11 @@ func (m *MessageMediaGiveaway) TypeInfo() tdp.Type { SchemaName: "only_new_subscribers", Null: !m.Flags.Has(0), }, + { + Name: "WinnersAreVisible", + SchemaName: "winners_are_visible", + Null: !m.Flags.Has(2), + }, { Name: "Channels", SchemaName: "channels", @@ -3500,6 +3524,11 @@ func (m *MessageMediaGiveaway) TypeInfo() tdp.Type { SchemaName: "countries_iso2", Null: !m.Flags.Has(1), }, + { + Name: "PrizeDescription", + SchemaName: "prize_description", + Null: !m.Flags.Has(3), + }, { Name: "Quantity", SchemaName: "quantity", @@ -3521,15 +3550,21 @@ func (m *MessageMediaGiveaway) SetFlags() { if !(m.OnlyNewSubscribers == false) { m.Flags.Set(0) } + if !(m.WinnersAreVisible == false) { + m.Flags.Set(2) + } if !(m.CountriesISO2 == nil) { m.Flags.Set(1) } + if !(m.PrizeDescription == "") { + m.Flags.Set(3) + } } // Encode implements bin.Encoder. func (m *MessageMediaGiveaway) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageMediaGiveaway#58260664 as nil") + return fmt.Errorf("can't encode messageMediaGiveaway#daad85b0 as nil") } b.PutID(MessageMediaGiveawayTypeID) return m.EncodeBare(b) @@ -3538,11 +3573,11 @@ func (m *MessageMediaGiveaway) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageMediaGiveaway) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageMediaGiveaway#58260664 as nil") + return fmt.Errorf("can't encode messageMediaGiveaway#daad85b0 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageMediaGiveaway#58260664: field flags: %w", err) + return fmt.Errorf("unable to encode messageMediaGiveaway#daad85b0: field flags: %w", err) } b.PutVectorHeader(len(m.Channels)) for _, v := range m.Channels { @@ -3554,6 +3589,9 @@ func (m *MessageMediaGiveaway) EncodeBare(b *bin.Buffer) error { b.PutString(v) } } + if m.Flags.Has(3) { + b.PutString(m.PrizeDescription) + } b.PutInt(m.Quantity) b.PutInt(m.Months) b.PutInt(m.UntilDate) @@ -3563,10 +3601,10 @@ func (m *MessageMediaGiveaway) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageMediaGiveaway) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageMediaGiveaway#58260664 to nil") + return fmt.Errorf("can't decode messageMediaGiveaway#daad85b0 to nil") } if err := b.ConsumeID(MessageMediaGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#58260664: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: %w", err) } return m.DecodeBare(b) } @@ -3574,18 +3612,19 @@ func (m *MessageMediaGiveaway) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageMediaGiveaway#58260664 to nil") + return fmt.Errorf("can't decode messageMediaGiveaway#daad85b0 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#58260664: field flags: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field flags: %w", err) } } m.OnlyNewSubscribers = m.Flags.Has(0) + m.WinnersAreVisible = m.Flags.Has(2) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#58260664: field channels: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field channels: %w", err) } if headerLen > 0 { @@ -3594,7 +3633,7 @@ func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#58260664: field channels: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field channels: %w", err) } m.Channels = append(m.Channels, value) } @@ -3602,7 +3641,7 @@ func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(1) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#58260664: field countries_iso2: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field countries_iso2: %w", err) } if headerLen > 0 { @@ -3611,29 +3650,36 @@ func (m *MessageMediaGiveaway) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#58260664: field countries_iso2: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field countries_iso2: %w", err) } m.CountriesISO2 = append(m.CountriesISO2, value) } } + if m.Flags.Has(3) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field prize_description: %w", err) + } + m.PrizeDescription = value + } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#58260664: field quantity: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field quantity: %w", err) } m.Quantity = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#58260664: field months: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field months: %w", err) } m.Months = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageMediaGiveaway#58260664: field until_date: %w", err) + return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field until_date: %w", err) } m.UntilDate = value } @@ -3659,6 +3705,25 @@ func (m *MessageMediaGiveaway) GetOnlyNewSubscribers() (value bool) { return m.Flags.Has(0) } +// SetWinnersAreVisible sets value of WinnersAreVisible conditional field. +func (m *MessageMediaGiveaway) SetWinnersAreVisible(value bool) { + if value { + m.Flags.Set(2) + m.WinnersAreVisible = true + } else { + m.Flags.Unset(2) + m.WinnersAreVisible = false + } +} + +// GetWinnersAreVisible returns value of WinnersAreVisible conditional field. +func (m *MessageMediaGiveaway) GetWinnersAreVisible() (value bool) { + if m == nil { + return + } + return m.Flags.Has(2) +} + // GetChannels returns value of Channels field. func (m *MessageMediaGiveaway) GetChannels() (value []int64) { if m == nil { @@ -3685,6 +3750,24 @@ func (m *MessageMediaGiveaway) GetCountriesISO2() (value []string, ok bool) { return m.CountriesISO2, true } +// SetPrizeDescription sets value of PrizeDescription conditional field. +func (m *MessageMediaGiveaway) SetPrizeDescription(value string) { + m.Flags.Set(3) + m.PrizeDescription = value +} + +// GetPrizeDescription returns value of PrizeDescription conditional field and +// boolean which is true if field was set. +func (m *MessageMediaGiveaway) GetPrizeDescription() (value string, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(3) { + return value, false + } + return m.PrizeDescription, true +} + // GetQuantity returns value of Quantity field. func (m *MessageMediaGiveaway) GetQuantity() (value int) { if m == nil { @@ -3709,6 +3792,499 @@ func (m *MessageMediaGiveaway) GetUntilDate() (value int) { return m.UntilDate } +// MessageMediaGiveawayResults represents TL type `messageMediaGiveawayResults#c6991068`. +// +// See https://core.telegram.org/constructor/messageMediaGiveawayResults for reference. +type MessageMediaGiveawayResults struct { + // Flags field of MessageMediaGiveawayResults. + Flags bin.Fields + // OnlyNewSubscribers field of MessageMediaGiveawayResults. + OnlyNewSubscribers bool + // Refunded field of MessageMediaGiveawayResults. + Refunded bool + // ChannelID field of MessageMediaGiveawayResults. + ChannelID int64 + // AdditionalPeersCount field of MessageMediaGiveawayResults. + // + // Use SetAdditionalPeersCount and GetAdditionalPeersCount helpers. + AdditionalPeersCount int + // LaunchMsgID field of MessageMediaGiveawayResults. + LaunchMsgID int + // WinnersCount field of MessageMediaGiveawayResults. + WinnersCount int + // UnclaimedCount field of MessageMediaGiveawayResults. + UnclaimedCount int + // Winners field of MessageMediaGiveawayResults. + Winners []int64 + // Months field of MessageMediaGiveawayResults. + Months int + // PrizeDescription field of MessageMediaGiveawayResults. + // + // Use SetPrizeDescription and GetPrizeDescription helpers. + PrizeDescription string + // UntilDate field of MessageMediaGiveawayResults. + UntilDate int +} + +// MessageMediaGiveawayResultsTypeID is TL type id of MessageMediaGiveawayResults. +const MessageMediaGiveawayResultsTypeID = 0xc6991068 + +// construct implements constructor of MessageMediaClass. +func (m MessageMediaGiveawayResults) construct() MessageMediaClass { return &m } + +// Ensuring interfaces in compile-time for MessageMediaGiveawayResults. +var ( + _ bin.Encoder = &MessageMediaGiveawayResults{} + _ bin.Decoder = &MessageMediaGiveawayResults{} + _ bin.BareEncoder = &MessageMediaGiveawayResults{} + _ bin.BareDecoder = &MessageMediaGiveawayResults{} + + _ MessageMediaClass = &MessageMediaGiveawayResults{} +) + +func (m *MessageMediaGiveawayResults) Zero() bool { + if m == nil { + return true + } + if !(m.Flags.Zero()) { + return false + } + if !(m.OnlyNewSubscribers == false) { + return false + } + if !(m.Refunded == false) { + return false + } + if !(m.ChannelID == 0) { + return false + } + if !(m.AdditionalPeersCount == 0) { + return false + } + if !(m.LaunchMsgID == 0) { + return false + } + if !(m.WinnersCount == 0) { + return false + } + if !(m.UnclaimedCount == 0) { + return false + } + if !(m.Winners == nil) { + return false + } + if !(m.Months == 0) { + return false + } + if !(m.PrizeDescription == "") { + return false + } + if !(m.UntilDate == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageMediaGiveawayResults) String() string { + if m == nil { + return "MessageMediaGiveawayResults(nil)" + } + type Alias MessageMediaGiveawayResults + return fmt.Sprintf("MessageMediaGiveawayResults%+v", Alias(*m)) +} + +// FillFrom fills MessageMediaGiveawayResults from given interface. +func (m *MessageMediaGiveawayResults) FillFrom(from interface { + GetOnlyNewSubscribers() (value bool) + GetRefunded() (value bool) + GetChannelID() (value int64) + GetAdditionalPeersCount() (value int, ok bool) + GetLaunchMsgID() (value int) + GetWinnersCount() (value int) + GetUnclaimedCount() (value int) + GetWinners() (value []int64) + GetMonths() (value int) + GetPrizeDescription() (value string, ok bool) + GetUntilDate() (value int) +}) { + m.OnlyNewSubscribers = from.GetOnlyNewSubscribers() + m.Refunded = from.GetRefunded() + m.ChannelID = from.GetChannelID() + if val, ok := from.GetAdditionalPeersCount(); ok { + m.AdditionalPeersCount = val + } + + m.LaunchMsgID = from.GetLaunchMsgID() + m.WinnersCount = from.GetWinnersCount() + m.UnclaimedCount = from.GetUnclaimedCount() + m.Winners = from.GetWinners() + m.Months = from.GetMonths() + if val, ok := from.GetPrizeDescription(); ok { + m.PrizeDescription = val + } + + m.UntilDate = from.GetUntilDate() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageMediaGiveawayResults) TypeID() uint32 { + return MessageMediaGiveawayResultsTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageMediaGiveawayResults) TypeName() string { + return "messageMediaGiveawayResults" +} + +// TypeInfo returns info about TL type. +func (m *MessageMediaGiveawayResults) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageMediaGiveawayResults", + ID: MessageMediaGiveawayResultsTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "OnlyNewSubscribers", + SchemaName: "only_new_subscribers", + Null: !m.Flags.Has(0), + }, + { + Name: "Refunded", + SchemaName: "refunded", + Null: !m.Flags.Has(2), + }, + { + Name: "ChannelID", + SchemaName: "channel_id", + }, + { + Name: "AdditionalPeersCount", + SchemaName: "additional_peers_count", + Null: !m.Flags.Has(3), + }, + { + Name: "LaunchMsgID", + SchemaName: "launch_msg_id", + }, + { + Name: "WinnersCount", + SchemaName: "winners_count", + }, + { + Name: "UnclaimedCount", + SchemaName: "unclaimed_count", + }, + { + Name: "Winners", + SchemaName: "winners", + }, + { + Name: "Months", + SchemaName: "months", + }, + { + Name: "PrizeDescription", + SchemaName: "prize_description", + Null: !m.Flags.Has(1), + }, + { + Name: "UntilDate", + SchemaName: "until_date", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (m *MessageMediaGiveawayResults) SetFlags() { + if !(m.OnlyNewSubscribers == false) { + m.Flags.Set(0) + } + if !(m.Refunded == false) { + m.Flags.Set(2) + } + if !(m.AdditionalPeersCount == 0) { + m.Flags.Set(3) + } + if !(m.PrizeDescription == "") { + m.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (m *MessageMediaGiveawayResults) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageMediaGiveawayResults#c6991068 as nil") + } + b.PutID(MessageMediaGiveawayResultsTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageMediaGiveawayResults) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageMediaGiveawayResults#c6991068 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageMediaGiveawayResults#c6991068: field flags: %w", err) + } + b.PutLong(m.ChannelID) + if m.Flags.Has(3) { + b.PutInt(m.AdditionalPeersCount) + } + b.PutInt(m.LaunchMsgID) + b.PutInt(m.WinnersCount) + b.PutInt(m.UnclaimedCount) + b.PutVectorHeader(len(m.Winners)) + for _, v := range m.Winners { + b.PutLong(v) + } + b.PutInt(m.Months) + if m.Flags.Has(1) { + b.PutString(m.PrizeDescription) + } + b.PutInt(m.UntilDate) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageMediaGiveawayResults) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageMediaGiveawayResults#c6991068 to nil") + } + if err := b.ConsumeID(MessageMediaGiveawayResultsTypeID); err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageMediaGiveawayResults) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageMediaGiveawayResults#c6991068 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field flags: %w", err) + } + } + m.OnlyNewSubscribers = m.Flags.Has(0) + m.Refunded = m.Flags.Has(2) + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field channel_id: %w", err) + } + m.ChannelID = value + } + if m.Flags.Has(3) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field additional_peers_count: %w", err) + } + m.AdditionalPeersCount = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field launch_msg_id: %w", err) + } + m.LaunchMsgID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field winners_count: %w", err) + } + m.WinnersCount = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field unclaimed_count: %w", err) + } + m.UnclaimedCount = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field winners: %w", err) + } + + if headerLen > 0 { + m.Winners = make([]int64, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field winners: %w", err) + } + m.Winners = append(m.Winners, value) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field months: %w", err) + } + m.Months = value + } + if m.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field prize_description: %w", err) + } + m.PrizeDescription = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field until_date: %w", err) + } + m.UntilDate = value + } + return nil +} + +// SetOnlyNewSubscribers sets value of OnlyNewSubscribers conditional field. +func (m *MessageMediaGiveawayResults) SetOnlyNewSubscribers(value bool) { + if value { + m.Flags.Set(0) + m.OnlyNewSubscribers = true + } else { + m.Flags.Unset(0) + m.OnlyNewSubscribers = false + } +} + +// GetOnlyNewSubscribers returns value of OnlyNewSubscribers conditional field. +func (m *MessageMediaGiveawayResults) GetOnlyNewSubscribers() (value bool) { + if m == nil { + return + } + return m.Flags.Has(0) +} + +// SetRefunded sets value of Refunded conditional field. +func (m *MessageMediaGiveawayResults) SetRefunded(value bool) { + if value { + m.Flags.Set(2) + m.Refunded = true + } else { + m.Flags.Unset(2) + m.Refunded = false + } +} + +// GetRefunded returns value of Refunded conditional field. +func (m *MessageMediaGiveawayResults) GetRefunded() (value bool) { + if m == nil { + return + } + return m.Flags.Has(2) +} + +// GetChannelID returns value of ChannelID field. +func (m *MessageMediaGiveawayResults) GetChannelID() (value int64) { + if m == nil { + return + } + return m.ChannelID +} + +// SetAdditionalPeersCount sets value of AdditionalPeersCount conditional field. +func (m *MessageMediaGiveawayResults) SetAdditionalPeersCount(value int) { + m.Flags.Set(3) + m.AdditionalPeersCount = value +} + +// GetAdditionalPeersCount returns value of AdditionalPeersCount conditional field and +// boolean which is true if field was set. +func (m *MessageMediaGiveawayResults) GetAdditionalPeersCount() (value int, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(3) { + return value, false + } + return m.AdditionalPeersCount, true +} + +// GetLaunchMsgID returns value of LaunchMsgID field. +func (m *MessageMediaGiveawayResults) GetLaunchMsgID() (value int) { + if m == nil { + return + } + return m.LaunchMsgID +} + +// GetWinnersCount returns value of WinnersCount field. +func (m *MessageMediaGiveawayResults) GetWinnersCount() (value int) { + if m == nil { + return + } + return m.WinnersCount +} + +// GetUnclaimedCount returns value of UnclaimedCount field. +func (m *MessageMediaGiveawayResults) GetUnclaimedCount() (value int) { + if m == nil { + return + } + return m.UnclaimedCount +} + +// GetWinners returns value of Winners field. +func (m *MessageMediaGiveawayResults) GetWinners() (value []int64) { + if m == nil { + return + } + return m.Winners +} + +// GetMonths returns value of Months field. +func (m *MessageMediaGiveawayResults) GetMonths() (value int) { + if m == nil { + return + } + return m.Months +} + +// SetPrizeDescription sets value of PrizeDescription conditional field. +func (m *MessageMediaGiveawayResults) SetPrizeDescription(value string) { + m.Flags.Set(1) + m.PrizeDescription = value +} + +// GetPrizeDescription returns value of PrizeDescription conditional field and +// boolean which is true if field was set. +func (m *MessageMediaGiveawayResults) GetPrizeDescription() (value string, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(1) { + return value, false + } + return m.PrizeDescription, true +} + +// GetUntilDate returns value of UntilDate field. +func (m *MessageMediaGiveawayResults) GetUntilDate() (value int) { + if m == nil { + return + } + return m.UntilDate +} + // MessageMediaClassName is schema name of MessageMediaClass. const MessageMediaClassName = "MessageMedia" @@ -3737,7 +4313,8 @@ const MessageMediaClassName = "MessageMedia" // case *tg.MessageMediaPoll: // messageMediaPoll#4bd6e798 // case *tg.MessageMediaDice: // messageMediaDice#3f7ee58b // case *tg.MessageMediaStory: // messageMediaStory#68cb6283 -// case *tg.MessageMediaGiveaway: // messageMediaGiveaway#58260664 +// case *tg.MessageMediaGiveaway: // messageMediaGiveaway#daad85b0 +// case *tg.MessageMediaGiveawayResults: // messageMediaGiveawayResults#c6991068 // default: panic(v) // } type MessageMediaClass interface { @@ -3865,12 +4442,19 @@ func DecodeMessageMedia(buf *bin.Buffer) (MessageMediaClass, error) { } return &v, nil case MessageMediaGiveawayTypeID: - // Decoding messageMediaGiveaway#58260664. + // Decoding messageMediaGiveaway#daad85b0. v := MessageMediaGiveaway{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", err) } return &v, nil + case MessageMediaGiveawayResultsTypeID: + // Decoding messageMediaGiveawayResults#c6991068. + v := MessageMediaGiveawayResults{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_message_media_slices_gen.go b/tg/tl_message_media_slices_gen.go index 6f03b5f03b..04f8ec7f93 100644 --- a/tg/tl_message_media_slices_gen.go +++ b/tg/tl_message_media_slices_gen.go @@ -285,6 +285,19 @@ func (s MessageMediaClassArray) AsMessageMediaGiveaway() (to MessageMediaGiveawa return to } +// AsMessageMediaGiveawayResults returns copy with only MessageMediaGiveawayResults constructors. +func (s MessageMediaClassArray) AsMessageMediaGiveawayResults() (to MessageMediaGiveawayResultsArray) { + for _, elem := range s { + value, ok := elem.(*MessageMediaGiveawayResults) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // MessageMediaPhotoArray is adapter for slice of MessageMediaPhoto. type MessageMediaPhotoArray []MessageMediaPhoto @@ -1378,3 +1391,85 @@ func (s *MessageMediaGiveawayArray) Pop() (v MessageMediaGiveaway, ok bool) { return v, true } + +// MessageMediaGiveawayResultsArray is adapter for slice of MessageMediaGiveawayResults. +type MessageMediaGiveawayResultsArray []MessageMediaGiveawayResults + +// Sort sorts slice of MessageMediaGiveawayResults. +func (s MessageMediaGiveawayResultsArray) Sort(less func(a, b MessageMediaGiveawayResults) bool) MessageMediaGiveawayResultsArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageMediaGiveawayResults. +func (s MessageMediaGiveawayResultsArray) SortStable(less func(a, b MessageMediaGiveawayResults) bool) MessageMediaGiveawayResultsArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageMediaGiveawayResults. +func (s MessageMediaGiveawayResultsArray) Retain(keep func(x MessageMediaGiveawayResults) bool) MessageMediaGiveawayResultsArray { + 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 MessageMediaGiveawayResultsArray) First() (v MessageMediaGiveawayResults, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageMediaGiveawayResultsArray) Last() (v MessageMediaGiveawayResults, 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 *MessageMediaGiveawayResultsArray) PopFirst() (v MessageMediaGiveawayResults, 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 MessageMediaGiveawayResults + 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 *MessageMediaGiveawayResultsArray) Pop() (v MessageMediaGiveawayResults, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_messages_send_bot_requested_peer_gen.go b/tg/tl_messages_send_bot_requested_peer_gen.go index cb2d07d0da..ca43a475b6 100644 --- a/tg/tl_messages_send_bot_requested_peer_gen.go +++ b/tg/tl_messages_send_bot_requested_peer_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesSendBotRequestedPeerRequest represents TL type `messages.sendBotRequestedPeer#fe38d01b`. +// MessagesSendBotRequestedPeerRequest represents TL type `messages.sendBotRequestedPeer#91b2d060`. // Send a chosen peer, as requested by a keyboardButtonRequestPeer¹ button. // // Links: @@ -55,12 +55,12 @@ type MessagesSendBotRequestedPeerRequest struct { // Links: // 1) https://core.telegram.org/constructor/keyboardButtonRequestPeer ButtonID int - // The chosen peer. - RequestedPeer InputPeerClass + // RequestedPeers field of MessagesSendBotRequestedPeerRequest. + RequestedPeers []InputPeerClass } // MessagesSendBotRequestedPeerRequestTypeID is TL type id of MessagesSendBotRequestedPeerRequest. -const MessagesSendBotRequestedPeerRequestTypeID = 0xfe38d01b +const MessagesSendBotRequestedPeerRequestTypeID = 0x91b2d060 // Ensuring interfaces in compile-time for MessagesSendBotRequestedPeerRequest. var ( @@ -83,7 +83,7 @@ func (s *MessagesSendBotRequestedPeerRequest) Zero() bool { if !(s.ButtonID == 0) { return false } - if !(s.RequestedPeer == nil) { + if !(s.RequestedPeers == nil) { return false } @@ -104,12 +104,12 @@ func (s *MessagesSendBotRequestedPeerRequest) FillFrom(from interface { GetPeer() (value InputPeerClass) GetMsgID() (value int) GetButtonID() (value int) - GetRequestedPeer() (value InputPeerClass) + GetRequestedPeers() (value []InputPeerClass) }) { s.Peer = from.GetPeer() s.MsgID = from.GetMsgID() s.ButtonID = from.GetButtonID() - s.RequestedPeer = from.GetRequestedPeer() + s.RequestedPeers = from.GetRequestedPeers() } // TypeID returns type id in TL schema. @@ -148,8 +148,8 @@ func (s *MessagesSendBotRequestedPeerRequest) TypeInfo() tdp.Type { SchemaName: "button_id", }, { - Name: "RequestedPeer", - SchemaName: "requested_peer", + Name: "RequestedPeers", + SchemaName: "requested_peers", }, } return typ @@ -158,7 +158,7 @@ func (s *MessagesSendBotRequestedPeerRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (s *MessagesSendBotRequestedPeerRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendBotRequestedPeer#fe38d01b as nil") + return fmt.Errorf("can't encode messages.sendBotRequestedPeer#91b2d060 as nil") } b.PutID(MessagesSendBotRequestedPeerRequestTypeID) return s.EncodeBare(b) @@ -167,21 +167,24 @@ func (s *MessagesSendBotRequestedPeerRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *MessagesSendBotRequestedPeerRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode messages.sendBotRequestedPeer#fe38d01b as nil") + return fmt.Errorf("can't encode messages.sendBotRequestedPeer#91b2d060 as nil") } if s.Peer == nil { - return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#fe38d01b: field peer is nil") + return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#91b2d060: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#fe38d01b: field peer: %w", err) + return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#91b2d060: field peer: %w", err) } b.PutInt(s.MsgID) b.PutInt(s.ButtonID) - if s.RequestedPeer == nil { - return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#fe38d01b: field requested_peer is nil") - } - if err := s.RequestedPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#fe38d01b: field requested_peer: %w", err) + b.PutVectorHeader(len(s.RequestedPeers)) + for idx, v := range s.RequestedPeers { + if v == nil { + return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#91b2d060: field requested_peers element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.sendBotRequestedPeer#91b2d060: field requested_peers element with index %d: %w", idx, err) + } } return nil } @@ -189,10 +192,10 @@ func (s *MessagesSendBotRequestedPeerRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *MessagesSendBotRequestedPeerRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendBotRequestedPeer#fe38d01b to nil") + return fmt.Errorf("can't decode messages.sendBotRequestedPeer#91b2d060 to nil") } if err := b.ConsumeID(MessagesSendBotRequestedPeerRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#fe38d01b: %w", err) + return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: %w", err) } return s.DecodeBare(b) } @@ -200,35 +203,45 @@ func (s *MessagesSendBotRequestedPeerRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *MessagesSendBotRequestedPeerRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode messages.sendBotRequestedPeer#fe38d01b to nil") + return fmt.Errorf("can't decode messages.sendBotRequestedPeer#91b2d060 to nil") } { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#fe38d01b: field peer: %w", err) + return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field peer: %w", err) } s.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#fe38d01b: field msg_id: %w", err) + return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field msg_id: %w", err) } s.MsgID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#fe38d01b: field button_id: %w", err) + return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field button_id: %w", err) } s.ButtonID = value } { - value, err := DecodeInputPeer(b) + headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#fe38d01b: field requested_peer: %w", err) + return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field requested_peers: %w", err) + } + + if headerLen > 0 { + s.RequestedPeers = make([]InputPeerClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.sendBotRequestedPeer#91b2d060: field requested_peers: %w", err) + } + s.RequestedPeers = append(s.RequestedPeers, value) } - s.RequestedPeer = value } return nil } @@ -257,15 +270,20 @@ func (s *MessagesSendBotRequestedPeerRequest) GetButtonID() (value int) { return s.ButtonID } -// GetRequestedPeer returns value of RequestedPeer field. -func (s *MessagesSendBotRequestedPeerRequest) GetRequestedPeer() (value InputPeerClass) { +// GetRequestedPeers returns value of RequestedPeers field. +func (s *MessagesSendBotRequestedPeerRequest) GetRequestedPeers() (value []InputPeerClass) { if s == nil { return } - return s.RequestedPeer + return s.RequestedPeers +} + +// MapRequestedPeers returns field RequestedPeers wrapped in InputPeerClassArray helper. +func (s *MessagesSendBotRequestedPeerRequest) MapRequestedPeers() (value InputPeerClassArray) { + return InputPeerClassArray(s.RequestedPeers) } -// MessagesSendBotRequestedPeer invokes method messages.sendBotRequestedPeer#fe38d01b returning error if any. +// MessagesSendBotRequestedPeer invokes method messages.sendBotRequestedPeer#91b2d060 returning error if any. // Send a chosen peer, as requested by a keyboardButtonRequestPeer¹ button. // // Links: diff --git a/tg/tl_payments_checked_gift_code_gen.go b/tg/tl_payments_checked_gift_code_gen.go index 26441c9814..812f77e411 100644 --- a/tg/tl_payments_checked_gift_code_gen.go +++ b/tg/tl_payments_checked_gift_code_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// PaymentsCheckedGiftCode represents TL type `payments.checkedGiftCode#b722f158`. +// PaymentsCheckedGiftCode represents TL type `payments.checkedGiftCode#284a1096`. // // See https://core.telegram.org/constructor/payments.checkedGiftCode for reference. type PaymentsCheckedGiftCode struct { @@ -43,6 +43,8 @@ type PaymentsCheckedGiftCode struct { // ViaGiveaway field of PaymentsCheckedGiftCode. ViaGiveaway bool // FromID field of PaymentsCheckedGiftCode. + // + // Use SetFromID and GetFromID helpers. FromID PeerClass // GiveawayMsgID field of PaymentsCheckedGiftCode. // @@ -67,7 +69,7 @@ type PaymentsCheckedGiftCode struct { } // PaymentsCheckedGiftCodeTypeID is TL type id of PaymentsCheckedGiftCode. -const PaymentsCheckedGiftCodeTypeID = 0xb722f158 +const PaymentsCheckedGiftCodeTypeID = 0x284a1096 // Ensuring interfaces in compile-time for PaymentsCheckedGiftCode. var ( @@ -127,7 +129,7 @@ func (c *PaymentsCheckedGiftCode) String() string { // FillFrom fills PaymentsCheckedGiftCode from given interface. func (c *PaymentsCheckedGiftCode) FillFrom(from interface { GetViaGiveaway() (value bool) - GetFromID() (value PeerClass) + GetFromID() (value PeerClass, ok bool) GetGiveawayMsgID() (value int, ok bool) GetToID() (value int64, ok bool) GetDate() (value int) @@ -137,7 +139,10 @@ func (c *PaymentsCheckedGiftCode) FillFrom(from interface { GetUsers() (value []UserClass) }) { c.ViaGiveaway = from.GetViaGiveaway() - c.FromID = from.GetFromID() + if val, ok := from.GetFromID(); ok { + c.FromID = val + } + if val, ok := from.GetGiveawayMsgID(); ok { c.GiveawayMsgID = val } @@ -187,6 +192,7 @@ func (c *PaymentsCheckedGiftCode) TypeInfo() tdp.Type { { Name: "FromID", SchemaName: "from_id", + Null: !c.Flags.Has(4), }, { Name: "GiveawayMsgID", @@ -228,6 +234,9 @@ func (c *PaymentsCheckedGiftCode) SetFlags() { if !(c.ViaGiveaway == false) { c.Flags.Set(2) } + if !(c.FromID == nil) { + c.Flags.Set(4) + } if !(c.GiveawayMsgID == 0) { c.Flags.Set(3) } @@ -242,7 +251,7 @@ func (c *PaymentsCheckedGiftCode) SetFlags() { // Encode implements bin.Encoder. func (c *PaymentsCheckedGiftCode) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode payments.checkedGiftCode#b722f158 as nil") + return fmt.Errorf("can't encode payments.checkedGiftCode#284a1096 as nil") } b.PutID(PaymentsCheckedGiftCodeTypeID) return c.EncodeBare(b) @@ -251,17 +260,19 @@ func (c *PaymentsCheckedGiftCode) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *PaymentsCheckedGiftCode) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode payments.checkedGiftCode#b722f158 as nil") + return fmt.Errorf("can't encode payments.checkedGiftCode#284a1096 as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.checkedGiftCode#b722f158: field flags: %w", err) - } - if c.FromID == nil { - return fmt.Errorf("unable to encode payments.checkedGiftCode#b722f158: field from_id is nil") + return fmt.Errorf("unable to encode payments.checkedGiftCode#284a1096: field flags: %w", err) } - if err := c.FromID.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.checkedGiftCode#b722f158: field from_id: %w", err) + if c.Flags.Has(4) { + if c.FromID == nil { + return fmt.Errorf("unable to encode payments.checkedGiftCode#284a1096: field from_id is nil") + } + if err := c.FromID.Encode(b); err != nil { + return fmt.Errorf("unable to encode payments.checkedGiftCode#284a1096: field from_id: %w", err) + } } if c.Flags.Has(3) { b.PutInt(c.GiveawayMsgID) @@ -277,19 +288,19 @@ func (c *PaymentsCheckedGiftCode) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(c.Chats)) for idx, v := range c.Chats { if v == nil { - return fmt.Errorf("unable to encode payments.checkedGiftCode#b722f158: field chats element with index %d is nil", idx) + return fmt.Errorf("unable to encode payments.checkedGiftCode#284a1096: field chats element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.checkedGiftCode#b722f158: field chats element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode payments.checkedGiftCode#284a1096: field chats element with index %d: %w", idx, err) } } b.PutVectorHeader(len(c.Users)) for idx, v := range c.Users { if v == nil { - return fmt.Errorf("unable to encode payments.checkedGiftCode#b722f158: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode payments.checkedGiftCode#284a1096: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode payments.checkedGiftCode#b722f158: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode payments.checkedGiftCode#284a1096: field users element with index %d: %w", idx, err) } } return nil @@ -298,10 +309,10 @@ func (c *PaymentsCheckedGiftCode) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *PaymentsCheckedGiftCode) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode payments.checkedGiftCode#b722f158 to nil") + return fmt.Errorf("can't decode payments.checkedGiftCode#284a1096 to nil") } if err := b.ConsumeID(PaymentsCheckedGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: %w", err) } return c.DecodeBare(b) } @@ -309,60 +320,60 @@ func (c *PaymentsCheckedGiftCode) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *PaymentsCheckedGiftCode) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode payments.checkedGiftCode#b722f158 to nil") + return fmt.Errorf("can't decode payments.checkedGiftCode#284a1096 to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field flags: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field flags: %w", err) } } c.ViaGiveaway = c.Flags.Has(2) - { + if c.Flags.Has(4) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field from_id: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field from_id: %w", err) } c.FromID = value } if c.Flags.Has(3) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field giveaway_msg_id: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field giveaway_msg_id: %w", err) } c.GiveawayMsgID = value } if c.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field to_id: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field to_id: %w", err) } c.ToID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field date: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field date: %w", err) } c.Date = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field months: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field months: %w", err) } c.Months = value } if c.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field used_date: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field used_date: %w", err) } c.UsedDate = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field chats: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field chats: %w", err) } if headerLen > 0 { @@ -371,7 +382,7 @@ func (c *PaymentsCheckedGiftCode) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeChat(b) if err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field chats: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field chats: %w", err) } c.Chats = append(c.Chats, value) } @@ -379,7 +390,7 @@ func (c *PaymentsCheckedGiftCode) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode payments.checkedGiftCode#b722f158: field users: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field users: %w", err) } if headerLen > 0 { @@ -388,7 +399,7 @@ func (c *PaymentsCheckedGiftCode) 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.checkedGiftCode#b722f158: field users: %w", err) + return fmt.Errorf("unable to decode payments.checkedGiftCode#284a1096: field users: %w", err) } c.Users = append(c.Users, value) } @@ -415,12 +426,22 @@ func (c *PaymentsCheckedGiftCode) GetViaGiveaway() (value bool) { return c.Flags.Has(2) } -// GetFromID returns value of FromID field. -func (c *PaymentsCheckedGiftCode) GetFromID() (value PeerClass) { +// SetFromID sets value of FromID conditional field. +func (c *PaymentsCheckedGiftCode) SetFromID(value PeerClass) { + c.Flags.Set(4) + c.FromID = value +} + +// GetFromID returns value of FromID conditional field and +// boolean which is true if field was set. +func (c *PaymentsCheckedGiftCode) GetFromID() (value PeerClass, ok bool) { if c == nil { return } - return c.FromID + if !c.Flags.Has(4) { + return value, false + } + return c.FromID, true } // SetGiveawayMsgID sets value of GiveawayMsgID conditional field. diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index e5e294d013..39b8da5255 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 167 +const Layer = 169 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -116,10 +116,10 @@ func TypesMap() map[uint32]string { ChatEmptyTypeID: "chatEmpty#29562865", ChatTypeID: "chat#41cbf256", ChatForbiddenTypeID: "chatForbidden#6592a1a7", - ChannelTypeID: "channel#8e87ccd8", + ChannelTypeID: "channel#aadfc8f", ChannelForbiddenTypeID: "channelForbidden#17d493d5", ChatFullTypeID: "chatFull#c9d31138", - ChannelFullTypeID: "channelFull#723027bd", + ChannelFullTypeID: "channelFull#f2bcb6f", ChatParticipantTypeID: "chatParticipant#c02d4007", ChatParticipantCreatorTypeID: "chatParticipantCreator#e46bcee4", ChatParticipantAdminTypeID: "chatParticipantAdmin#a0933f5b", @@ -144,7 +144,8 @@ func TypesMap() map[uint32]string { MessageMediaPollTypeID: "messageMediaPoll#4bd6e798", MessageMediaDiceTypeID: "messageMediaDice#3f7ee58b", MessageMediaStoryTypeID: "messageMediaStory#68cb6283", - MessageMediaGiveawayTypeID: "messageMediaGiveaway#58260664", + MessageMediaGiveawayTypeID: "messageMediaGiveaway#daad85b0", + MessageMediaGiveawayResultsTypeID: "messageMediaGiveawayResults#c6991068", MessageActionEmptyTypeID: "messageActionEmpty#b6aef7b0", MessageActionChatCreateTypeID: "messageActionChatCreate#bd47cbad", MessageActionChatEditTitleTypeID: "messageActionChatEditTitle#b5a1ce5a", @@ -181,9 +182,9 @@ func TypesMap() map[uint32]string { MessageActionTopicCreateTypeID: "messageActionTopicCreate#d999256", MessageActionTopicEditTypeID: "messageActionTopicEdit#c0944820", MessageActionSuggestProfilePhotoTypeID: "messageActionSuggestProfilePhoto#57de635e", - MessageActionRequestedPeerTypeID: "messageActionRequestedPeer#fe77345d", + MessageActionRequestedPeerTypeID: "messageActionRequestedPeer#31518e9b", MessageActionSetChatWallPaperTypeID: "messageActionSetChatWallPaper#5060a3f4", - MessageActionGiftCodeTypeID: "messageActionGiftCode#d2cfdb0e", + MessageActionGiftCodeTypeID: "messageActionGiftCode#678c2e09", MessageActionGiveawayLaunchTypeID: "messageActionGiveawayLaunch#332ba9ed", MessageActionGiveawayResultsTypeID: "messageActionGiveawayResults#2a9fadc5", DialogTypeID: "dialog#d58a08c6", @@ -380,6 +381,8 @@ func TypesMap() map[uint32]string { UpdateBotChatBoostTypeID: "updateBotChatBoost#904dd49c", UpdateChannelViewForumAsMessagesTypeID: "updateChannelViewForumAsMessages#7b68920", UpdatePeerWallpaperTypeID: "updatePeerWallpaper#ae3f101d", + UpdateBotMessageReactionTypeID: "updateBotMessageReaction#ac21d3ce", + UpdateBotMessageReactionsTypeID: "updateBotMessageReactions#9cb7759", UpdatesStateTypeID: "updates.state#a56c2a3e", UpdatesDifferenceEmptyTypeID: "updates.differenceEmpty#5d75a138", UpdatesDifferenceTypeID: "updates.difference#f49ca0", @@ -530,6 +533,7 @@ func TypesMap() map[uint32]string { InputStickerSetEmojiGenericAnimationsTypeID: "inputStickerSetEmojiGenericAnimations#4c4d4ce", InputStickerSetEmojiDefaultStatusesTypeID: "inputStickerSetEmojiDefaultStatuses#29d0f5ee", InputStickerSetEmojiDefaultTopicIconsTypeID: "inputStickerSetEmojiDefaultTopicIcons#44c1f8e9", + InputStickerSetEmojiChannelDefaultStatusesTypeID: "inputStickerSetEmojiChannelDefaultStatuses#49748553", StickerSetTypeID: "stickerSet#2dd14edc", MessagesStickerSetTypeID: "messages.stickerSet#6e153f16", MessagesStickerSetNotModifiedTypeID: "messages.stickerSetNotModified#d3f924eb", @@ -550,7 +554,7 @@ func TypesMap() map[uint32]string { KeyboardButtonUserProfileTypeID: "keyboardButtonUserProfile#308660c1", KeyboardButtonWebViewTypeID: "keyboardButtonWebView#13767230", KeyboardButtonSimpleWebViewTypeID: "keyboardButtonSimpleWebView#a0c0505c", - KeyboardButtonRequestPeerTypeID: "keyboardButtonRequestPeer#d0b468c", + KeyboardButtonRequestPeerTypeID: "keyboardButtonRequestPeer#53d7bfd8", KeyboardButtonRowTypeID: "keyboardButtonRow#77608b83", ReplyKeyboardHideTypeID: "replyKeyboardHide#a03e5b85", ReplyKeyboardForceReplyTypeID: "replyKeyboardForceReply#86b40b08", @@ -824,8 +828,10 @@ func TypesMap() map[uint32]string { ChannelAdminLogEventActionDeleteTopicTypeID: "channelAdminLogEventActionDeleteTopic#ae168909", ChannelAdminLogEventActionPinTopicTypeID: "channelAdminLogEventActionPinTopic#5d8d353b", ChannelAdminLogEventActionToggleAntiSpamTypeID: "channelAdminLogEventActionToggleAntiSpam#64f36dfc", - ChannelAdminLogEventActionChangeColorTypeID: "channelAdminLogEventActionChangeColor#3c2b247b", - ChannelAdminLogEventActionChangeBackgroundEmojiTypeID: "channelAdminLogEventActionChangeBackgroundEmoji#445fc434", + ChannelAdminLogEventActionChangePeerColorTypeID: "channelAdminLogEventActionChangePeerColor#5796e780", + ChannelAdminLogEventActionChangeProfilePeerColorTypeID: "channelAdminLogEventActionChangeProfilePeerColor#5e477b25", + ChannelAdminLogEventActionChangeWallpaperTypeID: "channelAdminLogEventActionChangeWallpaper#31bb5d52", + ChannelAdminLogEventActionChangeEmojiStatusTypeID: "channelAdminLogEventActionChangeEmojiStatus#3ea9feb1", ChannelAdminLogEventTypeID: "channelAdminLogEvent#1fad68cd", ChannelsAdminLogResultsTypeID: "channels.adminLogResults#ed8af74d", ChannelAdminLogEventsFilterTypeID: "channelAdminLogEventsFilter#ea107ae4", @@ -940,7 +946,7 @@ func TypesMap() map[uint32]string { AccountWallPapersNotModifiedTypeID: "account.wallPapersNotModified#1c199183", AccountWallPapersTypeID: "account.wallPapers#cdc3858c", CodeSettingsTypeID: "codeSettings#ad253d78", - WallPaperSettingsTypeID: "wallPaperSettings#1dc1bca4", + WallPaperSettingsTypeID: "wallPaperSettings#372efcd0", AutoDownloadSettingsTypeID: "autoDownloadSettings#baa57628", AccountAutoDownloadSettingsTypeID: "account.autoDownloadSettings#63cacf26", EmojiKeywordTypeID: "emojiKeyword#d5b3b9f9", @@ -1108,7 +1114,7 @@ func TypesMap() map[uint32]string { InputStorePaymentPremiumSubscriptionTypeID: "inputStorePaymentPremiumSubscription#a6751e66", InputStorePaymentGiftPremiumTypeID: "inputStorePaymentGiftPremium#616f7fe8", InputStorePaymentPremiumGiftCodeTypeID: "inputStorePaymentPremiumGiftCode#a3805f3f", - InputStorePaymentPremiumGiveawayTypeID: "inputStorePaymentPremiumGiveaway#7c9375e6", + InputStorePaymentPremiumGiveawayTypeID: "inputStorePaymentPremiumGiveaway#160544ca", PremiumGiftOptionTypeID: "premiumGiftOption#74c34319", PaymentFormMethodTypeID: "paymentFormMethod#88f8f21b", EmojiStatusEmptyTypeID: "emojiStatusEmpty#2de11aae", @@ -1186,7 +1192,9 @@ func TypesMap() map[uint32]string { StoriesAllStoriesTypeID: "stories.allStories#6efc5e81", StoriesStoriesTypeID: "stories.stories#5dd8c3c8", StoryViewTypeID: "storyView#b0bdeac5", - StoriesStoryViewsListTypeID: "stories.storyViewsList#46e9b9ec", + StoryViewPublicForwardTypeID: "storyViewPublicForward#9083670b", + StoryViewPublicRepostTypeID: "storyViewPublicRepost#bd74cf49", + StoriesStoryViewsListTypeID: "stories.storyViewsList#59d78fc5", StoriesStoryViewsTypeID: "stories.storyViews#de9eed1d", InputReplyToMessageTypeID: "inputReplyToMessage#22c0f6d5", InputReplyToStoryTypeID: "inputReplyToStory#15b0f283", @@ -1197,11 +1205,13 @@ func TypesMap() map[uint32]string { InputMediaAreaVenueTypeID: "inputMediaAreaVenue#b282217f", MediaAreaGeoPointTypeID: "mediaAreaGeoPoint#df8b3b22", MediaAreaSuggestedReactionTypeID: "mediaAreaSuggestedReaction#14455871", + MediaAreaChannelPostTypeID: "mediaAreaChannelPost#770416af", + InputMediaAreaChannelPostTypeID: "inputMediaAreaChannelPost#2271f2bf", PeerStoriesTypeID: "peerStories#9a35e999", StoriesPeerStoriesTypeID: "stories.peerStories#cae68768", MessagesWebPageTypeID: "messages.webPage#fd5e12bd", PremiumGiftCodeOptionTypeID: "premiumGiftCodeOption#257e962b", - PaymentsCheckedGiftCodeTypeID: "payments.checkedGiftCode#b722f158", + PaymentsCheckedGiftCodeTypeID: "payments.checkedGiftCode#284a1096", PaymentsGiveawayInfoTypeID: "payments.giveawayInfo#4367daa0", PaymentsGiveawayInfoResultsTypeID: "payments.giveawayInfoResults#cd5570", PrepaidGiveawayTypeID: "prepaidGiveaway#b2539d54", @@ -1220,9 +1230,13 @@ func TypesMap() map[uint32]string { PeerColorTypeID: "peerColor#b54b5acf", HelpPeerColorSetTypeID: "help.peerColorSet#26219a58", HelpPeerColorProfileSetTypeID: "help.peerColorProfileSet#767d61eb", - HelpPeerColorOptionTypeID: "help.peerColorOption#135bd42f", + HelpPeerColorOptionTypeID: "help.peerColorOption#ef8430ab", HelpPeerColorsNotModifiedTypeID: "help.peerColorsNotModified#2ba1f5ce", HelpPeerColorsTypeID: "help.peerColors#f8ed08", + StoryReactionTypeID: "storyReaction#6090d6d5", + StoryReactionPublicForwardTypeID: "storyReactionPublicForward#bbab2643", + StoryReactionPublicRepostTypeID: "storyReactionPublicRepost#cfcd0f13", + StoriesStoryReactionsListTypeID: "stories.storyReactionsList#aa5f789c", InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d", InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0", InitConnectionRequestTypeID: "initConnection#c1cd5ea9", @@ -1342,6 +1356,8 @@ func TypesMap() map[uint32]string { AccountInvalidateSignInCodesRequestTypeID: "account.invalidateSignInCodes#ca8ae8ba", AccountUpdateColorRequestTypeID: "account.updateColor#7cefa15d", AccountGetDefaultBackgroundEmojisRequestTypeID: "account.getDefaultBackgroundEmojis#a60ab9ce", + AccountGetChannelDefaultEmojiStatusesRequestTypeID: "account.getChannelDefaultEmojiStatuses#7727a7d5", + AccountGetChannelRestrictedStatusEmojisRequestTypeID: "account.getChannelRestrictedStatusEmojis#35a9e0d5", UsersGetUsersRequestTypeID: "users.getUsers#d91a548", UsersGetFullUserRequestTypeID: "users.getFullUser#b60f5918", UsersSetSecureValueErrorsRequestTypeID: "users.setSecureValueErrors#90c894b5", @@ -1548,7 +1564,7 @@ func TypesMap() map[uint32]string { MessagesGetExtendedMediaRequestTypeID: "messages.getExtendedMedia#84f80814", MessagesSetDefaultHistoryTTLRequestTypeID: "messages.setDefaultHistoryTTL#9eb51445", MessagesGetDefaultHistoryTTLRequestTypeID: "messages.getDefaultHistoryTTL#658b7188", - MessagesSendBotRequestedPeerRequestTypeID: "messages.sendBotRequestedPeer#fe38d01b", + MessagesSendBotRequestedPeerRequestTypeID: "messages.sendBotRequestedPeer#91b2d060", MessagesGetEmojiGroupsRequestTypeID: "messages.getEmojiGroups#7488ce5b", MessagesGetEmojiStatusGroupsRequestTypeID: "messages.getEmojiStatusGroups#2ecd56cd", MessagesGetEmojiProfilePhotoGroupsRequestTypeID: "messages.getEmojiProfilePhotoGroups#21a548f3", @@ -1579,7 +1595,6 @@ func TypesMap() map[uint32]string { HelpGetAppUpdateRequestTypeID: "help.getAppUpdate#522d5a7d", HelpGetInviteTextRequestTypeID: "help.getInviteText#4d392343", HelpGetSupportRequestTypeID: "help.getSupport#9cdf08cd", - HelpGetAppChangelogRequestTypeID: "help.getAppChangelog#9010ef6f", HelpSetBotUpdatesStatusRequestTypeID: "help.setBotUpdatesStatus#ec22cfcd", HelpGetCDNConfigRequestTypeID: "help.getCdnConfig#52029342", HelpGetRecentMeURLsRequestTypeID: "help.getRecentMeUrls#3dc0f114", @@ -1655,9 +1670,10 @@ func TypesMap() map[uint32]string { ChannelsReportAntiSpamFalsePositiveRequestTypeID: "channels.reportAntiSpamFalsePositive#a850a693", ChannelsToggleParticipantsHiddenRequestTypeID: "channels.toggleParticipantsHidden#6a6e7854", ChannelsClickSponsoredMessageRequestTypeID: "channels.clickSponsoredMessage#18afbc93", - ChannelsUpdateColorRequestTypeID: "channels.updateColor#621a201f", + ChannelsUpdateColorRequestTypeID: "channels.updateColor#d8aa3671", ChannelsToggleViewForumAsMessagesRequestTypeID: "channels.toggleViewForumAsMessages#9738bb15", ChannelsGetChannelRecommendationsRequestTypeID: "channels.getChannelRecommendations#83b70d97", + ChannelsUpdateEmojiStatusRequestTypeID: "channels.updateEmojiStatus#f0d3e6a8", BotsSendCustomRequestRequestTypeID: "bots.sendCustomRequest#aa2769ed", BotsAnswerWebhookJSONQueryRequestTypeID: "bots.answerWebhookJSONQuery#e6213f4d", BotsSetBotCommandsRequestTypeID: "bots.setBotCommands#517165a", @@ -1740,7 +1756,7 @@ func TypesMap() map[uint32]string { StatsGetBroadcastStatsRequestTypeID: "stats.getBroadcastStats#ab42441a", StatsLoadAsyncGraphRequestTypeID: "stats.loadAsyncGraph#621d5fa0", StatsGetMegagroupStatsRequestTypeID: "stats.getMegagroupStats#dcdf8607", - StatsGetMessagePublicForwardsRequestTypeID: "stats.getMessagePublicForwards#5630281b", + StatsGetMessagePublicForwardsRequestTypeID: "stats.getMessagePublicForwards#5f150144", StatsGetMessageStatsRequestTypeID: "stats.getMessageStats#b6e0a3f5", StatsGetStoryStatsRequestTypeID: "stats.getStoryStats#374fef40", StatsGetStoryPublicForwardsRequestTypeID: "stats.getStoryPublicForwards#a6437ef6", @@ -1778,6 +1794,7 @@ func TypesMap() map[uint32]string { StoriesGetPeerMaxIDsRequestTypeID: "stories.getPeerMaxIDs#535983c3", StoriesGetChatsToSendRequestTypeID: "stories.getChatsToSend#a56a8b60", StoriesTogglePeerStoriesHiddenRequestTypeID: "stories.togglePeerStoriesHidden#bd0415c4", + StoriesGetStoryReactionsListRequestTypeID: "stories.getStoryReactionsList#b9b2881f", PremiumGetBoostsListRequestTypeID: "premium.getBoostsList#60f67660", PremiumGetMyBoostsRequestTypeID: "premium.getMyBoosts#be77b4a", PremiumApplyBoostRequestTypeID: "premium.applyBoost#6b7da746", @@ -1910,6 +1927,7 @@ func NamesMap() map[string]uint32 { "messageMediaDice": MessageMediaDiceTypeID, "messageMediaStory": MessageMediaStoryTypeID, "messageMediaGiveaway": MessageMediaGiveawayTypeID, + "messageMediaGiveawayResults": MessageMediaGiveawayResultsTypeID, "messageActionEmpty": MessageActionEmptyTypeID, "messageActionChatCreate": MessageActionChatCreateTypeID, "messageActionChatEditTitle": MessageActionChatEditTitleTypeID, @@ -2145,6 +2163,8 @@ func NamesMap() map[string]uint32 { "updateBotChatBoost": UpdateBotChatBoostTypeID, "updateChannelViewForumAsMessages": UpdateChannelViewForumAsMessagesTypeID, "updatePeerWallpaper": UpdatePeerWallpaperTypeID, + "updateBotMessageReaction": UpdateBotMessageReactionTypeID, + "updateBotMessageReactions": UpdateBotMessageReactionsTypeID, "updates.state": UpdatesStateTypeID, "updates.differenceEmpty": UpdatesDifferenceEmptyTypeID, "updates.difference": UpdatesDifferenceTypeID, @@ -2295,6 +2315,7 @@ func NamesMap() map[string]uint32 { "inputStickerSetEmojiGenericAnimations": InputStickerSetEmojiGenericAnimationsTypeID, "inputStickerSetEmojiDefaultStatuses": InputStickerSetEmojiDefaultStatusesTypeID, "inputStickerSetEmojiDefaultTopicIcons": InputStickerSetEmojiDefaultTopicIconsTypeID, + "inputStickerSetEmojiChannelDefaultStatuses": InputStickerSetEmojiChannelDefaultStatusesTypeID, "stickerSet": StickerSetTypeID, "messages.stickerSet": MessagesStickerSetTypeID, "messages.stickerSetNotModified": MessagesStickerSetNotModifiedTypeID, @@ -2589,8 +2610,10 @@ func NamesMap() map[string]uint32 { "channelAdminLogEventActionDeleteTopic": ChannelAdminLogEventActionDeleteTopicTypeID, "channelAdminLogEventActionPinTopic": ChannelAdminLogEventActionPinTopicTypeID, "channelAdminLogEventActionToggleAntiSpam": ChannelAdminLogEventActionToggleAntiSpamTypeID, - "channelAdminLogEventActionChangeColor": ChannelAdminLogEventActionChangeColorTypeID, - "channelAdminLogEventActionChangeBackgroundEmoji": ChannelAdminLogEventActionChangeBackgroundEmojiTypeID, + "channelAdminLogEventActionChangePeerColor": ChannelAdminLogEventActionChangePeerColorTypeID, + "channelAdminLogEventActionChangeProfilePeerColor": ChannelAdminLogEventActionChangeProfilePeerColorTypeID, + "channelAdminLogEventActionChangeWallpaper": ChannelAdminLogEventActionChangeWallpaperTypeID, + "channelAdminLogEventActionChangeEmojiStatus": ChannelAdminLogEventActionChangeEmojiStatusTypeID, "channelAdminLogEvent": ChannelAdminLogEventTypeID, "channels.adminLogResults": ChannelsAdminLogResultsTypeID, "channelAdminLogEventsFilter": ChannelAdminLogEventsFilterTypeID, @@ -2951,6 +2974,8 @@ func NamesMap() map[string]uint32 { "stories.allStories": StoriesAllStoriesTypeID, "stories.stories": StoriesStoriesTypeID, "storyView": StoryViewTypeID, + "storyViewPublicForward": StoryViewPublicForwardTypeID, + "storyViewPublicRepost": StoryViewPublicRepostTypeID, "stories.storyViewsList": StoriesStoryViewsListTypeID, "stories.storyViews": StoriesStoryViewsTypeID, "inputReplyToMessage": InputReplyToMessageTypeID, @@ -2962,6 +2987,8 @@ func NamesMap() map[string]uint32 { "inputMediaAreaVenue": InputMediaAreaVenueTypeID, "mediaAreaGeoPoint": MediaAreaGeoPointTypeID, "mediaAreaSuggestedReaction": MediaAreaSuggestedReactionTypeID, + "mediaAreaChannelPost": MediaAreaChannelPostTypeID, + "inputMediaAreaChannelPost": InputMediaAreaChannelPostTypeID, "peerStories": PeerStoriesTypeID, "stories.peerStories": StoriesPeerStoriesTypeID, "messages.webPage": MessagesWebPageTypeID, @@ -2988,6 +3015,10 @@ func NamesMap() map[string]uint32 { "help.peerColorOption": HelpPeerColorOptionTypeID, "help.peerColorsNotModified": HelpPeerColorsNotModifiedTypeID, "help.peerColors": HelpPeerColorsTypeID, + "storyReaction": StoryReactionTypeID, + "storyReactionPublicForward": StoryReactionPublicForwardTypeID, + "storyReactionPublicRepost": StoryReactionPublicRepostTypeID, + "stories.storyReactionsList": StoriesStoryReactionsListTypeID, "invokeAfterMsg": InvokeAfterMsgRequestTypeID, "invokeAfterMsgs": InvokeAfterMsgsRequestTypeID, "initConnection": InitConnectionRequestTypeID, @@ -3107,6 +3138,8 @@ func NamesMap() map[string]uint32 { "account.invalidateSignInCodes": AccountInvalidateSignInCodesRequestTypeID, "account.updateColor": AccountUpdateColorRequestTypeID, "account.getDefaultBackgroundEmojis": AccountGetDefaultBackgroundEmojisRequestTypeID, + "account.getChannelDefaultEmojiStatuses": AccountGetChannelDefaultEmojiStatusesRequestTypeID, + "account.getChannelRestrictedStatusEmojis": AccountGetChannelRestrictedStatusEmojisRequestTypeID, "users.getUsers": UsersGetUsersRequestTypeID, "users.getFullUser": UsersGetFullUserRequestTypeID, "users.setSecureValueErrors": UsersSetSecureValueErrorsRequestTypeID, @@ -3344,7 +3377,6 @@ func NamesMap() map[string]uint32 { "help.getAppUpdate": HelpGetAppUpdateRequestTypeID, "help.getInviteText": HelpGetInviteTextRequestTypeID, "help.getSupport": HelpGetSupportRequestTypeID, - "help.getAppChangelog": HelpGetAppChangelogRequestTypeID, "help.setBotUpdatesStatus": HelpSetBotUpdatesStatusRequestTypeID, "help.getCdnConfig": HelpGetCDNConfigRequestTypeID, "help.getRecentMeUrls": HelpGetRecentMeURLsRequestTypeID, @@ -3423,6 +3455,7 @@ func NamesMap() map[string]uint32 { "channels.updateColor": ChannelsUpdateColorRequestTypeID, "channels.toggleViewForumAsMessages": ChannelsToggleViewForumAsMessagesRequestTypeID, "channels.getChannelRecommendations": ChannelsGetChannelRecommendationsRequestTypeID, + "channels.updateEmojiStatus": ChannelsUpdateEmojiStatusRequestTypeID, "bots.sendCustomRequest": BotsSendCustomRequestRequestTypeID, "bots.answerWebhookJSONQuery": BotsAnswerWebhookJSONQueryRequestTypeID, "bots.setBotCommands": BotsSetBotCommandsRequestTypeID, @@ -3543,6 +3576,7 @@ func NamesMap() map[string]uint32 { "stories.getPeerMaxIDs": StoriesGetPeerMaxIDsRequestTypeID, "stories.getChatsToSend": StoriesGetChatsToSendRequestTypeID, "stories.togglePeerStoriesHidden": StoriesTogglePeerStoriesHiddenRequestTypeID, + "stories.getStoryReactionsList": StoriesGetStoryReactionsListRequestTypeID, "premium.getBoostsList": PremiumGetBoostsListRequestTypeID, "premium.getMyBoosts": PremiumGetMyBoostsRequestTypeID, "premium.applyBoost": PremiumApplyBoostRequestTypeID, @@ -3675,6 +3709,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageMediaDiceTypeID: func() bin.Object { return &MessageMediaDice{} }, MessageMediaStoryTypeID: func() bin.Object { return &MessageMediaStory{} }, MessageMediaGiveawayTypeID: func() bin.Object { return &MessageMediaGiveaway{} }, + MessageMediaGiveawayResultsTypeID: func() bin.Object { return &MessageMediaGiveawayResults{} }, MessageActionEmptyTypeID: func() bin.Object { return &MessageActionEmpty{} }, MessageActionChatCreateTypeID: func() bin.Object { return &MessageActionChatCreate{} }, MessageActionChatEditTitleTypeID: func() bin.Object { return &MessageActionChatEditTitle{} }, @@ -3910,6 +3945,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateBotChatBoostTypeID: func() bin.Object { return &UpdateBotChatBoost{} }, UpdateChannelViewForumAsMessagesTypeID: func() bin.Object { return &UpdateChannelViewForumAsMessages{} }, UpdatePeerWallpaperTypeID: func() bin.Object { return &UpdatePeerWallpaper{} }, + UpdateBotMessageReactionTypeID: func() bin.Object { return &UpdateBotMessageReaction{} }, + UpdateBotMessageReactionsTypeID: func() bin.Object { return &UpdateBotMessageReactions{} }, UpdatesStateTypeID: func() bin.Object { return &UpdatesState{} }, UpdatesDifferenceEmptyTypeID: func() bin.Object { return &UpdatesDifferenceEmpty{} }, UpdatesDifferenceTypeID: func() bin.Object { return &UpdatesDifference{} }, @@ -4060,6 +4097,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputStickerSetEmojiGenericAnimationsTypeID: func() bin.Object { return &InputStickerSetEmojiGenericAnimations{} }, InputStickerSetEmojiDefaultStatusesTypeID: func() bin.Object { return &InputStickerSetEmojiDefaultStatuses{} }, InputStickerSetEmojiDefaultTopicIconsTypeID: func() bin.Object { return &InputStickerSetEmojiDefaultTopicIcons{} }, + InputStickerSetEmojiChannelDefaultStatusesTypeID: func() bin.Object { return &InputStickerSetEmojiChannelDefaultStatuses{} }, StickerSetTypeID: func() bin.Object { return &StickerSet{} }, MessagesStickerSetTypeID: func() bin.Object { return &MessagesStickerSet{} }, MessagesStickerSetNotModifiedTypeID: func() bin.Object { return &MessagesStickerSetNotModified{} }, @@ -4354,8 +4392,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelAdminLogEventActionDeleteTopicTypeID: func() bin.Object { return &ChannelAdminLogEventActionDeleteTopic{} }, ChannelAdminLogEventActionPinTopicTypeID: func() bin.Object { return &ChannelAdminLogEventActionPinTopic{} }, ChannelAdminLogEventActionToggleAntiSpamTypeID: func() bin.Object { return &ChannelAdminLogEventActionToggleAntiSpam{} }, - ChannelAdminLogEventActionChangeColorTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeColor{} }, - ChannelAdminLogEventActionChangeBackgroundEmojiTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeBackgroundEmoji{} }, + ChannelAdminLogEventActionChangePeerColorTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangePeerColor{} }, + ChannelAdminLogEventActionChangeProfilePeerColorTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeProfilePeerColor{} }, + ChannelAdminLogEventActionChangeWallpaperTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeWallpaper{} }, + ChannelAdminLogEventActionChangeEmojiStatusTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeEmojiStatus{} }, ChannelAdminLogEventTypeID: func() bin.Object { return &ChannelAdminLogEvent{} }, ChannelsAdminLogResultsTypeID: func() bin.Object { return &ChannelsAdminLogResults{} }, ChannelAdminLogEventsFilterTypeID: func() bin.Object { return &ChannelAdminLogEventsFilter{} }, @@ -4716,6 +4756,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StoriesAllStoriesTypeID: func() bin.Object { return &StoriesAllStories{} }, StoriesStoriesTypeID: func() bin.Object { return &StoriesStories{} }, StoryViewTypeID: func() bin.Object { return &StoryView{} }, + StoryViewPublicForwardTypeID: func() bin.Object { return &StoryViewPublicForward{} }, + StoryViewPublicRepostTypeID: func() bin.Object { return &StoryViewPublicRepost{} }, StoriesStoryViewsListTypeID: func() bin.Object { return &StoriesStoryViewsList{} }, StoriesStoryViewsTypeID: func() bin.Object { return &StoriesStoryViews{} }, InputReplyToMessageTypeID: func() bin.Object { return &InputReplyToMessage{} }, @@ -4727,6 +4769,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { InputMediaAreaVenueTypeID: func() bin.Object { return &InputMediaAreaVenue{} }, MediaAreaGeoPointTypeID: func() bin.Object { return &MediaAreaGeoPoint{} }, MediaAreaSuggestedReactionTypeID: func() bin.Object { return &MediaAreaSuggestedReaction{} }, + MediaAreaChannelPostTypeID: func() bin.Object { return &MediaAreaChannelPost{} }, + InputMediaAreaChannelPostTypeID: func() bin.Object { return &InputMediaAreaChannelPost{} }, PeerStoriesTypeID: func() bin.Object { return &PeerStories{} }, StoriesPeerStoriesTypeID: func() bin.Object { return &StoriesPeerStories{} }, MessagesWebPageTypeID: func() bin.Object { return &MessagesWebPage{} }, @@ -4753,6 +4797,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { HelpPeerColorOptionTypeID: func() bin.Object { return &HelpPeerColorOption{} }, HelpPeerColorsNotModifiedTypeID: func() bin.Object { return &HelpPeerColorsNotModified{} }, HelpPeerColorsTypeID: func() bin.Object { return &HelpPeerColors{} }, + StoryReactionTypeID: func() bin.Object { return &StoryReaction{} }, + StoryReactionPublicForwardTypeID: func() bin.Object { return &StoryReactionPublicForward{} }, + StoryReactionPublicRepostTypeID: func() bin.Object { return &StoryReactionPublicRepost{} }, + StoriesStoryReactionsListTypeID: func() bin.Object { return &StoriesStoryReactionsList{} }, InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} }, InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} }, InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} }, @@ -4872,6 +4920,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { AccountInvalidateSignInCodesRequestTypeID: func() bin.Object { return &AccountInvalidateSignInCodesRequest{} }, AccountUpdateColorRequestTypeID: func() bin.Object { return &AccountUpdateColorRequest{} }, AccountGetDefaultBackgroundEmojisRequestTypeID: func() bin.Object { return &AccountGetDefaultBackgroundEmojisRequest{} }, + AccountGetChannelDefaultEmojiStatusesRequestTypeID: func() bin.Object { return &AccountGetChannelDefaultEmojiStatusesRequest{} }, + AccountGetChannelRestrictedStatusEmojisRequestTypeID: func() bin.Object { return &AccountGetChannelRestrictedStatusEmojisRequest{} }, UsersGetUsersRequestTypeID: func() bin.Object { return &UsersGetUsersRequest{} }, UsersGetFullUserRequestTypeID: func() bin.Object { return &UsersGetFullUserRequest{} }, UsersSetSecureValueErrorsRequestTypeID: func() bin.Object { return &UsersSetSecureValueErrorsRequest{} }, @@ -5109,7 +5159,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object { HelpGetAppUpdateRequestTypeID: func() bin.Object { return &HelpGetAppUpdateRequest{} }, HelpGetInviteTextRequestTypeID: func() bin.Object { return &HelpGetInviteTextRequest{} }, HelpGetSupportRequestTypeID: func() bin.Object { return &HelpGetSupportRequest{} }, - HelpGetAppChangelogRequestTypeID: func() bin.Object { return &HelpGetAppChangelogRequest{} }, HelpSetBotUpdatesStatusRequestTypeID: func() bin.Object { return &HelpSetBotUpdatesStatusRequest{} }, HelpGetCDNConfigRequestTypeID: func() bin.Object { return &HelpGetCDNConfigRequest{} }, HelpGetRecentMeURLsRequestTypeID: func() bin.Object { return &HelpGetRecentMeURLsRequest{} }, @@ -5188,6 +5237,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelsUpdateColorRequestTypeID: func() bin.Object { return &ChannelsUpdateColorRequest{} }, ChannelsToggleViewForumAsMessagesRequestTypeID: func() bin.Object { return &ChannelsToggleViewForumAsMessagesRequest{} }, ChannelsGetChannelRecommendationsRequestTypeID: func() bin.Object { return &ChannelsGetChannelRecommendationsRequest{} }, + ChannelsUpdateEmojiStatusRequestTypeID: func() bin.Object { return &ChannelsUpdateEmojiStatusRequest{} }, BotsSendCustomRequestRequestTypeID: func() bin.Object { return &BotsSendCustomRequestRequest{} }, BotsAnswerWebhookJSONQueryRequestTypeID: func() bin.Object { return &BotsAnswerWebhookJSONQueryRequest{} }, BotsSetBotCommandsRequestTypeID: func() bin.Object { return &BotsSetBotCommandsRequest{} }, @@ -5308,6 +5358,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StoriesGetPeerMaxIDsRequestTypeID: func() bin.Object { return &StoriesGetPeerMaxIDsRequest{} }, StoriesGetChatsToSendRequestTypeID: func() bin.Object { return &StoriesGetChatsToSendRequest{} }, StoriesTogglePeerStoriesHiddenRequestTypeID: func() bin.Object { return &StoriesTogglePeerStoriesHiddenRequest{} }, + StoriesGetStoryReactionsListRequestTypeID: func() bin.Object { return &StoriesGetStoryReactionsListRequest{} }, PremiumGetBoostsListRequestTypeID: func() bin.Object { return &PremiumGetBoostsListRequest{} }, PremiumGetMyBoostsRequestTypeID: func() bin.Object { return &PremiumGetMyBoostsRequest{} }, PremiumApplyBoostRequestTypeID: func() bin.Object { return &PremiumApplyBoostRequest{} }, @@ -5489,8 +5540,10 @@ func ClassConstructorsMap() map[string][]uint32 { ChannelAdminLogEventActionDeleteTopicTypeID, ChannelAdminLogEventActionPinTopicTypeID, ChannelAdminLogEventActionToggleAntiSpamTypeID, - ChannelAdminLogEventActionChangeColorTypeID, - ChannelAdminLogEventActionChangeBackgroundEmojiTypeID, + ChannelAdminLogEventActionChangePeerColorTypeID, + ChannelAdminLogEventActionChangeProfilePeerColorTypeID, + ChannelAdminLogEventActionChangeWallpaperTypeID, + ChannelAdminLogEventActionChangeEmojiStatusTypeID, }, ChannelLocationClassName: { ChannelLocationEmptyTypeID, @@ -5886,6 +5939,7 @@ func ClassConstructorsMap() map[string][]uint32 { InputStickerSetEmojiGenericAnimationsTypeID, InputStickerSetEmojiDefaultStatusesTypeID, InputStickerSetEmojiDefaultTopicIconsTypeID, + InputStickerSetEmojiChannelDefaultStatusesTypeID, }, InputStickeredMediaClassName: { InputStickeredMediaPhotoTypeID, @@ -5953,6 +6007,8 @@ func ClassConstructorsMap() map[string][]uint32 { InputMediaAreaVenueTypeID, MediaAreaGeoPointTypeID, MediaAreaSuggestedReactionTypeID, + MediaAreaChannelPostTypeID, + InputMediaAreaChannelPostTypeID, }, MessageActionClassName: { MessageActionEmptyTypeID, @@ -6045,6 +6101,7 @@ func ClassConstructorsMap() map[string][]uint32 { MessageMediaDiceTypeID, MessageMediaStoryTypeID, MessageMediaGiveawayTypeID, + MessageMediaGiveawayResultsTypeID, }, MessagePeerVoteClassName: { MessagePeerVoteTypeID, @@ -6439,6 +6496,16 @@ func ClassConstructorsMap() map[string][]uint32 { StoryItemSkippedTypeID, StoryItemTypeID, }, + StoryReactionClassName: { + StoryReactionTypeID, + StoryReactionPublicForwardTypeID, + StoryReactionPublicRepostTypeID, + }, + StoryViewClassName: { + StoryViewTypeID, + StoryViewPublicForwardTypeID, + StoryViewPublicRepostTypeID, + }, TopPeerCategoryClassName: { TopPeerCategoryBotsPMTypeID, TopPeerCategoryBotsInlineTypeID, @@ -6575,6 +6642,8 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateBotChatBoostTypeID, UpdateChannelViewForumAsMessagesTypeID, UpdatePeerWallpaperTypeID, + UpdateBotMessageReactionTypeID, + UpdateBotMessageReactionsTypeID, }, UpdatesChannelDifferenceClassName: { UpdatesChannelDifferenceEmptyTypeID, diff --git a/tg/tl_server_gen.go b/tg/tl_server_gen.go index 0512e1f153..ac7489e7f4 100644 --- a/tg/tl_server_gen.go +++ b/tg/tl_server_gen.go @@ -2157,6 +2157,40 @@ func (s *ServerDispatcher) OnAccountGetDefaultBackgroundEmojis(f func(ctx contex s.handlers[AccountGetDefaultBackgroundEmojisRequestTypeID] = handler } +func (s *ServerDispatcher) OnAccountGetChannelDefaultEmojiStatuses(f func(ctx context.Context, hash int64) (AccountEmojiStatusesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountGetChannelDefaultEmojiStatusesRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Hash) + if err != nil { + return nil, err + } + return &AccountEmojiStatusesBox{EmojiStatuses: response}, nil + } + + s.handlers[AccountGetChannelDefaultEmojiStatusesRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnAccountGetChannelRestrictedStatusEmojis(f func(ctx context.Context, hash int64) (EmojiListClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request AccountGetChannelRestrictedStatusEmojisRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Hash) + if err != nil { + return nil, err + } + return &EmojiListBox{EmojiList: response}, nil + } + + s.handlers[AccountGetChannelRestrictedStatusEmojisRequestTypeID] = 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 @@ -6410,23 +6444,6 @@ func (s *ServerDispatcher) OnHelpGetSupport(f func(ctx context.Context) (*HelpSu s.handlers[HelpGetSupportRequestTypeID] = handler } -func (s *ServerDispatcher) OnHelpGetAppChangelog(f func(ctx context.Context, prevappversion string) (UpdatesClass, error)) { - handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { - var request HelpGetAppChangelogRequest - if err := request.Decode(b); err != nil { - return nil, err - } - - response, err := f(ctx, request.PrevAppVersion) - if err != nil { - return nil, err - } - return &UpdatesBox{Updates: response}, nil - } - - s.handlers[HelpGetAppChangelogRequestTypeID] = handler -} - func (s *ServerDispatcher) OnHelpSetBotUpdatesStatus(f func(ctx context.Context, request *HelpSetBotUpdatesStatusRequest) (bool, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request HelpSetBotUpdatesStatusRequest @@ -7829,6 +7846,23 @@ func (s *ServerDispatcher) OnChannelsGetChannelRecommendations(f func(ctx contex s.handlers[ChannelsGetChannelRecommendationsRequestTypeID] = handler } +func (s *ServerDispatcher) OnChannelsUpdateEmojiStatus(f func(ctx context.Context, request *ChannelsUpdateEmojiStatusRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request ChannelsUpdateEmojiStatusRequest + 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[ChannelsUpdateEmojiStatusRequestTypeID] = handler +} + func (s *ServerDispatcher) OnBotsSendCustomRequest(f func(ctx context.Context, request *BotsSendCustomRequestRequest) (*DataJSON, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request BotsSendCustomRequestRequest @@ -9299,7 +9333,7 @@ func (s *ServerDispatcher) OnStatsGetMegagroupStats(f func(ctx context.Context, s.handlers[StatsGetMegagroupStatsRequestTypeID] = handler } -func (s *ServerDispatcher) OnStatsGetMessagePublicForwards(f func(ctx context.Context, request *StatsGetMessagePublicForwardsRequest) (MessagesMessagesClass, error)) { +func (s *ServerDispatcher) OnStatsGetMessagePublicForwards(f func(ctx context.Context, request *StatsGetMessagePublicForwardsRequest) (*StatsPublicForwards, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request StatsGetMessagePublicForwardsRequest if err := request.Decode(b); err != nil { @@ -9310,7 +9344,7 @@ func (s *ServerDispatcher) OnStatsGetMessagePublicForwards(f func(ctx context.Co if err != nil { return nil, err } - return &MessagesMessagesBox{Messages: response}, nil + return response, nil } s.handlers[StatsGetMessagePublicForwardsRequestTypeID] = handler @@ -9973,6 +10007,23 @@ func (s *ServerDispatcher) OnStoriesTogglePeerStoriesHidden(f func(ctx context.C s.handlers[StoriesTogglePeerStoriesHiddenRequestTypeID] = handler } +func (s *ServerDispatcher) OnStoriesGetStoryReactionsList(f func(ctx context.Context, request *StoriesGetStoryReactionsListRequest) (*StoriesStoryReactionsList, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request StoriesGetStoryReactionsListRequest + 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[StoriesGetStoryReactionsListRequestTypeID] = handler +} + func (s *ServerDispatcher) OnPremiumGetBoostsList(f func(ctx context.Context, request *PremiumGetBoostsListRequest) (*PremiumBoostsList, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request PremiumGetBoostsListRequest diff --git a/tg/tl_stats_get_message_public_forwards_gen.go b/tg/tl_stats_get_message_public_forwards_gen.go index fc36add152..e820badac1 100644 --- a/tg/tl_stats_get_message_public_forwards_gen.go +++ b/tg/tl_stats_get_message_public_forwards_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StatsGetMessagePublicForwardsRequest represents TL type `stats.getMessagePublicForwards#5630281b`. +// StatsGetMessagePublicForwardsRequest represents TL type `stats.getMessagePublicForwards#5f150144`. // Obtains a list of messages, indicating to which other public channels was a channel // message forwarded. // Will return a list of messages¹ with peer_id equal to the public channel to which @@ -46,21 +46,8 @@ type StatsGetMessagePublicForwardsRequest struct { Channel InputChannelClass // Source message ID MsgID int - // Initially 0, then set to the next_rate parameter of messages.messagesSlice¹ - // - // Links: - // 1) https://core.telegram.org/constructor/messages.messagesSlice - OffsetRate int - // Offsets for pagination, for more info click here¹ - // - // Links: - // 1) https://core.telegram.org/api/offsets - OffsetPeer InputPeerClass - // Offsets for pagination, for more info click here¹ - // - // Links: - // 1) https://core.telegram.org/api/offsets - OffsetID int + // Offset field of StatsGetMessagePublicForwardsRequest. + Offset string // Maximum number of results to return, see pagination¹ // // Links: @@ -69,7 +56,7 @@ type StatsGetMessagePublicForwardsRequest struct { } // StatsGetMessagePublicForwardsRequestTypeID is TL type id of StatsGetMessagePublicForwardsRequest. -const StatsGetMessagePublicForwardsRequestTypeID = 0x5630281b +const StatsGetMessagePublicForwardsRequestTypeID = 0x5f150144 // Ensuring interfaces in compile-time for StatsGetMessagePublicForwardsRequest. var ( @@ -89,13 +76,7 @@ func (g *StatsGetMessagePublicForwardsRequest) Zero() bool { if !(g.MsgID == 0) { return false } - if !(g.OffsetRate == 0) { - return false - } - if !(g.OffsetPeer == nil) { - return false - } - if !(g.OffsetID == 0) { + if !(g.Offset == "") { return false } if !(g.Limit == 0) { @@ -118,16 +99,12 @@ func (g *StatsGetMessagePublicForwardsRequest) String() string { func (g *StatsGetMessagePublicForwardsRequest) FillFrom(from interface { GetChannel() (value InputChannelClass) GetMsgID() (value int) - GetOffsetRate() (value int) - GetOffsetPeer() (value InputPeerClass) - GetOffsetID() (value int) + GetOffset() (value string) GetLimit() (value int) }) { g.Channel = from.GetChannel() g.MsgID = from.GetMsgID() - g.OffsetRate = from.GetOffsetRate() - g.OffsetPeer = from.GetOffsetPeer() - g.OffsetID = from.GetOffsetID() + g.Offset = from.GetOffset() g.Limit = from.GetLimit() } @@ -163,16 +140,8 @@ func (g *StatsGetMessagePublicForwardsRequest) TypeInfo() tdp.Type { SchemaName: "msg_id", }, { - Name: "OffsetRate", - SchemaName: "offset_rate", - }, - { - Name: "OffsetPeer", - SchemaName: "offset_peer", - }, - { - Name: "OffsetID", - SchemaName: "offset_id", + Name: "Offset", + SchemaName: "offset", }, { Name: "Limit", @@ -185,7 +154,7 @@ func (g *StatsGetMessagePublicForwardsRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *StatsGetMessagePublicForwardsRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode stats.getMessagePublicForwards#5630281b as nil") + return fmt.Errorf("can't encode stats.getMessagePublicForwards#5f150144 as nil") } b.PutID(StatsGetMessagePublicForwardsRequestTypeID) return g.EncodeBare(b) @@ -194,23 +163,16 @@ func (g *StatsGetMessagePublicForwardsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *StatsGetMessagePublicForwardsRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode stats.getMessagePublicForwards#5630281b as nil") + return fmt.Errorf("can't encode stats.getMessagePublicForwards#5f150144 as nil") } if g.Channel == nil { - return fmt.Errorf("unable to encode stats.getMessagePublicForwards#5630281b: field channel is nil") + return fmt.Errorf("unable to encode stats.getMessagePublicForwards#5f150144: field channel is nil") } if err := g.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode stats.getMessagePublicForwards#5630281b: field channel: %w", err) + return fmt.Errorf("unable to encode stats.getMessagePublicForwards#5f150144: field channel: %w", err) } b.PutInt(g.MsgID) - b.PutInt(g.OffsetRate) - if g.OffsetPeer == nil { - return fmt.Errorf("unable to encode stats.getMessagePublicForwards#5630281b: field offset_peer is nil") - } - if err := g.OffsetPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode stats.getMessagePublicForwards#5630281b: field offset_peer: %w", err) - } - b.PutInt(g.OffsetID) + b.PutString(g.Offset) b.PutInt(g.Limit) return nil } @@ -218,10 +180,10 @@ func (g *StatsGetMessagePublicForwardsRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (g *StatsGetMessagePublicForwardsRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode stats.getMessagePublicForwards#5630281b to nil") + return fmt.Errorf("can't decode stats.getMessagePublicForwards#5f150144 to nil") } if err := b.ConsumeID(StatsGetMessagePublicForwardsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5630281b: %w", err) + return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5f150144: %w", err) } return g.DecodeBare(b) } @@ -229,47 +191,33 @@ func (g *StatsGetMessagePublicForwardsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *StatsGetMessagePublicForwardsRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode stats.getMessagePublicForwards#5630281b to nil") + return fmt.Errorf("can't decode stats.getMessagePublicForwards#5f150144 to nil") } { value, err := DecodeInputChannel(b) if err != nil { - return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5630281b: field channel: %w", err) + return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5f150144: field channel: %w", err) } g.Channel = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5630281b: field msg_id: %w", err) + return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5f150144: field msg_id: %w", err) } g.MsgID = value } { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5630281b: field offset_rate: %w", err) - } - g.OffsetRate = value - } - { - value, err := DecodeInputPeer(b) - if err != nil { - return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5630281b: field offset_peer: %w", err) - } - g.OffsetPeer = value - } - { - value, err := b.Int() + value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5630281b: field offset_id: %w", err) + return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5f150144: field offset: %w", err) } - g.OffsetID = value + g.Offset = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5630281b: field limit: %w", err) + return fmt.Errorf("unable to decode stats.getMessagePublicForwards#5f150144: field limit: %w", err) } g.Limit = value } @@ -292,28 +240,12 @@ func (g *StatsGetMessagePublicForwardsRequest) GetMsgID() (value int) { return g.MsgID } -// GetOffsetRate returns value of OffsetRate field. -func (g *StatsGetMessagePublicForwardsRequest) GetOffsetRate() (value int) { - if g == nil { - return - } - return g.OffsetRate -} - -// GetOffsetPeer returns value of OffsetPeer field. -func (g *StatsGetMessagePublicForwardsRequest) GetOffsetPeer() (value InputPeerClass) { - if g == nil { - return - } - return g.OffsetPeer -} - -// GetOffsetID returns value of OffsetID field. -func (g *StatsGetMessagePublicForwardsRequest) GetOffsetID() (value int) { +// GetOffset returns value of Offset field. +func (g *StatsGetMessagePublicForwardsRequest) GetOffset() (value string) { if g == nil { return } - return g.OffsetID + return g.Offset } // GetLimit returns value of Limit field. @@ -329,7 +261,7 @@ func (g *StatsGetMessagePublicForwardsRequest) GetChannelAsNotEmpty() (NotEmptyI return g.Channel.AsNotEmpty() } -// StatsGetMessagePublicForwards invokes method stats.getMessagePublicForwards#5630281b returning error if any. +// StatsGetMessagePublicForwards invokes method stats.getMessagePublicForwards#5f150144 returning error if any. // Obtains a list of messages, indicating to which other public channels was a channel // message forwarded. // Will return a list of messages¹ with peer_id equal to the public channel to which @@ -346,11 +278,11 @@ func (g *StatsGetMessagePublicForwardsRequest) GetChannelAsNotEmpty() (NotEmptyI // 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/stats.getMessagePublicForwards for reference. -func (c *Client) StatsGetMessagePublicForwards(ctx context.Context, request *StatsGetMessagePublicForwardsRequest) (MessagesMessagesClass, error) { - var result MessagesMessagesBox +func (c *Client) StatsGetMessagePublicForwards(ctx context.Context, request *StatsGetMessagePublicForwardsRequest) (*StatsPublicForwards, error) { + var result StatsPublicForwards if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } - return result.Messages, nil + return &result, nil } diff --git a/tg/tl_sticker_set_gen.go b/tg/tl_sticker_set_gen.go index 440908b6d0..7f4871eec1 100644 --- a/tg/tl_sticker_set_gen.go +++ b/tg/tl_sticker_set_gen.go @@ -56,6 +56,8 @@ type StickerSet struct { Emojis bool // TextColor field of StickerSet. TextColor bool + // ChannelEmojiStatus field of StickerSet. + ChannelEmojiStatus bool // When was this stickerset installed // // Use SetInstalledDate and GetInstalledDate helpers. @@ -136,6 +138,9 @@ func (s *StickerSet) Zero() bool { if !(s.TextColor == false) { return false } + if !(s.ChannelEmojiStatus == false) { + return false + } if !(s.InstalledDate == 0) { return false } @@ -191,6 +196,7 @@ func (s *StickerSet) FillFrom(from interface { GetVideos() (value bool) GetEmojis() (value bool) GetTextColor() (value bool) + GetChannelEmojiStatus() (value bool) GetInstalledDate() (value int, ok bool) GetID() (value int64) GetAccessHash() (value int64) @@ -210,6 +216,7 @@ func (s *StickerSet) FillFrom(from interface { s.Videos = from.GetVideos() s.Emojis = from.GetEmojis() s.TextColor = from.GetTextColor() + s.ChannelEmojiStatus = from.GetChannelEmojiStatus() if val, ok := from.GetInstalledDate(); ok { s.InstalledDate = val } @@ -296,6 +303,11 @@ func (s *StickerSet) TypeInfo() tdp.Type { SchemaName: "text_color", Null: !s.Flags.Has(9), }, + { + Name: "ChannelEmojiStatus", + SchemaName: "channel_emoji_status", + Null: !s.Flags.Has(10), + }, { Name: "InstalledDate", SchemaName: "installed_date", @@ -372,6 +384,9 @@ func (s *StickerSet) SetFlags() { if !(s.TextColor == false) { s.Flags.Set(9) } + if !(s.ChannelEmojiStatus == false) { + s.Flags.Set(10) + } if !(s.InstalledDate == 0) { s.Flags.Set(0) } @@ -467,6 +482,7 @@ func (s *StickerSet) DecodeBare(b *bin.Buffer) error { s.Videos = s.Flags.Has(6) s.Emojis = s.Flags.Has(7) s.TextColor = s.Flags.Has(9) + s.ChannelEmojiStatus = s.Flags.Has(10) if s.Flags.Has(0) { value, err := b.Int() if err != nil { @@ -690,6 +706,25 @@ func (s *StickerSet) GetTextColor() (value bool) { return s.Flags.Has(9) } +// SetChannelEmojiStatus sets value of ChannelEmojiStatus conditional field. +func (s *StickerSet) SetChannelEmojiStatus(value bool) { + if value { + s.Flags.Set(10) + s.ChannelEmojiStatus = true + } else { + s.Flags.Unset(10) + s.ChannelEmojiStatus = false + } +} + +// GetChannelEmojiStatus returns value of ChannelEmojiStatus conditional field. +func (s *StickerSet) GetChannelEmojiStatus() (value bool) { + if s == nil { + return + } + return s.Flags.Has(10) +} + // SetInstalledDate sets value of InstalledDate conditional field. func (s *StickerSet) SetInstalledDate(value int) { s.Flags.Set(0) diff --git a/tg/tl_stories_get_story_reactions_list_gen.go b/tg/tl_stories_get_story_reactions_list_gen.go new file mode 100644 index 0000000000..0600c76440 --- /dev/null +++ b/tg/tl_stories_get_story_reactions_list_gen.go @@ -0,0 +1,386 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StoriesGetStoryReactionsListRequest represents TL type `stories.getStoryReactionsList#b9b2881f`. +// +// See https://core.telegram.org/method/stories.getStoryReactionsList for reference. +type StoriesGetStoryReactionsListRequest struct { + // Flags field of StoriesGetStoryReactionsListRequest. + Flags bin.Fields + // ForwardsFirst field of StoriesGetStoryReactionsListRequest. + ForwardsFirst bool + // Peer field of StoriesGetStoryReactionsListRequest. + Peer InputPeerClass + // ID field of StoriesGetStoryReactionsListRequest. + ID int + // Reaction field of StoriesGetStoryReactionsListRequest. + // + // Use SetReaction and GetReaction helpers. + Reaction ReactionClass + // Offset field of StoriesGetStoryReactionsListRequest. + // + // Use SetOffset and GetOffset helpers. + Offset string + // Limit field of StoriesGetStoryReactionsListRequest. + Limit int +} + +// StoriesGetStoryReactionsListRequestTypeID is TL type id of StoriesGetStoryReactionsListRequest. +const StoriesGetStoryReactionsListRequestTypeID = 0xb9b2881f + +// Ensuring interfaces in compile-time for StoriesGetStoryReactionsListRequest. +var ( + _ bin.Encoder = &StoriesGetStoryReactionsListRequest{} + _ bin.Decoder = &StoriesGetStoryReactionsListRequest{} + _ bin.BareEncoder = &StoriesGetStoryReactionsListRequest{} + _ bin.BareDecoder = &StoriesGetStoryReactionsListRequest{} +) + +func (g *StoriesGetStoryReactionsListRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Flags.Zero()) { + return false + } + if !(g.ForwardsFirst == false) { + return false + } + if !(g.Peer == nil) { + return false + } + if !(g.ID == 0) { + return false + } + if !(g.Reaction == nil) { + return false + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *StoriesGetStoryReactionsListRequest) String() string { + if g == nil { + return "StoriesGetStoryReactionsListRequest(nil)" + } + type Alias StoriesGetStoryReactionsListRequest + return fmt.Sprintf("StoriesGetStoryReactionsListRequest%+v", Alias(*g)) +} + +// FillFrom fills StoriesGetStoryReactionsListRequest from given interface. +func (g *StoriesGetStoryReactionsListRequest) FillFrom(from interface { + GetForwardsFirst() (value bool) + GetPeer() (value InputPeerClass) + GetID() (value int) + GetReaction() (value ReactionClass, ok bool) + GetOffset() (value string, ok bool) + GetLimit() (value int) +}) { + g.ForwardsFirst = from.GetForwardsFirst() + g.Peer = from.GetPeer() + g.ID = from.GetID() + if val, ok := from.GetReaction(); ok { + g.Reaction = val + } + + if val, ok := from.GetOffset(); ok { + g.Offset = val + } + + g.Limit = from.GetLimit() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoriesGetStoryReactionsListRequest) TypeID() uint32 { + return StoriesGetStoryReactionsListRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoriesGetStoryReactionsListRequest) TypeName() string { + return "stories.getStoryReactionsList" +} + +// TypeInfo returns info about TL type. +func (g *StoriesGetStoryReactionsListRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stories.getStoryReactionsList", + ID: StoriesGetStoryReactionsListRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ForwardsFirst", + SchemaName: "forwards_first", + Null: !g.Flags.Has(2), + }, + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "Reaction", + SchemaName: "reaction", + Null: !g.Flags.Has(0), + }, + { + Name: "Offset", + SchemaName: "offset", + Null: !g.Flags.Has(1), + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (g *StoriesGetStoryReactionsListRequest) SetFlags() { + if !(g.ForwardsFirst == false) { + g.Flags.Set(2) + } + if !(g.Reaction == nil) { + g.Flags.Set(0) + } + if !(g.Offset == "") { + g.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (g *StoriesGetStoryReactionsListRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode stories.getStoryReactionsList#b9b2881f as nil") + } + b.PutID(StoriesGetStoryReactionsListRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *StoriesGetStoryReactionsListRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode stories.getStoryReactionsList#b9b2881f as nil") + } + g.SetFlags() + if err := g.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field flags: %w", err) + } + if g.Peer == nil { + return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field peer: %w", err) + } + b.PutInt(g.ID) + if g.Flags.Has(0) { + if g.Reaction == nil { + return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field reaction is nil") + } + if err := g.Reaction.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.getStoryReactionsList#b9b2881f: field reaction: %w", err) + } + } + if g.Flags.Has(1) { + b.PutString(g.Offset) + } + b.PutInt(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *StoriesGetStoryReactionsListRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode stories.getStoryReactionsList#b9b2881f to nil") + } + if err := b.ConsumeID(StoriesGetStoryReactionsListRequestTypeID); err != nil { + return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *StoriesGetStoryReactionsListRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode stories.getStoryReactionsList#b9b2881f to nil") + } + { + if err := g.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field flags: %w", err) + } + } + g.ForwardsFirst = g.Flags.Has(2) + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field peer: %w", err) + } + g.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field id: %w", err) + } + g.ID = value + } + if g.Flags.Has(0) { + value, err := DecodeReaction(b) + if err != nil { + return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field reaction: %w", err) + } + g.Reaction = value + } + if g.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stories.getStoryReactionsList#b9b2881f: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// SetForwardsFirst sets value of ForwardsFirst conditional field. +func (g *StoriesGetStoryReactionsListRequest) SetForwardsFirst(value bool) { + if value { + g.Flags.Set(2) + g.ForwardsFirst = true + } else { + g.Flags.Unset(2) + g.ForwardsFirst = false + } +} + +// GetForwardsFirst returns value of ForwardsFirst conditional field. +func (g *StoriesGetStoryReactionsListRequest) GetForwardsFirst() (value bool) { + if g == nil { + return + } + return g.Flags.Has(2) +} + +// GetPeer returns value of Peer field. +func (g *StoriesGetStoryReactionsListRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// GetID returns value of ID field. +func (g *StoriesGetStoryReactionsListRequest) GetID() (value int) { + if g == nil { + return + } + return g.ID +} + +// SetReaction sets value of Reaction conditional field. +func (g *StoriesGetStoryReactionsListRequest) SetReaction(value ReactionClass) { + g.Flags.Set(0) + g.Reaction = value +} + +// GetReaction returns value of Reaction conditional field and +// boolean which is true if field was set. +func (g *StoriesGetStoryReactionsListRequest) GetReaction() (value ReactionClass, ok bool) { + if g == nil { + return + } + if !g.Flags.Has(0) { + return value, false + } + return g.Reaction, true +} + +// SetOffset sets value of Offset conditional field. +func (g *StoriesGetStoryReactionsListRequest) SetOffset(value string) { + g.Flags.Set(1) + g.Offset = value +} + +// GetOffset returns value of Offset conditional field and +// boolean which is true if field was set. +func (g *StoriesGetStoryReactionsListRequest) GetOffset() (value string, ok bool) { + if g == nil { + return + } + if !g.Flags.Has(1) { + return value, false + } + return g.Offset, true +} + +// GetLimit returns value of Limit field. +func (g *StoriesGetStoryReactionsListRequest) GetLimit() (value int) { + if g == nil { + return + } + return g.Limit +} + +// StoriesGetStoryReactionsList invokes method stories.getStoryReactionsList#b9b2881f returning error if any. +// +// See https://core.telegram.org/method/stories.getStoryReactionsList for reference. +func (c *Client) StoriesGetStoryReactionsList(ctx context.Context, request *StoriesGetStoryReactionsListRequest) (*StoriesStoryReactionsList, error) { + var result StoriesStoryReactionsList + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_stories_get_story_reactions_list_slices_gen.go b/tg/tl_stories_get_story_reactions_list_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_stories_get_story_reactions_list_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_stories_get_story_views_list_gen.go b/tg/tl_stories_get_story_views_list_gen.go index 30c9fb5e6a..c5ee8af8b5 100644 --- a/tg/tl_stories_get_story_views_list_gen.go +++ b/tg/tl_stories_get_story_views_list_gen.go @@ -57,6 +57,8 @@ type StoriesGetStoryViewsListRequest struct { // 1) https://core.telegram.org/constructor/storyView // 2) https://core.telegram.org/constructor/storyView ReactionsFirst bool + // ForwardsFirst field of StoriesGetStoryViewsListRequest. + ForwardsFirst bool // Peer where the story was posted Peer InputPeerClass // Search for specific peers @@ -101,6 +103,9 @@ func (g *StoriesGetStoryViewsListRequest) Zero() bool { if !(g.ReactionsFirst == false) { return false } + if !(g.ForwardsFirst == false) { + return false + } if !(g.Peer == nil) { return false } @@ -133,6 +138,7 @@ func (g *StoriesGetStoryViewsListRequest) String() string { func (g *StoriesGetStoryViewsListRequest) FillFrom(from interface { GetJustContacts() (value bool) GetReactionsFirst() (value bool) + GetForwardsFirst() (value bool) GetPeer() (value InputPeerClass) GetQ() (value string, ok bool) GetID() (value int) @@ -141,6 +147,7 @@ func (g *StoriesGetStoryViewsListRequest) FillFrom(from interface { }) { g.JustContacts = from.GetJustContacts() g.ReactionsFirst = from.GetReactionsFirst() + g.ForwardsFirst = from.GetForwardsFirst() g.Peer = from.GetPeer() if val, ok := from.GetQ(); ok { g.Q = val @@ -184,6 +191,11 @@ func (g *StoriesGetStoryViewsListRequest) TypeInfo() tdp.Type { SchemaName: "reactions_first", Null: !g.Flags.Has(2), }, + { + Name: "ForwardsFirst", + SchemaName: "forwards_first", + Null: !g.Flags.Has(3), + }, { Name: "Peer", SchemaName: "peer", @@ -217,6 +229,9 @@ func (g *StoriesGetStoryViewsListRequest) SetFlags() { if !(g.ReactionsFirst == false) { g.Flags.Set(2) } + if !(g.ForwardsFirst == false) { + g.Flags.Set(3) + } if !(g.Q == "") { g.Flags.Set(1) } @@ -278,6 +293,7 @@ func (g *StoriesGetStoryViewsListRequest) DecodeBare(b *bin.Buffer) error { } g.JustContacts = g.Flags.Has(0) g.ReactionsFirst = g.Flags.Has(2) + g.ForwardsFirst = g.Flags.Has(3) { value, err := DecodeInputPeer(b) if err != nil { @@ -354,6 +370,25 @@ func (g *StoriesGetStoryViewsListRequest) GetReactionsFirst() (value bool) { return g.Flags.Has(2) } +// SetForwardsFirst sets value of ForwardsFirst conditional field. +func (g *StoriesGetStoryViewsListRequest) SetForwardsFirst(value bool) { + if value { + g.Flags.Set(3) + g.ForwardsFirst = true + } else { + g.Flags.Unset(3) + g.ForwardsFirst = false + } +} + +// GetForwardsFirst returns value of ForwardsFirst conditional field. +func (g *StoriesGetStoryViewsListRequest) GetForwardsFirst() (value bool) { + if g == nil { + return + } + return g.Flags.Has(3) +} + // GetPeer returns value of Peer field. func (g *StoriesGetStoryViewsListRequest) GetPeer() (value InputPeerClass) { if g == nil { diff --git a/tg/tl_stories_story_reactions_list_gen.go b/tg/tl_stories_story_reactions_list_gen.go new file mode 100644 index 0000000000..da005f1739 --- /dev/null +++ b/tg/tl_stories_story_reactions_list_gen.go @@ -0,0 +1,377 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StoriesStoryReactionsList represents TL type `stories.storyReactionsList#aa5f789c`. +// +// See https://core.telegram.org/constructor/stories.storyReactionsList for reference. +type StoriesStoryReactionsList struct { + // Flags field of StoriesStoryReactionsList. + Flags bin.Fields + // Count field of StoriesStoryReactionsList. + Count int + // Reactions field of StoriesStoryReactionsList. + Reactions []StoryReactionClass + // Chats field of StoriesStoryReactionsList. + Chats []ChatClass + // Users field of StoriesStoryReactionsList. + Users []UserClass + // NextOffset field of StoriesStoryReactionsList. + // + // Use SetNextOffset and GetNextOffset helpers. + NextOffset string +} + +// StoriesStoryReactionsListTypeID is TL type id of StoriesStoryReactionsList. +const StoriesStoryReactionsListTypeID = 0xaa5f789c + +// Ensuring interfaces in compile-time for StoriesStoryReactionsList. +var ( + _ bin.Encoder = &StoriesStoryReactionsList{} + _ bin.Decoder = &StoriesStoryReactionsList{} + _ bin.BareEncoder = &StoriesStoryReactionsList{} + _ bin.BareDecoder = &StoriesStoryReactionsList{} +) + +func (s *StoriesStoryReactionsList) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Count == 0) { + return false + } + if !(s.Reactions == nil) { + return false + } + if !(s.Chats == nil) { + return false + } + if !(s.Users == nil) { + return false + } + if !(s.NextOffset == "") { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoriesStoryReactionsList) String() string { + if s == nil { + return "StoriesStoryReactionsList(nil)" + } + type Alias StoriesStoryReactionsList + return fmt.Sprintf("StoriesStoryReactionsList%+v", Alias(*s)) +} + +// FillFrom fills StoriesStoryReactionsList from given interface. +func (s *StoriesStoryReactionsList) FillFrom(from interface { + GetCount() (value int) + GetReactions() (value []StoryReactionClass) + GetChats() (value []ChatClass) + GetUsers() (value []UserClass) + GetNextOffset() (value string, ok bool) +}) { + s.Count = from.GetCount() + s.Reactions = from.GetReactions() + s.Chats = from.GetChats() + s.Users = from.GetUsers() + if val, ok := from.GetNextOffset(); ok { + s.NextOffset = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoriesStoryReactionsList) TypeID() uint32 { + return StoriesStoryReactionsListTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoriesStoryReactionsList) TypeName() string { + return "stories.storyReactionsList" +} + +// TypeInfo returns info about TL type. +func (s *StoriesStoryReactionsList) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stories.storyReactionsList", + ID: StoriesStoryReactionsListTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Count", + SchemaName: "count", + }, + { + Name: "Reactions", + SchemaName: "reactions", + }, + { + Name: "Chats", + SchemaName: "chats", + }, + { + Name: "Users", + SchemaName: "users", + }, + { + Name: "NextOffset", + SchemaName: "next_offset", + Null: !s.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StoriesStoryReactionsList) SetFlags() { + if !(s.NextOffset == "") { + s.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (s *StoriesStoryReactionsList) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stories.storyReactionsList#aa5f789c as nil") + } + b.PutID(StoriesStoryReactionsListTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoriesStoryReactionsList) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stories.storyReactionsList#aa5f789c as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.storyReactionsList#aa5f789c: field flags: %w", err) + } + b.PutInt(s.Count) + b.PutVectorHeader(len(s.Reactions)) + for idx, v := range s.Reactions { + if v == nil { + return fmt.Errorf("unable to encode stories.storyReactionsList#aa5f789c: field reactions element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.storyReactionsList#aa5f789c: field reactions 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 stories.storyReactionsList#aa5f789c: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.storyReactionsList#aa5f789c: field chats 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 stories.storyReactionsList#aa5f789c: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.storyReactionsList#aa5f789c: field users element with index %d: %w", idx, err) + } + } + if s.Flags.Has(0) { + b.PutString(s.NextOffset) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoriesStoryReactionsList) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stories.storyReactionsList#aa5f789c to nil") + } + if err := b.ConsumeID(StoriesStoryReactionsListTypeID); err != nil { + return fmt.Errorf("unable to decode stories.storyReactionsList#aa5f789c: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoriesStoryReactionsList) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stories.storyReactionsList#aa5f789c to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode stories.storyReactionsList#aa5f789c: field flags: %w", err) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stories.storyReactionsList#aa5f789c: field count: %w", err) + } + s.Count = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stories.storyReactionsList#aa5f789c: field reactions: %w", err) + } + + if headerLen > 0 { + s.Reactions = make([]StoryReactionClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeStoryReaction(b) + if err != nil { + return fmt.Errorf("unable to decode stories.storyReactionsList#aa5f789c: field reactions: %w", err) + } + s.Reactions = append(s.Reactions, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stories.storyReactionsList#aa5f789c: 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 stories.storyReactionsList#aa5f789c: field chats: %w", err) + } + s.Chats = append(s.Chats, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stories.storyReactionsList#aa5f789c: field users: %w", err) + } + + if headerLen > 0 { + s.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeUser(b) + if err != nil { + return fmt.Errorf("unable to decode stories.storyReactionsList#aa5f789c: field users: %w", err) + } + s.Users = append(s.Users, value) + } + } + if s.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode stories.storyReactionsList#aa5f789c: field next_offset: %w", err) + } + s.NextOffset = value + } + return nil +} + +// GetCount returns value of Count field. +func (s *StoriesStoryReactionsList) GetCount() (value int) { + if s == nil { + return + } + return s.Count +} + +// GetReactions returns value of Reactions field. +func (s *StoriesStoryReactionsList) GetReactions() (value []StoryReactionClass) { + if s == nil { + return + } + return s.Reactions +} + +// GetChats returns value of Chats field. +func (s *StoriesStoryReactionsList) GetChats() (value []ChatClass) { + if s == nil { + return + } + return s.Chats +} + +// GetUsers returns value of Users field. +func (s *StoriesStoryReactionsList) GetUsers() (value []UserClass) { + if s == nil { + return + } + return s.Users +} + +// SetNextOffset sets value of NextOffset conditional field. +func (s *StoriesStoryReactionsList) SetNextOffset(value string) { + s.Flags.Set(0) + s.NextOffset = value +} + +// GetNextOffset returns value of NextOffset conditional field and +// boolean which is true if field was set. +func (s *StoriesStoryReactionsList) GetNextOffset() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(0) { + return value, false + } + return s.NextOffset, true +} + +// MapReactions returns field Reactions wrapped in StoryReactionClassArray helper. +func (s *StoriesStoryReactionsList) MapReactions() (value StoryReactionClassArray) { + return StoryReactionClassArray(s.Reactions) +} + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (s *StoriesStoryReactionsList) MapChats() (value ChatClassArray) { + return ChatClassArray(s.Chats) +} + +// MapUsers returns field Users wrapped in UserClassArray helper. +func (s *StoriesStoryReactionsList) MapUsers() (value UserClassArray) { + return UserClassArray(s.Users) +} diff --git a/tg/tl_stories_story_reactions_list_slices_gen.go b/tg/tl_stories_story_reactions_list_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_stories_story_reactions_list_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_stories_story_views_list_gen.go b/tg/tl_stories_story_views_list_gen.go index f644bebbbd..b53bbe501e 100644 --- a/tg/tl_stories_story_views_list_gen.go +++ b/tg/tl_stories_story_views_list_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StoriesStoryViewsList represents TL type `stories.storyViewsList#46e9b9ec`. +// StoriesStoryViewsList represents TL type `stories.storyViewsList#59d78fc5`. // Reaction and view counters for a story¹ // // Links: @@ -46,10 +46,16 @@ type StoriesStoryViewsList struct { Flags bin.Fields // Total number of results that can be fetched Count int + // ViewsCount field of StoriesStoryViewsList. + ViewsCount int + // ForwardsCount field of StoriesStoryViewsList. + ForwardsCount int // Number of reactions that were added to the story ReactionsCount int // Story view date and reaction information - Views []StoryView + Views []StoryViewClass + // Chats field of StoriesStoryViewsList. + Chats []ChatClass // Mentioned users Users []UserClass // Offset for pagination @@ -59,7 +65,7 @@ type StoriesStoryViewsList struct { } // StoriesStoryViewsListTypeID is TL type id of StoriesStoryViewsList. -const StoriesStoryViewsListTypeID = 0x46e9b9ec +const StoriesStoryViewsListTypeID = 0x59d78fc5 // Ensuring interfaces in compile-time for StoriesStoryViewsList. var ( @@ -79,12 +85,21 @@ func (s *StoriesStoryViewsList) Zero() bool { if !(s.Count == 0) { return false } + if !(s.ViewsCount == 0) { + return false + } + if !(s.ForwardsCount == 0) { + return false + } if !(s.ReactionsCount == 0) { return false } if !(s.Views == nil) { return false } + if !(s.Chats == nil) { + return false + } if !(s.Users == nil) { return false } @@ -107,14 +122,20 @@ func (s *StoriesStoryViewsList) String() string { // FillFrom fills StoriesStoryViewsList from given interface. func (s *StoriesStoryViewsList) FillFrom(from interface { GetCount() (value int) + GetViewsCount() (value int) + GetForwardsCount() (value int) GetReactionsCount() (value int) - GetViews() (value []StoryView) + GetViews() (value []StoryViewClass) + GetChats() (value []ChatClass) GetUsers() (value []UserClass) GetNextOffset() (value string, ok bool) }) { s.Count = from.GetCount() + s.ViewsCount = from.GetViewsCount() + s.ForwardsCount = from.GetForwardsCount() s.ReactionsCount = from.GetReactionsCount() s.Views = from.GetViews() + s.Chats = from.GetChats() s.Users = from.GetUsers() if val, ok := from.GetNextOffset(); ok { s.NextOffset = val @@ -149,6 +170,14 @@ func (s *StoriesStoryViewsList) TypeInfo() tdp.Type { Name: "Count", SchemaName: "count", }, + { + Name: "ViewsCount", + SchemaName: "views_count", + }, + { + Name: "ForwardsCount", + SchemaName: "forwards_count", + }, { Name: "ReactionsCount", SchemaName: "reactions_count", @@ -157,6 +186,10 @@ func (s *StoriesStoryViewsList) TypeInfo() tdp.Type { Name: "Views", SchemaName: "views", }, + { + Name: "Chats", + SchemaName: "chats", + }, { Name: "Users", SchemaName: "users", @@ -180,7 +213,7 @@ func (s *StoriesStoryViewsList) SetFlags() { // Encode implements bin.Encoder. func (s *StoriesStoryViewsList) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stories.storyViewsList#46e9b9ec as nil") + return fmt.Errorf("can't encode stories.storyViewsList#59d78fc5 as nil") } b.PutID(StoriesStoryViewsListTypeID) return s.EncodeBare(b) @@ -189,27 +222,41 @@ func (s *StoriesStoryViewsList) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StoriesStoryViewsList) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stories.storyViewsList#46e9b9ec as nil") + return fmt.Errorf("can't encode stories.storyViewsList#59d78fc5 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.storyViewsList#46e9b9ec: field flags: %w", err) + return fmt.Errorf("unable to encode stories.storyViewsList#59d78fc5: field flags: %w", err) } b.PutInt(s.Count) + b.PutInt(s.ViewsCount) + b.PutInt(s.ForwardsCount) b.PutInt(s.ReactionsCount) b.PutVectorHeader(len(s.Views)) for idx, v := range s.Views { + if v == nil { + return fmt.Errorf("unable to encode stories.storyViewsList#59d78fc5: field views element with index %d is nil", idx) + } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.storyViewsList#46e9b9ec: field views element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stories.storyViewsList#59d78fc5: field views 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 stories.storyViewsList#59d78fc5: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.storyViewsList#59d78fc5: field chats 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 stories.storyViewsList#46e9b9ec: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode stories.storyViewsList#59d78fc5: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.storyViewsList#46e9b9ec: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stories.storyViewsList#59d78fc5: field users element with index %d: %w", idx, err) } } if s.Flags.Has(0) { @@ -221,10 +268,10 @@ func (s *StoriesStoryViewsList) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *StoriesStoryViewsList) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stories.storyViewsList#46e9b9ec to nil") + return fmt.Errorf("can't decode stories.storyViewsList#59d78fc5 to nil") } if err := b.ConsumeID(StoriesStoryViewsListTypeID); err != nil { - return fmt.Errorf("unable to decode stories.storyViewsList#46e9b9ec: %w", err) + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: %w", err) } return s.DecodeBare(b) } @@ -232,40 +279,54 @@ func (s *StoriesStoryViewsList) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StoriesStoryViewsList) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stories.storyViewsList#46e9b9ec to nil") + return fmt.Errorf("can't decode stories.storyViewsList#59d78fc5 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode stories.storyViewsList#46e9b9ec: field flags: %w", err) + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field flags: %w", err) } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stories.storyViewsList#46e9b9ec: field count: %w", err) + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field count: %w", err) } s.Count = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stories.storyViewsList#46e9b9ec: field reactions_count: %w", err) + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field views_count: %w", err) + } + s.ViewsCount = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field forwards_count: %w", err) + } + s.ForwardsCount = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field reactions_count: %w", err) } s.ReactionsCount = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode stories.storyViewsList#46e9b9ec: field views: %w", err) + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field views: %w", err) } if headerLen > 0 { - s.Views = make([]StoryView, 0, headerLen%bin.PreallocateLimit) + s.Views = make([]StoryViewClass, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { - var value StoryView - if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode stories.storyViewsList#46e9b9ec: field views: %w", err) + value, err := DecodeStoryView(b) + if err != nil { + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field views: %w", err) } s.Views = append(s.Views, value) } @@ -273,7 +334,24 @@ func (s *StoriesStoryViewsList) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode stories.storyViewsList#46e9b9ec: field users: %w", err) + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: 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 stories.storyViewsList#59d78fc5: field chats: %w", err) + } + s.Chats = append(s.Chats, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field users: %w", err) } if headerLen > 0 { @@ -282,7 +360,7 @@ func (s *StoriesStoryViewsList) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeUser(b) if err != nil { - return fmt.Errorf("unable to decode stories.storyViewsList#46e9b9ec: field users: %w", err) + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field users: %w", err) } s.Users = append(s.Users, value) } @@ -290,7 +368,7 @@ func (s *StoriesStoryViewsList) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stories.storyViewsList#46e9b9ec: field next_offset: %w", err) + return fmt.Errorf("unable to decode stories.storyViewsList#59d78fc5: field next_offset: %w", err) } s.NextOffset = value } @@ -305,6 +383,22 @@ func (s *StoriesStoryViewsList) GetCount() (value int) { return s.Count } +// GetViewsCount returns value of ViewsCount field. +func (s *StoriesStoryViewsList) GetViewsCount() (value int) { + if s == nil { + return + } + return s.ViewsCount +} + +// GetForwardsCount returns value of ForwardsCount field. +func (s *StoriesStoryViewsList) GetForwardsCount() (value int) { + if s == nil { + return + } + return s.ForwardsCount +} + // GetReactionsCount returns value of ReactionsCount field. func (s *StoriesStoryViewsList) GetReactionsCount() (value int) { if s == nil { @@ -314,13 +408,21 @@ func (s *StoriesStoryViewsList) GetReactionsCount() (value int) { } // GetViews returns value of Views field. -func (s *StoriesStoryViewsList) GetViews() (value []StoryView) { +func (s *StoriesStoryViewsList) GetViews() (value []StoryViewClass) { if s == nil { return } return s.Views } +// GetChats returns value of Chats field. +func (s *StoriesStoryViewsList) GetChats() (value []ChatClass) { + if s == nil { + return + } + return s.Chats +} + // GetUsers returns value of Users field. func (s *StoriesStoryViewsList) GetUsers() (value []UserClass) { if s == nil { @@ -347,6 +449,16 @@ func (s *StoriesStoryViewsList) GetNextOffset() (value string, ok bool) { return s.NextOffset, true } +// MapViews returns field Views wrapped in StoryViewClassArray helper. +func (s *StoriesStoryViewsList) MapViews() (value StoryViewClassArray) { + return StoryViewClassArray(s.Views) +} + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (s *StoriesStoryViewsList) MapChats() (value ChatClassArray) { + return ChatClassArray(s.Chats) +} + // MapUsers returns field Users wrapped in UserClassArray helper. func (s *StoriesStoryViewsList) MapUsers() (value UserClassArray) { return UserClassArray(s.Users) diff --git a/tg/tl_story_reaction_gen.go b/tg/tl_story_reaction_gen.go new file mode 100644 index 0000000000..34f353348c --- /dev/null +++ b/tg/tl_story_reaction_gen.go @@ -0,0 +1,637 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StoryReaction represents TL type `storyReaction#6090d6d5`. +// +// See https://core.telegram.org/constructor/storyReaction for reference. +type StoryReaction struct { + // PeerID field of StoryReaction. + PeerID PeerClass + // Date field of StoryReaction. + Date int + // Reaction field of StoryReaction. + Reaction ReactionClass +} + +// StoryReactionTypeID is TL type id of StoryReaction. +const StoryReactionTypeID = 0x6090d6d5 + +// construct implements constructor of StoryReactionClass. +func (s StoryReaction) construct() StoryReactionClass { return &s } + +// Ensuring interfaces in compile-time for StoryReaction. +var ( + _ bin.Encoder = &StoryReaction{} + _ bin.Decoder = &StoryReaction{} + _ bin.BareEncoder = &StoryReaction{} + _ bin.BareDecoder = &StoryReaction{} + + _ StoryReactionClass = &StoryReaction{} +) + +func (s *StoryReaction) Zero() bool { + if s == nil { + return true + } + if !(s.PeerID == nil) { + return false + } + if !(s.Date == 0) { + return false + } + if !(s.Reaction == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryReaction) String() string { + if s == nil { + return "StoryReaction(nil)" + } + type Alias StoryReaction + return fmt.Sprintf("StoryReaction%+v", Alias(*s)) +} + +// FillFrom fills StoryReaction from given interface. +func (s *StoryReaction) FillFrom(from interface { + GetPeerID() (value PeerClass) + GetDate() (value int) + GetReaction() (value ReactionClass) +}) { + s.PeerID = from.GetPeerID() + s.Date = from.GetDate() + s.Reaction = from.GetReaction() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryReaction) TypeID() uint32 { + return StoryReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryReaction) TypeName() string { + return "storyReaction" +} + +// TypeInfo returns info about TL type. +func (s *StoryReaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyReaction", + ID: StoryReactionTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "PeerID", + SchemaName: "peer_id", + }, + { + Name: "Date", + SchemaName: "date", + }, + { + Name: "Reaction", + SchemaName: "reaction", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryReaction) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyReaction#6090d6d5 as nil") + } + b.PutID(StoryReactionTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryReaction) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyReaction#6090d6d5 as nil") + } + if s.PeerID == nil { + return fmt.Errorf("unable to encode storyReaction#6090d6d5: field peer_id is nil") + } + if err := s.PeerID.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyReaction#6090d6d5: field peer_id: %w", err) + } + b.PutInt(s.Date) + if s.Reaction == nil { + return fmt.Errorf("unable to encode storyReaction#6090d6d5: field reaction is nil") + } + if err := s.Reaction.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyReaction#6090d6d5: field reaction: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryReaction) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyReaction#6090d6d5 to nil") + } + if err := b.ConsumeID(StoryReactionTypeID); err != nil { + return fmt.Errorf("unable to decode storyReaction#6090d6d5: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryReaction) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyReaction#6090d6d5 to nil") + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode storyReaction#6090d6d5: field peer_id: %w", err) + } + s.PeerID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode storyReaction#6090d6d5: field date: %w", err) + } + s.Date = value + } + { + value, err := DecodeReaction(b) + if err != nil { + return fmt.Errorf("unable to decode storyReaction#6090d6d5: field reaction: %w", err) + } + s.Reaction = value + } + return nil +} + +// GetPeerID returns value of PeerID field. +func (s *StoryReaction) GetPeerID() (value PeerClass) { + if s == nil { + return + } + return s.PeerID +} + +// GetDate returns value of Date field. +func (s *StoryReaction) GetDate() (value int) { + if s == nil { + return + } + return s.Date +} + +// GetReaction returns value of Reaction field. +func (s *StoryReaction) GetReaction() (value ReactionClass) { + if s == nil { + return + } + return s.Reaction +} + +// StoryReactionPublicForward represents TL type `storyReactionPublicForward#bbab2643`. +// +// See https://core.telegram.org/constructor/storyReactionPublicForward for reference. +type StoryReactionPublicForward struct { + // Message field of StoryReactionPublicForward. + Message MessageClass +} + +// StoryReactionPublicForwardTypeID is TL type id of StoryReactionPublicForward. +const StoryReactionPublicForwardTypeID = 0xbbab2643 + +// construct implements constructor of StoryReactionClass. +func (s StoryReactionPublicForward) construct() StoryReactionClass { return &s } + +// Ensuring interfaces in compile-time for StoryReactionPublicForward. +var ( + _ bin.Encoder = &StoryReactionPublicForward{} + _ bin.Decoder = &StoryReactionPublicForward{} + _ bin.BareEncoder = &StoryReactionPublicForward{} + _ bin.BareDecoder = &StoryReactionPublicForward{} + + _ StoryReactionClass = &StoryReactionPublicForward{} +) + +func (s *StoryReactionPublicForward) Zero() bool { + if s == nil { + return true + } + if !(s.Message == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryReactionPublicForward) String() string { + if s == nil { + return "StoryReactionPublicForward(nil)" + } + type Alias StoryReactionPublicForward + return fmt.Sprintf("StoryReactionPublicForward%+v", Alias(*s)) +} + +// FillFrom fills StoryReactionPublicForward from given interface. +func (s *StoryReactionPublicForward) FillFrom(from interface { + GetMessage() (value MessageClass) +}) { + s.Message = from.GetMessage() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryReactionPublicForward) TypeID() uint32 { + return StoryReactionPublicForwardTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryReactionPublicForward) TypeName() string { + return "storyReactionPublicForward" +} + +// TypeInfo returns info about TL type. +func (s *StoryReactionPublicForward) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyReactionPublicForward", + ID: StoryReactionPublicForwardTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Message", + SchemaName: "message", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryReactionPublicForward) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyReactionPublicForward#bbab2643 as nil") + } + b.PutID(StoryReactionPublicForwardTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryReactionPublicForward) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyReactionPublicForward#bbab2643 as nil") + } + if s.Message == nil { + return fmt.Errorf("unable to encode storyReactionPublicForward#bbab2643: field message is nil") + } + if err := s.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyReactionPublicForward#bbab2643: field message: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryReactionPublicForward) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyReactionPublicForward#bbab2643 to nil") + } + if err := b.ConsumeID(StoryReactionPublicForwardTypeID); err != nil { + return fmt.Errorf("unable to decode storyReactionPublicForward#bbab2643: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryReactionPublicForward) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyReactionPublicForward#bbab2643 to nil") + } + { + value, err := DecodeMessage(b) + if err != nil { + return fmt.Errorf("unable to decode storyReactionPublicForward#bbab2643: field message: %w", err) + } + s.Message = value + } + return nil +} + +// GetMessage returns value of Message field. +func (s *StoryReactionPublicForward) GetMessage() (value MessageClass) { + if s == nil { + return + } + return s.Message +} + +// StoryReactionPublicRepost represents TL type `storyReactionPublicRepost#cfcd0f13`. +// +// See https://core.telegram.org/constructor/storyReactionPublicRepost for reference. +type StoryReactionPublicRepost struct { + // PeerID field of StoryReactionPublicRepost. + PeerID PeerClass + // Story field of StoryReactionPublicRepost. + Story StoryItemClass +} + +// StoryReactionPublicRepostTypeID is TL type id of StoryReactionPublicRepost. +const StoryReactionPublicRepostTypeID = 0xcfcd0f13 + +// construct implements constructor of StoryReactionClass. +func (s StoryReactionPublicRepost) construct() StoryReactionClass { return &s } + +// Ensuring interfaces in compile-time for StoryReactionPublicRepost. +var ( + _ bin.Encoder = &StoryReactionPublicRepost{} + _ bin.Decoder = &StoryReactionPublicRepost{} + _ bin.BareEncoder = &StoryReactionPublicRepost{} + _ bin.BareDecoder = &StoryReactionPublicRepost{} + + _ StoryReactionClass = &StoryReactionPublicRepost{} +) + +func (s *StoryReactionPublicRepost) Zero() bool { + if s == nil { + return true + } + if !(s.PeerID == nil) { + return false + } + if !(s.Story == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryReactionPublicRepost) String() string { + if s == nil { + return "StoryReactionPublicRepost(nil)" + } + type Alias StoryReactionPublicRepost + return fmt.Sprintf("StoryReactionPublicRepost%+v", Alias(*s)) +} + +// FillFrom fills StoryReactionPublicRepost from given interface. +func (s *StoryReactionPublicRepost) FillFrom(from interface { + GetPeerID() (value PeerClass) + GetStory() (value StoryItemClass) +}) { + s.PeerID = from.GetPeerID() + s.Story = from.GetStory() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryReactionPublicRepost) TypeID() uint32 { + return StoryReactionPublicRepostTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryReactionPublicRepost) TypeName() string { + return "storyReactionPublicRepost" +} + +// TypeInfo returns info about TL type. +func (s *StoryReactionPublicRepost) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyReactionPublicRepost", + ID: StoryReactionPublicRepostTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "PeerID", + SchemaName: "peer_id", + }, + { + Name: "Story", + SchemaName: "story", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StoryReactionPublicRepost) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyReactionPublicRepost#cfcd0f13 as nil") + } + b.PutID(StoryReactionPublicRepostTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryReactionPublicRepost) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyReactionPublicRepost#cfcd0f13 as nil") + } + if s.PeerID == nil { + return fmt.Errorf("unable to encode storyReactionPublicRepost#cfcd0f13: field peer_id is nil") + } + if err := s.PeerID.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyReactionPublicRepost#cfcd0f13: field peer_id: %w", err) + } + if s.Story == nil { + return fmt.Errorf("unable to encode storyReactionPublicRepost#cfcd0f13: field story is nil") + } + if err := s.Story.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyReactionPublicRepost#cfcd0f13: field story: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryReactionPublicRepost) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyReactionPublicRepost#cfcd0f13 to nil") + } + if err := b.ConsumeID(StoryReactionPublicRepostTypeID); err != nil { + return fmt.Errorf("unable to decode storyReactionPublicRepost#cfcd0f13: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryReactionPublicRepost) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyReactionPublicRepost#cfcd0f13 to nil") + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode storyReactionPublicRepost#cfcd0f13: field peer_id: %w", err) + } + s.PeerID = value + } + { + value, err := DecodeStoryItem(b) + if err != nil { + return fmt.Errorf("unable to decode storyReactionPublicRepost#cfcd0f13: field story: %w", err) + } + s.Story = value + } + return nil +} + +// GetPeerID returns value of PeerID field. +func (s *StoryReactionPublicRepost) GetPeerID() (value PeerClass) { + if s == nil { + return + } + return s.PeerID +} + +// GetStory returns value of Story field. +func (s *StoryReactionPublicRepost) GetStory() (value StoryItemClass) { + if s == nil { + return + } + return s.Story +} + +// StoryReactionClassName is schema name of StoryReactionClass. +const StoryReactionClassName = "StoryReaction" + +// StoryReactionClass represents StoryReaction generic type. +// +// See https://core.telegram.org/type/StoryReaction for reference. +// +// Example: +// +// g, err := tg.DecodeStoryReaction(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.StoryReaction: // storyReaction#6090d6d5 +// case *tg.StoryReactionPublicForward: // storyReactionPublicForward#bbab2643 +// case *tg.StoryReactionPublicRepost: // storyReactionPublicRepost#cfcd0f13 +// default: panic(v) +// } +type StoryReactionClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() StoryReactionClass + + // 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 +} + +// DecodeStoryReaction implements binary de-serialization for StoryReactionClass. +func DecodeStoryReaction(buf *bin.Buffer) (StoryReactionClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case StoryReactionTypeID: + // Decoding storyReaction#6090d6d5. + v := StoryReaction{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryReactionClass: %w", err) + } + return &v, nil + case StoryReactionPublicForwardTypeID: + // Decoding storyReactionPublicForward#bbab2643. + v := StoryReactionPublicForward{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryReactionClass: %w", err) + } + return &v, nil + case StoryReactionPublicRepostTypeID: + // Decoding storyReactionPublicRepost#cfcd0f13. + v := StoryReactionPublicRepost{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryReactionClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StoryReactionClass: %w", bin.NewUnexpectedID(id)) + } +} + +// StoryReaction boxes the StoryReactionClass providing a helper. +type StoryReactionBox struct { + StoryReaction StoryReactionClass +} + +// Decode implements bin.Decoder for StoryReactionBox. +func (b *StoryReactionBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode StoryReactionBox to nil") + } + v, err := DecodeStoryReaction(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StoryReaction = v + return nil +} + +// Encode implements bin.Encode for StoryReactionBox. +func (b *StoryReactionBox) Encode(buf *bin.Buffer) error { + if b == nil || b.StoryReaction == nil { + return fmt.Errorf("unable to encode StoryReactionClass as nil") + } + return b.StoryReaction.Encode(buf) +} diff --git a/tg/tl_story_reaction_slices_gen.go b/tg/tl_story_reaction_slices_gen.go new file mode 100644 index 0000000000..0754508620 --- /dev/null +++ b/tg/tl_story_reaction_slices_gen.go @@ -0,0 +1,416 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// StoryReactionClassArray is adapter for slice of StoryReactionClass. +type StoryReactionClassArray []StoryReactionClass + +// Sort sorts slice of StoryReactionClass. +func (s StoryReactionClassArray) Sort(less func(a, b StoryReactionClass) bool) StoryReactionClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StoryReactionClass. +func (s StoryReactionClassArray) SortStable(less func(a, b StoryReactionClass) bool) StoryReactionClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StoryReactionClass. +func (s StoryReactionClassArray) Retain(keep func(x StoryReactionClass) bool) StoryReactionClassArray { + 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 StoryReactionClassArray) First() (v StoryReactionClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StoryReactionClassArray) Last() (v StoryReactionClass, 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 *StoryReactionClassArray) PopFirst() (v StoryReactionClass, 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 StoryReactionClass + 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 *StoryReactionClassArray) Pop() (v StoryReactionClass, 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 +} + +// AsStoryReaction returns copy with only StoryReaction constructors. +func (s StoryReactionClassArray) AsStoryReaction() (to StoryReactionArray) { + for _, elem := range s { + value, ok := elem.(*StoryReaction) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsStoryReactionPublicForward returns copy with only StoryReactionPublicForward constructors. +func (s StoryReactionClassArray) AsStoryReactionPublicForward() (to StoryReactionPublicForwardArray) { + for _, elem := range s { + value, ok := elem.(*StoryReactionPublicForward) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsStoryReactionPublicRepost returns copy with only StoryReactionPublicRepost constructors. +func (s StoryReactionClassArray) AsStoryReactionPublicRepost() (to StoryReactionPublicRepostArray) { + for _, elem := range s { + value, ok := elem.(*StoryReactionPublicRepost) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// StoryReactionArray is adapter for slice of StoryReaction. +type StoryReactionArray []StoryReaction + +// Sort sorts slice of StoryReaction. +func (s StoryReactionArray) Sort(less func(a, b StoryReaction) bool) StoryReactionArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StoryReaction. +func (s StoryReactionArray) SortStable(less func(a, b StoryReaction) bool) StoryReactionArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StoryReaction. +func (s StoryReactionArray) Retain(keep func(x StoryReaction) bool) StoryReactionArray { + 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 StoryReactionArray) First() (v StoryReaction, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StoryReactionArray) Last() (v StoryReaction, 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 *StoryReactionArray) PopFirst() (v StoryReaction, 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 StoryReaction + 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 *StoryReactionArray) Pop() (v StoryReaction, 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 StoryReaction by Date. +func (s StoryReactionArray) SortByDate() StoryReactionArray { + return s.Sort(func(a, b StoryReaction) bool { + return a.GetDate() < b.GetDate() + }) +} + +// SortStableByDate sorts slice of StoryReaction by Date. +func (s StoryReactionArray) SortStableByDate() StoryReactionArray { + return s.SortStable(func(a, b StoryReaction) bool { + return a.GetDate() < b.GetDate() + }) +} + +// StoryReactionPublicForwardArray is adapter for slice of StoryReactionPublicForward. +type StoryReactionPublicForwardArray []StoryReactionPublicForward + +// Sort sorts slice of StoryReactionPublicForward. +func (s StoryReactionPublicForwardArray) Sort(less func(a, b StoryReactionPublicForward) bool) StoryReactionPublicForwardArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StoryReactionPublicForward. +func (s StoryReactionPublicForwardArray) SortStable(less func(a, b StoryReactionPublicForward) bool) StoryReactionPublicForwardArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StoryReactionPublicForward. +func (s StoryReactionPublicForwardArray) Retain(keep func(x StoryReactionPublicForward) bool) StoryReactionPublicForwardArray { + 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 StoryReactionPublicForwardArray) First() (v StoryReactionPublicForward, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StoryReactionPublicForwardArray) Last() (v StoryReactionPublicForward, 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 *StoryReactionPublicForwardArray) PopFirst() (v StoryReactionPublicForward, 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 StoryReactionPublicForward + 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 *StoryReactionPublicForwardArray) Pop() (v StoryReactionPublicForward, 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 +} + +// StoryReactionPublicRepostArray is adapter for slice of StoryReactionPublicRepost. +type StoryReactionPublicRepostArray []StoryReactionPublicRepost + +// Sort sorts slice of StoryReactionPublicRepost. +func (s StoryReactionPublicRepostArray) Sort(less func(a, b StoryReactionPublicRepost) bool) StoryReactionPublicRepostArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StoryReactionPublicRepost. +func (s StoryReactionPublicRepostArray) SortStable(less func(a, b StoryReactionPublicRepost) bool) StoryReactionPublicRepostArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StoryReactionPublicRepost. +func (s StoryReactionPublicRepostArray) Retain(keep func(x StoryReactionPublicRepost) bool) StoryReactionPublicRepostArray { + 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 StoryReactionPublicRepostArray) First() (v StoryReactionPublicRepost, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StoryReactionPublicRepostArray) Last() (v StoryReactionPublicRepost, 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 *StoryReactionPublicRepostArray) PopFirst() (v StoryReactionPublicRepost, 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 StoryReactionPublicRepost + 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 *StoryReactionPublicRepostArray) Pop() (v StoryReactionPublicRepost, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_story_view_gen.go b/tg/tl_story_view_gen.go index 226b5adf38..0429f3fd86 100644 --- a/tg/tl_story_view_gen.go +++ b/tg/tl_story_view_gen.go @@ -68,12 +68,17 @@ type StoryView struct { // StoryViewTypeID is TL type id of StoryView. const StoryViewTypeID = 0xb0bdeac5 +// construct implements constructor of StoryViewClass. +func (s StoryView) construct() StoryViewClass { return &s } + // Ensuring interfaces in compile-time for StoryView. var ( _ bin.Encoder = &StoryView{} _ bin.Decoder = &StoryView{} _ bin.BareEncoder = &StoryView{} _ bin.BareDecoder = &StoryView{} + + _ StoryViewClass = &StoryView{} ) func (s *StoryView) Zero() bool { @@ -341,3 +346,599 @@ func (s *StoryView) GetReaction() (value ReactionClass, ok bool) { } return s.Reaction, true } + +// StoryViewPublicForward represents TL type `storyViewPublicForward#9083670b`. +// +// See https://core.telegram.org/constructor/storyViewPublicForward for reference. +type StoryViewPublicForward struct { + // Flags field of StoryViewPublicForward. + Flags bin.Fields + // Blocked field of StoryViewPublicForward. + Blocked bool + // BlockedMyStoriesFrom field of StoryViewPublicForward. + BlockedMyStoriesFrom bool + // Message field of StoryViewPublicForward. + Message MessageClass +} + +// StoryViewPublicForwardTypeID is TL type id of StoryViewPublicForward. +const StoryViewPublicForwardTypeID = 0x9083670b + +// construct implements constructor of StoryViewClass. +func (s StoryViewPublicForward) construct() StoryViewClass { return &s } + +// Ensuring interfaces in compile-time for StoryViewPublicForward. +var ( + _ bin.Encoder = &StoryViewPublicForward{} + _ bin.Decoder = &StoryViewPublicForward{} + _ bin.BareEncoder = &StoryViewPublicForward{} + _ bin.BareDecoder = &StoryViewPublicForward{} + + _ StoryViewClass = &StoryViewPublicForward{} +) + +func (s *StoryViewPublicForward) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Blocked == false) { + return false + } + if !(s.BlockedMyStoriesFrom == false) { + return false + } + if !(s.Message == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryViewPublicForward) String() string { + if s == nil { + return "StoryViewPublicForward(nil)" + } + type Alias StoryViewPublicForward + return fmt.Sprintf("StoryViewPublicForward%+v", Alias(*s)) +} + +// FillFrom fills StoryViewPublicForward from given interface. +func (s *StoryViewPublicForward) FillFrom(from interface { + GetBlocked() (value bool) + GetBlockedMyStoriesFrom() (value bool) + GetMessage() (value MessageClass) +}) { + s.Blocked = from.GetBlocked() + s.BlockedMyStoriesFrom = from.GetBlockedMyStoriesFrom() + s.Message = from.GetMessage() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryViewPublicForward) TypeID() uint32 { + return StoryViewPublicForwardTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryViewPublicForward) TypeName() string { + return "storyViewPublicForward" +} + +// TypeInfo returns info about TL type. +func (s *StoryViewPublicForward) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyViewPublicForward", + ID: StoryViewPublicForwardTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Blocked", + SchemaName: "blocked", + Null: !s.Flags.Has(0), + }, + { + Name: "BlockedMyStoriesFrom", + SchemaName: "blocked_my_stories_from", + Null: !s.Flags.Has(1), + }, + { + Name: "Message", + SchemaName: "message", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StoryViewPublicForward) SetFlags() { + if !(s.Blocked == false) { + s.Flags.Set(0) + } + if !(s.BlockedMyStoriesFrom == false) { + s.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (s *StoryViewPublicForward) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyViewPublicForward#9083670b as nil") + } + b.PutID(StoryViewPublicForwardTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryViewPublicForward) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyViewPublicForward#9083670b as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyViewPublicForward#9083670b: field flags: %w", err) + } + if s.Message == nil { + return fmt.Errorf("unable to encode storyViewPublicForward#9083670b: field message is nil") + } + if err := s.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyViewPublicForward#9083670b: field message: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryViewPublicForward) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyViewPublicForward#9083670b to nil") + } + if err := b.ConsumeID(StoryViewPublicForwardTypeID); err != nil { + return fmt.Errorf("unable to decode storyViewPublicForward#9083670b: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryViewPublicForward) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyViewPublicForward#9083670b to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode storyViewPublicForward#9083670b: field flags: %w", err) + } + } + s.Blocked = s.Flags.Has(0) + s.BlockedMyStoriesFrom = s.Flags.Has(1) + { + value, err := DecodeMessage(b) + if err != nil { + return fmt.Errorf("unable to decode storyViewPublicForward#9083670b: field message: %w", err) + } + s.Message = value + } + return nil +} + +// SetBlocked sets value of Blocked conditional field. +func (s *StoryViewPublicForward) SetBlocked(value bool) { + if value { + s.Flags.Set(0) + s.Blocked = true + } else { + s.Flags.Unset(0) + s.Blocked = false + } +} + +// GetBlocked returns value of Blocked conditional field. +func (s *StoryViewPublicForward) GetBlocked() (value bool) { + if s == nil { + return + } + return s.Flags.Has(0) +} + +// SetBlockedMyStoriesFrom sets value of BlockedMyStoriesFrom conditional field. +func (s *StoryViewPublicForward) SetBlockedMyStoriesFrom(value bool) { + if value { + s.Flags.Set(1) + s.BlockedMyStoriesFrom = true + } else { + s.Flags.Unset(1) + s.BlockedMyStoriesFrom = false + } +} + +// GetBlockedMyStoriesFrom returns value of BlockedMyStoriesFrom conditional field. +func (s *StoryViewPublicForward) GetBlockedMyStoriesFrom() (value bool) { + if s == nil { + return + } + return s.Flags.Has(1) +} + +// GetMessage returns value of Message field. +func (s *StoryViewPublicForward) GetMessage() (value MessageClass) { + if s == nil { + return + } + return s.Message +} + +// StoryViewPublicRepost represents TL type `storyViewPublicRepost#bd74cf49`. +// +// See https://core.telegram.org/constructor/storyViewPublicRepost for reference. +type StoryViewPublicRepost struct { + // Flags field of StoryViewPublicRepost. + Flags bin.Fields + // Blocked field of StoryViewPublicRepost. + Blocked bool + // BlockedMyStoriesFrom field of StoryViewPublicRepost. + BlockedMyStoriesFrom bool + // PeerID field of StoryViewPublicRepost. + PeerID PeerClass + // Story field of StoryViewPublicRepost. + Story StoryItemClass +} + +// StoryViewPublicRepostTypeID is TL type id of StoryViewPublicRepost. +const StoryViewPublicRepostTypeID = 0xbd74cf49 + +// construct implements constructor of StoryViewClass. +func (s StoryViewPublicRepost) construct() StoryViewClass { return &s } + +// Ensuring interfaces in compile-time for StoryViewPublicRepost. +var ( + _ bin.Encoder = &StoryViewPublicRepost{} + _ bin.Decoder = &StoryViewPublicRepost{} + _ bin.BareEncoder = &StoryViewPublicRepost{} + _ bin.BareDecoder = &StoryViewPublicRepost{} + + _ StoryViewClass = &StoryViewPublicRepost{} +) + +func (s *StoryViewPublicRepost) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Blocked == false) { + return false + } + if !(s.BlockedMyStoriesFrom == false) { + return false + } + if !(s.PeerID == nil) { + return false + } + if !(s.Story == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryViewPublicRepost) String() string { + if s == nil { + return "StoryViewPublicRepost(nil)" + } + type Alias StoryViewPublicRepost + return fmt.Sprintf("StoryViewPublicRepost%+v", Alias(*s)) +} + +// FillFrom fills StoryViewPublicRepost from given interface. +func (s *StoryViewPublicRepost) FillFrom(from interface { + GetBlocked() (value bool) + GetBlockedMyStoriesFrom() (value bool) + GetPeerID() (value PeerClass) + GetStory() (value StoryItemClass) +}) { + s.Blocked = from.GetBlocked() + s.BlockedMyStoriesFrom = from.GetBlockedMyStoriesFrom() + s.PeerID = from.GetPeerID() + s.Story = from.GetStory() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryViewPublicRepost) TypeID() uint32 { + return StoryViewPublicRepostTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryViewPublicRepost) TypeName() string { + return "storyViewPublicRepost" +} + +// TypeInfo returns info about TL type. +func (s *StoryViewPublicRepost) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyViewPublicRepost", + ID: StoryViewPublicRepostTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Blocked", + SchemaName: "blocked", + Null: !s.Flags.Has(0), + }, + { + Name: "BlockedMyStoriesFrom", + SchemaName: "blocked_my_stories_from", + Null: !s.Flags.Has(1), + }, + { + Name: "PeerID", + SchemaName: "peer_id", + }, + { + Name: "Story", + SchemaName: "story", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StoryViewPublicRepost) SetFlags() { + if !(s.Blocked == false) { + s.Flags.Set(0) + } + if !(s.BlockedMyStoriesFrom == false) { + s.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (s *StoryViewPublicRepost) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyViewPublicRepost#bd74cf49 as nil") + } + b.PutID(StoryViewPublicRepostTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryViewPublicRepost) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyViewPublicRepost#bd74cf49 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field flags: %w", err) + } + if s.PeerID == nil { + return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field peer_id is nil") + } + if err := s.PeerID.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field peer_id: %w", err) + } + if s.Story == nil { + return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field story is nil") + } + if err := s.Story.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyViewPublicRepost#bd74cf49: field story: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryViewPublicRepost) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyViewPublicRepost#bd74cf49 to nil") + } + if err := b.ConsumeID(StoryViewPublicRepostTypeID); err != nil { + return fmt.Errorf("unable to decode storyViewPublicRepost#bd74cf49: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryViewPublicRepost) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyViewPublicRepost#bd74cf49 to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode storyViewPublicRepost#bd74cf49: field flags: %w", err) + } + } + s.Blocked = s.Flags.Has(0) + s.BlockedMyStoriesFrom = s.Flags.Has(1) + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode storyViewPublicRepost#bd74cf49: field peer_id: %w", err) + } + s.PeerID = value + } + { + value, err := DecodeStoryItem(b) + if err != nil { + return fmt.Errorf("unable to decode storyViewPublicRepost#bd74cf49: field story: %w", err) + } + s.Story = value + } + return nil +} + +// SetBlocked sets value of Blocked conditional field. +func (s *StoryViewPublicRepost) SetBlocked(value bool) { + if value { + s.Flags.Set(0) + s.Blocked = true + } else { + s.Flags.Unset(0) + s.Blocked = false + } +} + +// GetBlocked returns value of Blocked conditional field. +func (s *StoryViewPublicRepost) GetBlocked() (value bool) { + if s == nil { + return + } + return s.Flags.Has(0) +} + +// SetBlockedMyStoriesFrom sets value of BlockedMyStoriesFrom conditional field. +func (s *StoryViewPublicRepost) SetBlockedMyStoriesFrom(value bool) { + if value { + s.Flags.Set(1) + s.BlockedMyStoriesFrom = true + } else { + s.Flags.Unset(1) + s.BlockedMyStoriesFrom = false + } +} + +// GetBlockedMyStoriesFrom returns value of BlockedMyStoriesFrom conditional field. +func (s *StoryViewPublicRepost) GetBlockedMyStoriesFrom() (value bool) { + if s == nil { + return + } + return s.Flags.Has(1) +} + +// GetPeerID returns value of PeerID field. +func (s *StoryViewPublicRepost) GetPeerID() (value PeerClass) { + if s == nil { + return + } + return s.PeerID +} + +// GetStory returns value of Story field. +func (s *StoryViewPublicRepost) GetStory() (value StoryItemClass) { + if s == nil { + return + } + return s.Story +} + +// StoryViewClassName is schema name of StoryViewClass. +const StoryViewClassName = "StoryView" + +// StoryViewClass represents StoryView generic type. +// +// See https://core.telegram.org/type/StoryView for reference. +// +// Example: +// +// g, err := tg.DecodeStoryView(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.StoryView: // storyView#b0bdeac5 +// case *tg.StoryViewPublicForward: // storyViewPublicForward#9083670b +// case *tg.StoryViewPublicRepost: // storyViewPublicRepost#bd74cf49 +// default: panic(v) +// } +type StoryViewClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() StoryViewClass + + // 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 + + // Whether we have completely blocked¹ this user, including from viewing more of our + // stories. + // + // Links: + // 1) https://core.telegram.org/api/block + GetBlocked() (value bool) + + // Whether we have blocked¹ this user from viewing more of our stories. + // + // Links: + // 1) https://core.telegram.org/api/block + GetBlockedMyStoriesFrom() (value bool) +} + +// DecodeStoryView implements binary de-serialization for StoryViewClass. +func DecodeStoryView(buf *bin.Buffer) (StoryViewClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case StoryViewTypeID: + // Decoding storyView#b0bdeac5. + v := StoryView{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryViewClass: %w", err) + } + return &v, nil + case StoryViewPublicForwardTypeID: + // Decoding storyViewPublicForward#9083670b. + v := StoryViewPublicForward{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryViewClass: %w", err) + } + return &v, nil + case StoryViewPublicRepostTypeID: + // Decoding storyViewPublicRepost#bd74cf49. + v := StoryViewPublicRepost{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StoryViewClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode StoryViewClass: %w", bin.NewUnexpectedID(id)) + } +} + +// StoryView boxes the StoryViewClass providing a helper. +type StoryViewBox struct { + StoryView StoryViewClass +} + +// Decode implements bin.Decoder for StoryViewBox. +func (b *StoryViewBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode StoryViewBox to nil") + } + v, err := DecodeStoryView(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.StoryView = v + return nil +} + +// Encode implements bin.Encode for StoryViewBox. +func (b *StoryViewBox) Encode(buf *bin.Buffer) error { + if b == nil || b.StoryView == nil { + return fmt.Errorf("unable to encode StoryViewClass as nil") + } + return b.StoryView.Encode(buf) +} diff --git a/tg/tl_story_view_slices_gen.go b/tg/tl_story_view_slices_gen.go index fe21471a4c..d0de2f4a39 100644 --- a/tg/tl_story_view_slices_gen.go +++ b/tg/tl_story_view_slices_gen.go @@ -33,3 +33,384 @@ var ( _ = tgerr.Error{} _ = tdjson.Encoder{} ) + +// StoryViewClassArray is adapter for slice of StoryViewClass. +type StoryViewClassArray []StoryViewClass + +// Sort sorts slice of StoryViewClass. +func (s StoryViewClassArray) Sort(less func(a, b StoryViewClass) bool) StoryViewClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StoryViewClass. +func (s StoryViewClassArray) SortStable(less func(a, b StoryViewClass) bool) StoryViewClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StoryViewClass. +func (s StoryViewClassArray) Retain(keep func(x StoryViewClass) bool) StoryViewClassArray { + 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 StoryViewClassArray) First() (v StoryViewClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StoryViewClassArray) Last() (v StoryViewClass, 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 *StoryViewClassArray) PopFirst() (v StoryViewClass, 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 StoryViewClass + 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 *StoryViewClassArray) Pop() (v StoryViewClass, 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 +} + +// AsStoryView returns copy with only StoryView constructors. +func (s StoryViewClassArray) AsStoryView() (to StoryViewArray) { + for _, elem := range s { + value, ok := elem.(*StoryView) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsStoryViewPublicForward returns copy with only StoryViewPublicForward constructors. +func (s StoryViewClassArray) AsStoryViewPublicForward() (to StoryViewPublicForwardArray) { + for _, elem := range s { + value, ok := elem.(*StoryViewPublicForward) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsStoryViewPublicRepost returns copy with only StoryViewPublicRepost constructors. +func (s StoryViewClassArray) AsStoryViewPublicRepost() (to StoryViewPublicRepostArray) { + for _, elem := range s { + value, ok := elem.(*StoryViewPublicRepost) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// StoryViewArray is adapter for slice of StoryView. +type StoryViewArray []StoryView + +// Sort sorts slice of StoryView. +func (s StoryViewArray) Sort(less func(a, b StoryView) bool) StoryViewArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StoryView. +func (s StoryViewArray) SortStable(less func(a, b StoryView) bool) StoryViewArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StoryView. +func (s StoryViewArray) Retain(keep func(x StoryView) bool) StoryViewArray { + 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 StoryViewArray) First() (v StoryView, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StoryViewArray) Last() (v StoryView, 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 *StoryViewArray) PopFirst() (v StoryView, 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 StoryView + 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 *StoryViewArray) Pop() (v StoryView, 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 StoryView by Date. +func (s StoryViewArray) SortByDate() StoryViewArray { + return s.Sort(func(a, b StoryView) bool { + return a.GetDate() < b.GetDate() + }) +} + +// SortStableByDate sorts slice of StoryView by Date. +func (s StoryViewArray) SortStableByDate() StoryViewArray { + return s.SortStable(func(a, b StoryView) bool { + return a.GetDate() < b.GetDate() + }) +} + +// StoryViewPublicForwardArray is adapter for slice of StoryViewPublicForward. +type StoryViewPublicForwardArray []StoryViewPublicForward + +// Sort sorts slice of StoryViewPublicForward. +func (s StoryViewPublicForwardArray) Sort(less func(a, b StoryViewPublicForward) bool) StoryViewPublicForwardArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StoryViewPublicForward. +func (s StoryViewPublicForwardArray) SortStable(less func(a, b StoryViewPublicForward) bool) StoryViewPublicForwardArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StoryViewPublicForward. +func (s StoryViewPublicForwardArray) Retain(keep func(x StoryViewPublicForward) bool) StoryViewPublicForwardArray { + 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 StoryViewPublicForwardArray) First() (v StoryViewPublicForward, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StoryViewPublicForwardArray) Last() (v StoryViewPublicForward, 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 *StoryViewPublicForwardArray) PopFirst() (v StoryViewPublicForward, 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 StoryViewPublicForward + 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 *StoryViewPublicForwardArray) Pop() (v StoryViewPublicForward, 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 +} + +// StoryViewPublicRepostArray is adapter for slice of StoryViewPublicRepost. +type StoryViewPublicRepostArray []StoryViewPublicRepost + +// Sort sorts slice of StoryViewPublicRepost. +func (s StoryViewPublicRepostArray) Sort(less func(a, b StoryViewPublicRepost) bool) StoryViewPublicRepostArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of StoryViewPublicRepost. +func (s StoryViewPublicRepostArray) SortStable(less func(a, b StoryViewPublicRepost) bool) StoryViewPublicRepostArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of StoryViewPublicRepost. +func (s StoryViewPublicRepostArray) Retain(keep func(x StoryViewPublicRepost) bool) StoryViewPublicRepostArray { + 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 StoryViewPublicRepostArray) First() (v StoryViewPublicRepost, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s StoryViewPublicRepostArray) Last() (v StoryViewPublicRepost, 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 *StoryViewPublicRepostArray) PopFirst() (v StoryViewPublicRepost, 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 StoryViewPublicRepost + 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 *StoryViewPublicRepostArray) Pop() (v StoryViewPublicRepost, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_update_gen.go b/tg/tl_update_gen.go index ac0beead60..ad6d9c40b6 100644 --- a/tg/tl_update_gen.go +++ b/tg/tl_update_gen.go @@ -24139,6 +24139,620 @@ func (u *UpdatePeerWallpaper) GetWallpaper() (value WallPaperClass, ok bool) { return u.Wallpaper, true } +// UpdateBotMessageReaction represents TL type `updateBotMessageReaction#ac21d3ce`. +// +// See https://core.telegram.org/constructor/updateBotMessageReaction for reference. +type UpdateBotMessageReaction struct { + // Peer field of UpdateBotMessageReaction. + Peer PeerClass + // MsgID field of UpdateBotMessageReaction. + MsgID int + // Date field of UpdateBotMessageReaction. + Date int + // Actor field of UpdateBotMessageReaction. + Actor PeerClass + // OldReactions field of UpdateBotMessageReaction. + OldReactions []ReactionClass + // NewReactions field of UpdateBotMessageReaction. + NewReactions []ReactionClass + // Qts field of UpdateBotMessageReaction. + Qts int +} + +// UpdateBotMessageReactionTypeID is TL type id of UpdateBotMessageReaction. +const UpdateBotMessageReactionTypeID = 0xac21d3ce + +// construct implements constructor of UpdateClass. +func (u UpdateBotMessageReaction) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateBotMessageReaction. +var ( + _ bin.Encoder = &UpdateBotMessageReaction{} + _ bin.Decoder = &UpdateBotMessageReaction{} + _ bin.BareEncoder = &UpdateBotMessageReaction{} + _ bin.BareDecoder = &UpdateBotMessageReaction{} + + _ UpdateClass = &UpdateBotMessageReaction{} +) + +func (u *UpdateBotMessageReaction) Zero() bool { + if u == nil { + return true + } + if !(u.Peer == nil) { + return false + } + if !(u.MsgID == 0) { + return false + } + if !(u.Date == 0) { + return false + } + if !(u.Actor == nil) { + return false + } + if !(u.OldReactions == nil) { + return false + } + if !(u.NewReactions == nil) { + return false + } + if !(u.Qts == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateBotMessageReaction) String() string { + if u == nil { + return "UpdateBotMessageReaction(nil)" + } + type Alias UpdateBotMessageReaction + return fmt.Sprintf("UpdateBotMessageReaction%+v", Alias(*u)) +} + +// FillFrom fills UpdateBotMessageReaction from given interface. +func (u *UpdateBotMessageReaction) FillFrom(from interface { + GetPeer() (value PeerClass) + GetMsgID() (value int) + GetDate() (value int) + GetActor() (value PeerClass) + GetOldReactions() (value []ReactionClass) + GetNewReactions() (value []ReactionClass) + GetQts() (value int) +}) { + u.Peer = from.GetPeer() + u.MsgID = from.GetMsgID() + u.Date = from.GetDate() + u.Actor = from.GetActor() + u.OldReactions = from.GetOldReactions() + u.NewReactions = from.GetNewReactions() + u.Qts = from.GetQts() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateBotMessageReaction) TypeID() uint32 { + return UpdateBotMessageReactionTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateBotMessageReaction) TypeName() string { + return "updateBotMessageReaction" +} + +// TypeInfo returns info about TL type. +func (u *UpdateBotMessageReaction) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateBotMessageReaction", + ID: UpdateBotMessageReactionTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "MsgID", + SchemaName: "msg_id", + }, + { + Name: "Date", + SchemaName: "date", + }, + { + Name: "Actor", + SchemaName: "actor", + }, + { + Name: "OldReactions", + SchemaName: "old_reactions", + }, + { + Name: "NewReactions", + SchemaName: "new_reactions", + }, + { + Name: "Qts", + SchemaName: "qts", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateBotMessageReaction) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotMessageReaction#ac21d3ce as nil") + } + b.PutID(UpdateBotMessageReactionTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateBotMessageReaction) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotMessageReaction#ac21d3ce as nil") + } + if u.Peer == nil { + return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field peer is nil") + } + if err := u.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field peer: %w", err) + } + b.PutInt(u.MsgID) + b.PutInt(u.Date) + if u.Actor == nil { + return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field actor is nil") + } + if err := u.Actor.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field actor: %w", err) + } + b.PutVectorHeader(len(u.OldReactions)) + for idx, v := range u.OldReactions { + if v == nil { + return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field old_reactions element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field old_reactions element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(u.NewReactions)) + for idx, v := range u.NewReactions { + if v == nil { + return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field new_reactions element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field new_reactions element with index %d: %w", idx, err) + } + } + b.PutInt(u.Qts) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateBotMessageReaction) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotMessageReaction#ac21d3ce to nil") + } + if err := b.ConsumeID(UpdateBotMessageReactionTypeID); err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateBotMessageReaction) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotMessageReaction#ac21d3ce to nil") + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field peer: %w", err) + } + u.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field msg_id: %w", err) + } + u.MsgID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field date: %w", err) + } + u.Date = value + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field actor: %w", err) + } + u.Actor = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field old_reactions: %w", err) + } + + if headerLen > 0 { + u.OldReactions = make([]ReactionClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeReaction(b) + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field old_reactions: %w", err) + } + u.OldReactions = append(u.OldReactions, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field new_reactions: %w", err) + } + + if headerLen > 0 { + u.NewReactions = make([]ReactionClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeReaction(b) + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field new_reactions: %w", err) + } + u.NewReactions = append(u.NewReactions, value) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field qts: %w", err) + } + u.Qts = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (u *UpdateBotMessageReaction) GetPeer() (value PeerClass) { + if u == nil { + return + } + return u.Peer +} + +// GetMsgID returns value of MsgID field. +func (u *UpdateBotMessageReaction) GetMsgID() (value int) { + if u == nil { + return + } + return u.MsgID +} + +// GetDate returns value of Date field. +func (u *UpdateBotMessageReaction) GetDate() (value int) { + if u == nil { + return + } + return u.Date +} + +// GetActor returns value of Actor field. +func (u *UpdateBotMessageReaction) GetActor() (value PeerClass) { + if u == nil { + return + } + return u.Actor +} + +// GetOldReactions returns value of OldReactions field. +func (u *UpdateBotMessageReaction) GetOldReactions() (value []ReactionClass) { + if u == nil { + return + } + return u.OldReactions +} + +// GetNewReactions returns value of NewReactions field. +func (u *UpdateBotMessageReaction) GetNewReactions() (value []ReactionClass) { + if u == nil { + return + } + return u.NewReactions +} + +// GetQts returns value of Qts field. +func (u *UpdateBotMessageReaction) GetQts() (value int) { + if u == nil { + return + } + return u.Qts +} + +// MapOldReactions returns field OldReactions wrapped in ReactionClassArray helper. +func (u *UpdateBotMessageReaction) MapOldReactions() (value ReactionClassArray) { + return ReactionClassArray(u.OldReactions) +} + +// MapNewReactions returns field NewReactions wrapped in ReactionClassArray helper. +func (u *UpdateBotMessageReaction) MapNewReactions() (value ReactionClassArray) { + return ReactionClassArray(u.NewReactions) +} + +// UpdateBotMessageReactions represents TL type `updateBotMessageReactions#9cb7759`. +// +// See https://core.telegram.org/constructor/updateBotMessageReactions for reference. +type UpdateBotMessageReactions struct { + // Peer field of UpdateBotMessageReactions. + Peer PeerClass + // MsgID field of UpdateBotMessageReactions. + MsgID int + // Date field of UpdateBotMessageReactions. + Date int + // Reactions field of UpdateBotMessageReactions. + Reactions []ReactionCount + // Qts field of UpdateBotMessageReactions. + Qts int +} + +// UpdateBotMessageReactionsTypeID is TL type id of UpdateBotMessageReactions. +const UpdateBotMessageReactionsTypeID = 0x9cb7759 + +// construct implements constructor of UpdateClass. +func (u UpdateBotMessageReactions) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateBotMessageReactions. +var ( + _ bin.Encoder = &UpdateBotMessageReactions{} + _ bin.Decoder = &UpdateBotMessageReactions{} + _ bin.BareEncoder = &UpdateBotMessageReactions{} + _ bin.BareDecoder = &UpdateBotMessageReactions{} + + _ UpdateClass = &UpdateBotMessageReactions{} +) + +func (u *UpdateBotMessageReactions) Zero() bool { + if u == nil { + return true + } + if !(u.Peer == nil) { + return false + } + if !(u.MsgID == 0) { + return false + } + if !(u.Date == 0) { + return false + } + if !(u.Reactions == nil) { + return false + } + if !(u.Qts == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateBotMessageReactions) String() string { + if u == nil { + return "UpdateBotMessageReactions(nil)" + } + type Alias UpdateBotMessageReactions + return fmt.Sprintf("UpdateBotMessageReactions%+v", Alias(*u)) +} + +// FillFrom fills UpdateBotMessageReactions from given interface. +func (u *UpdateBotMessageReactions) FillFrom(from interface { + GetPeer() (value PeerClass) + GetMsgID() (value int) + GetDate() (value int) + GetReactions() (value []ReactionCount) + GetQts() (value int) +}) { + u.Peer = from.GetPeer() + u.MsgID = from.GetMsgID() + u.Date = from.GetDate() + u.Reactions = from.GetReactions() + u.Qts = from.GetQts() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateBotMessageReactions) TypeID() uint32 { + return UpdateBotMessageReactionsTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateBotMessageReactions) TypeName() string { + return "updateBotMessageReactions" +} + +// TypeInfo returns info about TL type. +func (u *UpdateBotMessageReactions) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateBotMessageReactions", + ID: UpdateBotMessageReactionsTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "MsgID", + SchemaName: "msg_id", + }, + { + Name: "Date", + SchemaName: "date", + }, + { + Name: "Reactions", + SchemaName: "reactions", + }, + { + Name: "Qts", + SchemaName: "qts", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateBotMessageReactions) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotMessageReactions#9cb7759 as nil") + } + b.PutID(UpdateBotMessageReactionsTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateBotMessageReactions) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotMessageReactions#9cb7759 as nil") + } + if u.Peer == nil { + return fmt.Errorf("unable to encode updateBotMessageReactions#9cb7759: field peer is nil") + } + if err := u.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBotMessageReactions#9cb7759: field peer: %w", err) + } + b.PutInt(u.MsgID) + b.PutInt(u.Date) + b.PutVectorHeader(len(u.Reactions)) + for idx, v := range u.Reactions { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBotMessageReactions#9cb7759: field reactions element with index %d: %w", idx, err) + } + } + b.PutInt(u.Qts) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateBotMessageReactions) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotMessageReactions#9cb7759 to nil") + } + if err := b.ConsumeID(UpdateBotMessageReactionsTypeID); err != nil { + return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateBotMessageReactions) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotMessageReactions#9cb7759 to nil") + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field peer: %w", err) + } + u.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field msg_id: %w", err) + } + u.MsgID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field date: %w", err) + } + u.Date = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field reactions: %w", err) + } + + if headerLen > 0 { + u.Reactions = make([]ReactionCount, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value ReactionCount + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field reactions: %w", err) + } + u.Reactions = append(u.Reactions, value) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field qts: %w", err) + } + u.Qts = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (u *UpdateBotMessageReactions) GetPeer() (value PeerClass) { + if u == nil { + return + } + return u.Peer +} + +// GetMsgID returns value of MsgID field. +func (u *UpdateBotMessageReactions) GetMsgID() (value int) { + if u == nil { + return + } + return u.MsgID +} + +// GetDate returns value of Date field. +func (u *UpdateBotMessageReactions) GetDate() (value int) { + if u == nil { + return + } + return u.Date +} + +// GetReactions returns value of Reactions field. +func (u *UpdateBotMessageReactions) GetReactions() (value []ReactionCount) { + if u == nil { + return + } + return u.Reactions +} + +// GetQts returns value of Qts field. +func (u *UpdateBotMessageReactions) GetQts() (value int) { + if u == nil { + return + } + return u.Qts +} + // UpdateClassName is schema name of UpdateClass. const UpdateClassName = "Update" @@ -24273,6 +24887,8 @@ const UpdateClassName = "Update" // case *tg.UpdateBotChatBoost: // updateBotChatBoost#904dd49c // case *tg.UpdateChannelViewForumAsMessages: // updateChannelViewForumAsMessages#7b68920 // case *tg.UpdatePeerWallpaper: // updatePeerWallpaper#ae3f101d +// case *tg.UpdateBotMessageReaction: // updateBotMessageReaction#ac21d3ce +// case *tg.UpdateBotMessageReactions: // updateBotMessageReactions#9cb7759 // default: panic(v) // } type UpdateClass interface { @@ -25141,6 +25757,20 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateBotMessageReactionTypeID: + // Decoding updateBotMessageReaction#ac21d3ce. + v := UpdateBotMessageReaction{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateBotMessageReactionsTypeID: + // Decoding updateBotMessageReactions#9cb7759. + v := UpdateBotMessageReactions{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode UpdateClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_update_slices_gen.go b/tg/tl_update_slices_gen.go index 3868963920..109235eb90 100644 --- a/tg/tl_update_slices_gen.go +++ b/tg/tl_update_slices_gen.go @@ -1481,6 +1481,32 @@ func (s UpdateClassArray) AsUpdatePeerWallpaper() (to UpdatePeerWallpaperArray) return to } +// AsUpdateBotMessageReaction returns copy with only UpdateBotMessageReaction constructors. +func (s UpdateClassArray) AsUpdateBotMessageReaction() (to UpdateBotMessageReactionArray) { + for _, elem := range s { + value, ok := elem.(*UpdateBotMessageReaction) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateBotMessageReactions returns copy with only UpdateBotMessageReactions constructors. +func (s UpdateClassArray) AsUpdateBotMessageReactions() (to UpdateBotMessageReactionsArray) { + for _, elem := range s { + value, ok := elem.(*UpdateBotMessageReactions) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // UpdateNewMessageArray is adapter for slice of UpdateNewMessage. type UpdateNewMessageArray []UpdateNewMessage @@ -10328,3 +10354,195 @@ func (s *UpdatePeerWallpaperArray) Pop() (v UpdatePeerWallpaper, ok bool) { return v, true } + +// UpdateBotMessageReactionArray is adapter for slice of UpdateBotMessageReaction. +type UpdateBotMessageReactionArray []UpdateBotMessageReaction + +// Sort sorts slice of UpdateBotMessageReaction. +func (s UpdateBotMessageReactionArray) Sort(less func(a, b UpdateBotMessageReaction) bool) UpdateBotMessageReactionArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateBotMessageReaction. +func (s UpdateBotMessageReactionArray) SortStable(less func(a, b UpdateBotMessageReaction) bool) UpdateBotMessageReactionArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateBotMessageReaction. +func (s UpdateBotMessageReactionArray) Retain(keep func(x UpdateBotMessageReaction) bool) UpdateBotMessageReactionArray { + 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 UpdateBotMessageReactionArray) First() (v UpdateBotMessageReaction, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateBotMessageReactionArray) Last() (v UpdateBotMessageReaction, 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 *UpdateBotMessageReactionArray) PopFirst() (v UpdateBotMessageReaction, 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 UpdateBotMessageReaction + 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 *UpdateBotMessageReactionArray) Pop() (v UpdateBotMessageReaction, 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 UpdateBotMessageReaction by Date. +func (s UpdateBotMessageReactionArray) SortByDate() UpdateBotMessageReactionArray { + return s.Sort(func(a, b UpdateBotMessageReaction) bool { + return a.GetDate() < b.GetDate() + }) +} + +// SortStableByDate sorts slice of UpdateBotMessageReaction by Date. +func (s UpdateBotMessageReactionArray) SortStableByDate() UpdateBotMessageReactionArray { + return s.SortStable(func(a, b UpdateBotMessageReaction) bool { + return a.GetDate() < b.GetDate() + }) +} + +// UpdateBotMessageReactionsArray is adapter for slice of UpdateBotMessageReactions. +type UpdateBotMessageReactionsArray []UpdateBotMessageReactions + +// Sort sorts slice of UpdateBotMessageReactions. +func (s UpdateBotMessageReactionsArray) Sort(less func(a, b UpdateBotMessageReactions) bool) UpdateBotMessageReactionsArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateBotMessageReactions. +func (s UpdateBotMessageReactionsArray) SortStable(less func(a, b UpdateBotMessageReactions) bool) UpdateBotMessageReactionsArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateBotMessageReactions. +func (s UpdateBotMessageReactionsArray) Retain(keep func(x UpdateBotMessageReactions) bool) UpdateBotMessageReactionsArray { + 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 UpdateBotMessageReactionsArray) First() (v UpdateBotMessageReactions, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateBotMessageReactionsArray) Last() (v UpdateBotMessageReactions, 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 *UpdateBotMessageReactionsArray) PopFirst() (v UpdateBotMessageReactions, 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 UpdateBotMessageReactions + 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 *UpdateBotMessageReactionsArray) Pop() (v UpdateBotMessageReactions, 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 UpdateBotMessageReactions by Date. +func (s UpdateBotMessageReactionsArray) SortByDate() UpdateBotMessageReactionsArray { + return s.Sort(func(a, b UpdateBotMessageReactions) bool { + return a.GetDate() < b.GetDate() + }) +} + +// SortStableByDate sorts slice of UpdateBotMessageReactions by Date. +func (s UpdateBotMessageReactionsArray) SortStableByDate() UpdateBotMessageReactionsArray { + return s.SortStable(func(a, b UpdateBotMessageReactions) bool { + return a.GetDate() < b.GetDate() + }) +} diff --git a/tg/tl_updates_classifier_gen.go b/tg/tl_updates_classifier_gen.go index 138d81b6f0..60ceee86ea 100644 --- a/tg/tl_updates_classifier_gen.go +++ b/tg/tl_updates_classifier_gen.go @@ -72,6 +72,10 @@ func IsQtsUpdate(u UpdateClass) (qts int, ok bool) { return u.Qts, true case *UpdateBotChatBoost: return u.Qts, true + case *UpdateBotMessageReaction: + return u.Qts, true + case *UpdateBotMessageReactions: + return u.Qts, true } return diff --git a/tg/tl_wall_paper_settings_gen.go b/tg/tl_wall_paper_settings_gen.go index 14e9118a2c..15b354db9b 100644 --- a/tg/tl_wall_paper_settings_gen.go +++ b/tg/tl_wall_paper_settings_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// WallPaperSettings represents TL type `wallPaperSettings#1dc1bca4`. +// WallPaperSettings represents TL type `wallPaperSettings#372efcd0`. // Wallpaper¹ rendering information. // // Links: @@ -95,10 +95,14 @@ type WallPaperSettings struct { // // Use SetRotation and GetRotation helpers. Rotation int + // Emoticon field of WallPaperSettings. + // + // Use SetEmoticon and GetEmoticon helpers. + Emoticon string } // WallPaperSettingsTypeID is TL type id of WallPaperSettings. -const WallPaperSettingsTypeID = 0x1dc1bca4 +const WallPaperSettingsTypeID = 0x372efcd0 // Ensuring interfaces in compile-time for WallPaperSettings. var ( @@ -139,6 +143,9 @@ func (w *WallPaperSettings) Zero() bool { if !(w.Rotation == 0) { return false } + if !(w.Emoticon == "") { + return false + } return true } @@ -162,6 +169,7 @@ func (w *WallPaperSettings) FillFrom(from interface { GetFourthBackgroundColor() (value int, ok bool) GetIntensity() (value int, ok bool) GetRotation() (value int, ok bool) + GetEmoticon() (value string, ok bool) }) { w.Blur = from.GetBlur() w.Motion = from.GetMotion() @@ -189,6 +197,10 @@ func (w *WallPaperSettings) FillFrom(from interface { w.Rotation = val } + if val, ok := from.GetEmoticon(); ok { + w.Emoticon = val + } + } // TypeID returns type id in TL schema. @@ -254,6 +266,11 @@ func (w *WallPaperSettings) TypeInfo() tdp.Type { SchemaName: "rotation", Null: !w.Flags.Has(4), }, + { + Name: "Emoticon", + SchemaName: "emoticon", + Null: !w.Flags.Has(7), + }, } return typ } @@ -284,12 +301,15 @@ func (w *WallPaperSettings) SetFlags() { if !(w.Rotation == 0) { w.Flags.Set(4) } + if !(w.Emoticon == "") { + w.Flags.Set(7) + } } // Encode implements bin.Encoder. func (w *WallPaperSettings) Encode(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't encode wallPaperSettings#1dc1bca4 as nil") + return fmt.Errorf("can't encode wallPaperSettings#372efcd0 as nil") } b.PutID(WallPaperSettingsTypeID) return w.EncodeBare(b) @@ -298,11 +318,11 @@ func (w *WallPaperSettings) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (w *WallPaperSettings) EncodeBare(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't encode wallPaperSettings#1dc1bca4 as nil") + return fmt.Errorf("can't encode wallPaperSettings#372efcd0 as nil") } w.SetFlags() if err := w.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode wallPaperSettings#1dc1bca4: field flags: %w", err) + return fmt.Errorf("unable to encode wallPaperSettings#372efcd0: field flags: %w", err) } if w.Flags.Has(0) { b.PutInt(w.BackgroundColor) @@ -322,16 +342,19 @@ func (w *WallPaperSettings) EncodeBare(b *bin.Buffer) error { if w.Flags.Has(4) { b.PutInt(w.Rotation) } + if w.Flags.Has(7) { + b.PutString(w.Emoticon) + } return nil } // Decode implements bin.Decoder. func (w *WallPaperSettings) Decode(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't decode wallPaperSettings#1dc1bca4 to nil") + return fmt.Errorf("can't decode wallPaperSettings#372efcd0 to nil") } if err := b.ConsumeID(WallPaperSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode wallPaperSettings#1dc1bca4: %w", err) + return fmt.Errorf("unable to decode wallPaperSettings#372efcd0: %w", err) } return w.DecodeBare(b) } @@ -339,11 +362,11 @@ func (w *WallPaperSettings) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (w *WallPaperSettings) DecodeBare(b *bin.Buffer) error { if w == nil { - return fmt.Errorf("can't decode wallPaperSettings#1dc1bca4 to nil") + return fmt.Errorf("can't decode wallPaperSettings#372efcd0 to nil") } { if err := w.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode wallPaperSettings#1dc1bca4: field flags: %w", err) + return fmt.Errorf("unable to decode wallPaperSettings#372efcd0: field flags: %w", err) } } w.Blur = w.Flags.Has(1) @@ -351,45 +374,52 @@ func (w *WallPaperSettings) DecodeBare(b *bin.Buffer) error { if w.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode wallPaperSettings#1dc1bca4: field background_color: %w", err) + return fmt.Errorf("unable to decode wallPaperSettings#372efcd0: field background_color: %w", err) } w.BackgroundColor = value } if w.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode wallPaperSettings#1dc1bca4: field second_background_color: %w", err) + return fmt.Errorf("unable to decode wallPaperSettings#372efcd0: field second_background_color: %w", err) } w.SecondBackgroundColor = value } if w.Flags.Has(5) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode wallPaperSettings#1dc1bca4: field third_background_color: %w", err) + return fmt.Errorf("unable to decode wallPaperSettings#372efcd0: field third_background_color: %w", err) } w.ThirdBackgroundColor = value } if w.Flags.Has(6) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode wallPaperSettings#1dc1bca4: field fourth_background_color: %w", err) + return fmt.Errorf("unable to decode wallPaperSettings#372efcd0: field fourth_background_color: %w", err) } w.FourthBackgroundColor = value } if w.Flags.Has(3) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode wallPaperSettings#1dc1bca4: field intensity: %w", err) + return fmt.Errorf("unable to decode wallPaperSettings#372efcd0: field intensity: %w", err) } w.Intensity = value } if w.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode wallPaperSettings#1dc1bca4: field rotation: %w", err) + return fmt.Errorf("unable to decode wallPaperSettings#372efcd0: field rotation: %w", err) } w.Rotation = value } + if w.Flags.Has(7) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode wallPaperSettings#372efcd0: field emoticon: %w", err) + } + w.Emoticon = value + } return nil } @@ -538,3 +568,21 @@ func (w *WallPaperSettings) GetRotation() (value int, ok bool) { } return w.Rotation, true } + +// SetEmoticon sets value of Emoticon conditional field. +func (w *WallPaperSettings) SetEmoticon(value string) { + w.Flags.Set(7) + w.Emoticon = value +} + +// GetEmoticon returns value of Emoticon conditional field and +// boolean which is true if field was set. +func (w *WallPaperSettings) GetEmoticon() (value string, ok bool) { + if w == nil { + return + } + if !w.Flags.Has(7) { + return value, false + } + return w.Emoticon, true +}