diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index f60e4320fb..c095be68a0 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: 173 -// SHA256: e9fedcc9c68ac53e741e5ea9122fa99f7918d8931635a213217fd4c1e947f7da +// Layer: 174 +// SHA256: 0ddea0bde6ac2c064737f407b043fa0ef68eb8d7710f92f8c7e758af19ca65bf boolFalse#bc799737 = Bool; @@ -168,7 +168,7 @@ channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true 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#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; +channelFull#44c054a7 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 boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -186,7 +186,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#76bec211 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int = Message; +message#1e4c8a69 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int = Message; messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message; @@ -304,6 +304,8 @@ messageActionGiveawayLaunch#332ba9ed = MessageAction; messageActionGiveawayResults#2a9fadc5 winners_count:int unclaimed_count:int = MessageAction; +messageActionBoostApply#cc02aa6d boosts:int = MessageAction; + dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -1600,6 +1602,8 @@ channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_valu channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeEmojiStickerSet#46d840ab prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; + channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; @@ -1970,7 +1974,7 @@ messages.discussionMessage#a6341782 flags:# messages:Vector max_id:flag messageReplyHeader#afbc09db flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector quote_offset:flags.10?int = MessageReplyHeader; -messageReplyStoryHeader#9c98bfc1 user_id:long story_id:int = MessageReplyHeader; +messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader; messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies; @@ -2310,7 +2314,7 @@ storyItemDeleted#51e6ee4f id:int = StoryItem; storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem; -storyItem#af6365a1 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector media:MessageMedia media_areas:flags.14?Vector privacy:flags.2?Vector views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem; +storyItem#79b26a24 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector media:MessageMedia media_areas:flags.14?Vector privacy:flags.2?Vector views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem; stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories; @@ -2330,7 +2334,7 @@ stories.storyViews#de9eed1d views:Vector users:Vector = storie inputReplyToMessage#22c0f6d5 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector quote_offset:flags.4?int = InputReplyTo; -inputReplyToStory#15b0f283 user_id:InputUser story_id:int = InputReplyTo; +inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo; exportedStoryLink#3fc9053b link:string = ExportedStoryLink; @@ -2396,7 +2400,7 @@ help.peerColorSet#26219a58 colors:Vector = help.PeerColorSet; help.peerColorProfileSet#767d61eb palette_colors:Vector bg_colors:Vector story_colors:Vector = help.PeerColorSet; -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.peerColorOption#adec6ebe 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 group_min_level:flags.4?int = help.PeerColorOption; help.peerColorsNotModified#2ba1f5ce = help.PeerColors; @@ -3325,6 +3329,10 @@ channels.getChannelRecommendations#83b70d97 channel:InputChannel = messages.Chat channels.updateEmojiStatus#f0d3e6a8 channel:InputChannel emoji_status:EmojiStatus = Updates; +channels.setBoostsToUnblockRestrictions#ad399cee channel:InputChannel boosts:int = Updates; + +channels.setEmojiStickers#3cd930b7 channel:InputChannel stickerset:InputStickerSet = Bool; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3577,4 +3585,4 @@ premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; -// LAYER 173 +// LAYER 174 diff --git a/_schema/telegram.tl b/_schema/telegram.tl index 9d230a821a..66cd13da6d 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: 173 -// SHA256: e9fedcc9c68ac53e741e5ea9122fa99f7918d8931635a213217fd4c1e947f7da +// Layer: 174 +// SHA256: 0ddea0bde6ac2c064737f407b043fa0ef68eb8d7710f92f8c7e758af19ca65bf boolFalse#bc799737 = Bool; @@ -169,7 +169,7 @@ channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true 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#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; +channelFull#44c054a7 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 boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -187,7 +187,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#76bec211 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int = Message; +message#1e4c8a69 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int = Message; messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message; @@ -305,6 +305,8 @@ messageActionGiveawayLaunch#332ba9ed = MessageAction; messageActionGiveawayResults#2a9fadc5 winners_count:int unclaimed_count:int = MessageAction; +messageActionBoostApply#cc02aa6d boosts:int = MessageAction; + dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -1601,6 +1603,8 @@ channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_valu channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeEmojiStickerSet#46d840ab prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; + channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; @@ -1971,7 +1975,7 @@ messages.discussionMessage#a6341782 flags:# messages:Vector max_id:flag messageReplyHeader#afbc09db flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector quote_offset:flags.10?int = MessageReplyHeader; -messageReplyStoryHeader#9c98bfc1 user_id:long story_id:int = MessageReplyHeader; +messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader; messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies; @@ -2311,7 +2315,7 @@ storyItemDeleted#51e6ee4f id:int = StoryItem; storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem; -storyItem#af6365a1 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector media:MessageMedia media_areas:flags.14?Vector privacy:flags.2?Vector views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem; +storyItem#79b26a24 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector media:MessageMedia media_areas:flags.14?Vector privacy:flags.2?Vector views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem; stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories; @@ -2331,7 +2335,7 @@ stories.storyViews#de9eed1d views:Vector users:Vector = storie inputReplyToMessage#22c0f6d5 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector quote_offset:flags.4?int = InputReplyTo; -inputReplyToStory#15b0f283 user_id:InputUser story_id:int = InputReplyTo; +inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo; exportedStoryLink#3fc9053b link:string = ExportedStoryLink; @@ -2397,7 +2401,7 @@ help.peerColorSet#26219a58 colors:Vector = help.PeerColorSet; help.peerColorProfileSet#767d61eb palette_colors:Vector bg_colors:Vector story_colors:Vector = help.PeerColorSet; -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.peerColorOption#adec6ebe 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 group_min_level:flags.4?int = help.PeerColorOption; help.peerColorsNotModified#2ba1f5ce = help.PeerColors; @@ -3326,6 +3330,10 @@ channels.getChannelRecommendations#83b70d97 channel:InputChannel = messages.Chat channels.updateEmojiStatus#f0d3e6a8 channel:InputChannel emoji_status:EmojiStatus = Updates; +channels.setBoostsToUnblockRestrictions#ad399cee channel:InputChannel boosts:int = Updates; + +channels.setEmojiStickers#3cd930b7 channel:InputChannel stickerset:InputStickerSet = Bool; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3610,4 +3618,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 173 +// LAYER 174 diff --git a/tg/tl_channel_admin_log_event_action_gen.go b/tg/tl_channel_admin_log_event_action_gen.go index 5006ade053..50167bd4b9 100644 --- a/tg/tl_channel_admin_log_event_action_gen.go +++ b/tg/tl_channel_admin_log_event_action_gen.go @@ -7395,6 +7395,179 @@ func (c *ChannelAdminLogEventActionChangeEmojiStatus) GetNewValue() (value Emoji return c.NewValue } +// ChannelAdminLogEventActionChangeEmojiStickerSet represents TL type `channelAdminLogEventActionChangeEmojiStickerSet#46d840ab`. +// +// See https://core.telegram.org/constructor/channelAdminLogEventActionChangeEmojiStickerSet for reference. +type ChannelAdminLogEventActionChangeEmojiStickerSet struct { + // PrevStickerset field of ChannelAdminLogEventActionChangeEmojiStickerSet. + PrevStickerset InputStickerSetClass + // NewStickerset field of ChannelAdminLogEventActionChangeEmojiStickerSet. + NewStickerset InputStickerSetClass +} + +// ChannelAdminLogEventActionChangeEmojiStickerSetTypeID is TL type id of ChannelAdminLogEventActionChangeEmojiStickerSet. +const ChannelAdminLogEventActionChangeEmojiStickerSetTypeID = 0x46d840ab + +// construct implements constructor of ChannelAdminLogEventActionClass. +func (c ChannelAdminLogEventActionChangeEmojiStickerSet) construct() ChannelAdminLogEventActionClass { + return &c +} + +// Ensuring interfaces in compile-time for ChannelAdminLogEventActionChangeEmojiStickerSet. +var ( + _ bin.Encoder = &ChannelAdminLogEventActionChangeEmojiStickerSet{} + _ bin.Decoder = &ChannelAdminLogEventActionChangeEmojiStickerSet{} + _ bin.BareEncoder = &ChannelAdminLogEventActionChangeEmojiStickerSet{} + _ bin.BareDecoder = &ChannelAdminLogEventActionChangeEmojiStickerSet{} + + _ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionChangeEmojiStickerSet{} +) + +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) Zero() bool { + if c == nil { + return true + } + if !(c.PrevStickerset == nil) { + return false + } + if !(c.NewStickerset == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) String() string { + if c == nil { + return "ChannelAdminLogEventActionChangeEmojiStickerSet(nil)" + } + type Alias ChannelAdminLogEventActionChangeEmojiStickerSet + return fmt.Sprintf("ChannelAdminLogEventActionChangeEmojiStickerSet%+v", Alias(*c)) +} + +// FillFrom fills ChannelAdminLogEventActionChangeEmojiStickerSet from given interface. +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) FillFrom(from interface { + GetPrevStickerset() (value InputStickerSetClass) + GetNewStickerset() (value InputStickerSetClass) +}) { + c.PrevStickerset = from.GetPrevStickerset() + c.NewStickerset = from.GetNewStickerset() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelAdminLogEventActionChangeEmojiStickerSet) TypeID() uint32 { + return ChannelAdminLogEventActionChangeEmojiStickerSetTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelAdminLogEventActionChangeEmojiStickerSet) TypeName() string { + return "channelAdminLogEventActionChangeEmojiStickerSet" +} + +// TypeInfo returns info about TL type. +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channelAdminLogEventActionChangeEmojiStickerSet", + ID: ChannelAdminLogEventActionChangeEmojiStickerSetTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "PrevStickerset", + SchemaName: "prev_stickerset", + }, + { + Name: "NewStickerset", + SchemaName: "new_stickerset", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab as nil") + } + b.PutID(ChannelAdminLogEventActionChangeEmojiStickerSetTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab as nil") + } + if c.PrevStickerset == nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab: field prev_stickerset is nil") + } + if err := c.PrevStickerset.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab: field prev_stickerset: %w", err) + } + if c.NewStickerset == nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab: field new_stickerset is nil") + } + if err := c.NewStickerset.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab: field new_stickerset: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab to nil") + } + if err := b.ConsumeID(ChannelAdminLogEventActionChangeEmojiStickerSetTypeID); err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab to nil") + } + { + value, err := DecodeInputStickerSet(b) + if err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab: field prev_stickerset: %w", err) + } + c.PrevStickerset = value + } + { + value, err := DecodeInputStickerSet(b) + if err != nil { + return fmt.Errorf("unable to decode channelAdminLogEventActionChangeEmojiStickerSet#46d840ab: field new_stickerset: %w", err) + } + c.NewStickerset = value + } + return nil +} + +// GetPrevStickerset returns value of PrevStickerset field. +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) GetPrevStickerset() (value InputStickerSetClass) { + if c == nil { + return + } + return c.PrevStickerset +} + +// GetNewStickerset returns value of NewStickerset field. +func (c *ChannelAdminLogEventActionChangeEmojiStickerSet) GetNewStickerset() (value InputStickerSetClass) { + if c == nil { + return + } + return c.NewStickerset +} + // ChannelAdminLogEventActionClassName is schema name of ChannelAdminLogEventActionClass. const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction" @@ -7456,6 +7629,7 @@ const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction" // case *tg.ChannelAdminLogEventActionChangeProfilePeerColor: // channelAdminLogEventActionChangeProfilePeerColor#5e477b25 // case *tg.ChannelAdminLogEventActionChangeWallpaper: // channelAdminLogEventActionChangeWallpaper#31bb5d52 // case *tg.ChannelAdminLogEventActionChangeEmojiStatus: // channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 +// case *tg.ChannelAdminLogEventActionChangeEmojiStickerSet: // channelAdminLogEventActionChangeEmojiStickerSet#46d840ab // default: panic(v) // } type ChannelAdminLogEventActionClass interface { @@ -7813,6 +7987,13 @@ func DecodeChannelAdminLogEventAction(buf *bin.Buffer) (ChannelAdminLogEventActi return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) } return &v, nil + case ChannelAdminLogEventActionChangeEmojiStickerSetTypeID: + // Decoding channelAdminLogEventActionChangeEmojiStickerSet#46d840ab. + v := ChannelAdminLogEventActionChangeEmojiStickerSet{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_channel_admin_log_event_action_slices_gen.go b/tg/tl_channel_admin_log_event_action_slices_gen.go index 8322d1487e..fa1a7d1600 100644 --- a/tg/tl_channel_admin_log_event_action_slices_gen.go +++ b/tg/tl_channel_admin_log_event_action_slices_gen.go @@ -701,6 +701,19 @@ func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChange return to } +// AsChannelAdminLogEventActionChangeEmojiStickerSet returns copy with only ChannelAdminLogEventActionChangeEmojiStickerSet constructors. +func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionChangeEmojiStickerSet() (to ChannelAdminLogEventActionChangeEmojiStickerSetArray) { + for _, elem := range s { + value, ok := elem.(*ChannelAdminLogEventActionChangeEmojiStickerSet) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // ChannelAdminLogEventActionChangeTitleArray is adapter for slice of ChannelAdminLogEventActionChangeTitle. type ChannelAdminLogEventActionChangeTitleArray []ChannelAdminLogEventActionChangeTitle @@ -4390,3 +4403,85 @@ func (s *ChannelAdminLogEventActionChangeEmojiStatusArray) Pop() (v ChannelAdmin return v, true } + +// ChannelAdminLogEventActionChangeEmojiStickerSetArray is adapter for slice of ChannelAdminLogEventActionChangeEmojiStickerSet. +type ChannelAdminLogEventActionChangeEmojiStickerSetArray []ChannelAdminLogEventActionChangeEmojiStickerSet + +// Sort sorts slice of ChannelAdminLogEventActionChangeEmojiStickerSet. +func (s ChannelAdminLogEventActionChangeEmojiStickerSetArray) Sort(less func(a, b ChannelAdminLogEventActionChangeEmojiStickerSet) bool) ChannelAdminLogEventActionChangeEmojiStickerSetArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of ChannelAdminLogEventActionChangeEmojiStickerSet. +func (s ChannelAdminLogEventActionChangeEmojiStickerSetArray) SortStable(less func(a, b ChannelAdminLogEventActionChangeEmojiStickerSet) bool) ChannelAdminLogEventActionChangeEmojiStickerSetArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of ChannelAdminLogEventActionChangeEmojiStickerSet. +func (s ChannelAdminLogEventActionChangeEmojiStickerSetArray) Retain(keep func(x ChannelAdminLogEventActionChangeEmojiStickerSet) bool) ChannelAdminLogEventActionChangeEmojiStickerSetArray { + 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 ChannelAdminLogEventActionChangeEmojiStickerSetArray) First() (v ChannelAdminLogEventActionChangeEmojiStickerSet, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s ChannelAdminLogEventActionChangeEmojiStickerSetArray) Last() (v ChannelAdminLogEventActionChangeEmojiStickerSet, 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 *ChannelAdminLogEventActionChangeEmojiStickerSetArray) PopFirst() (v ChannelAdminLogEventActionChangeEmojiStickerSet, 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 ChannelAdminLogEventActionChangeEmojiStickerSet + 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 *ChannelAdminLogEventActionChangeEmojiStickerSetArray) Pop() (v ChannelAdminLogEventActionChangeEmojiStickerSet, 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_channels_set_boosts_to_unblock_restrictions_gen.go b/tg/tl_channels_set_boosts_to_unblock_restrictions_gen.go new file mode 100644 index 0000000000..fe7aa1ed01 --- /dev/null +++ b/tg/tl_channels_set_boosts_to_unblock_restrictions_gen.go @@ -0,0 +1,210 @@ +// 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{} +) + +// ChannelsSetBoostsToUnblockRestrictionsRequest represents TL type `channels.setBoostsToUnblockRestrictions#ad399cee`. +// +// See https://core.telegram.org/method/channels.setBoostsToUnblockRestrictions for reference. +type ChannelsSetBoostsToUnblockRestrictionsRequest struct { + // Channel field of ChannelsSetBoostsToUnblockRestrictionsRequest. + Channel InputChannelClass + // Boosts field of ChannelsSetBoostsToUnblockRestrictionsRequest. + Boosts int +} + +// ChannelsSetBoostsToUnblockRestrictionsRequestTypeID is TL type id of ChannelsSetBoostsToUnblockRestrictionsRequest. +const ChannelsSetBoostsToUnblockRestrictionsRequestTypeID = 0xad399cee + +// Ensuring interfaces in compile-time for ChannelsSetBoostsToUnblockRestrictionsRequest. +var ( + _ bin.Encoder = &ChannelsSetBoostsToUnblockRestrictionsRequest{} + _ bin.Decoder = &ChannelsSetBoostsToUnblockRestrictionsRequest{} + _ bin.BareEncoder = &ChannelsSetBoostsToUnblockRestrictionsRequest{} + _ bin.BareDecoder = &ChannelsSetBoostsToUnblockRestrictionsRequest{} +) + +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Channel == nil) { + return false + } + if !(s.Boosts == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) String() string { + if s == nil { + return "ChannelsSetBoostsToUnblockRestrictionsRequest(nil)" + } + type Alias ChannelsSetBoostsToUnblockRestrictionsRequest + return fmt.Sprintf("ChannelsSetBoostsToUnblockRestrictionsRequest%+v", Alias(*s)) +} + +// FillFrom fills ChannelsSetBoostsToUnblockRestrictionsRequest from given interface. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) FillFrom(from interface { + GetChannel() (value InputChannelClass) + GetBoosts() (value int) +}) { + s.Channel = from.GetChannel() + s.Boosts = from.GetBoosts() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelsSetBoostsToUnblockRestrictionsRequest) TypeID() uint32 { + return ChannelsSetBoostsToUnblockRestrictionsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelsSetBoostsToUnblockRestrictionsRequest) TypeName() string { + return "channels.setBoostsToUnblockRestrictions" +} + +// TypeInfo returns info about TL type. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channels.setBoostsToUnblockRestrictions", + ID: ChannelsSetBoostsToUnblockRestrictionsRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Channel", + SchemaName: "channel", + }, + { + Name: "Boosts", + SchemaName: "boosts", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode channels.setBoostsToUnblockRestrictions#ad399cee as nil") + } + b.PutID(ChannelsSetBoostsToUnblockRestrictionsRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode channels.setBoostsToUnblockRestrictions#ad399cee as nil") + } + if s.Channel == nil { + return fmt.Errorf("unable to encode channels.setBoostsToUnblockRestrictions#ad399cee: field channel is nil") + } + if err := s.Channel.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.setBoostsToUnblockRestrictions#ad399cee: field channel: %w", err) + } + b.PutInt(s.Boosts) + return nil +} + +// Decode implements bin.Decoder. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode channels.setBoostsToUnblockRestrictions#ad399cee to nil") + } + if err := b.ConsumeID(ChannelsSetBoostsToUnblockRestrictionsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode channels.setBoostsToUnblockRestrictions#ad399cee: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode channels.setBoostsToUnblockRestrictions#ad399cee to nil") + } + { + value, err := DecodeInputChannel(b) + if err != nil { + return fmt.Errorf("unable to decode channels.setBoostsToUnblockRestrictions#ad399cee: field channel: %w", err) + } + s.Channel = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode channels.setBoostsToUnblockRestrictions#ad399cee: field boosts: %w", err) + } + s.Boosts = value + } + return nil +} + +// GetChannel returns value of Channel field. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) GetChannel() (value InputChannelClass) { + if s == nil { + return + } + return s.Channel +} + +// GetBoosts returns value of Boosts field. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) GetBoosts() (value int) { + if s == nil { + return + } + return s.Boosts +} + +// GetChannelAsNotEmpty returns mapped value of Channel field. +func (s *ChannelsSetBoostsToUnblockRestrictionsRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { + return s.Channel.AsNotEmpty() +} + +// ChannelsSetBoostsToUnblockRestrictions invokes method channels.setBoostsToUnblockRestrictions#ad399cee returning error if any. +// +// See https://core.telegram.org/method/channels.setBoostsToUnblockRestrictions for reference. +func (c *Client) ChannelsSetBoostsToUnblockRestrictions(ctx context.Context, request *ChannelsSetBoostsToUnblockRestrictionsRequest) (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_set_boosts_to_unblock_restrictions_slices_gen.go b/tg/tl_channels_set_boosts_to_unblock_restrictions_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_channels_set_boosts_to_unblock_restrictions_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_channels_set_emoji_stickers_gen.go b/tg/tl_channels_set_emoji_stickers_gen.go new file mode 100644 index 0000000000..f2364ef82c --- /dev/null +++ b/tg/tl_channels_set_emoji_stickers_gen.go @@ -0,0 +1,216 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// ChannelsSetEmojiStickersRequest represents TL type `channels.setEmojiStickers#3cd930b7`. +// +// See https://core.telegram.org/method/channels.setEmojiStickers for reference. +type ChannelsSetEmojiStickersRequest struct { + // Channel field of ChannelsSetEmojiStickersRequest. + Channel InputChannelClass + // Stickerset field of ChannelsSetEmojiStickersRequest. + Stickerset InputStickerSetClass +} + +// ChannelsSetEmojiStickersRequestTypeID is TL type id of ChannelsSetEmojiStickersRequest. +const ChannelsSetEmojiStickersRequestTypeID = 0x3cd930b7 + +// Ensuring interfaces in compile-time for ChannelsSetEmojiStickersRequest. +var ( + _ bin.Encoder = &ChannelsSetEmojiStickersRequest{} + _ bin.Decoder = &ChannelsSetEmojiStickersRequest{} + _ bin.BareEncoder = &ChannelsSetEmojiStickersRequest{} + _ bin.BareDecoder = &ChannelsSetEmojiStickersRequest{} +) + +func (s *ChannelsSetEmojiStickersRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Channel == nil) { + return false + } + if !(s.Stickerset == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *ChannelsSetEmojiStickersRequest) String() string { + if s == nil { + return "ChannelsSetEmojiStickersRequest(nil)" + } + type Alias ChannelsSetEmojiStickersRequest + return fmt.Sprintf("ChannelsSetEmojiStickersRequest%+v", Alias(*s)) +} + +// FillFrom fills ChannelsSetEmojiStickersRequest from given interface. +func (s *ChannelsSetEmojiStickersRequest) FillFrom(from interface { + GetChannel() (value InputChannelClass) + GetStickerset() (value InputStickerSetClass) +}) { + s.Channel = from.GetChannel() + s.Stickerset = from.GetStickerset() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelsSetEmojiStickersRequest) TypeID() uint32 { + return ChannelsSetEmojiStickersRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelsSetEmojiStickersRequest) TypeName() string { + return "channels.setEmojiStickers" +} + +// TypeInfo returns info about TL type. +func (s *ChannelsSetEmojiStickersRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channels.setEmojiStickers", + ID: ChannelsSetEmojiStickersRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Channel", + SchemaName: "channel", + }, + { + Name: "Stickerset", + SchemaName: "stickerset", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *ChannelsSetEmojiStickersRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode channels.setEmojiStickers#3cd930b7 as nil") + } + b.PutID(ChannelsSetEmojiStickersRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *ChannelsSetEmojiStickersRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode channels.setEmojiStickers#3cd930b7 as nil") + } + if s.Channel == nil { + return fmt.Errorf("unable to encode channels.setEmojiStickers#3cd930b7: field channel is nil") + } + if err := s.Channel.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.setEmojiStickers#3cd930b7: field channel: %w", err) + } + if s.Stickerset == nil { + return fmt.Errorf("unable to encode channels.setEmojiStickers#3cd930b7: field stickerset is nil") + } + if err := s.Stickerset.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.setEmojiStickers#3cd930b7: field stickerset: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *ChannelsSetEmojiStickersRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode channels.setEmojiStickers#3cd930b7 to nil") + } + if err := b.ConsumeID(ChannelsSetEmojiStickersRequestTypeID); err != nil { + return fmt.Errorf("unable to decode channels.setEmojiStickers#3cd930b7: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *ChannelsSetEmojiStickersRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode channels.setEmojiStickers#3cd930b7 to nil") + } + { + value, err := DecodeInputChannel(b) + if err != nil { + return fmt.Errorf("unable to decode channels.setEmojiStickers#3cd930b7: field channel: %w", err) + } + s.Channel = value + } + { + value, err := DecodeInputStickerSet(b) + if err != nil { + return fmt.Errorf("unable to decode channels.setEmojiStickers#3cd930b7: field stickerset: %w", err) + } + s.Stickerset = value + } + return nil +} + +// GetChannel returns value of Channel field. +func (s *ChannelsSetEmojiStickersRequest) GetChannel() (value InputChannelClass) { + if s == nil { + return + } + return s.Channel +} + +// GetStickerset returns value of Stickerset field. +func (s *ChannelsSetEmojiStickersRequest) GetStickerset() (value InputStickerSetClass) { + if s == nil { + return + } + return s.Stickerset +} + +// GetChannelAsNotEmpty returns mapped value of Channel field. +func (s *ChannelsSetEmojiStickersRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { + return s.Channel.AsNotEmpty() +} + +// ChannelsSetEmojiStickers invokes method channels.setEmojiStickers#3cd930b7 returning error if any. +// +// See https://core.telegram.org/method/channels.setEmojiStickers for reference. +func (c *Client) ChannelsSetEmojiStickers(ctx context.Context, request *ChannelsSetEmojiStickersRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_channels_set_emoji_stickers_slices_gen.go b/tg/tl_channels_set_emoji_stickers_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_channels_set_emoji_stickers_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 26a8eca85d..1cc0d7813c 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#f2bcb6f`. +// ChannelFull represents TL type `channelFull#44c054a7`. // Full info about a channel¹, supergroup² or gigagroup³. // // Links: @@ -1278,10 +1278,22 @@ type ChannelFull struct { // // Use SetWallpaper and GetWallpaper helpers. Wallpaper WallPaperClass + // BoostsApplied field of ChannelFull. + // + // Use SetBoostsApplied and GetBoostsApplied helpers. + BoostsApplied int + // BoostsUnrestrict field of ChannelFull. + // + // Use SetBoostsUnrestrict and GetBoostsUnrestrict helpers. + BoostsUnrestrict int + // Emojiset field of ChannelFull. + // + // Use SetEmojiset and GetEmojiset helpers. + Emojiset StickerSet } // ChannelFullTypeID is TL type id of ChannelFull. -const ChannelFullTypeID = 0xf2bcb6f +const ChannelFullTypeID = 0x44c054a7 // construct implements constructor of ChatFullClass. func (c ChannelFull) construct() ChatFullClass { return &c } @@ -1459,6 +1471,15 @@ func (c *ChannelFull) Zero() bool { if !(c.Wallpaper == nil) { return false } + if !(c.BoostsApplied == 0) { + return false + } + if !(c.BoostsUnrestrict == 0) { + return false + } + if !(c.Emojiset.Zero()) { + return false + } return true } @@ -1525,6 +1546,9 @@ func (c *ChannelFull) FillFrom(from interface { GetAvailableReactions() (value ChatReactionsClass, ok bool) GetStories() (value PeerStories, ok bool) GetWallpaper() (value WallPaperClass, ok bool) + GetBoostsApplied() (value int, ok bool) + GetBoostsUnrestrict() (value int, ok bool) + GetEmojiset() (value StickerSet, ok bool) }) { c.CanViewParticipants = from.GetCanViewParticipants() c.CanSetUsername = from.GetCanSetUsername() @@ -1661,6 +1685,18 @@ func (c *ChannelFull) FillFrom(from interface { c.Wallpaper = val } + if val, ok := from.GetBoostsApplied(); ok { + c.BoostsApplied = val + } + + if val, ok := from.GetBoostsUnrestrict(); ok { + c.BoostsUnrestrict = val + } + + if val, ok := from.GetEmojiset(); ok { + c.Emojiset = val + } + } // TypeID returns type id in TL schema. @@ -1932,6 +1968,21 @@ func (c *ChannelFull) TypeInfo() tdp.Type { SchemaName: "wallpaper", Null: !c.Flags2.Has(7), }, + { + Name: "BoostsApplied", + SchemaName: "boosts_applied", + Null: !c.Flags2.Has(8), + }, + { + Name: "BoostsUnrestrict", + SchemaName: "boosts_unrestrict", + Null: !c.Flags2.Has(9), + }, + { + Name: "Emojiset", + SchemaName: "emojiset", + Null: !c.Flags2.Has(10), + }, } return typ } @@ -2064,12 +2115,21 @@ func (c *ChannelFull) SetFlags() { if !(c.Wallpaper == nil) { c.Flags2.Set(7) } + if !(c.BoostsApplied == 0) { + c.Flags2.Set(8) + } + if !(c.BoostsUnrestrict == 0) { + c.Flags2.Set(9) + } + if !(c.Emojiset.Zero()) { + c.Flags2.Set(10) + } } // Encode implements bin.Encoder. func (c *ChannelFull) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channelFull#f2bcb6f as nil") + return fmt.Errorf("can't encode channelFull#44c054a7 as nil") } b.PutID(ChannelFullTypeID) return c.EncodeBare(b) @@ -2078,14 +2138,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#f2bcb6f as nil") + return fmt.Errorf("can't encode channelFull#44c054a7 as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field flags: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field flags: %w", err) } if err := c.Flags2.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field flags2: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field flags2: %w", err) } b.PutLong(c.ID) b.PutString(c.About) @@ -2108,26 +2168,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#f2bcb6f: field chat_photo is nil") + return fmt.Errorf("unable to encode channelFull#44c054a7: field chat_photo is nil") } if err := c.ChatPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field chat_photo: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field chat_photo: %w", err) } if err := c.NotifySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field notify_settings: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field notify_settings: %w", err) } if c.Flags.Has(23) { if c.ExportedInvite == nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field exported_invite is nil") + return fmt.Errorf("unable to encode channelFull#44c054a7: field exported_invite is nil") } if err := c.ExportedInvite.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field exported_invite: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: 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#f2bcb6f: field bot_info element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field bot_info element with index %d: %w", idx, err) } } if c.Flags.Has(4) { @@ -2141,7 +2201,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#f2bcb6f: field stickerset: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field stickerset: %w", err) } } if c.Flags.Has(9) { @@ -2155,10 +2215,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#f2bcb6f: field location is nil") + return fmt.Errorf("unable to encode channelFull#44c054a7: field location is nil") } if err := c.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field location: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field location: %w", err) } } if c.Flags.Has(17) { @@ -2173,7 +2233,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#f2bcb6f: field call: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field call: %w", err) } } if c.Flags.Has(24) { @@ -2187,10 +2247,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#f2bcb6f: field groupcall_default_join_as is nil") + return fmt.Errorf("unable to encode channelFull#44c054a7: field groupcall_default_join_as is nil") } if err := c.GroupcallDefaultJoinAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field groupcall_default_join_as: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field groupcall_default_join_as: %w", err) } } if c.Flags.Has(27) { @@ -2207,31 +2267,42 @@ func (c *ChannelFull) EncodeBare(b *bin.Buffer) error { } if c.Flags.Has(29) { if c.DefaultSendAs == nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field default_send_as is nil") + return fmt.Errorf("unable to encode channelFull#44c054a7: field default_send_as is nil") } if err := c.DefaultSendAs.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field default_send_as: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: field default_send_as: %w", err) } } if c.Flags.Has(30) { if c.AvailableReactions == nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field available_reactions is nil") + return fmt.Errorf("unable to encode channelFull#44c054a7: field available_reactions is nil") } if err := c.AvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode channelFull#f2bcb6f: field available_reactions: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: 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#f2bcb6f: field stories: %w", err) + return fmt.Errorf("unable to encode channelFull#44c054a7: 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") + return fmt.Errorf("unable to encode channelFull#44c054a7: 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 fmt.Errorf("unable to encode channelFull#44c054a7: field wallpaper: %w", err) + } + } + if c.Flags2.Has(8) { + b.PutInt(c.BoostsApplied) + } + if c.Flags2.Has(9) { + b.PutInt(c.BoostsUnrestrict) + } + if c.Flags2.Has(10) { + if err := c.Emojiset.Encode(b); err != nil { + return fmt.Errorf("unable to encode channelFull#44c054a7: field emojiset: %w", err) } } return nil @@ -2240,10 +2311,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#f2bcb6f to nil") + return fmt.Errorf("can't decode channelFull#44c054a7 to nil") } if err := b.ConsumeID(ChannelFullTypeID); err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: %w", err) } return c.DecodeBare(b) } @@ -2251,11 +2322,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#f2bcb6f to nil") + return fmt.Errorf("can't decode channelFull#44c054a7 to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field flags: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field flags: %w", err) } } c.CanViewParticipants = c.Flags.Has(3) @@ -2268,7 +2339,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#f2bcb6f: field flags2: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field flags2: %w", err) } } c.CanDeleteChannel = c.Flags2.Has(0) @@ -2280,96 +2351,96 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field id: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field id: %w", err) } c.ID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field about: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field participants_count: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field admins_count: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field kicked_count: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field banned_count: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field online_count: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field online_count: %w", err) } c.OnlineCount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field read_inbox_max_id: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field read_inbox_max_id: %w", err) } c.ReadInboxMaxID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field read_outbox_max_id: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field read_outbox_max_id: %w", err) } c.ReadOutboxMaxID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field unread_count: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field unread_count: %w", err) } c.UnreadCount = value } { value, err := DecodePhoto(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field chat_photo: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field chat_photo: %w", err) } c.ChatPhoto = value } { if err := c.NotifySettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field notify_settings: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field notify_settings: %w", err) } } if c.Flags.Has(23) { value, err := DecodeExportedChatInvite(b) if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field exported_invite: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field exported_invite: %w", err) } c.ExportedInvite = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field bot_info: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field bot_info: %w", err) } if headerLen > 0 { @@ -2378,7 +2449,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#f2bcb6f: field bot_info: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field bot_info: %w", err) } c.BotInfo = append(c.BotInfo, value) } @@ -2386,101 +2457,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#f2bcb6f: field migrated_from_chat_id: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field migrated_from_max_id: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field pinned_msg_id: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field stickerset: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field stickerset: %w", err) } } if c.Flags.Has(9) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field available_min_id: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field folder_id: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field linked_chat_id: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field location: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field slowmode_seconds: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field slowmode_next_send_date: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field stats_dc: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field stats_dc: %w", err) } c.StatsDC = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field pts: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field call: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field call: %w", err) } } if c.Flags.Has(24) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channelFull#f2bcb6f: field ttl_period: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field pending_suggestions: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field pending_suggestions: %w", err) } if headerLen > 0 { @@ -2489,7 +2560,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#f2bcb6f: field pending_suggestions: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field pending_suggestions: %w", err) } c.PendingSuggestions = append(c.PendingSuggestions, value) } @@ -2497,28 +2568,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#f2bcb6f: field groupcall_default_join_as: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field theme_emoticon: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field requests_pending: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field recent_requesters: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field recent_requesters: %w", err) } if headerLen > 0 { @@ -2527,7 +2598,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#f2bcb6f: field recent_requesters: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: field recent_requesters: %w", err) } c.RecentRequesters = append(c.RecentRequesters, value) } @@ -2535,29 +2606,48 @@ 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#f2bcb6f: field default_send_as: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field available_reactions: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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#f2bcb6f: field stories: %w", err) + return fmt.Errorf("unable to decode channelFull#44c054a7: 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) + return fmt.Errorf("unable to decode channelFull#44c054a7: field wallpaper: %w", err) } c.Wallpaper = value } + if c.Flags2.Has(8) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode channelFull#44c054a7: field boosts_applied: %w", err) + } + c.BoostsApplied = value + } + if c.Flags2.Has(9) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode channelFull#44c054a7: field boosts_unrestrict: %w", err) + } + c.BoostsUnrestrict = value + } + if c.Flags2.Has(10) { + if err := c.Emojiset.Decode(b); err != nil { + return fmt.Errorf("unable to decode channelFull#44c054a7: field emojiset: %w", err) + } + } return nil } @@ -3403,6 +3493,60 @@ func (c *ChannelFull) GetWallpaper() (value WallPaperClass, ok bool) { return c.Wallpaper, true } +// SetBoostsApplied sets value of BoostsApplied conditional field. +func (c *ChannelFull) SetBoostsApplied(value int) { + c.Flags2.Set(8) + c.BoostsApplied = value +} + +// GetBoostsApplied returns value of BoostsApplied conditional field and +// boolean which is true if field was set. +func (c *ChannelFull) GetBoostsApplied() (value int, ok bool) { + if c == nil { + return + } + if !c.Flags2.Has(8) { + return value, false + } + return c.BoostsApplied, true +} + +// SetBoostsUnrestrict sets value of BoostsUnrestrict conditional field. +func (c *ChannelFull) SetBoostsUnrestrict(value int) { + c.Flags2.Set(9) + c.BoostsUnrestrict = value +} + +// GetBoostsUnrestrict returns value of BoostsUnrestrict conditional field and +// boolean which is true if field was set. +func (c *ChannelFull) GetBoostsUnrestrict() (value int, ok bool) { + if c == nil { + return + } + if !c.Flags2.Has(9) { + return value, false + } + return c.BoostsUnrestrict, true +} + +// SetEmojiset sets value of Emojiset conditional field. +func (c *ChannelFull) SetEmojiset(value StickerSet) { + c.Flags2.Set(10) + c.Emojiset = value +} + +// GetEmojiset returns value of Emojiset conditional field and +// boolean which is true if field was set. +func (c *ChannelFull) GetEmojiset() (value StickerSet, ok bool) { + if c == nil { + return + } + if !c.Flags2.Has(10) { + return value, false + } + return c.Emojiset, true +} + // ChatFullClassName is schema name of ChatFullClass. const ChatFullClassName = "ChatFull" @@ -3418,7 +3562,7 @@ const ChatFullClassName = "ChatFull" // } // switch v := g.(type) { // case *tg.ChatFull: // chatFull#c9d31138 -// case *tg.ChannelFull: // channelFull#f2bcb6f +// case *tg.ChannelFull: // channelFull#44c054a7 // default: panic(v) // } type ChatFullClass interface { @@ -3524,7 +3668,7 @@ func DecodeChatFull(buf *bin.Buffer) (ChatFullClass, error) { } return &v, nil case ChannelFullTypeID: - // Decoding channelFull#f2bcb6f. + // Decoding channelFull#44c054a7. v := ChannelFull{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatFullClass: %w", err) diff --git a/tg/tl_help_peer_color_option_gen.go b/tg/tl_help_peer_color_option_gen.go index b273dc39bc..bb588925fb 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#ef8430ab`. +// HelpPeerColorOption represents TL type `help.peerColorOption#adec6ebe`. // Contains info about a color palette »¹. // // Links: @@ -68,10 +68,14 @@ type HelpPeerColorOption struct { // // Use SetChannelMinLevel and GetChannelMinLevel helpers. ChannelMinLevel int + // GroupMinLevel field of HelpPeerColorOption. + // + // Use SetGroupMinLevel and GetGroupMinLevel helpers. + GroupMinLevel int } // HelpPeerColorOptionTypeID is TL type id of HelpPeerColorOption. -const HelpPeerColorOptionTypeID = 0xef8430ab +const HelpPeerColorOptionTypeID = 0xadec6ebe // Ensuring interfaces in compile-time for HelpPeerColorOption. var ( @@ -103,6 +107,9 @@ func (p *HelpPeerColorOption) Zero() bool { if !(p.ChannelMinLevel == 0) { return false } + if !(p.GroupMinLevel == 0) { + return false + } return true } @@ -123,6 +130,7 @@ func (p *HelpPeerColorOption) FillFrom(from interface { GetColors() (value HelpPeerColorSetClass, ok bool) GetDarkColors() (value HelpPeerColorSetClass, ok bool) GetChannelMinLevel() (value int, ok bool) + GetGroupMinLevel() (value int, ok bool) }) { p.Hidden = from.GetHidden() p.ColorID = from.GetColorID() @@ -138,6 +146,10 @@ func (p *HelpPeerColorOption) FillFrom(from interface { p.ChannelMinLevel = val } + if val, ok := from.GetGroupMinLevel(); ok { + p.GroupMinLevel = val + } + } // TypeID returns type id in TL schema. @@ -187,6 +199,11 @@ func (p *HelpPeerColorOption) TypeInfo() tdp.Type { SchemaName: "channel_min_level", Null: !p.Flags.Has(3), }, + { + Name: "GroupMinLevel", + SchemaName: "group_min_level", + Null: !p.Flags.Has(4), + }, } return typ } @@ -205,12 +222,15 @@ func (p *HelpPeerColorOption) SetFlags() { if !(p.ChannelMinLevel == 0) { p.Flags.Set(3) } + if !(p.GroupMinLevel == 0) { + p.Flags.Set(4) + } } // Encode implements bin.Encoder. func (p *HelpPeerColorOption) Encode(b *bin.Buffer) error { if p == nil { - return fmt.Errorf("can't encode help.peerColorOption#ef8430ab as nil") + return fmt.Errorf("can't encode help.peerColorOption#adec6ebe as nil") } b.PutID(HelpPeerColorOptionTypeID) return p.EncodeBare(b) @@ -219,42 +239,45 @@ 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#ef8430ab as nil") + return fmt.Errorf("can't encode help.peerColorOption#adec6ebe as nil") } p.SetFlags() if err := p.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode help.peerColorOption#ef8430ab: field flags: %w", err) + return fmt.Errorf("unable to encode help.peerColorOption#adec6ebe: 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#ef8430ab: field colors is nil") + return fmt.Errorf("unable to encode help.peerColorOption#adec6ebe: field colors is nil") } if err := p.Colors.Encode(b); err != nil { - return fmt.Errorf("unable to encode help.peerColorOption#ef8430ab: field colors: %w", err) + return fmt.Errorf("unable to encode help.peerColorOption#adec6ebe: field colors: %w", err) } } if p.Flags.Has(2) { if p.DarkColors == nil { - return fmt.Errorf("unable to encode help.peerColorOption#ef8430ab: field dark_colors is nil") + return fmt.Errorf("unable to encode help.peerColorOption#adec6ebe: field dark_colors is nil") } if err := p.DarkColors.Encode(b); err != nil { - return fmt.Errorf("unable to encode help.peerColorOption#ef8430ab: field dark_colors: %w", err) + return fmt.Errorf("unable to encode help.peerColorOption#adec6ebe: field dark_colors: %w", err) } } if p.Flags.Has(3) { b.PutInt(p.ChannelMinLevel) } + if p.Flags.Has(4) { + b.PutInt(p.GroupMinLevel) + } 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#ef8430ab to nil") + return fmt.Errorf("can't decode help.peerColorOption#adec6ebe to nil") } if err := b.ConsumeID(HelpPeerColorOptionTypeID); err != nil { - return fmt.Errorf("unable to decode help.peerColorOption#ef8430ab: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#adec6ebe: %w", err) } return p.DecodeBare(b) } @@ -262,42 +285,49 @@ 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#ef8430ab to nil") + return fmt.Errorf("can't decode help.peerColorOption#adec6ebe to nil") } { if err := p.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode help.peerColorOption#ef8430ab: field flags: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#adec6ebe: 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#ef8430ab: field color_id: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#adec6ebe: 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#ef8430ab: field colors: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#adec6ebe: 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#ef8430ab: field dark_colors: %w", err) + return fmt.Errorf("unable to decode help.peerColorOption#adec6ebe: 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) + return fmt.Errorf("unable to decode help.peerColorOption#adec6ebe: field channel_min_level: %w", err) } p.ChannelMinLevel = value } + if p.Flags.Has(4) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorOption#adec6ebe: field group_min_level: %w", err) + } + p.GroupMinLevel = value + } return nil } @@ -381,3 +411,21 @@ func (p *HelpPeerColorOption) GetChannelMinLevel() (value int, ok bool) { } return p.ChannelMinLevel, true } + +// SetGroupMinLevel sets value of GroupMinLevel conditional field. +func (p *HelpPeerColorOption) SetGroupMinLevel(value int) { + p.Flags.Set(4) + p.GroupMinLevel = value +} + +// GetGroupMinLevel returns value of GroupMinLevel conditional field and +// boolean which is true if field was set. +func (p *HelpPeerColorOption) GetGroupMinLevel() (value int, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(4) { + return value, false + } + return p.GroupMinLevel, true +} diff --git a/tg/tl_input_reply_to_gen.go b/tg/tl_input_reply_to_gen.go index 872f6e4475..7b93ba4eaa 100644 --- a/tg/tl_input_reply_to_gen.go +++ b/tg/tl_input_reply_to_gen.go @@ -473,19 +473,19 @@ func (i *InputReplyToMessage) MapQuoteEntities() (value MessageEntityClassArray, return MessageEntityClassArray(i.QuoteEntities), true } -// InputReplyToStory represents TL type `inputReplyToStory#15b0f283`. +// InputReplyToStory represents TL type `inputReplyToStory#5881323a`. // Reply to a story. // // See https://core.telegram.org/constructor/inputReplyToStory for reference. type InputReplyToStory struct { - // ID of the user that posted the story. - UserID InputUserClass + // Peer field of InputReplyToStory. + Peer InputPeerClass // ID of the story to reply to. StoryID int } // InputReplyToStoryTypeID is TL type id of InputReplyToStory. -const InputReplyToStoryTypeID = 0x15b0f283 +const InputReplyToStoryTypeID = 0x5881323a // construct implements constructor of InputReplyToClass. func (i InputReplyToStory) construct() InputReplyToClass { return &i } @@ -504,7 +504,7 @@ func (i *InputReplyToStory) Zero() bool { if i == nil { return true } - if !(i.UserID == nil) { + if !(i.Peer == nil) { return false } if !(i.StoryID == 0) { @@ -525,10 +525,10 @@ func (i *InputReplyToStory) String() string { // FillFrom fills InputReplyToStory from given interface. func (i *InputReplyToStory) FillFrom(from interface { - GetUserID() (value InputUserClass) + GetPeer() (value InputPeerClass) GetStoryID() (value int) }) { - i.UserID = from.GetUserID() + i.Peer = from.GetPeer() i.StoryID = from.GetStoryID() } @@ -556,8 +556,8 @@ func (i *InputReplyToStory) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "UserID", - SchemaName: "user_id", + Name: "Peer", + SchemaName: "peer", }, { Name: "StoryID", @@ -570,7 +570,7 @@ func (i *InputReplyToStory) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (i *InputReplyToStory) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputReplyToStory#15b0f283 as nil") + return fmt.Errorf("can't encode inputReplyToStory#5881323a as nil") } b.PutID(InputReplyToStoryTypeID) return i.EncodeBare(b) @@ -579,13 +579,13 @@ func (i *InputReplyToStory) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputReplyToStory) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputReplyToStory#15b0f283 as nil") + return fmt.Errorf("can't encode inputReplyToStory#5881323a as nil") } - if i.UserID == nil { - return fmt.Errorf("unable to encode inputReplyToStory#15b0f283: field user_id is nil") + if i.Peer == nil { + return fmt.Errorf("unable to encode inputReplyToStory#5881323a: field peer is nil") } - if err := i.UserID.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputReplyToStory#15b0f283: field user_id: %w", err) + if err := i.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputReplyToStory#5881323a: field peer: %w", err) } b.PutInt(i.StoryID) return nil @@ -594,10 +594,10 @@ func (i *InputReplyToStory) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (i *InputReplyToStory) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputReplyToStory#15b0f283 to nil") + return fmt.Errorf("can't decode inputReplyToStory#5881323a to nil") } if err := b.ConsumeID(InputReplyToStoryTypeID); err != nil { - return fmt.Errorf("unable to decode inputReplyToStory#15b0f283: %w", err) + return fmt.Errorf("unable to decode inputReplyToStory#5881323a: %w", err) } return i.DecodeBare(b) } @@ -605,31 +605,31 @@ func (i *InputReplyToStory) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputReplyToStory) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputReplyToStory#15b0f283 to nil") + return fmt.Errorf("can't decode inputReplyToStory#5881323a to nil") } { - value, err := DecodeInputUser(b) + value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode inputReplyToStory#15b0f283: field user_id: %w", err) + return fmt.Errorf("unable to decode inputReplyToStory#5881323a: field peer: %w", err) } - i.UserID = value + i.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode inputReplyToStory#15b0f283: field story_id: %w", err) + return fmt.Errorf("unable to decode inputReplyToStory#5881323a: field story_id: %w", err) } i.StoryID = value } return nil } -// GetUserID returns value of UserID field. -func (i *InputReplyToStory) GetUserID() (value InputUserClass) { +// GetPeer returns value of Peer field. +func (i *InputReplyToStory) GetPeer() (value InputPeerClass) { if i == nil { return } - return i.UserID + return i.Peer } // GetStoryID returns value of StoryID field. @@ -655,7 +655,7 @@ const InputReplyToClassName = "InputReplyTo" // } // switch v := g.(type) { // case *tg.InputReplyToMessage: // inputReplyToMessage#22c0f6d5 -// case *tg.InputReplyToStory: // inputReplyToStory#15b0f283 +// case *tg.InputReplyToStory: // inputReplyToStory#5881323a // default: panic(v) // } type InputReplyToClass interface { @@ -692,7 +692,7 @@ func DecodeInputReplyTo(buf *bin.Buffer) (InputReplyToClass, error) { } return &v, nil case InputReplyToStoryTypeID: - // Decoding inputReplyToStory#15b0f283. + // Decoding inputReplyToStory#5881323a. v := InputReplyToStory{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputReplyToClass: %w", err) diff --git a/tg/tl_message_action_gen.go b/tg/tl_message_action_gen.go index 8615773c7b..c085f35e4f 100644 --- a/tg/tl_message_action_gen.go +++ b/tg/tl_message_action_gen.go @@ -7693,6 +7693,140 @@ func (m *MessageActionGiveawayResults) GetUnclaimedCount() (value int) { return m.UnclaimedCount } +// MessageActionBoostApply represents TL type `messageActionBoostApply#cc02aa6d`. +// +// See https://core.telegram.org/constructor/messageActionBoostApply for reference. +type MessageActionBoostApply struct { + // Boosts field of MessageActionBoostApply. + Boosts int +} + +// MessageActionBoostApplyTypeID is TL type id of MessageActionBoostApply. +const MessageActionBoostApplyTypeID = 0xcc02aa6d + +// construct implements constructor of MessageActionClass. +func (m MessageActionBoostApply) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionBoostApply. +var ( + _ bin.Encoder = &MessageActionBoostApply{} + _ bin.Decoder = &MessageActionBoostApply{} + _ bin.BareEncoder = &MessageActionBoostApply{} + _ bin.BareDecoder = &MessageActionBoostApply{} + + _ MessageActionClass = &MessageActionBoostApply{} +) + +func (m *MessageActionBoostApply) Zero() bool { + if m == nil { + return true + } + if !(m.Boosts == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionBoostApply) String() string { + if m == nil { + return "MessageActionBoostApply(nil)" + } + type Alias MessageActionBoostApply + return fmt.Sprintf("MessageActionBoostApply%+v", Alias(*m)) +} + +// FillFrom fills MessageActionBoostApply from given interface. +func (m *MessageActionBoostApply) FillFrom(from interface { + GetBoosts() (value int) +}) { + m.Boosts = from.GetBoosts() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionBoostApply) TypeID() uint32 { + return MessageActionBoostApplyTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionBoostApply) TypeName() string { + return "messageActionBoostApply" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionBoostApply) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionBoostApply", + ID: MessageActionBoostApplyTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Boosts", + SchemaName: "boosts", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageActionBoostApply) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionBoostApply#cc02aa6d as nil") + } + b.PutID(MessageActionBoostApplyTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionBoostApply) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionBoostApply#cc02aa6d as nil") + } + b.PutInt(m.Boosts) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionBoostApply) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionBoostApply#cc02aa6d to nil") + } + if err := b.ConsumeID(MessageActionBoostApplyTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionBoostApply#cc02aa6d: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionBoostApply) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionBoostApply#cc02aa6d to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageActionBoostApply#cc02aa6d: field boosts: %w", err) + } + m.Boosts = value + } + return nil +} + +// GetBoosts returns value of Boosts field. +func (m *MessageActionBoostApply) GetBoosts() (value int) { + if m == nil { + return + } + return m.Boosts +} + // MessageActionClassName is schema name of MessageActionClass. const MessageActionClassName = "MessageAction" @@ -7748,6 +7882,7 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionGiftCode: // messageActionGiftCode#678c2e09 // case *tg.MessageActionGiveawayLaunch: // messageActionGiveawayLaunch#332ba9ed // case *tg.MessageActionGiveawayResults: // messageActionGiveawayResults#2a9fadc5 +// case *tg.MessageActionBoostApply: // messageActionBoostApply#cc02aa6d // default: panic(v) // } type MessageActionClass interface { @@ -8063,6 +8198,13 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) } return &v, nil + case MessageActionBoostApplyTypeID: + // Decoding messageActionBoostApply#cc02aa6d. + v := MessageActionBoostApply{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode MessageActionClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_message_action_slices_gen.go b/tg/tl_message_action_slices_gen.go index b1d178f868..a0f0b0a3b7 100644 --- a/tg/tl_message_action_slices_gen.go +++ b/tg/tl_message_action_slices_gen.go @@ -545,6 +545,19 @@ func (s MessageActionClassArray) AsMessageActionGiveawayResults() (to MessageAct return to } +// AsMessageActionBoostApply returns copy with only MessageActionBoostApply constructors. +func (s MessageActionClassArray) AsMessageActionBoostApply() (to MessageActionBoostApplyArray) { + for _, elem := range s { + value, ok := elem.(*MessageActionBoostApply) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // MessageActionChatCreateArray is adapter for slice of MessageActionChatCreate. type MessageActionChatCreateArray []MessageActionChatCreate @@ -3250,3 +3263,85 @@ func (s *MessageActionGiveawayResultsArray) Pop() (v MessageActionGiveawayResult return v, true } + +// MessageActionBoostApplyArray is adapter for slice of MessageActionBoostApply. +type MessageActionBoostApplyArray []MessageActionBoostApply + +// Sort sorts slice of MessageActionBoostApply. +func (s MessageActionBoostApplyArray) Sort(less func(a, b MessageActionBoostApply) bool) MessageActionBoostApplyArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of MessageActionBoostApply. +func (s MessageActionBoostApplyArray) SortStable(less func(a, b MessageActionBoostApply) bool) MessageActionBoostApplyArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of MessageActionBoostApply. +func (s MessageActionBoostApplyArray) Retain(keep func(x MessageActionBoostApply) bool) MessageActionBoostApplyArray { + 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 MessageActionBoostApplyArray) First() (v MessageActionBoostApply, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s MessageActionBoostApplyArray) Last() (v MessageActionBoostApply, 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 *MessageActionBoostApplyArray) PopFirst() (v MessageActionBoostApply, 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 MessageActionBoostApply + 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 *MessageActionBoostApplyArray) Pop() (v MessageActionBoostApply, 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_gen.go b/tg/tl_message_gen.go index 6b1bd28896..c748280ed9 100644 --- a/tg/tl_message_gen.go +++ b/tg/tl_message_gen.go @@ -240,7 +240,7 @@ func (m *MessageEmpty) GetPeerID() (value PeerClass, ok bool) { return m.PeerID, true } -// Message represents TL type `message#76bec211`. +// Message represents TL type `message#1e4c8a69`. // A message // // See https://core.telegram.org/constructor/message for reference. @@ -294,6 +294,10 @@ type Message struct { // // Use SetFromID and GetFromID helpers. FromID PeerClass + // FromBoostsApplied field of Message. + // + // Use SetFromBoostsApplied and GetFromBoostsApplied helpers. + FromBoostsApplied int // Peer ID, the chat where this message was sent PeerID PeerClass // Messages fetched from a saved messages dialog »¹ will have peer=inputPeerSelf² and @@ -384,7 +388,7 @@ type Message struct { } // MessageTypeID is TL type id of Message. -const MessageTypeID = 0x76bec211 +const MessageTypeID = 0x1e4c8a69 // construct implements constructor of MessageClass. func (m Message) construct() MessageClass { return &m } @@ -445,6 +449,9 @@ func (m *Message) Zero() bool { if !(m.FromID == nil) { return false } + if !(m.FromBoostsApplied == 0) { + return false + } if !(m.PeerID == nil) { return false } @@ -530,6 +537,7 @@ func (m *Message) FillFrom(from interface { GetInvertMedia() (value bool) GetID() (value int) GetFromID() (value PeerClass, ok bool) + GetFromBoostsApplied() (value int, ok bool) GetPeerID() (value PeerClass) GetSavedPeerID() (value PeerClass, ok bool) GetFwdFrom() (value MessageFwdHeader, ok bool) @@ -566,6 +574,10 @@ func (m *Message) FillFrom(from interface { m.FromID = val } + if val, ok := from.GetFromBoostsApplied(); ok { + m.FromBoostsApplied = val + } + m.PeerID = from.GetPeerID() if val, ok := from.GetSavedPeerID(); ok { m.SavedPeerID = val @@ -722,6 +734,11 @@ func (m *Message) TypeInfo() tdp.Type { SchemaName: "from_id", Null: !m.Flags.Has(8), }, + { + Name: "FromBoostsApplied", + SchemaName: "from_boosts_applied", + Null: !m.Flags.Has(29), + }, { Name: "PeerID", SchemaName: "peer_id", @@ -856,6 +873,9 @@ func (m *Message) SetFlags() { if !(m.FromID == nil) { m.Flags.Set(8) } + if !(m.FromBoostsApplied == 0) { + m.Flags.Set(29) + } if !(m.SavedPeerID == nil) { m.Flags.Set(28) } @@ -909,7 +929,7 @@ func (m *Message) SetFlags() { // Encode implements bin.Encoder. func (m *Message) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#76bec211 as nil") + return fmt.Errorf("can't encode message#1e4c8a69 as nil") } b.PutID(MessageTypeID) return m.EncodeBare(b) @@ -918,38 +938,41 @@ func (m *Message) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *Message) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode message#76bec211 as nil") + return fmt.Errorf("can't encode message#1e4c8a69 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field flags: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field flags: %w", err) } b.PutInt(m.ID) if m.Flags.Has(8) { if m.FromID == nil { - return fmt.Errorf("unable to encode message#76bec211: field from_id is nil") + return fmt.Errorf("unable to encode message#1e4c8a69: field from_id is nil") } if err := m.FromID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field from_id: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field from_id: %w", err) } } + if m.Flags.Has(29) { + b.PutInt(m.FromBoostsApplied) + } if m.PeerID == nil { - return fmt.Errorf("unable to encode message#76bec211: field peer_id is nil") + return fmt.Errorf("unable to encode message#1e4c8a69: field peer_id is nil") } if err := m.PeerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field peer_id: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field peer_id: %w", err) } if m.Flags.Has(28) { if m.SavedPeerID == nil { - return fmt.Errorf("unable to encode message#76bec211: field saved_peer_id is nil") + return fmt.Errorf("unable to encode message#1e4c8a69: field saved_peer_id is nil") } if err := m.SavedPeerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field saved_peer_id: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field saved_peer_id: %w", err) } } if m.Flags.Has(2) { if err := m.FwdFrom.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field fwd_from: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field fwd_from: %w", err) } } if m.Flags.Has(11) { @@ -957,38 +980,38 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(3) { if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#76bec211: field reply_to is nil") + return fmt.Errorf("unable to encode message#1e4c8a69: field reply_to is nil") } if err := m.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field reply_to: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field reply_to: %w", err) } } b.PutInt(m.Date) b.PutString(m.Message) if m.Flags.Has(9) { if m.Media == nil { - return fmt.Errorf("unable to encode message#76bec211: field media is nil") + return fmt.Errorf("unable to encode message#1e4c8a69: field media is nil") } if err := m.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field media: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field media: %w", err) } } if m.Flags.Has(6) { if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#76bec211: field reply_markup is nil") + return fmt.Errorf("unable to encode message#1e4c8a69: field reply_markup is nil") } if err := m.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field reply_markup: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field reply_markup: %w", err) } } if m.Flags.Has(7) { b.PutVectorHeader(len(m.Entities)) for idx, v := range m.Entities { if v == nil { - return fmt.Errorf("unable to encode message#76bec211: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode message#1e4c8a69: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode message#1e4c8a69: field entities element with index %d: %w", idx, err) } } } @@ -1000,7 +1023,7 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(23) { if err := m.Replies.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field replies: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field replies: %w", err) } } if m.Flags.Has(15) { @@ -1014,14 +1037,14 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { } if m.Flags.Has(20) { if err := m.Reactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field reactions: %w", err) + return fmt.Errorf("unable to encode message#1e4c8a69: field reactions: %w", err) } } if m.Flags.Has(22) { b.PutVectorHeader(len(m.RestrictionReason)) for idx, v := range m.RestrictionReason { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#76bec211: field restriction_reason element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode message#1e4c8a69: field restriction_reason element with index %d: %w", idx, err) } } } @@ -1034,10 +1057,10 @@ func (m *Message) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *Message) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#76bec211 to nil") + return fmt.Errorf("can't decode message#1e4c8a69 to nil") } if err := b.ConsumeID(MessageTypeID); err != nil { - return fmt.Errorf("unable to decode message#76bec211: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: %w", err) } return m.DecodeBare(b) } @@ -1045,11 +1068,11 @@ func (m *Message) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *Message) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode message#76bec211 to nil") + return fmt.Errorf("can't decode message#1e4c8a69 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#76bec211: field flags: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field flags: %w", err) } } m.Out = m.Flags.Has(1) @@ -1066,82 +1089,89 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field id: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field id: %w", err) } m.ID = value } if m.Flags.Has(8) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field from_id: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field from_id: %w", err) } m.FromID = value } + if m.Flags.Has(29) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode message#1e4c8a69: field from_boosts_applied: %w", err) + } + m.FromBoostsApplied = value + } { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field peer_id: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field peer_id: %w", err) } m.PeerID = value } if m.Flags.Has(28) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field saved_peer_id: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field saved_peer_id: %w", err) } m.SavedPeerID = value } if m.Flags.Has(2) { if err := m.FwdFrom.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#76bec211: field fwd_from: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field fwd_from: %w", err) } } if m.Flags.Has(11) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field via_bot_id: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field via_bot_id: %w", err) } m.ViaBotID = value } if m.Flags.Has(3) { value, err := DecodeMessageReplyHeader(b) if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field reply_to: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field reply_to: %w", err) } m.ReplyTo = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field date: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field date: %w", err) } m.Date = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field message: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field message: %w", err) } m.Message = value } if m.Flags.Has(9) { value, err := DecodeMessageMedia(b) if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field media: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field media: %w", err) } m.Media = value } if m.Flags.Has(6) { value, err := DecodeReplyMarkup(b) if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field reply_markup: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field reply_markup: %w", err) } m.ReplyMarkup = value } if m.Flags.Has(7) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field entities: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field entities: %w", err) } if headerLen > 0 { @@ -1150,7 +1180,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field entities: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field entities: %w", err) } m.Entities = append(m.Entities, value) } @@ -1158,52 +1188,52 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field views: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field views: %w", err) } m.Views = value } if m.Flags.Has(10) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field forwards: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field forwards: %w", err) } m.Forwards = value } if m.Flags.Has(23) { if err := m.Replies.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#76bec211: field replies: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field replies: %w", err) } } if m.Flags.Has(15) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field edit_date: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field edit_date: %w", err) } m.EditDate = value } if m.Flags.Has(16) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field post_author: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field post_author: %w", err) } m.PostAuthor = value } if m.Flags.Has(17) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field grouped_id: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field grouped_id: %w", err) } m.GroupedID = value } if m.Flags.Has(20) { if err := m.Reactions.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#76bec211: field reactions: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field reactions: %w", err) } } if m.Flags.Has(22) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field restriction_reason: %w", err) } if headerLen > 0 { @@ -1212,7 +1242,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value RestrictionReason if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#76bec211: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field restriction_reason: %w", err) } m.RestrictionReason = append(m.RestrictionReason, value) } @@ -1220,7 +1250,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(25) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode message#76bec211: field ttl_period: %w", err) + return fmt.Errorf("unable to decode message#1e4c8a69: field ttl_period: %w", err) } m.TTLPeriod = value } @@ -1462,6 +1492,24 @@ func (m *Message) GetFromID() (value PeerClass, ok bool) { return m.FromID, true } +// SetFromBoostsApplied sets value of FromBoostsApplied conditional field. +func (m *Message) SetFromBoostsApplied(value int) { + m.Flags.Set(29) + m.FromBoostsApplied = value +} + +// GetFromBoostsApplied returns value of FromBoostsApplied conditional field and +// boolean which is true if field was set. +func (m *Message) GetFromBoostsApplied() (value int, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(29) { + return value, false + } + return m.FromBoostsApplied, true +} + // GetPeerID returns value of PeerID field. func (m *Message) GetPeerID() (value PeerClass) { if m == nil { @@ -2409,7 +2457,7 @@ const MessageClassName = "Message" // } // switch v := g.(type) { // case *tg.MessageEmpty: // messageEmpty#90a6ca84 -// case *tg.Message: // message#76bec211 +// case *tg.Message: // message#1e4c8a69 // case *tg.MessageService: // messageService#2b085862 // default: panic(v) // } @@ -2547,7 +2595,7 @@ func DecodeMessage(buf *bin.Buffer) (MessageClass, error) { } return &v, nil case MessageTypeID: - // Decoding message#76bec211. + // Decoding message#1e4c8a69. v := Message{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageClass: %w", err) diff --git a/tg/tl_message_reply_header_gen.go b/tg/tl_message_reply_header_gen.go index 8d3de3ba02..a8dc2c1cd6 100644 --- a/tg/tl_message_reply_header_gen.go +++ b/tg/tl_message_reply_header_gen.go @@ -706,7 +706,7 @@ func (m *MessageReplyHeader) MapQuoteEntities() (value MessageEntityClassArray, return MessageEntityClassArray(m.QuoteEntities), true } -// MessageReplyStoryHeader represents TL type `messageReplyStoryHeader#9c98bfc1`. +// MessageReplyStoryHeader represents TL type `messageReplyStoryHeader#e5af939`. // Represents a reply to a story¹ // // Links: @@ -714,14 +714,14 @@ func (m *MessageReplyHeader) MapQuoteEntities() (value MessageEntityClassArray, // // See https://core.telegram.org/constructor/messageReplyStoryHeader for reference. type MessageReplyStoryHeader struct { - // ID of the user that posted a story - UserID int64 + // Peer field of MessageReplyStoryHeader. + Peer PeerClass // Story ID StoryID int } // MessageReplyStoryHeaderTypeID is TL type id of MessageReplyStoryHeader. -const MessageReplyStoryHeaderTypeID = 0x9c98bfc1 +const MessageReplyStoryHeaderTypeID = 0xe5af939 // construct implements constructor of MessageReplyHeaderClass. func (m MessageReplyStoryHeader) construct() MessageReplyHeaderClass { return &m } @@ -740,7 +740,7 @@ func (m *MessageReplyStoryHeader) Zero() bool { if m == nil { return true } - if !(m.UserID == 0) { + if !(m.Peer == nil) { return false } if !(m.StoryID == 0) { @@ -761,10 +761,10 @@ func (m *MessageReplyStoryHeader) String() string { // FillFrom fills MessageReplyStoryHeader from given interface. func (m *MessageReplyStoryHeader) FillFrom(from interface { - GetUserID() (value int64) + GetPeer() (value PeerClass) GetStoryID() (value int) }) { - m.UserID = from.GetUserID() + m.Peer = from.GetPeer() m.StoryID = from.GetStoryID() } @@ -792,8 +792,8 @@ func (m *MessageReplyStoryHeader) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "UserID", - SchemaName: "user_id", + Name: "Peer", + SchemaName: "peer", }, { Name: "StoryID", @@ -806,7 +806,7 @@ func (m *MessageReplyStoryHeader) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *MessageReplyStoryHeader) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReplyStoryHeader#9c98bfc1 as nil") + return fmt.Errorf("can't encode messageReplyStoryHeader#e5af939 as nil") } b.PutID(MessageReplyStoryHeaderTypeID) return m.EncodeBare(b) @@ -815,9 +815,14 @@ func (m *MessageReplyStoryHeader) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageReplyStoryHeader) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReplyStoryHeader#9c98bfc1 as nil") + return fmt.Errorf("can't encode messageReplyStoryHeader#e5af939 as nil") + } + if m.Peer == nil { + return fmt.Errorf("unable to encode messageReplyStoryHeader#e5af939: field peer is nil") + } + if err := m.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageReplyStoryHeader#e5af939: field peer: %w", err) } - b.PutLong(m.UserID) b.PutInt(m.StoryID) return nil } @@ -825,10 +830,10 @@ func (m *MessageReplyStoryHeader) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageReplyStoryHeader) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReplyStoryHeader#9c98bfc1 to nil") + return fmt.Errorf("can't decode messageReplyStoryHeader#e5af939 to nil") } if err := b.ConsumeID(MessageReplyStoryHeaderTypeID); err != nil { - return fmt.Errorf("unable to decode messageReplyStoryHeader#9c98bfc1: %w", err) + return fmt.Errorf("unable to decode messageReplyStoryHeader#e5af939: %w", err) } return m.DecodeBare(b) } @@ -836,31 +841,31 @@ func (m *MessageReplyStoryHeader) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageReplyStoryHeader) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReplyStoryHeader#9c98bfc1 to nil") + return fmt.Errorf("can't decode messageReplyStoryHeader#e5af939 to nil") } { - value, err := b.Long() + value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageReplyStoryHeader#9c98bfc1: field user_id: %w", err) + return fmt.Errorf("unable to decode messageReplyStoryHeader#e5af939: field peer: %w", err) } - m.UserID = value + m.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageReplyStoryHeader#9c98bfc1: field story_id: %w", err) + return fmt.Errorf("unable to decode messageReplyStoryHeader#e5af939: field story_id: %w", err) } m.StoryID = value } return nil } -// GetUserID returns value of UserID field. -func (m *MessageReplyStoryHeader) GetUserID() (value int64) { +// GetPeer returns value of Peer field. +func (m *MessageReplyStoryHeader) GetPeer() (value PeerClass) { if m == nil { return } - return m.UserID + return m.Peer } // GetStoryID returns value of StoryID field. @@ -886,7 +891,7 @@ const MessageReplyHeaderClassName = "MessageReplyHeader" // } // switch v := g.(type) { // case *tg.MessageReplyHeader: // messageReplyHeader#afbc09db -// case *tg.MessageReplyStoryHeader: // messageReplyStoryHeader#9c98bfc1 +// case *tg.MessageReplyStoryHeader: // messageReplyStoryHeader#e5af939 // default: panic(v) // } type MessageReplyHeaderClass interface { @@ -923,7 +928,7 @@ func DecodeMessageReplyHeader(buf *bin.Buffer) (MessageReplyHeaderClass, error) } return &v, nil case MessageReplyStoryHeaderTypeID: - // Decoding messageReplyStoryHeader#9c98bfc1. + // Decoding messageReplyStoryHeader#e5af939. v := MessageReplyStoryHeader{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageReplyHeaderClass: %w", err) diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index 7b66351299..98e6ff4545 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 173 +const Layer = 174 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -119,7 +119,7 @@ func TypesMap() map[uint32]string { ChannelTypeID: "channel#aadfc8f", ChannelForbiddenTypeID: "channelForbidden#17d493d5", ChatFullTypeID: "chatFull#c9d31138", - ChannelFullTypeID: "channelFull#f2bcb6f", + ChannelFullTypeID: "channelFull#44c054a7", ChatParticipantTypeID: "chatParticipant#c02d4007", ChatParticipantCreatorTypeID: "chatParticipantCreator#e46bcee4", ChatParticipantAdminTypeID: "chatParticipantAdmin#a0933f5b", @@ -128,7 +128,7 @@ func TypesMap() map[uint32]string { ChatPhotoEmptyTypeID: "chatPhotoEmpty#37c1011c", ChatPhotoTypeID: "chatPhoto#1c6e1c11", MessageEmptyTypeID: "messageEmpty#90a6ca84", - MessageTypeID: "message#76bec211", + MessageTypeID: "message#1e4c8a69", MessageServiceTypeID: "messageService#2b085862", MessageMediaEmptyTypeID: "messageMediaEmpty#3ded6320", MessageMediaPhotoTypeID: "messageMediaPhoto#695150d7", @@ -187,6 +187,7 @@ func TypesMap() map[uint32]string { MessageActionGiftCodeTypeID: "messageActionGiftCode#678c2e09", MessageActionGiveawayLaunchTypeID: "messageActionGiveawayLaunch#332ba9ed", MessageActionGiveawayResultsTypeID: "messageActionGiveawayResults#2a9fadc5", + MessageActionBoostApplyTypeID: "messageActionBoostApply#cc02aa6d", DialogTypeID: "dialog#d58a08c6", DialogFolderTypeID: "dialogFolder#71bd134c", PhotoEmptyTypeID: "photoEmpty#2331b22d", @@ -835,6 +836,7 @@ func TypesMap() map[uint32]string { ChannelAdminLogEventActionChangeProfilePeerColorTypeID: "channelAdminLogEventActionChangeProfilePeerColor#5e477b25", ChannelAdminLogEventActionChangeWallpaperTypeID: "channelAdminLogEventActionChangeWallpaper#31bb5d52", ChannelAdminLogEventActionChangeEmojiStatusTypeID: "channelAdminLogEventActionChangeEmojiStatus#3ea9feb1", + ChannelAdminLogEventActionChangeEmojiStickerSetTypeID: "channelAdminLogEventActionChangeEmojiStickerSet#46d840ab", ChannelAdminLogEventTypeID: "channelAdminLogEvent#1fad68cd", ChannelsAdminLogResultsTypeID: "channels.adminLogResults#ed8af74d", ChannelAdminLogEventsFilterTypeID: "channelAdminLogEventsFilter#ea107ae4", @@ -1020,7 +1022,7 @@ func TypesMap() map[uint32]string { MessagesMessageViewsTypeID: "messages.messageViews#b6c4f543", MessagesDiscussionMessageTypeID: "messages.discussionMessage#a6341782", MessageReplyHeaderTypeID: "messageReplyHeader#afbc09db", - MessageReplyStoryHeaderTypeID: "messageReplyStoryHeader#9c98bfc1", + MessageReplyStoryHeaderTypeID: "messageReplyStoryHeader#e5af939", MessageRepliesTypeID: "messageReplies#83d60fc2", PeerBlockedTypeID: "peerBlocked#e8fd8014", StatsMessageStatsTypeID: "stats.messageStats#7fe91c14", @@ -1190,7 +1192,7 @@ func TypesMap() map[uint32]string { StoryViewsTypeID: "storyViews#8d595cd6", StoryItemDeletedTypeID: "storyItemDeleted#51e6ee4f", StoryItemSkippedTypeID: "storyItemSkipped#ffadc913", - StoryItemTypeID: "storyItem#af6365a1", + StoryItemTypeID: "storyItem#79b26a24", StoriesAllStoriesNotModifiedTypeID: "stories.allStoriesNotModified#1158fe3e", StoriesAllStoriesTypeID: "stories.allStories#6efc5e81", StoriesStoriesTypeID: "stories.stories#5dd8c3c8", @@ -1200,7 +1202,7 @@ func TypesMap() map[uint32]string { StoriesStoryViewsListTypeID: "stories.storyViewsList#59d78fc5", StoriesStoryViewsTypeID: "stories.storyViews#de9eed1d", InputReplyToMessageTypeID: "inputReplyToMessage#22c0f6d5", - InputReplyToStoryTypeID: "inputReplyToStory#15b0f283", + InputReplyToStoryTypeID: "inputReplyToStory#5881323a", ExportedStoryLinkTypeID: "exportedStoryLink#3fc9053b", StoriesStealthModeTypeID: "storiesStealthMode#712e27fd", MediaAreaCoordinatesTypeID: "mediaAreaCoordinates#3d1ea4e", @@ -1233,7 +1235,7 @@ func TypesMap() map[uint32]string { PeerColorTypeID: "peerColor#b54b5acf", HelpPeerColorSetTypeID: "help.peerColorSet#26219a58", HelpPeerColorProfileSetTypeID: "help.peerColorProfileSet#767d61eb", - HelpPeerColorOptionTypeID: "help.peerColorOption#ef8430ab", + HelpPeerColorOptionTypeID: "help.peerColorOption#adec6ebe", HelpPeerColorsNotModifiedTypeID: "help.peerColorsNotModified#2ba1f5ce", HelpPeerColorsTypeID: "help.peerColors#f8ed08", StoryReactionTypeID: "storyReaction#6090d6d5", @@ -1696,6 +1698,8 @@ func TypesMap() map[uint32]string { ChannelsToggleViewForumAsMessagesRequestTypeID: "channels.toggleViewForumAsMessages#9738bb15", ChannelsGetChannelRecommendationsRequestTypeID: "channels.getChannelRecommendations#83b70d97", ChannelsUpdateEmojiStatusRequestTypeID: "channels.updateEmojiStatus#f0d3e6a8", + ChannelsSetBoostsToUnblockRestrictionsRequestTypeID: "channels.setBoostsToUnblockRestrictions#ad399cee", + ChannelsSetEmojiStickersRequestTypeID: "channels.setEmojiStickers#3cd930b7", BotsSendCustomRequestRequestTypeID: "bots.sendCustomRequest#aa2769ed", BotsAnswerWebhookJSONQueryRequestTypeID: "bots.answerWebhookJSONQuery#e6213f4d", BotsSetBotCommandsRequestTypeID: "bots.setBotCommands#517165a", @@ -1991,6 +1995,7 @@ func NamesMap() map[string]uint32 { "messageActionGiftCode": MessageActionGiftCodeTypeID, "messageActionGiveawayLaunch": MessageActionGiveawayLaunchTypeID, "messageActionGiveawayResults": MessageActionGiveawayResultsTypeID, + "messageActionBoostApply": MessageActionBoostApplyTypeID, "dialog": DialogTypeID, "dialogFolder": DialogFolderTypeID, "photoEmpty": PhotoEmptyTypeID, @@ -2639,6 +2644,7 @@ func NamesMap() map[string]uint32 { "channelAdminLogEventActionChangeProfilePeerColor": ChannelAdminLogEventActionChangeProfilePeerColorTypeID, "channelAdminLogEventActionChangeWallpaper": ChannelAdminLogEventActionChangeWallpaperTypeID, "channelAdminLogEventActionChangeEmojiStatus": ChannelAdminLogEventActionChangeEmojiStatusTypeID, + "channelAdminLogEventActionChangeEmojiStickerSet": ChannelAdminLogEventActionChangeEmojiStickerSetTypeID, "channelAdminLogEvent": ChannelAdminLogEventTypeID, "channels.adminLogResults": ChannelsAdminLogResultsTypeID, "channelAdminLogEventsFilter": ChannelAdminLogEventsFilterTypeID, @@ -3500,6 +3506,8 @@ func NamesMap() map[string]uint32 { "channels.toggleViewForumAsMessages": ChannelsToggleViewForumAsMessagesRequestTypeID, "channels.getChannelRecommendations": ChannelsGetChannelRecommendationsRequestTypeID, "channels.updateEmojiStatus": ChannelsUpdateEmojiStatusRequestTypeID, + "channels.setBoostsToUnblockRestrictions": ChannelsSetBoostsToUnblockRestrictionsRequestTypeID, + "channels.setEmojiStickers": ChannelsSetEmojiStickersRequestTypeID, "bots.sendCustomRequest": BotsSendCustomRequestRequestTypeID, "bots.answerWebhookJSONQuery": BotsAnswerWebhookJSONQueryRequestTypeID, "bots.setBotCommands": BotsSetBotCommandsRequestTypeID, @@ -3795,6 +3803,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageActionGiftCodeTypeID: func() bin.Object { return &MessageActionGiftCode{} }, MessageActionGiveawayLaunchTypeID: func() bin.Object { return &MessageActionGiveawayLaunch{} }, MessageActionGiveawayResultsTypeID: func() bin.Object { return &MessageActionGiveawayResults{} }, + MessageActionBoostApplyTypeID: func() bin.Object { return &MessageActionBoostApply{} }, DialogTypeID: func() bin.Object { return &Dialog{} }, DialogFolderTypeID: func() bin.Object { return &DialogFolder{} }, PhotoEmptyTypeID: func() bin.Object { return &PhotoEmpty{} }, @@ -4443,6 +4452,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelAdminLogEventActionChangeProfilePeerColorTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeProfilePeerColor{} }, ChannelAdminLogEventActionChangeWallpaperTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeWallpaper{} }, ChannelAdminLogEventActionChangeEmojiStatusTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeEmojiStatus{} }, + ChannelAdminLogEventActionChangeEmojiStickerSetTypeID: func() bin.Object { return &ChannelAdminLogEventActionChangeEmojiStickerSet{} }, ChannelAdminLogEventTypeID: func() bin.Object { return &ChannelAdminLogEvent{} }, ChannelsAdminLogResultsTypeID: func() bin.Object { return &ChannelsAdminLogResults{} }, ChannelAdminLogEventsFilterTypeID: func() bin.Object { return &ChannelAdminLogEventsFilter{} }, @@ -5304,6 +5314,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelsToggleViewForumAsMessagesRequestTypeID: func() bin.Object { return &ChannelsToggleViewForumAsMessagesRequest{} }, ChannelsGetChannelRecommendationsRequestTypeID: func() bin.Object { return &ChannelsGetChannelRecommendationsRequest{} }, ChannelsUpdateEmojiStatusRequestTypeID: func() bin.Object { return &ChannelsUpdateEmojiStatusRequest{} }, + ChannelsSetBoostsToUnblockRestrictionsRequestTypeID: func() bin.Object { return &ChannelsSetBoostsToUnblockRestrictionsRequest{} }, + ChannelsSetEmojiStickersRequestTypeID: func() bin.Object { return &ChannelsSetEmojiStickersRequest{} }, BotsSendCustomRequestRequestTypeID: func() bin.Object { return &BotsSendCustomRequestRequest{} }, BotsAnswerWebhookJSONQueryRequestTypeID: func() bin.Object { return &BotsAnswerWebhookJSONQueryRequest{} }, BotsSetBotCommandsRequestTypeID: func() bin.Object { return &BotsSetBotCommandsRequest{} }, @@ -5610,6 +5622,7 @@ func ClassConstructorsMap() map[string][]uint32 { ChannelAdminLogEventActionChangeProfilePeerColorTypeID, ChannelAdminLogEventActionChangeWallpaperTypeID, ChannelAdminLogEventActionChangeEmojiStatusTypeID, + ChannelAdminLogEventActionChangeEmojiStickerSetTypeID, }, ChannelLocationClassName: { ChannelLocationEmptyTypeID, @@ -6118,6 +6131,7 @@ func ClassConstructorsMap() map[string][]uint32 { MessageActionGiftCodeTypeID, MessageActionGiveawayLaunchTypeID, MessageActionGiveawayResultsTypeID, + MessageActionBoostApplyTypeID, }, MessageClassName: { MessageEmptyTypeID, diff --git a/tg/tl_server_gen.go b/tg/tl_server_gen.go index 1f35cee9e7..d78f82386c 100644 --- a/tg/tl_server_gen.go +++ b/tg/tl_server_gen.go @@ -8062,6 +8062,44 @@ func (s *ServerDispatcher) OnChannelsUpdateEmojiStatus(f func(ctx context.Contex s.handlers[ChannelsUpdateEmojiStatusRequestTypeID] = handler } +func (s *ServerDispatcher) OnChannelsSetBoostsToUnblockRestrictions(f func(ctx context.Context, request *ChannelsSetBoostsToUnblockRestrictionsRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request ChannelsSetBoostsToUnblockRestrictionsRequest + 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[ChannelsSetBoostsToUnblockRestrictionsRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnChannelsSetEmojiStickers(f func(ctx context.Context, request *ChannelsSetEmojiStickersRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request ChannelsSetEmojiStickersRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[ChannelsSetEmojiStickersRequestTypeID] = 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 diff --git a/tg/tl_story_item_gen.go b/tg/tl_story_item_gen.go index 4cf670a190..072b4bcdfe 100644 --- a/tg/tl_story_item_gen.go +++ b/tg/tl_story_item_gen.go @@ -420,7 +420,7 @@ func (s *StoryItemSkipped) GetExpireDate() (value int) { return s.ExpireDate } -// StoryItem represents TL type `storyItem#af6365a1`. +// StoryItem represents TL type `storyItem#79b26a24`. // Represents a story¹. // // Links: @@ -468,6 +468,10 @@ type StoryItem struct { ID int // When was the story posted. Date int + // FromID field of StoryItem. + // + // Use SetFromID and GetFromID helpers. + FromID PeerClass // For reposted stories »¹, contains info about the original story. // // Links: @@ -515,7 +519,7 @@ type StoryItem struct { } // StoryItemTypeID is TL type id of StoryItem. -const StoryItemTypeID = 0xaf6365a1 +const StoryItemTypeID = 0x79b26a24 // construct implements constructor of StoryItemClass. func (s StoryItem) construct() StoryItemClass { return &s } @@ -570,6 +574,9 @@ func (s *StoryItem) Zero() bool { if !(s.Date == 0) { return false } + if !(s.FromID == nil) { + return false + } if !(s.FwdFrom.Zero()) { return false } @@ -623,6 +630,7 @@ func (s *StoryItem) FillFrom(from interface { GetOut() (value bool) GetID() (value int) GetDate() (value int) + GetFromID() (value PeerClass, ok bool) GetFwdFrom() (value StoryFwdHeader, ok bool) GetExpireDate() (value int) GetCaption() (value string, ok bool) @@ -644,6 +652,10 @@ func (s *StoryItem) FillFrom(from interface { s.Out = from.GetOut() s.ID = from.GetID() s.Date = from.GetDate() + if val, ok := from.GetFromID(); ok { + s.FromID = val + } + if val, ok := from.GetFwdFrom(); ok { s.FwdFrom = val } @@ -752,6 +764,11 @@ func (s *StoryItem) TypeInfo() tdp.Type { Name: "Date", SchemaName: "date", }, + { + Name: "FromID", + SchemaName: "from_id", + Null: !s.Flags.Has(18), + }, { Name: "FwdFrom", SchemaName: "fwd_from", @@ -828,6 +845,9 @@ func (s *StoryItem) SetFlags() { if !(s.Out == false) { s.Flags.Set(16) } + if !(s.FromID == nil) { + s.Flags.Set(18) + } if !(s.FwdFrom.Zero()) { s.Flags.Set(17) } @@ -854,7 +874,7 @@ func (s *StoryItem) SetFlags() { // Encode implements bin.Encoder. func (s *StoryItem) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode storyItem#af6365a1 as nil") + return fmt.Errorf("can't encode storyItem#79b26a24 as nil") } b.PutID(StoryItemTypeID) return s.EncodeBare(b) @@ -863,17 +883,25 @@ func (s *StoryItem) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StoryItem) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode storyItem#af6365a1 as nil") + return fmt.Errorf("can't encode storyItem#79b26a24 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field flags: %w", err) + return fmt.Errorf("unable to encode storyItem#79b26a24: field flags: %w", err) } b.PutInt(s.ID) b.PutInt(s.Date) + if s.Flags.Has(18) { + if s.FromID == nil { + return fmt.Errorf("unable to encode storyItem#79b26a24: field from_id is nil") + } + if err := s.FromID.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyItem#79b26a24: field from_id: %w", err) + } + } if s.Flags.Has(17) { if err := s.FwdFrom.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field fwd_from: %w", err) + return fmt.Errorf("unable to encode storyItem#79b26a24: field fwd_from: %w", err) } } b.PutInt(s.ExpireDate) @@ -884,27 +912,27 @@ func (s *StoryItem) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(s.Entities)) for idx, v := range s.Entities { if v == nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode storyItem#79b26a24: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode storyItem#79b26a24: field entities element with index %d: %w", idx, err) } } } if s.Media == nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field media is nil") + return fmt.Errorf("unable to encode storyItem#79b26a24: field media is nil") } if err := s.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field media: %w", err) + return fmt.Errorf("unable to encode storyItem#79b26a24: field media: %w", err) } if s.Flags.Has(14) { b.PutVectorHeader(len(s.MediaAreas)) for idx, v := range s.MediaAreas { if v == nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field media_areas element with index %d is nil", idx) + return fmt.Errorf("unable to encode storyItem#79b26a24: field media_areas element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field media_areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode storyItem#79b26a24: field media_areas element with index %d: %w", idx, err) } } } @@ -912,24 +940,24 @@ func (s *StoryItem) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(s.Privacy)) for idx, v := range s.Privacy { if v == nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field privacy element with index %d is nil", idx) + return fmt.Errorf("unable to encode storyItem#79b26a24: field privacy element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field privacy element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode storyItem#79b26a24: field privacy element with index %d: %w", idx, err) } } } if s.Flags.Has(3) { if err := s.Views.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field views: %w", err) + return fmt.Errorf("unable to encode storyItem#79b26a24: field views: %w", err) } } if s.Flags.Has(15) { if s.SentReaction == nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field sent_reaction is nil") + return fmt.Errorf("unable to encode storyItem#79b26a24: field sent_reaction is nil") } if err := s.SentReaction.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#af6365a1: field sent_reaction: %w", err) + return fmt.Errorf("unable to encode storyItem#79b26a24: field sent_reaction: %w", err) } } return nil @@ -938,10 +966,10 @@ func (s *StoryItem) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *StoryItem) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode storyItem#af6365a1 to nil") + return fmt.Errorf("can't decode storyItem#79b26a24 to nil") } if err := b.ConsumeID(StoryItemTypeID); err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: %w", err) } return s.DecodeBare(b) } @@ -949,11 +977,11 @@ func (s *StoryItem) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StoryItem) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode storyItem#af6365a1 to nil") + return fmt.Errorf("can't decode storyItem#79b26a24 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field flags: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field flags: %w", err) } } s.Pinned = s.Flags.Has(5) @@ -968,40 +996,47 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field id: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field id: %w", err) } s.ID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field date: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field date: %w", err) } s.Date = value } + if s.Flags.Has(18) { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode storyItem#79b26a24: field from_id: %w", err) + } + s.FromID = value + } if s.Flags.Has(17) { if err := s.FwdFrom.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field fwd_from: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field fwd_from: %w", err) } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field expire_date: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field expire_date: %w", err) } s.ExpireDate = value } if s.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field caption: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field caption: %w", err) } s.Caption = value } if s.Flags.Has(1) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field entities: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field entities: %w", err) } if headerLen > 0 { @@ -1010,7 +1045,7 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field entities: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field entities: %w", err) } s.Entities = append(s.Entities, value) } @@ -1018,14 +1053,14 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error { { value, err := DecodeMessageMedia(b) if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field media: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field media: %w", err) } s.Media = value } if s.Flags.Has(14) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field media_areas: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field media_areas: %w", err) } if headerLen > 0 { @@ -1034,7 +1069,7 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMediaArea(b) if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field media_areas: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field media_areas: %w", err) } s.MediaAreas = append(s.MediaAreas, value) } @@ -1042,7 +1077,7 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(2) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field privacy: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field privacy: %w", err) } if headerLen > 0 { @@ -1051,20 +1086,20 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodePrivacyRule(b) if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field privacy: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field privacy: %w", err) } s.Privacy = append(s.Privacy, value) } } if s.Flags.Has(3) { if err := s.Views.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field views: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field views: %w", err) } } if s.Flags.Has(15) { value, err := DecodeReaction(b) if err != nil { - return fmt.Errorf("unable to decode storyItem#af6365a1: field sent_reaction: %w", err) + return fmt.Errorf("unable to decode storyItem#79b26a24: field sent_reaction: %w", err) } s.SentReaction = value } @@ -1258,6 +1293,24 @@ func (s *StoryItem) GetDate() (value int) { return s.Date } +// SetFromID sets value of FromID conditional field. +func (s *StoryItem) SetFromID(value PeerClass) { + s.Flags.Set(18) + s.FromID = value +} + +// GetFromID returns value of FromID conditional field and +// boolean which is true if field was set. +func (s *StoryItem) GetFromID() (value PeerClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(18) { + return value, false + } + return s.FromID, true +} + // SetFwdFrom sets value of FwdFrom conditional field. func (s *StoryItem) SetFwdFrom(value StoryFwdHeader) { s.Flags.Set(17) @@ -1440,7 +1493,7 @@ const StoryItemClassName = "StoryItem" // switch v := g.(type) { // case *tg.StoryItemDeleted: // storyItemDeleted#51e6ee4f // case *tg.StoryItemSkipped: // storyItemSkipped#ffadc913 -// case *tg.StoryItem: // storyItem#af6365a1 +// case *tg.StoryItem: // storyItem#79b26a24 // default: panic(v) // } type StoryItemClass interface { @@ -1487,7 +1540,7 @@ func DecodeStoryItem(buf *bin.Buffer) (StoryItemClass, error) { } return &v, nil case StoryItemTypeID: - // Decoding storyItem#af6365a1. + // Decoding storyItem#79b26a24. v := StoryItem{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StoryItemClass: %w", err)