diff --git a/Makefile b/Makefile index 4d8de90997..28388a614d 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,7 @@ generate: download_schema: go run ./cmd/dltl -base https://raw.githubusercontent.com/tdlib/td -branch master -dir td/generate/scheme -f telegram_api.tl -o _schema/tdlib.tl go run ./cmd/dltl -base https://raw.githubusercontent.com/telegramdesktop/tdesktop -branch dev -dir Telegram/SourceFiles/mtproto/scheme -f api.tl -o _schema/tdesktop.tl - go run ./cmd/dltl -base https://raw.githubusercontent.com/telegramdesktop/tdesktop -branch dev -dir Telegram/SourceFiles/mtproto/scheme -f layer.tl -o _schema/layer.tl - go run ./cmd/dltl -base https://raw.githubusercontent.com/telegramdesktop/tdesktop -branch dev -dir Telegram/SourceFiles/mtproto/scheme -f api.tl -merge _schema/legacy.tl,_schema/layer.tl -o _schema/telegram.tl + go run ./cmd/dltl -base https://raw.githubusercontent.com/telegramdesktop/tdesktop -branch dev -dir Telegram/SourceFiles/mtproto/scheme -f api.tl -merge _schema/legacy.tl -o _schema/telegram.tl .PHONY: download_schema download_public_keys: diff --git a/_schema/layer.tl b/_schema/layer.tl deleted file mode 100644 index 25f22bf557..0000000000 --- a/_schema/layer.tl +++ /dev/null @@ -1,7 +0,0 @@ -// Code generated by ./cmd/dltl, DO NOT EDIT. -// -// Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/layer.tl -// Layer: 166 -// SHA256: a0dbdfb46897445f2eb0ba70df15f042172b668dfbdd11f7fd12c3fb0af29837 - -// LAYER 166 diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index dcc690decd..65cde4140c 100644 --- a/_schema/tdesktop.tl +++ b/_schema/tdesktop.tl @@ -1,7 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl -// SHA256: 4056d76f6bec7a43b31a625278ee24c0a29cbd462dfc4769be1361c0221b96c7 +// Layer: 167 +// SHA256: 4313c183fe2e60588dc1323061b46db2b105347501d9a5fb33032d2fe58ecfaa boolFalse#bc799737 = Bool; @@ -137,7 +138,7 @@ storage.fileWebp#1081464c = storage.FileType; userEmpty#d3bc4b7a id:long = User; -user#eb602f25 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.7?int background_emoji_id:flags2.6?long = User; +user#215c4438 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; @@ -161,13 +162,13 @@ chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5 chatForbidden#6592a1a7 id:long title:string = Chat; -channel#1981ea7e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.6?int background_emoji_id:flags2.5?long = Chat; +channel#8e87ccd8 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.7?PeerColor = Chat; channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions = ChatFull; -channelFull#723027bd flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions stories:flags2.4?PeerStories = ChatFull; +channelFull#723027bd flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions stories:flags2.4?PeerStories = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -293,15 +294,15 @@ messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; messageActionRequestedPeer#fe77345d button_id:int peer:Peer = MessageAction; -messageActionSetChatWallPaper#bc44a927 wallpaper:WallPaper = MessageAction; - -messageActionSetSameChatWallPaper#c0787d6d wallpaper:WallPaper = MessageAction; +messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; messageActionGiftCode#d2cfdb0e flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string = MessageAction; messageActionGiveawayLaunch#332ba9ed = MessageAction; -dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?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; +messageActionGiveawayResults#2a9fadc5 winners_count:int unclaimed_count: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; @@ -375,7 +376,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; +userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -683,6 +684,12 @@ updateStoriesStealthMode#2c084dc1 stealth_mode:StoriesStealthMode = Update; updateSentStoryReaction#7d627683 peer:Peer story_id:int reaction:Reaction = Update; +updateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update; + +updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; + +updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -1907,9 +1914,7 @@ statsGraphError#bedc9822 error:string = StatsGraph; statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph; -messageInteractionCounters#ad4fc9bd msg_id:int views:int forwards:int = MessageInteractionCounters; - -stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector = stats.BroadcastStats; +stats.broadcastStats#396ca5fc period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev reactions_per_post:StatsAbsValueAndPrev views_per_story:StatsAbsValueAndPrev shares_per_story:StatsAbsValueAndPrev reactions_per_story:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph reactions_by_emotion_graph:StatsGraph story_interactions_graph:StatsGraph story_reactions_by_emotion_graph:StatsGraph recent_posts_interactions:Vector = stats.BroadcastStats; help.promoDataEmpty#98f6ac75 expires:int = help.PromoData; @@ -1945,7 +1950,7 @@ messages.messageViews#b6c4f543 views:Vector chats:Vector use messages.discussionMessage#a6341782 flags:# messages:Vector max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector users:Vector = messages.DiscussionMessage; -messageReplyHeader#6eebcabd 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 = MessageReplyHeader; +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; @@ -1953,7 +1958,7 @@ messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:in peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked; -stats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats; +stats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats; groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall; @@ -2031,7 +2036,7 @@ account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswo account.resetPasswordOk#e926d63e = account.ResetPasswordResult; -sponsoredMessage#daafff6b flags:# recommended:flags.5?true show_peer_photo:flags.6?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string webpage:flags.9?SponsoredWebPage message:string entities:flags.1?Vector sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; +sponsoredMessage#ed5383f7 flags:# recommended:flags.5?true show_peer_photo:flags.6?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string webpage:flags.9?SponsoredWebPage app:flags.10?BotApp message:string entities:flags.1?Vector button_text:flags.11?string sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; messages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector chats:Vector users:Vector = messages.SponsoredMessages; @@ -2131,7 +2136,7 @@ inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:Pre payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice; -messages.transcribedAudio#93752c52 flags:# pending:flags.0?true transcription_id:long text:string = messages.TranscribedAudio; +messages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio; help.premiumPromo#5334759c status_text:string status_entities:Vector video_sections:Vector videos:Vector period_options:Vector users:Vector = help.PremiumPromo; @@ -2287,7 +2292,7 @@ storyItemDeleted#51e6ee4f id:int = StoryItem; storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem; -storyItem#44c457ce 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 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#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; stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories; @@ -2301,7 +2306,7 @@ stories.storyViewsList#46e9b9ec flags:# count:int reactions_count:int views:Vect stories.storyViews#de9eed1d views:Vector users:Vector = stories.StoryViews; -inputReplyToMessage#73ec805 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 = InputReplyTo; +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; @@ -2345,6 +2350,32 @@ premium.myBoosts#9ae228e2 my_boosts:Vector chats:Vector users:Vec premium.boostsStatus#4959427a flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int gift_boosts:flags.4?int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue boost_url:string prepaid_giveaways:flags.3?Vector my_boost_slots:flags.2?Vector = premium.BoostsStatus; +storyFwdHeader#b826e150 flags:# modified:flags.3?true from:flags.0?Peer from_name:flags.1?string story_id:flags.2?int = StoryFwdHeader; + +postInteractionCountersMessage#e7058e7f msg_id:int views:int forwards:int reactions:int = PostInteractionCounters; + +postInteractionCountersStory#8a480e27 story_id:int views:int forwards:int reactions:int = PostInteractionCounters; + +stats.storyStats#50cd067c views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.StoryStats; + +publicForwardMessage#1f2bf4a message:Message = PublicForward; + +publicForwardStory#edf3add0 peer:Peer story:StoryItem = PublicForward; + +stats.publicForwards#93037e20 flags:# count:int forwards:Vector next_offset:flags.0?string chats:Vector users:Vector = stats.PublicForwards; + +peerColor#b54b5acf flags:# color:flags.0?int background_emoji_id:flags.1?long = PeerColor; + +help.peerColorSet#26219a58 colors:Vector = help.PeerColorSet; + +help.peerColorProfileSet#767d61eb palette_colors:Vector bg_colors:Vector story_colors:Vector = help.PeerColorSet; + +help.peerColorOption#135bd42f flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet = help.PeerColorOption; + +help.peerColorsNotModified#2ba1f5ce = help.PeerColors; + +help.peerColors#f8ed08 hash:int colors:Vector = help.PeerColors; + ---functions--- @@ -2582,7 +2613,7 @@ account.deleteAutoSaveExceptions#53bc0020 = Bool; account.invalidateSignInCodes#ca8ae8ba codes:Vector = Bool; -account.updateColor#a001cc43 flags:# color:int background_emoji_id:flags.0?long = Bool; +account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int background_emoji_id:flags.0?long = Bool; account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; @@ -3014,7 +3045,9 @@ messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; messages.requestAppWebView#8c5a3b3c flags:# write_allowed:flags.0?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = AppWebViewResult; -messages.setChatWallPaper#8ffacae1 flags:# peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; +messages.setChatWallPaper#8ffacae1 flags:# for_both:flags.3?true revert:flags.4?true peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; + +messages.searchEmojiStickerSets#92b4494c flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; updates.getState#edd4882a = updates.State; @@ -3094,6 +3127,10 @@ help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList; help.getPremiumPromo#b81b93d4 = help.PremiumPromo; +help.getPeerColors#da80f42f hash:int = help.PeerColors; + +help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors; + channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; @@ -3208,6 +3245,10 @@ channels.clickSponsoredMessage#18afbc93 channel:InputChannel random_id:bytes = B channels.updateColor#621a201f flags:# channel:InputChannel color:int background_emoji_id:flags.0?long = Updates; +channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; + +channels.getChannelRecommendations#83b70d97 channel:InputChannel = messages.Chats; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3376,6 +3417,10 @@ stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_r stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; +stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats; + +stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; + chatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector = chatlists.ExportedChatlistInvite; chatlists.deleteExportedInvite#719c5c5e chatlist:InputChatlist slug:string = Bool; @@ -3400,7 +3445,7 @@ chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector stories.canSendStory#c7dfdfdd peer:InputPeer = Bool; -stories.sendStory#bcb73644 flags:# pinned:flags.2?true noforwards:flags.4?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector caption:flags.0?string entities:flags.1?Vector privacy_rules:Vector random_id:long period:flags.3?int = Updates; +stories.sendStory#e4e6694b flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector caption:flags.0?string entities:flags.1?Vector privacy_rules:Vector random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int = Updates; stories.editStory#b583ba46 flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector caption:flags.1?string entities:flags.1?Vector privacy_rules:flags.2?Vector = Updates; @@ -3452,3 +3497,6 @@ premium.applyBoost#6b7da746 flags:# slots:flags.0?Vector peer:InputPeer = p premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; +premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; + +// LAYER 167 diff --git a/_schema/tdlib.tl b/_schema/tdlib.tl index 95af2a4646..fbdc474fe6 100644 --- a/_schema/tdlib.tl +++ b/_schema/tdlib.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/tdlib/td/master/td/generate/scheme/telegram_api.tl -// Layer: 166 -// SHA256: d8c5ba04b019ab472713f30505d814df8a45f68a7277803d7f0cc00f0ba3db73 +// Layer: 167 +// SHA256: 63887bd77705197129e252c7c2c762682010876c3b259f9a6ea82537bfc6c3db int#a8509bda ? = Int; @@ -170,7 +170,7 @@ storage.fileWebp#1081464c = storage.FileType; userEmpty#d3bc4b7a id:long = User; -user#eb602f25 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.7?int background_emoji_id:flags2.6?long = User; +user#215c4438 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; @@ -194,13 +194,13 @@ chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5 chatForbidden#6592a1a7 id:long title:string = Chat; -channel#1981ea7e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.6?int background_emoji_id:flags2.5?long = Chat; +channel#8e87ccd8 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.7?PeerColor = Chat; channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions = ChatFull; -channelFull#723027bd flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions stories:flags2.4?PeerStories = ChatFull; +channelFull#723027bd flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions stories:flags2.4?PeerStories = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -326,15 +326,15 @@ messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; messageActionRequestedPeer#fe77345d button_id:int peer:Peer = MessageAction; -messageActionSetChatWallPaper#bc44a927 wallpaper:WallPaper = MessageAction; - -messageActionSetSameChatWallPaper#c0787d6d wallpaper:WallPaper = MessageAction; +messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; messageActionGiftCode#d2cfdb0e flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string = MessageAction; messageActionGiveawayLaunch#332ba9ed = MessageAction; -dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?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; +messageActionGiveawayResults#2a9fadc5 winners_count:int unclaimed_count: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; @@ -408,7 +408,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; +userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -718,6 +718,10 @@ updateSentStoryReaction#7d627683 peer:Peer story_id:int reaction:Reaction = Upda updateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update; +updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; + +updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -1942,9 +1946,7 @@ statsGraphError#bedc9822 error:string = StatsGraph; statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph; -messageInteractionCounters#ad4fc9bd msg_id:int views:int forwards:int = MessageInteractionCounters; - -stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector = stats.BroadcastStats; +stats.broadcastStats#396ca5fc period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev reactions_per_post:StatsAbsValueAndPrev views_per_story:StatsAbsValueAndPrev shares_per_story:StatsAbsValueAndPrev reactions_per_story:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph reactions_by_emotion_graph:StatsGraph story_interactions_graph:StatsGraph story_reactions_by_emotion_graph:StatsGraph recent_posts_interactions:Vector = stats.BroadcastStats; help.promoDataEmpty#98f6ac75 expires:int = help.PromoData; @@ -1980,7 +1982,7 @@ messages.messageViews#b6c4f543 views:Vector chats:Vector use messages.discussionMessage#a6341782 flags:# messages:Vector max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector users:Vector = messages.DiscussionMessage; -messageReplyHeader#6eebcabd 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 = MessageReplyHeader; +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; @@ -1988,7 +1990,7 @@ messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:in peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked; -stats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats; +stats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats; groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall; @@ -2066,7 +2068,7 @@ account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswo account.resetPasswordOk#e926d63e = account.ResetPasswordResult; -sponsoredMessage#daafff6b flags:# recommended:flags.5?true show_peer_photo:flags.6?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string webpage:flags.9?SponsoredWebPage message:string entities:flags.1?Vector sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; +sponsoredMessage#ed5383f7 flags:# recommended:flags.5?true show_peer_photo:flags.6?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string webpage:flags.9?SponsoredWebPage app:flags.10?BotApp message:string entities:flags.1?Vector button_text:flags.11?string sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; messages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector chats:Vector users:Vector = messages.SponsoredMessages; @@ -2166,7 +2168,7 @@ inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:Pre payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice; -messages.transcribedAudio#93752c52 flags:# pending:flags.0?true transcription_id:long text:string = messages.TranscribedAudio; +messages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio; help.premiumPromo#5334759c status_text:string status_entities:Vector video_sections:Vector videos:Vector period_options:Vector users:Vector = help.PremiumPromo; @@ -2322,7 +2324,7 @@ storyItemDeleted#51e6ee4f id:int = StoryItem; storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem; -storyItem#44c457ce 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 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#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; stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories; @@ -2336,7 +2338,7 @@ stories.storyViewsList#46e9b9ec flags:# count:int reactions_count:int views:Vect stories.storyViews#de9eed1d views:Vector users:Vector = stories.StoryViews; -inputReplyToMessage#73ec805 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 = InputReplyTo; +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; @@ -2380,6 +2382,32 @@ premium.myBoosts#9ae228e2 my_boosts:Vector chats:Vector users:Vec premium.boostsStatus#4959427a flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int gift_boosts:flags.4?int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue boost_url:string prepaid_giveaways:flags.3?Vector my_boost_slots:flags.2?Vector = premium.BoostsStatus; +storyFwdHeader#b826e150 flags:# modified:flags.3?true from:flags.0?Peer from_name:flags.1?string story_id:flags.2?int = StoryFwdHeader; + +postInteractionCountersMessage#e7058e7f msg_id:int views:int forwards:int reactions:int = PostInteractionCounters; + +postInteractionCountersStory#8a480e27 story_id:int views:int forwards:int reactions:int = PostInteractionCounters; + +stats.storyStats#50cd067c views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.StoryStats; + +publicForwardMessage#1f2bf4a message:Message = PublicForward; + +publicForwardStory#edf3add0 peer:Peer story:StoryItem = PublicForward; + +stats.publicForwards#93037e20 flags:# count:int forwards:Vector next_offset:flags.0?string chats:Vector users:Vector = stats.PublicForwards; + +peerColor#b54b5acf flags:# color:flags.0?int background_emoji_id:flags.1?long = PeerColor; + +help.peerColorSet#26219a58 colors:Vector = help.PeerColorSet; + +help.peerColorProfileSet#767d61eb palette_colors:Vector bg_colors:Vector story_colors:Vector = help.PeerColorSet; + +help.peerColorOption#135bd42f flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet = help.PeerColorOption; + +help.peerColorsNotModified#2ba1f5ce = help.PeerColors; + +help.peerColors#f8ed08 hash:int colors:Vector = help.PeerColors; + ---functions--- @@ -2617,7 +2645,7 @@ account.deleteAutoSaveExceptions#53bc0020 = Bool; account.invalidateSignInCodes#ca8ae8ba codes:Vector = Bool; -account.updateColor#a001cc43 flags:# color:int background_emoji_id:flags.0?long = Bool; +account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int background_emoji_id:flags.0?long = Bool; account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; @@ -3049,7 +3077,9 @@ messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; messages.requestAppWebView#8c5a3b3c flags:# write_allowed:flags.0?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = AppWebViewResult; -messages.setChatWallPaper#8ffacae1 flags:# peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; +messages.setChatWallPaper#8ffacae1 flags:# for_both:flags.3?true revert:flags.4?true peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; + +messages.searchEmojiStickerSets#92b4494c flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; updates.getState#edd4882a = updates.State; @@ -3129,6 +3159,10 @@ help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList; help.getPremiumPromo#b81b93d4 = help.PremiumPromo; +help.getPeerColors#da80f42f hash:int = help.PeerColors; + +help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors; + channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; @@ -3243,6 +3277,10 @@ channels.clickSponsoredMessage#18afbc93 channel:InputChannel random_id:bytes = B channels.updateColor#621a201f flags:# channel:InputChannel color:int background_emoji_id:flags.0?long = Updates; +channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; + +channels.getChannelRecommendations#83b70d97 channel:InputChannel = messages.Chats; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3411,6 +3449,10 @@ stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_r stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; +stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats; + +stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; + chatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector = chatlists.ExportedChatlistInvite; chatlists.deleteExportedInvite#719c5c5e chatlist:InputChatlist slug:string = Bool; @@ -3435,7 +3477,7 @@ chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector stories.canSendStory#c7dfdfdd peer:InputPeer = Bool; -stories.sendStory#bcb73644 flags:# pinned:flags.2?true noforwards:flags.4?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector caption:flags.0?string entities:flags.1?Vector privacy_rules:Vector random_id:long period:flags.3?int = Updates; +stories.sendStory#e4e6694b flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector caption:flags.0?string entities:flags.1?Vector privacy_rules:Vector random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int = Updates; stories.editStory#b583ba46 flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector caption:flags.1?string entities:flags.1?Vector privacy_rules:flags.2?Vector = Updates; @@ -3489,4 +3531,4 @@ premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; -// LAYER 166 +// LAYER 167 diff --git a/_schema/telegram.tl b/_schema/telegram.tl index e0fd5598e7..1a0c39eaf7 100644 --- a/_schema/telegram.tl +++ b/_schema/telegram.tl @@ -1,9 +1,9 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl -// Merge: _schema/legacy.tl,_schema/layer.tl -// Layer: 166 -// SHA256: 4056d76f6bec7a43b31a625278ee24c0a29cbd462dfc4769be1361c0221b96c7 +// Merge: _schema/legacy.tl +// Layer: 167 +// SHA256: 4313c183fe2e60588dc1323061b46db2b105347501d9a5fb33032d2fe58ecfaa boolFalse#bc799737 = Bool; @@ -139,7 +139,7 @@ storage.fileWebp#1081464c = storage.FileType; userEmpty#d3bc4b7a id:long = User; -user#eb602f25 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.7?int background_emoji_id:flags2.6?long = User; +user#215c4438 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; @@ -163,13 +163,13 @@ chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5 chatForbidden#6592a1a7 id:long title:string = Chat; -channel#1981ea7e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.6?int background_emoji_id:flags2.5?long = Chat; +channel#8e87ccd8 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.7?PeerColor = Chat; channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions = ChatFull; -channelFull#723027bd flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions stories:flags2.4?PeerStories = ChatFull; +channelFull#723027bd flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions stories:flags2.4?PeerStories = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; @@ -295,15 +295,15 @@ messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; messageActionRequestedPeer#fe77345d button_id:int peer:Peer = MessageAction; -messageActionSetChatWallPaper#bc44a927 wallpaper:WallPaper = MessageAction; - -messageActionSetSameChatWallPaper#c0787d6d wallpaper:WallPaper = MessageAction; +messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; messageActionGiftCode#d2cfdb0e flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string = MessageAction; messageActionGiveawayLaunch#332ba9ed = MessageAction; -dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?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; +messageActionGiveawayResults#2a9fadc5 winners_count:int unclaimed_count: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; @@ -377,7 +377,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; +userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -685,6 +685,12 @@ updateStoriesStealthMode#2c084dc1 stealth_mode:StoriesStealthMode = Update; updateSentStoryReaction#7d627683 peer:Peer story_id:int reaction:Reaction = Update; +updateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update; + +updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; + +updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; + updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; @@ -1909,9 +1915,7 @@ statsGraphError#bedc9822 error:string = StatsGraph; statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph; -messageInteractionCounters#ad4fc9bd msg_id:int views:int forwards:int = MessageInteractionCounters; - -stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector = stats.BroadcastStats; +stats.broadcastStats#396ca5fc period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev reactions_per_post:StatsAbsValueAndPrev views_per_story:StatsAbsValueAndPrev shares_per_story:StatsAbsValueAndPrev reactions_per_story:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph reactions_by_emotion_graph:StatsGraph story_interactions_graph:StatsGraph story_reactions_by_emotion_graph:StatsGraph recent_posts_interactions:Vector = stats.BroadcastStats; help.promoDataEmpty#98f6ac75 expires:int = help.PromoData; @@ -1947,7 +1951,7 @@ messages.messageViews#b6c4f543 views:Vector chats:Vector use messages.discussionMessage#a6341782 flags:# messages:Vector max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector users:Vector = messages.DiscussionMessage; -messageReplyHeader#6eebcabd 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 = MessageReplyHeader; +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; @@ -1955,7 +1959,7 @@ messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:in peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked; -stats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats; +stats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats; groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall; @@ -2033,7 +2037,7 @@ account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswo account.resetPasswordOk#e926d63e = account.ResetPasswordResult; -sponsoredMessage#daafff6b flags:# recommended:flags.5?true show_peer_photo:flags.6?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string webpage:flags.9?SponsoredWebPage message:string entities:flags.1?Vector sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; +sponsoredMessage#ed5383f7 flags:# recommended:flags.5?true show_peer_photo:flags.6?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string webpage:flags.9?SponsoredWebPage app:flags.10?BotApp message:string entities:flags.1?Vector button_text:flags.11?string sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; messages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector chats:Vector users:Vector = messages.SponsoredMessages; @@ -2133,7 +2137,7 @@ inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:Pre payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice; -messages.transcribedAudio#93752c52 flags:# pending:flags.0?true transcription_id:long text:string = messages.TranscribedAudio; +messages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio; help.premiumPromo#5334759c status_text:string status_entities:Vector video_sections:Vector videos:Vector period_options:Vector users:Vector = help.PremiumPromo; @@ -2289,7 +2293,7 @@ storyItemDeleted#51e6ee4f id:int = StoryItem; storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem; -storyItem#44c457ce 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 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#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; stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories; @@ -2303,7 +2307,7 @@ stories.storyViewsList#46e9b9ec flags:# count:int reactions_count:int views:Vect stories.storyViews#de9eed1d views:Vector users:Vector = stories.StoryViews; -inputReplyToMessage#73ec805 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 = InputReplyTo; +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; @@ -2347,6 +2351,32 @@ premium.myBoosts#9ae228e2 my_boosts:Vector chats:Vector users:Vec premium.boostsStatus#4959427a flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int gift_boosts:flags.4?int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue boost_url:string prepaid_giveaways:flags.3?Vector my_boost_slots:flags.2?Vector = premium.BoostsStatus; +storyFwdHeader#b826e150 flags:# modified:flags.3?true from:flags.0?Peer from_name:flags.1?string story_id:flags.2?int = StoryFwdHeader; + +postInteractionCountersMessage#e7058e7f msg_id:int views:int forwards:int reactions:int = PostInteractionCounters; + +postInteractionCountersStory#8a480e27 story_id:int views:int forwards:int reactions:int = PostInteractionCounters; + +stats.storyStats#50cd067c views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.StoryStats; + +publicForwardMessage#1f2bf4a message:Message = PublicForward; + +publicForwardStory#edf3add0 peer:Peer story:StoryItem = PublicForward; + +stats.publicForwards#93037e20 flags:# count:int forwards:Vector next_offset:flags.0?string chats:Vector users:Vector = stats.PublicForwards; + +peerColor#b54b5acf flags:# color:flags.0?int background_emoji_id:flags.1?long = PeerColor; + +help.peerColorSet#26219a58 colors:Vector = help.PeerColorSet; + +help.peerColorProfileSet#767d61eb palette_colors:Vector bg_colors:Vector story_colors:Vector = help.PeerColorSet; + +help.peerColorOption#135bd42f flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet = help.PeerColorOption; + +help.peerColorsNotModified#2ba1f5ce = help.PeerColors; + +help.peerColors#f8ed08 hash:int colors:Vector = help.PeerColors; + ---functions--- @@ -2584,7 +2614,7 @@ account.deleteAutoSaveExceptions#53bc0020 = Bool; account.invalidateSignInCodes#ca8ae8ba codes:Vector = Bool; -account.updateColor#a001cc43 flags:# color:int background_emoji_id:flags.0?long = Bool; +account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int background_emoji_id:flags.0?long = Bool; account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; @@ -3016,7 +3046,9 @@ messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; messages.requestAppWebView#8c5a3b3c flags:# write_allowed:flags.0?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = AppWebViewResult; -messages.setChatWallPaper#8ffacae1 flags:# peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; +messages.setChatWallPaper#8ffacae1 flags:# for_both:flags.3?true revert:flags.4?true peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; + +messages.searchEmojiStickerSets#92b4494c flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; updates.getState#edd4882a = updates.State; @@ -3096,6 +3128,10 @@ help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList; help.getPremiumPromo#b81b93d4 = help.PremiumPromo; +help.getPeerColors#da80f42f hash:int = help.PeerColors; + +help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors; + channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; @@ -3210,6 +3246,10 @@ channels.clickSponsoredMessage#18afbc93 channel:InputChannel random_id:bytes = B channels.updateColor#621a201f flags:# channel:InputChannel color:int background_emoji_id:flags.0?long = Updates; +channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; + +channels.getChannelRecommendations#83b70d97 channel:InputChannel = messages.Chats; + bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -3378,6 +3418,10 @@ stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_r stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; +stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats; + +stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; + chatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector = chatlists.ExportedChatlistInvite; chatlists.deleteExportedInvite#719c5c5e chatlist:InputChatlist slug:string = Bool; @@ -3402,7 +3446,7 @@ chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector stories.canSendStory#c7dfdfdd peer:InputPeer = Bool; -stories.sendStory#bcb73644 flags:# pinned:flags.2?true noforwards:flags.4?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector caption:flags.0?string entities:flags.1?Vector privacy_rules:Vector random_id:long period:flags.3?int = Updates; +stories.sendStory#e4e6694b flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector caption:flags.0?string entities:flags.1?Vector privacy_rules:Vector random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int = Updates; stories.editStory#b583ba46 flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector caption:flags.1?string entities:flags.1?Vector privacy_rules:flags.2?Vector = Updates; @@ -3454,6 +3498,8 @@ premium.applyBoost#6b7da746 flags:# slots:flags.0?Vector peer:InputPeer = p premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; +premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; + ---types--- @@ -3486,4 +3532,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 166 +// LAYER 167 diff --git a/cmd/dltl/main.go b/cmd/dltl/main.go index 95a1fcbf69..3ad4afedd9 100644 --- a/cmd/dltl/main.go +++ b/cmd/dltl/main.go @@ -68,7 +68,7 @@ func main() { } defer func() { _ = res.Body.Close() }() if res.StatusCode/100 != 2 { - panic(fmt.Sprintf("status code %d", res.StatusCode)) + panic(fmt.Sprintf("%s %d", u.String(), res.StatusCode)) } // Parsing in-place. diff --git a/examples/go.mod b/examples/go.mod index d827df05bd..a606039467 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -14,7 +14,7 @@ require ( go.uber.org/atomic v1.11.0 go.uber.org/zap v1.26.0 golang.org/x/sync v0.5.0 - golang.org/x/term v0.14.0 + golang.org/x/term v0.15.0 golang.org/x/time v0.3.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) @@ -33,7 +33,7 @@ require ( github.com/golang/snappy v0.0.4 // indirect github.com/gotd/ige v0.2.2 // indirect github.com/gotd/neo v0.1.5 // indirect - github.com/klauspost/compress v1.17.3 // indirect + github.com/klauspost/compress v1.17.4 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -42,10 +42,10 @@ require ( go.opentelemetry.io/otel v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.15.0 // indirect + golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20230116083435-1de6713980de // indirect - golang.org/x/net v0.18.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sys v0.15.0 // indirect nhooyr.io/websocket v1.8.10 // indirect rsc.io/qr v0.2.0 // indirect ) diff --git a/examples/go.sum b/examples/go.sum index ed08655eb5..1b1d7a0048 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -60,16 +60,11 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4 github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= -github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= -github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= -github.com/go-faster/errors v0.6.1 h1:nNIPOBkprlKzkThvS/0YaX8Zs9KewLCOSFQS5BU06FI= -github.com/go-faster/errors v0.6.1/go.mod h1:5MGV2/2T9yvlrbhe9pD9LO5Z/2zCSq2T8j+Jpi2LAyY= +github.com/go-faster/errors v0.7.0 h1:UnD/xusnfUgtEYkgRZohqL2AfmPTwv13NAJwwFFaNYc= github.com/go-faster/errors v0.7.0/go.mod h1:5ySTjWFiphBs07IKuiL69nxdfd5+fzh1u7FPGZP2quo= github.com/go-faster/jx v1.1.0 h1:ZsW3wD+snOdmTDy9eIVgQdjUpXRRV4rqW8NS3t+20bg= github.com/go-faster/jx v1.1.0/go.mod h1:vKDNikrKoyUmpzaJ0OkIkRQClNHFX/nF3dnTJZb3skg= @@ -78,18 +73,8 @@ github.com/go-faster/xor v1.0.0 h1:2o8vTOgErSGHP3/7XwA5ib1FTtUsNtwCoLLBjl31X38= github.com/go-faster/xor v1.0.0/go.mod h1:x5CaDY9UKErKzqfRfFZdfu+OSTfoZny3w5Ak7UxcipQ= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= -github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -103,14 +88,12 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -119,13 +102,11 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gotd/contrib v0.19.0 h1:O6GvMrRVeFslIHLUcpaHVzcl9/5PcgR2jQTIIeTyds0= github.com/gotd/contrib v0.19.0/go.mod h1:LzPxzRF0FvtpBt/WyODWQnPpk0tm/G9z6RHUoPqMakU= github.com/gotd/ige v0.2.2 h1:XQ9dJZwBfDnOGSTxKXBGP4gMud3Qku2ekScRjDWWfEk= @@ -145,8 +126,6 @@ github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrO github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= @@ -161,12 +140,9 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= -github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/compress v1.17.3/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= +github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -177,27 +153,19 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg= github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ= github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM= github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= @@ -242,12 +210,9 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= @@ -265,15 +230,14 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= -go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= @@ -283,9 +247,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= @@ -315,9 +278,8 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -326,8 +288,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -342,22 +303,19 @@ golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -393,7 +351,6 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -405,15 +362,13 @@ gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYs gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= -nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q= nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY= rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs= diff --git a/go.mod b/go.mod index 26ad8b0200..79c5740406 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/go-faster/jx v1.1.0 github.com/go-faster/xor v1.0.0 github.com/go-openapi/inflect v0.19.0 - github.com/gotd/getdoc v0.36.0 + github.com/gotd/getdoc v0.37.0 github.com/gotd/ige v0.2.2 github.com/gotd/neo v0.1.5 github.com/gotd/tl v0.4.0 diff --git a/go.sum b/go.sum index d24e53a1d1..1b0c3e65b5 100644 --- a/go.sum +++ b/go.sum @@ -22,6 +22,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gotd/getdoc v0.36.0 h1:JHFUZrDo6Dv/R0HmjpPmGvX9Kw8aHH8GY7+8M09K+XE= github.com/gotd/getdoc v0.36.0/go.mod h1:yS2cctXnMY1Ju3QZaUxSzHlgOpqsUB+MkhA7r1hm2o0= +github.com/gotd/getdoc v0.37.0 h1:tnw5xHZZTU8vXgT5K/lBtLQxmRx730Lv+hMQ7gEMn+Y= +github.com/gotd/getdoc v0.37.0/go.mod h1:yS2cctXnMY1Ju3QZaUxSzHlgOpqsUB+MkhA7r1hm2o0= github.com/gotd/ige v0.2.2 h1:XQ9dJZwBfDnOGSTxKXBGP4gMud3Qku2ekScRjDWWfEk= github.com/gotd/ige v0.2.2/go.mod h1:tuCRb+Y5Y3eNTo3ypIfNpQ4MFjrnONiL2jN2AKZXmb0= github.com/gotd/neo v0.1.5 h1:oj0iQfMbGClP8xI59x7fE/uHoTJD7NZH9oV1WNuPukQ= diff --git a/telegram/query/cached/queries.gen.go b/telegram/query/cached/queries.gen.go index 3572918f46..7d74528245 100644 --- a/telegram/query/cached/queries.gen.go +++ b/telegram/query/cached/queries.gen.go @@ -1970,6 +1970,94 @@ func (s *MessagesSearchCustomEmoji) Fetch(ctx context.Context) (bool, error) { } } +type innerMessagesSearchEmojiStickerSets struct { + // Last received hash. + hash int64 + // Last received result. + value *tg.MessagesFoundStickerSets +} + +type MessagesSearchEmojiStickerSets struct { + // Query to send. + req *tg.MessagesSearchEmojiStickerSetsRequest + // Result state. + last atomic.Value + + // Reference to RPC client to make requests. + raw *tg.Client +} + +// NewMessagesSearchEmojiStickerSets creates new MessagesSearchEmojiStickerSets. +func NewMessagesSearchEmojiStickerSets(raw *tg.Client, initial *tg.MessagesSearchEmojiStickerSetsRequest) *MessagesSearchEmojiStickerSets { + q := &MessagesSearchEmojiStickerSets{ + req: initial, + raw: raw, + } + + return q +} + +func (s *MessagesSearchEmojiStickerSets) store(v innerMessagesSearchEmojiStickerSets) { + s.last.Store(v) +} + +func (s *MessagesSearchEmojiStickerSets) load() (innerMessagesSearchEmojiStickerSets, bool) { + v, ok := s.last.Load().(innerMessagesSearchEmojiStickerSets) + return v, ok +} + +// Value returns last received result. +// NB: May be nil. Returned MessagesFoundStickerSets must not be mutated. +func (s *MessagesSearchEmojiStickerSets) Value() *tg.MessagesFoundStickerSets { + inner, _ := s.load() + return inner.value +} + +// Hash returns last received hash. +func (s *MessagesSearchEmojiStickerSets) Hash() int64 { + inner, _ := s.load() + return inner.hash +} + +// Get updates data if needed and returns it. +func (s *MessagesSearchEmojiStickerSets) Get(ctx context.Context) (*tg.MessagesFoundStickerSets, error) { + if _, err := s.Fetch(ctx); err != nil { + return nil, err + } + + return s.Value(), nil +} + +// Fetch updates data if needed and returns true if data was modified. +func (s *MessagesSearchEmojiStickerSets) Fetch(ctx context.Context) (bool, error) { + lastHash := s.Hash() + + req := s.req + req.Hash = lastHash + result, err := s.raw.MessagesSearchEmojiStickerSets(ctx, req) + if err != nil { + return false, errors.Wrap(err, "execute MessagesSearchEmojiStickerSets") + } + + switch variant := result.(type) { + case *tg.MessagesFoundStickerSets: + hash := variant.Hash + + s.store(innerMessagesSearchEmojiStickerSets{ + hash: hash, + value: variant, + }) + return true, nil + case *tg.MessagesFoundStickerSetsNotModified: + if lastHash == 0 { + return false, errors.Errorf("got unexpected %T result", result) + } + return false, nil + default: + return false, errors.Errorf("unexpected type %T", result) + } +} + type innerMessagesSearchStickerSets struct { // Last received hash. hash int64 diff --git a/tg/e2e/tl_message_entity_gen.go b/tg/e2e/tl_message_entity_gen.go index 98a7f6719e..b6b93e7653 100644 --- a/tg/e2e/tl_message_entity_gen.go +++ b/tg/e2e/tl_message_entity_gen.go @@ -2840,12 +2840,19 @@ func (m *MessageEntityStrike) GetLength() (value int) { } // MessageEntityBlockquote represents TL type `messageEntityBlockquote#20df5d0`. +// Message entity representing a block quote. // // See https://core.telegram.org/constructor/messageEntityBlockquote for reference. type MessageEntityBlockquote struct { - // Offset field of MessageEntityBlockquote. + // Offset of message entity within message (in UTF-16 code units¹) + // + // Links: + // 1) https://core.telegram.org/api/entities#entity-length Offset int - // Length field of MessageEntityBlockquote. + // Length of message entity within message (in UTF-16 code units¹) + // + // Links: + // 1) https://core.telegram.org/api/entities#entity-length Length int } diff --git a/tg/tl_account_finish_takeout_session_gen.go b/tg/tl_account_finish_takeout_session_gen.go index 52546f9042..0a28e7ceb7 100644 --- a/tg/tl_account_finish_takeout_session_gen.go +++ b/tg/tl_account_finish_takeout_session_gen.go @@ -32,7 +32,10 @@ var ( ) // AccountFinishTakeoutSessionRequest represents TL type `account.finishTakeoutSession#1d2652ee`. -// Finish account takeout session +// Terminate a takeout session, see here » for more info¹. +// +// Links: +// 1. https://core.telegram.org/api/takeout // // See https://core.telegram.org/method/account.finishTakeoutSession for reference. type AccountFinishTakeoutSessionRequest struct { @@ -191,11 +194,14 @@ func (f *AccountFinishTakeoutSessionRequest) GetSuccess() (value bool) { } // AccountFinishTakeoutSession invokes method account.finishTakeoutSession#1d2652ee returning error if any. -// Finish account takeout session +// Terminate a takeout session, see here » for more info¹. +// +// Links: +// 1. https://core.telegram.org/api/takeout // // Possible errors: // -// 403 TAKEOUT_REQUIRED: A takeout session has to be initialized, first. +// 403 TAKEOUT_REQUIRED: A takeout session needs to be initialized first, see here » for more info. // // See https://core.telegram.org/method/account.finishTakeoutSession for reference. func (c *Client) AccountFinishTakeoutSession(ctx context.Context, request *AccountFinishTakeoutSessionRequest) (bool, error) { diff --git a/tg/tl_account_get_default_background_emojis_gen.go b/tg/tl_account_get_default_background_emojis_gen.go index f2870079c4..67547c2e0e 100644 --- a/tg/tl_account_get_default_background_emojis_gen.go +++ b/tg/tl_account_get_default_background_emojis_gen.go @@ -32,10 +32,19 @@ var ( ) // AccountGetDefaultBackgroundEmojisRequest represents TL type `account.getDefaultBackgroundEmojis#a60ab9ce`. +// Get a set of suggested custom emoji stickers¹ that can be used in an accent color +// pattern². +// +// Links: +// 1. https://core.telegram.org/api/custom-emoji +// 2. https://core.telegram.org/api/colors // // See https://core.telegram.org/method/account.getDefaultBackgroundEmojis for reference. type AccountGetDefaultBackgroundEmojisRequest struct { - // Hash field of AccountGetDefaultBackgroundEmojisRequest. + // Hash for pagination, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation Hash int64 } @@ -161,6 +170,12 @@ func (g *AccountGetDefaultBackgroundEmojisRequest) GetHash() (value int64) { } // AccountGetDefaultBackgroundEmojis invokes method account.getDefaultBackgroundEmojis#a60ab9ce returning error if any. +// Get a set of suggested custom emoji stickers¹ that can be used in an accent color +// pattern². +// +// Links: +// 1. https://core.telegram.org/api/custom-emoji +// 2. https://core.telegram.org/api/colors // // See https://core.telegram.org/method/account.getDefaultBackgroundEmojis for reference. func (c *Client) AccountGetDefaultBackgroundEmojis(ctx context.Context, hash int64) (EmojiListClass, error) { diff --git a/tg/tl_account_init_takeout_session_gen.go b/tg/tl_account_init_takeout_session_gen.go index 0efa529fb1..7e19f0f453 100644 --- a/tg/tl_account_init_takeout_session_gen.go +++ b/tg/tl_account_init_takeout_session_gen.go @@ -32,7 +32,10 @@ var ( ) // AccountInitTakeoutSessionRequest represents TL type `account.initTakeoutSession#8ef3eab0`. -// Initialize account takeout session +// Initialize a takeout session, see here » for more info¹. +// +// Links: +// 1. https://core.telegram.org/api/takeout // // See https://core.telegram.org/method/account.initTakeoutSession for reference. type AccountInitTakeoutSessionRequest struct { @@ -423,7 +426,10 @@ func (i *AccountInitTakeoutSessionRequest) GetFileMaxSize() (value int64, ok boo } // AccountInitTakeoutSession invokes method account.initTakeoutSession#8ef3eab0 returning error if any. -// Initialize account takeout session +// Initialize a takeout session, see here » for more info¹. +// +// Links: +// 1. https://core.telegram.org/api/takeout // // Possible errors: // diff --git a/tg/tl_account_update_color_gen.go b/tg/tl_account_update_color_gen.go index bda15cf03c..d058b934f9 100644 --- a/tg/tl_account_update_color_gen.go +++ b/tg/tl_account_update_color_gen.go @@ -31,22 +31,38 @@ var ( _ = tdjson.Encoder{} ) -// AccountUpdateColorRequest represents TL type `account.updateColor#a001cc43`. +// AccountUpdateColorRequest represents TL type `account.updateColor#7cefa15d`. +// Update the accent color and background custom emoji »¹ of the current account. +// +// Links: +// 1. https://core.telegram.org/api/colors // // See https://core.telegram.org/method/account.updateColor for reference. type AccountUpdateColorRequest struct { - // Flags field of AccountUpdateColorRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Color field of AccountUpdateColorRequest. + // Whether to change the accent color emoji pattern of the profile page; otherwise, the + // accent color and emoji pattern of messages will be changed. + ForProfile bool + // ID of the accent color palette »¹ to use (not RGB24, see here »² for more info). + // + // Links: + // 1) https://core.telegram.org/api/colors + // 2) https://core.telegram.org/api/colors + // + // Use SetColor and GetColor helpers. Color int - // BackgroundEmojiID field of AccountUpdateColorRequest. + // Custom emoji ID used in the accent color pattern. // // Use SetBackgroundEmojiID and GetBackgroundEmojiID helpers. BackgroundEmojiID int64 } // AccountUpdateColorRequestTypeID is TL type id of AccountUpdateColorRequest. -const AccountUpdateColorRequestTypeID = 0xa001cc43 +const AccountUpdateColorRequestTypeID = 0x7cefa15d // Ensuring interfaces in compile-time for AccountUpdateColorRequest. var ( @@ -63,6 +79,9 @@ func (u *AccountUpdateColorRequest) Zero() bool { if !(u.Flags.Zero()) { return false } + if !(u.ForProfile == false) { + return false + } if !(u.Color == 0) { return false } @@ -84,10 +103,15 @@ func (u *AccountUpdateColorRequest) String() string { // FillFrom fills AccountUpdateColorRequest from given interface. func (u *AccountUpdateColorRequest) FillFrom(from interface { - GetColor() (value int) + GetForProfile() (value bool) + GetColor() (value int, ok bool) GetBackgroundEmojiID() (value int64, ok bool) }) { - u.Color = from.GetColor() + u.ForProfile = from.GetForProfile() + if val, ok := from.GetColor(); ok { + u.Color = val + } + if val, ok := from.GetBackgroundEmojiID(); ok { u.BackgroundEmojiID = val } @@ -117,9 +141,15 @@ func (u *AccountUpdateColorRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "ForProfile", + SchemaName: "for_profile", + Null: !u.Flags.Has(1), + }, { Name: "Color", SchemaName: "color", + Null: !u.Flags.Has(2), }, { Name: "BackgroundEmojiID", @@ -132,6 +162,12 @@ func (u *AccountUpdateColorRequest) TypeInfo() tdp.Type { // SetFlags sets flags for non-zero fields. func (u *AccountUpdateColorRequest) SetFlags() { + if !(u.ForProfile == false) { + u.Flags.Set(1) + } + if !(u.Color == 0) { + u.Flags.Set(2) + } if !(u.BackgroundEmojiID == 0) { u.Flags.Set(0) } @@ -140,7 +176,7 @@ func (u *AccountUpdateColorRequest) SetFlags() { // Encode implements bin.Encoder. func (u *AccountUpdateColorRequest) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode account.updateColor#a001cc43 as nil") + return fmt.Errorf("can't encode account.updateColor#7cefa15d as nil") } b.PutID(AccountUpdateColorRequestTypeID) return u.EncodeBare(b) @@ -149,13 +185,15 @@ func (u *AccountUpdateColorRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *AccountUpdateColorRequest) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode account.updateColor#a001cc43 as nil") + return fmt.Errorf("can't encode account.updateColor#7cefa15d as nil") } u.SetFlags() if err := u.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode account.updateColor#a001cc43: field flags: %w", err) + return fmt.Errorf("unable to encode account.updateColor#7cefa15d: field flags: %w", err) + } + if u.Flags.Has(2) { + b.PutInt(u.Color) } - b.PutInt(u.Color) if u.Flags.Has(0) { b.PutLong(u.BackgroundEmojiID) } @@ -165,10 +203,10 @@ func (u *AccountUpdateColorRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *AccountUpdateColorRequest) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode account.updateColor#a001cc43 to nil") + return fmt.Errorf("can't decode account.updateColor#7cefa15d to nil") } if err := b.ConsumeID(AccountUpdateColorRequestTypeID); err != nil { - return fmt.Errorf("unable to decode account.updateColor#a001cc43: %w", err) + return fmt.Errorf("unable to decode account.updateColor#7cefa15d: %w", err) } return u.DecodeBare(b) } @@ -176,36 +214,66 @@ func (u *AccountUpdateColorRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *AccountUpdateColorRequest) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode account.updateColor#a001cc43 to nil") + return fmt.Errorf("can't decode account.updateColor#7cefa15d to nil") } { if err := u.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode account.updateColor#a001cc43: field flags: %w", err) + return fmt.Errorf("unable to decode account.updateColor#7cefa15d: field flags: %w", err) } } - { + u.ForProfile = u.Flags.Has(1) + if u.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode account.updateColor#a001cc43: field color: %w", err) + return fmt.Errorf("unable to decode account.updateColor#7cefa15d: field color: %w", err) } u.Color = value } if u.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode account.updateColor#a001cc43: field background_emoji_id: %w", err) + return fmt.Errorf("unable to decode account.updateColor#7cefa15d: field background_emoji_id: %w", err) } u.BackgroundEmojiID = value } return nil } -// GetColor returns value of Color field. -func (u *AccountUpdateColorRequest) GetColor() (value int) { +// SetForProfile sets value of ForProfile conditional field. +func (u *AccountUpdateColorRequest) SetForProfile(value bool) { + if value { + u.Flags.Set(1) + u.ForProfile = true + } else { + u.Flags.Unset(1) + u.ForProfile = false + } +} + +// GetForProfile returns value of ForProfile conditional field. +func (u *AccountUpdateColorRequest) GetForProfile() (value bool) { if u == nil { return } - return u.Color + return u.Flags.Has(1) +} + +// SetColor sets value of Color conditional field. +func (u *AccountUpdateColorRequest) SetColor(value int) { + u.Flags.Set(2) + u.Color = value +} + +// GetColor returns value of Color conditional field and +// boolean which is true if field was set. +func (u *AccountUpdateColorRequest) GetColor() (value int, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(2) { + return value, false + } + return u.Color, true } // SetBackgroundEmojiID sets value of BackgroundEmojiID conditional field. @@ -226,7 +294,15 @@ func (u *AccountUpdateColorRequest) GetBackgroundEmojiID() (value int64, ok bool return u.BackgroundEmojiID, true } -// AccountUpdateColor invokes method account.updateColor#a001cc43 returning error if any. +// AccountUpdateColor invokes method account.updateColor#7cefa15d returning error if any. +// Update the accent color and background custom emoji »¹ of the current account. +// +// Links: +// 1. https://core.telegram.org/api/colors +// +// Possible errors: +// +// 400 COLOR_INVALID: // // See https://core.telegram.org/method/account.updateColor for reference. func (c *Client) AccountUpdateColor(ctx context.Context, request *AccountUpdateColorRequest) (bool, error) { diff --git a/tg/tl_app_web_view_result_url_gen.go b/tg/tl_app_web_view_result_url_gen.go index ebeed2e833..f9d8ef64c1 100644 --- a/tg/tl_app_web_view_result_url_gen.go +++ b/tg/tl_app_web_view_result_url_gen.go @@ -32,10 +32,10 @@ var ( ) // AppWebViewResultURL represents TL type `appWebViewResultUrl#3c1b4f0d`. -// Contains the link that must be used to open a named bot mini app¹. +// Contains the link that must be used to open a named Mini App¹. // // Links: -// 1. https://core.telegram.org/api/bots/webapps#named-bot-mini-apps +// 1. https://core.telegram.org/api/bots/webapps#named-mini-apps // // See https://core.telegram.org/constructor/appWebViewResultUrl for reference. type AppWebViewResultURL struct { diff --git a/tg/tl_attach_menu_bot_gen.go b/tg/tl_attach_menu_bot_gen.go index 93255ca71e..b60db30793 100644 --- a/tg/tl_attach_menu_bot_gen.go +++ b/tg/tl_attach_menu_bot_gen.go @@ -32,7 +32,9 @@ var ( ) // AttachMenuBot represents TL type `attachMenuBot#d90d8dfe`. -// Represents a bot mini app that can be launched from the attachment menu »¹ +// Represents a bot mini app that can be launched from the attachment/side menu »¹ +// At least one of the show_in_attach_menu or the show_in_side_menu flags will always be +// set. // // Links: // 1. https://core.telegram.org/api/bots/attach @@ -44,8 +46,9 @@ type AttachMenuBot struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Whether this bot attachment menu entry should be shown in the attachment menu (toggle - // using messages.toggleBotInAttachMenu¹) + // If set, before launching the mini app the client should ask the user to add the mini + // app to the attachment/side menu, and only if the user accepts, after invoking messages + // toggleBotInAttachMenu¹ the app should be opened. // // Links: // 1) https://core.telegram.org/method/messages.toggleBotInAttachMenu @@ -57,11 +60,19 @@ type AttachMenuBot struct { HasSettings bool // Whether the bot would like to send messages to the user. RequestWriteAccess bool - // ShowInAttachMenu field of AttachMenuBot. + // Whether, when installed, an attachment menu entry should be shown for the Mini App. ShowInAttachMenu bool - // ShowInSideMenu field of AttachMenuBot. + // Whether, when installed, an entry in the main view side menu should be shown for the + // Mini App. ShowInSideMenu bool - // SideMenuDisclaimerNeeded field of AttachMenuBot. + // If inactive if set and the user hasn't previously accepted the third-party mini apps + // Terms of Service¹ for this bot, when showing the mini app installation prompt, an + // additional mandatory checkbox to accept the mini apps TOS² and a disclaimer + // indicating that this Mini App is not affiliated to Telegram should be shown. + // + // Links: + // 1) https://telegram.org/tos/mini-apps + // 2) https://telegram.org/tos/mini-apps SideMenuDisclaimerNeeded bool // Bot ID BotID int64 diff --git a/tg/tl_attach_menu_bot_icon_gen.go b/tg/tl_attach_menu_bot_icon_gen.go index ff03f314ea..46f0b6f4e6 100644 --- a/tg/tl_attach_menu_bot_icon_gen.go +++ b/tg/tl_attach_menu_bot_icon_gen.go @@ -51,6 +51,9 @@ type AttachMenuBotIcon struct { // ios_animated - Animated attachment menu icon in TGS format for the official iOS app // android_animated - Animated attachment menu icon in TGS format for the official // Android app macos_animated - Animated attachment menu icon in TGS format for the + // official native Mac OS app ios_side_menu_static - Side menu icon in PNG format for the + // official iOS app android_side_menu_static - Side menu icon in SVG format for the + // official android app macos_side_menu_static - Side menu icon in PNG format for the // official native Mac OS app Name string // The actual icon file. diff --git a/tg/tl_boost_gen.go b/tg/tl_boost_gen.go index 37f4268107..822c154c91 100644 --- a/tg/tl_boost_gen.go +++ b/tg/tl_boost_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/constructor/boost for reference. type Boost struct { - // Flags field of Boost. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Gift field of Boost. Gift bool diff --git a/tg/tl_bot_app_gen.go b/tg/tl_bot_app_gen.go index f6bc90c623..2d52c385b0 100644 --- a/tg/tl_bot_app_gen.go +++ b/tg/tl_bot_app_gen.go @@ -134,10 +134,10 @@ func (b *BotAppNotModified) DecodeBare(buf *bin.Buffer) error { } // BotApp represents TL type `botApp#95fcd1d6`. -// Contains information about a named bot mini app¹. +// Contains information about a named Mini App¹. // // Links: -// 1. https://core.telegram.org/api/bots/webapps#named-bot-mini-apps +// 1. https://core.telegram.org/api/bots/webapps#named-mini-apps // // See https://core.telegram.org/constructor/botApp for reference. type BotApp struct { @@ -150,10 +150,10 @@ type BotApp struct { ID int64 // bot mini app access hash AccessHash int64 - // bot mini app short name, used to generate named bot mini app deep links¹. + // bot mini app short name, used to generate named Mini App deep links¹. // // Links: - // 1) https://core.telegram.org/api/links#named-bot-mini-app-links + // 1) https://core.telegram.org/api/links#named-mini-app-links ShortName string // bot mini app title. Title string diff --git a/tg/tl_bot_inline_message_gen.go b/tg/tl_bot_inline_message_gen.go index 417310f1a7..8fa3309193 100644 --- a/tg/tl_bot_inline_message_gen.go +++ b/tg/tl_bot_inline_message_gen.go @@ -44,7 +44,8 @@ type BotInlineMessageMediaAuto struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // InvertMedia field of BotInlineMessageMediaAuto. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // Caption Message string @@ -367,7 +368,8 @@ type BotInlineMessageText struct { Flags bin.Fields // Disable webpage preview NoWebpage bool - // InvertMedia field of BotInlineMessageText. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // The message Message string @@ -2142,9 +2144,13 @@ func (b *BotInlineMessageMediaInvoice) GetReplyMarkup() (value ReplyMarkupClass, // // See https://core.telegram.org/constructor/botInlineMessageMediaWebPage for reference. type BotInlineMessageMediaWebPage struct { - // Flags field of BotInlineMessageMediaWebPage. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // InvertMedia field of BotInlineMessageMediaWebPage. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // ForceLargeMedia field of BotInlineMessageMediaWebPage. ForceLargeMedia bool @@ -2156,7 +2162,10 @@ type BotInlineMessageMediaWebPage struct { Safe bool // Message field of BotInlineMessageMediaWebPage. Message string - // Entities field of BotInlineMessageMediaWebPage. + // Message entities for styled text¹ + // + // Links: + // 1) https://core.telegram.org/api/entities // // Use SetEntities and GetEntities helpers. Entities []MessageEntityClass diff --git a/tg/tl_bots_invoke_web_view_custom_method_gen.go b/tg/tl_bots_invoke_web_view_custom_method_gen.go index 6f2942a2fc..a542b5d5d6 100644 --- a/tg/tl_bots_invoke_web_view_custom_method_gen.go +++ b/tg/tl_bots_invoke_web_view_custom_method_gen.go @@ -32,10 +32,16 @@ var ( ) // BotsInvokeWebViewCustomMethodRequest represents TL type `bots.invokeWebViewCustomMethod#87fc5e7`. -// Send a custom request from a mini bot app¹ +// Send a custom request from a mini bot app¹, triggered by a +// web_app_invoke_custom_method event »². +// The response should be sent using a custom_method_invoked¹ event, see here »² for +// more info on the flow. // // Links: // 1. https://core.telegram.org/api/bots/webapps +// 2. https://core.telegram.org/api/web-events#web-app-invoke-custom-method +// 3. https://core.telegram.org/api/bots/webapps#custom-method-invoked +// 4. https://core.telegram.org/api/web-events#web-app-invoke-custom-method // // See https://core.telegram.org/method/bots.invokeWebViewCustomMethod for reference. type BotsInvokeWebViewCustomMethodRequest struct { @@ -227,10 +233,16 @@ func (i *BotsInvokeWebViewCustomMethodRequest) GetParams() (value DataJSON) { } // BotsInvokeWebViewCustomMethod invokes method bots.invokeWebViewCustomMethod#87fc5e7 returning error if any. -// Send a custom request from a mini bot app¹ +// Send a custom request from a mini bot app¹, triggered by a +// web_app_invoke_custom_method event »². +// The response should be sent using a custom_method_invoked¹ event, see here »² for +// more info on the flow. // // Links: // 1. https://core.telegram.org/api/bots/webapps +// 2. https://core.telegram.org/api/web-events#web-app-invoke-custom-method +// 3. https://core.telegram.org/api/bots/webapps#custom-method-invoked +// 4. https://core.telegram.org/api/web-events#web-app-invoke-custom-method // // Possible errors: // diff --git a/tg/tl_channel_admin_log_events_filter_gen.go b/tg/tl_channel_admin_log_events_filter_gen.go index 708773d467..ef53ad6418 100644 --- a/tg/tl_channel_admin_log_events_filter_gen.go +++ b/tg/tl_channel_admin_log_events_filter_gen.go @@ -41,10 +41,12 @@ type ChannelAdminLogEventsFilter struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Join events¹ + // Join events¹, including joins using invite links² and join requests³. // // Links: // 1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantJoin + // 2) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantJoinByInvite + // 3) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantJoinByRequest Join bool // Leave events¹ // @@ -87,7 +89,8 @@ type ChannelAdminLogEventsFilter struct { // 1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantToggleAdmin Demote bool // Info change events (when about¹, linked chat², location³, photo⁴, stickerset⁵, - // title⁶ or username⁷ data of a channel gets modified) + // title⁶ or username⁷, slowmode⁸, history TTL⁹ settings of a channel gets + // modified) // // Links: // 1) https://core.telegram.org/constructor/channelAdminLogEventActionChangeAbout @@ -97,15 +100,18 @@ type ChannelAdminLogEventsFilter struct { // 5) https://core.telegram.org/constructor/channelAdminLogEventActionChangeStickerSet // 6) https://core.telegram.org/constructor/channelAdminLogEventActionChangeTitle // 7) https://core.telegram.org/constructor/channelAdminLogEventActionChangeUsername + // 8) https://core.telegram.org/constructor/channelAdminLogEventActionToggleSlowMode + // 9) https://core.telegram.org/constructor/channelAdminLogEventActionChangeHistoryTTL Info bool // Settings change events (invites¹, hidden prehistory², signatures³, default banned - // rights⁴) + // rights⁴, forum toggle events⁵) // // Links: // 1) https://core.telegram.org/constructor/channelAdminLogEventActionToggleInvites // 2) https://core.telegram.org/constructor/channelAdminLogEventActionTogglePreHistoryHidden // 3) https://core.telegram.org/constructor/channelAdminLogEventActionToggleSignatures // 4) https://core.telegram.org/constructor/channelAdminLogEventActionDefaultBannedRights + // 5) https://core.telegram.org/constructor/channelAdminLogEventActionToggleForum Settings bool // Message pin events¹ // diff --git a/tg/tl_channels_create_channel_gen.go b/tg/tl_channels_create_channel_gen.go index 3ebb64426f..55a8246b50 100644 --- a/tg/tl_channels_create_channel_gen.go +++ b/tg/tl_channels_create_channel_gen.go @@ -543,10 +543,11 @@ func (c *ChannelsCreateChannelRequest) GetGeoPointAsNotEmpty() (*InputGeoPoint, // // Possible errors: // -// 400 ADDRESS_INVALID: +// 400 ADDRESS_INVALID: The specified geopoint address is invalid. // 400 CHANNELS_ADMIN_LOCATED_TOO_MUCH: The user has reached the limit of public geogroups. // 400 CHANNELS_TOO_MUCH: You have joined too many channels/supergroups. // 400 CHAT_ABOUT_TOO_LONG: Chat about too long. +// 500 CHAT_INVALID: Invalid chat. // 400 CHAT_TITLE_EMPTY: No chat title provided. // 400 TTL_PERIOD_INVALID: The specified TTL period is invalid. // 406 USER_RESTRICTED: You're spamreported, you can't create channels or chats. diff --git a/tg/tl_channels_create_forum_topic_gen.go b/tg/tl_channels_create_forum_topic_gen.go index 4d9a413fec..1ee926212d 100644 --- a/tg/tl_channels_create_forum_topic_gen.go +++ b/tg/tl_channels_create_forum_topic_gen.go @@ -422,6 +422,7 @@ func (c *ChannelsCreateForumTopicRequest) GetChannelAsNotEmpty() (NotEmptyInputC // 400 CHANNEL_FORUM_MISSING: This supergroup is not a forum. // 400 CHANNEL_INVALID: The provided channel is invalid. // 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat. +// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // 400 TOPIC_TITLE_EMPTY: The specified topic title is empty. // // See https://core.telegram.org/method/channels.createForumTopic for reference. diff --git a/tg/tl_channels_edit_banned_gen.go b/tg/tl_channels_edit_banned_gen.go index f077683410..d03d4422fe 100644 --- a/tg/tl_channels_edit_banned_gen.go +++ b/tg/tl_channels_edit_banned_gen.go @@ -244,6 +244,7 @@ func (e *ChannelsEditBannedRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel // // Possible errors: // +// 406 BANNED_RIGHTS_INVALID: You provided some invalid flags in the banned rights. // 400 CHANNEL_INVALID: The provided channel is invalid. // 406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. diff --git a/tg/tl_channels_edit_forum_topic_gen.go b/tg/tl_channels_edit_forum_topic_gen.go index f6809d4e4a..1d10e72bd7 100644 --- a/tg/tl_channels_edit_forum_topic_gen.go +++ b/tg/tl_channels_edit_forum_topic_gen.go @@ -436,8 +436,8 @@ func (e *ChannelsEditForumTopicRequest) GetChannelAsNotEmpty() (NotEmptyInputCha // 403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 400 DOCUMENT_INVALID: The specified document is invalid. // 400 GENERAL_MODIFY_ICON_FORBIDDEN: You can't modify the icon of the "General" topic. -// 400 TOPIC_CLOSE_SEPARATELY: -// 400 TOPIC_HIDE_SEPARATELY: +// 400 TOPIC_CLOSE_SEPARATELY: The close flag cannot be provided together with any of the other flags. +// 400 TOPIC_HIDE_SEPARATELY: The hide flag cannot be provided together with any of the other flags. // 400 TOPIC_ID_INVALID: The specified topic ID is invalid. // 400 TOPIC_NOT_MODIFIED: The updated topic info is equal to the current topic info, nothing was changed. // diff --git a/tg/tl_channels_get_channel_recommendations_gen.go b/tg/tl_channels_get_channel_recommendations_gen.go new file mode 100644 index 0000000000..17fb50ac5e --- /dev/null +++ b/tg/tl_channels_get_channel_recommendations_gen.go @@ -0,0 +1,190 @@ +// 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{} +) + +// ChannelsGetChannelRecommendationsRequest represents TL type `channels.getChannelRecommendations#83b70d97`. +// +// See https://core.telegram.org/method/channels.getChannelRecommendations for reference. +type ChannelsGetChannelRecommendationsRequest struct { + // Channel field of ChannelsGetChannelRecommendationsRequest. + Channel InputChannelClass +} + +// ChannelsGetChannelRecommendationsRequestTypeID is TL type id of ChannelsGetChannelRecommendationsRequest. +const ChannelsGetChannelRecommendationsRequestTypeID = 0x83b70d97 + +// Ensuring interfaces in compile-time for ChannelsGetChannelRecommendationsRequest. +var ( + _ bin.Encoder = &ChannelsGetChannelRecommendationsRequest{} + _ bin.Decoder = &ChannelsGetChannelRecommendationsRequest{} + _ bin.BareEncoder = &ChannelsGetChannelRecommendationsRequest{} + _ bin.BareDecoder = &ChannelsGetChannelRecommendationsRequest{} +) + +func (g *ChannelsGetChannelRecommendationsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Channel == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *ChannelsGetChannelRecommendationsRequest) String() string { + if g == nil { + return "ChannelsGetChannelRecommendationsRequest(nil)" + } + type Alias ChannelsGetChannelRecommendationsRequest + return fmt.Sprintf("ChannelsGetChannelRecommendationsRequest%+v", Alias(*g)) +} + +// FillFrom fills ChannelsGetChannelRecommendationsRequest from given interface. +func (g *ChannelsGetChannelRecommendationsRequest) FillFrom(from interface { + GetChannel() (value InputChannelClass) +}) { + g.Channel = from.GetChannel() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelsGetChannelRecommendationsRequest) TypeID() uint32 { + return ChannelsGetChannelRecommendationsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelsGetChannelRecommendationsRequest) TypeName() string { + return "channels.getChannelRecommendations" +} + +// TypeInfo returns info about TL type. +func (g *ChannelsGetChannelRecommendationsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channels.getChannelRecommendations", + ID: ChannelsGetChannelRecommendationsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Channel", + SchemaName: "channel", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *ChannelsGetChannelRecommendationsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode channels.getChannelRecommendations#83b70d97 as nil") + } + b.PutID(ChannelsGetChannelRecommendationsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *ChannelsGetChannelRecommendationsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode channels.getChannelRecommendations#83b70d97 as nil") + } + if g.Channel == nil { + return fmt.Errorf("unable to encode channels.getChannelRecommendations#83b70d97: field channel is nil") + } + if err := g.Channel.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.getChannelRecommendations#83b70d97: field channel: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *ChannelsGetChannelRecommendationsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode channels.getChannelRecommendations#83b70d97 to nil") + } + if err := b.ConsumeID(ChannelsGetChannelRecommendationsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode channels.getChannelRecommendations#83b70d97: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *ChannelsGetChannelRecommendationsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode channels.getChannelRecommendations#83b70d97 to nil") + } + { + value, err := DecodeInputChannel(b) + if err != nil { + return fmt.Errorf("unable to decode channels.getChannelRecommendations#83b70d97: field channel: %w", err) + } + g.Channel = value + } + return nil +} + +// GetChannel returns value of Channel field. +func (g *ChannelsGetChannelRecommendationsRequest) GetChannel() (value InputChannelClass) { + if g == nil { + return + } + return g.Channel +} + +// GetChannelAsNotEmpty returns mapped value of Channel field. +func (g *ChannelsGetChannelRecommendationsRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { + return g.Channel.AsNotEmpty() +} + +// ChannelsGetChannelRecommendations invokes method channels.getChannelRecommendations#83b70d97 returning error if any. +// +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. +// +// See https://core.telegram.org/method/channels.getChannelRecommendations for reference. +func (c *Client) ChannelsGetChannelRecommendations(ctx context.Context, channel InputChannelClass) (MessagesChatsClass, error) { + var result MessagesChatsBox + + request := &ChannelsGetChannelRecommendationsRequest{ + Channel: channel, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.Chats, nil +} diff --git a/tg/tl_message_interaction_counters_slices_gen.go b/tg/tl_channels_get_channel_recommendations_slices_gen.go similarity index 100% rename from tg/tl_message_interaction_counters_slices_gen.go rename to tg/tl_channels_get_channel_recommendations_slices_gen.go diff --git a/tg/tl_channels_get_forum_topics_gen.go b/tg/tl_channels_get_forum_topics_gen.go index 3ef8b1ff23..47c5de56c1 100644 --- a/tg/tl_channels_get_forum_topics_gen.go +++ b/tg/tl_channels_get_forum_topics_gen.go @@ -50,22 +50,27 @@ type ChannelsGetForumTopicsRequest struct { // // Use SetQ and GetQ helpers. Q string - // Offsets for pagination, for more info click here¹ + // Offsets for pagination, for more info click here¹, date of the last message of the + // last found topic. Use 0 or any date in the future to get results from the last topic. // // Links: // 1) https://core.telegram.org/api/offsets OffsetDate int - // Offsets for pagination, for more info click here¹ + // Offsets for pagination, for more info click here¹, ID of the last message of the last + // found topic (or initially 0). // // Links: // 1) https://core.telegram.org/api/offsets OffsetID int - // Offsets for pagination, for more info click here¹ + // Offsets for pagination, for more info click here¹, ID of the last found topic (or + // initially 0). // // Links: // 1) https://core.telegram.org/api/offsets OffsetTopic int - // Maximum number of results to return, see pagination¹ + // Maximum number of results to return, see pagination¹. For optimal performance, the + // number of returned topics is chosen by the server and can be smaller than the + // specified limit. // // Links: // 1) https://core.telegram.org/api/offsets diff --git a/tg/tl_channels_get_left_channels_gen.go b/tg/tl_channels_get_left_channels_gen.go index b363b3c13b..5cdc1359f4 100644 --- a/tg/tl_channels_get_left_channels_gen.go +++ b/tg/tl_channels_get_left_channels_gen.go @@ -32,10 +32,12 @@ var ( ) // ChannelsGetLeftChannelsRequest represents TL type `channels.getLeftChannels#8341ecc0`. -// Get a list of channels/supergroups¹ we left +// Get a list of channels/supergroups¹ we left, requires a takeout session, see here » +// for more info². // // Links: // 1. https://core.telegram.org/api/channel +// 2. https://core.telegram.org/api/takeout // // See https://core.telegram.org/method/channels.getLeftChannels for reference. type ChannelsGetLeftChannelsRequest struct { @@ -168,14 +170,16 @@ func (g *ChannelsGetLeftChannelsRequest) GetOffset() (value int) { } // ChannelsGetLeftChannels invokes method channels.getLeftChannels#8341ecc0 returning error if any. -// Get a list of channels/supergroups¹ we left +// Get a list of channels/supergroups¹ we left, requires a takeout session, see here » +// for more info². // // Links: // 1. https://core.telegram.org/api/channel +// 2. https://core.telegram.org/api/takeout // // Possible errors: // -// 403 TAKEOUT_REQUIRED: A takeout session has to be initialized, first. +// 403 TAKEOUT_REQUIRED: A takeout session needs to be initialized first, see here » for more info. // // See https://core.telegram.org/method/channels.getLeftChannels for reference. func (c *Client) ChannelsGetLeftChannels(ctx context.Context, offset int) (MessagesChatsClass, error) { diff --git a/tg/tl_channels_reorder_pinned_forum_topics_gen.go b/tg/tl_channels_reorder_pinned_forum_topics_gen.go index 36e3633880..211cb5da12 100644 --- a/tg/tl_channels_reorder_pinned_forum_topics_gen.go +++ b/tg/tl_channels_reorder_pinned_forum_topics_gen.go @@ -41,7 +41,12 @@ type ChannelsReorderPinnedForumTopicsRequest struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // If set, topics pinned server-side but not present in the order field will be unpinned. + // If not set, the order of only the topics present both server-side and in order will be + // changed (i.e. mentioning topics not pinned server-side in order will not pin them, and + // not mentioning topics pinned server-side will not unpin them). If set, the entire + // server-side pinned topic list will be replaced with order (i.e. mentioning topics not + // pinned server-side in order will pin them, and not mentioning topics pinned + // server-side will unpin them) Force bool // Supergroup ID Channel InputChannelClass diff --git a/tg/tl_channels_toggle_view_forum_as_messages_gen.go b/tg/tl_channels_toggle_view_forum_as_messages_gen.go new file mode 100644 index 0000000000..a2dec87b85 --- /dev/null +++ b/tg/tl_channels_toggle_view_forum_as_messages_gen.go @@ -0,0 +1,214 @@ +// 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{} +) + +// ChannelsToggleViewForumAsMessagesRequest represents TL type `channels.toggleViewForumAsMessages#9738bb15`. +// +// See https://core.telegram.org/method/channels.toggleViewForumAsMessages for reference. +type ChannelsToggleViewForumAsMessagesRequest struct { + // Channel field of ChannelsToggleViewForumAsMessagesRequest. + Channel InputChannelClass + // Enabled field of ChannelsToggleViewForumAsMessagesRequest. + Enabled bool +} + +// ChannelsToggleViewForumAsMessagesRequestTypeID is TL type id of ChannelsToggleViewForumAsMessagesRequest. +const ChannelsToggleViewForumAsMessagesRequestTypeID = 0x9738bb15 + +// Ensuring interfaces in compile-time for ChannelsToggleViewForumAsMessagesRequest. +var ( + _ bin.Encoder = &ChannelsToggleViewForumAsMessagesRequest{} + _ bin.Decoder = &ChannelsToggleViewForumAsMessagesRequest{} + _ bin.BareEncoder = &ChannelsToggleViewForumAsMessagesRequest{} + _ bin.BareDecoder = &ChannelsToggleViewForumAsMessagesRequest{} +) + +func (t *ChannelsToggleViewForumAsMessagesRequest) Zero() bool { + if t == nil { + return true + } + if !(t.Channel == nil) { + return false + } + if !(t.Enabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (t *ChannelsToggleViewForumAsMessagesRequest) String() string { + if t == nil { + return "ChannelsToggleViewForumAsMessagesRequest(nil)" + } + type Alias ChannelsToggleViewForumAsMessagesRequest + return fmt.Sprintf("ChannelsToggleViewForumAsMessagesRequest%+v", Alias(*t)) +} + +// FillFrom fills ChannelsToggleViewForumAsMessagesRequest from given interface. +func (t *ChannelsToggleViewForumAsMessagesRequest) FillFrom(from interface { + GetChannel() (value InputChannelClass) + GetEnabled() (value bool) +}) { + t.Channel = from.GetChannel() + t.Enabled = from.GetEnabled() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*ChannelsToggleViewForumAsMessagesRequest) TypeID() uint32 { + return ChannelsToggleViewForumAsMessagesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*ChannelsToggleViewForumAsMessagesRequest) TypeName() string { + return "channels.toggleViewForumAsMessages" +} + +// TypeInfo returns info about TL type. +func (t *ChannelsToggleViewForumAsMessagesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "channels.toggleViewForumAsMessages", + ID: ChannelsToggleViewForumAsMessagesRequestTypeID, + } + if t == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Channel", + SchemaName: "channel", + }, + { + Name: "Enabled", + SchemaName: "enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (t *ChannelsToggleViewForumAsMessagesRequest) Encode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode channels.toggleViewForumAsMessages#9738bb15 as nil") + } + b.PutID(ChannelsToggleViewForumAsMessagesRequestTypeID) + return t.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (t *ChannelsToggleViewForumAsMessagesRequest) EncodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't encode channels.toggleViewForumAsMessages#9738bb15 as nil") + } + if t.Channel == nil { + return fmt.Errorf("unable to encode channels.toggleViewForumAsMessages#9738bb15: field channel is nil") + } + if err := t.Channel.Encode(b); err != nil { + return fmt.Errorf("unable to encode channels.toggleViewForumAsMessages#9738bb15: field channel: %w", err) + } + b.PutBool(t.Enabled) + return nil +} + +// Decode implements bin.Decoder. +func (t *ChannelsToggleViewForumAsMessagesRequest) Decode(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode channels.toggleViewForumAsMessages#9738bb15 to nil") + } + if err := b.ConsumeID(ChannelsToggleViewForumAsMessagesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode channels.toggleViewForumAsMessages#9738bb15: %w", err) + } + return t.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (t *ChannelsToggleViewForumAsMessagesRequest) DecodeBare(b *bin.Buffer) error { + if t == nil { + return fmt.Errorf("can't decode channels.toggleViewForumAsMessages#9738bb15 to nil") + } + { + value, err := DecodeInputChannel(b) + if err != nil { + return fmt.Errorf("unable to decode channels.toggleViewForumAsMessages#9738bb15: field channel: %w", err) + } + t.Channel = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode channels.toggleViewForumAsMessages#9738bb15: field enabled: %w", err) + } + t.Enabled = value + } + return nil +} + +// GetChannel returns value of Channel field. +func (t *ChannelsToggleViewForumAsMessagesRequest) GetChannel() (value InputChannelClass) { + if t == nil { + return + } + return t.Channel +} + +// GetEnabled returns value of Enabled field. +func (t *ChannelsToggleViewForumAsMessagesRequest) GetEnabled() (value bool) { + if t == nil { + return + } + return t.Enabled +} + +// GetChannelAsNotEmpty returns mapped value of Channel field. +func (t *ChannelsToggleViewForumAsMessagesRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { + return t.Channel.AsNotEmpty() +} + +// ChannelsToggleViewForumAsMessages invokes method channels.toggleViewForumAsMessages#9738bb15 returning error if any. +// +// Possible errors: +// +// 400 CHANNEL_INVALID: The provided channel is invalid. +// +// See https://core.telegram.org/method/channels.toggleViewForumAsMessages for reference. +func (c *Client) ChannelsToggleViewForumAsMessages(ctx context.Context, request *ChannelsToggleViewForumAsMessagesRequest) (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_toggle_view_forum_as_messages_slices_gen.go b/tg/tl_channels_toggle_view_forum_as_messages_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_channels_toggle_view_forum_as_messages_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_update_color_gen.go b/tg/tl_channels_update_color_gen.go index 21e1c67071..0fbb445a78 100644 --- a/tg/tl_channels_update_color_gen.go +++ b/tg/tl_channels_update_color_gen.go @@ -32,16 +32,27 @@ var ( ) // ChannelsUpdateColorRequest represents TL type `channels.updateColor#621a201f`. +// Update the accent color and background custom emoji »¹ of a channel. +// +// Links: +// 1. https://core.telegram.org/api/colors // // See https://core.telegram.org/method/channels.updateColor for reference. type ChannelsUpdateColorRequest struct { - // Flags field of ChannelsUpdateColorRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Channel field of ChannelsUpdateColorRequest. + // Channel whose accent color should be changed. Channel InputChannelClass - // Color field of ChannelsUpdateColorRequest. + // ID of the accent color palette »¹ to use (not RGB24, see here »² for more info). + // + // Links: + // 1) https://core.telegram.org/api/colors + // 2) https://core.telegram.org/api/colors Color int - // BackgroundEmojiID field of ChannelsUpdateColorRequest. + // Custom emoji ID used in the accent color pattern. // // Use SetBackgroundEmojiID and GetBackgroundEmojiID helpers. BackgroundEmojiID int64 @@ -264,6 +275,15 @@ func (u *ChannelsUpdateColorRequest) GetChannelAsNotEmpty() (NotEmptyInputChanne } // ChannelsUpdateColor invokes method channels.updateColor#621a201f returning error if any. +// Update the accent color and background custom emoji »¹ of a channel. +// +// Links: +// 1. https://core.telegram.org/api/colors +// +// Possible errors: +// +// 400 BOOSTS_REQUIRED: The specified channel must first be boosted by its users in order to perform this action. +// 400 CHANNEL_INVALID: The provided channel is invalid. // // See https://core.telegram.org/method/channels.updateColor for reference. func (c *Client) ChannelsUpdateColor(ctx context.Context, request *ChannelsUpdateColorRequest) (UpdatesClass, error) { diff --git a/tg/tl_chat_full_gen.go b/tg/tl_chat_full_gen.go index d65cdffa78..523f32b28e 100644 --- a/tg/tl_chat_full_gen.go +++ b/tg/tl_chat_full_gen.go @@ -1087,8 +1087,13 @@ type ChannelFull struct { // Links: // 1) https://core.telegram.org/api/translation TranslationsDisabled bool - // StoriesPinnedAvailable field of ChannelFull. + // Whether this user has some pinned stories¹. + // + // Links: + // 1) https://core.telegram.org/api/stories#pinned-or-archived-stories StoriesPinnedAvailable bool + // ViewForumAsMessages field of ChannelFull. + ViewForumAsMessages bool // ID of the channel ID int64 // Info about the channel @@ -1325,6 +1330,9 @@ func (c *ChannelFull) Zero() bool { if !(c.StoriesPinnedAvailable == false) { return false } + if !(c.ViewForumAsMessages == false) { + return false + } if !(c.ID == 0) { return false } @@ -1461,6 +1469,7 @@ func (c *ChannelFull) FillFrom(from interface { GetParticipantsHidden() (value bool) GetTranslationsDisabled() (value bool) GetStoriesPinnedAvailable() (value bool) + GetViewForumAsMessages() (value bool) GetID() (value int64) GetAbout() (value string) GetParticipantsCount() (value int, ok bool) @@ -1511,6 +1520,7 @@ func (c *ChannelFull) FillFrom(from interface { c.ParticipantsHidden = from.GetParticipantsHidden() c.TranslationsDisabled = from.GetTranslationsDisabled() c.StoriesPinnedAvailable = from.GetStoriesPinnedAvailable() + c.ViewForumAsMessages = from.GetViewForumAsMessages() c.ID = from.GetID() c.About = from.GetAbout() if val, ok := from.GetParticipantsCount(); ok { @@ -1718,6 +1728,11 @@ func (c *ChannelFull) TypeInfo() tdp.Type { SchemaName: "stories_pinned_available", Null: !c.Flags2.Has(5), }, + { + Name: "ViewForumAsMessages", + SchemaName: "view_forum_as_messages", + Null: !c.Flags2.Has(6), + }, { Name: "ID", SchemaName: "id", @@ -1934,6 +1949,9 @@ func (c *ChannelFull) SetFlags() { if !(c.StoriesPinnedAvailable == false) { c.Flags2.Set(5) } + if !(c.ViewForumAsMessages == false) { + c.Flags2.Set(6) + } if !(c.ParticipantsCount == 0) { c.Flags.Set(0) } @@ -2219,6 +2237,7 @@ func (c *ChannelFull) DecodeBare(b *bin.Buffer) error { c.ParticipantsHidden = c.Flags2.Has(2) c.TranslationsDisabled = c.Flags2.Has(3) c.StoriesPinnedAvailable = c.Flags2.Has(5) + c.ViewForumAsMessages = c.Flags2.Has(6) { value, err := b.Long() if err != nil { @@ -2743,6 +2762,25 @@ func (c *ChannelFull) GetStoriesPinnedAvailable() (value bool) { return c.Flags2.Has(5) } +// SetViewForumAsMessages sets value of ViewForumAsMessages conditional field. +func (c *ChannelFull) SetViewForumAsMessages(value bool) { + if value { + c.Flags2.Set(6) + c.ViewForumAsMessages = true + } else { + c.Flags2.Unset(6) + c.ViewForumAsMessages = false + } +} + +// GetViewForumAsMessages returns value of ViewForumAsMessages conditional field. +func (c *ChannelFull) GetViewForumAsMessages() (value bool) { + if c == nil { + return + } + return c.Flags2.Has(6) +} + // GetID returns value of ID field. func (c *ChannelFull) GetID() (value int64) { if c == nil { diff --git a/tg/tl_chat_gen.go b/tg/tl_chat_gen.go index e79c74a8d8..56b61d4695 100644 --- a/tg/tl_chat_gen.go +++ b/tg/tl_chat_gen.go @@ -999,7 +999,7 @@ func (c *ChatForbidden) GetTitle() (value string) { return c.Title } -// Channel represents TL type `channel#1981ea7e`. +// Channel represents TL type `channel#8e87ccd8`. // Channel/supergroup info // // See https://core.telegram.org/constructor/channel for reference. @@ -1011,7 +1011,7 @@ type Channel struct { Flags bin.Fields // Whether the current user is the creator of this channel Creator bool - // Whether the current user has left this channel + // Whether the current user has left or is not a member of this channel Left bool // Is this a channel? Broadcast bool @@ -1081,9 +1081,17 @@ type Channel struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags2 bin.Fields - // StoriesHidden field of Channel. + // Whether we have hidden all stories posted by this channel »¹. + // + // Links: + // 1) https://core.telegram.org/api/stories#hiding-stories-of-other-users StoriesHidden bool - // StoriesHiddenMin field of Channel. + // If set, indicates that the stories_hidden flag was not populated, and its value must + // cannot be relied on; use the previously cached value, or re-fetch the constructor + // using channels.getChannels¹ to obtain the latest value of the stories_hidden flag. + // + // Links: + // 1) https://core.telegram.org/method/channels.getChannels StoriesHiddenMin bool // StoriesUnavailable field of Channel. StoriesUnavailable bool @@ -1137,22 +1145,21 @@ type Channel struct { // // Use SetUsernames and GetUsernames helpers. Usernames []Username - // StoriesMaxID field of Channel. + // ID of the maximum read story¹. + // + // Links: + // 1) https://core.telegram.org/api/stories // // Use SetStoriesMaxID and GetStoriesMaxID helpers. StoriesMaxID int // Color field of Channel. // // Use SetColor and GetColor helpers. - Color int - // BackgroundEmojiID field of Channel. - // - // Use SetBackgroundEmojiID and GetBackgroundEmojiID helpers. - BackgroundEmojiID int64 + Color PeerColor } // ChannelTypeID is TL type id of Channel. -const ChannelTypeID = 0x1981ea7e +const ChannelTypeID = 0x8e87ccd8 // construct implements constructor of ChatClass. func (c Channel) construct() ChatClass { return &c } @@ -1285,10 +1292,7 @@ func (c *Channel) Zero() bool { if !(c.StoriesMaxID == 0) { return false } - if !(c.Color == 0) { - return false - } - if !(c.BackgroundEmojiID == 0) { + if !(c.Color.Zero()) { return false } @@ -1342,8 +1346,7 @@ func (c *Channel) FillFrom(from interface { GetParticipantsCount() (value int, ok bool) GetUsernames() (value []Username, ok bool) GetStoriesMaxID() (value int, ok bool) - GetColor() (value int, ok bool) - GetBackgroundEmojiID() (value int64, ok bool) + GetColor() (value PeerColor, ok bool) }) { c.Creator = from.GetCreator() c.Left = from.GetLeft() @@ -1412,10 +1415,6 @@ func (c *Channel) FillFrom(from interface { c.Color = val } - if val, ok := from.GetBackgroundEmojiID(); ok { - c.BackgroundEmojiID = val - } - } // TypeID returns type id in TL schema. @@ -1620,12 +1619,7 @@ func (c *Channel) TypeInfo() tdp.Type { { Name: "Color", SchemaName: "color", - Null: !c.Flags2.Has(6), - }, - { - Name: "BackgroundEmojiID", - SchemaName: "background_emoji_id", - Null: !c.Flags2.Has(5), + Null: !c.Flags2.Has(7), }, } return typ @@ -1729,18 +1723,15 @@ func (c *Channel) SetFlags() { if !(c.StoriesMaxID == 0) { c.Flags2.Set(4) } - if !(c.Color == 0) { - c.Flags2.Set(6) - } - if !(c.BackgroundEmojiID == 0) { - c.Flags2.Set(5) + if !(c.Color.Zero()) { + c.Flags2.Set(7) } } // Encode implements bin.Encoder. func (c *Channel) Encode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channel#1981ea7e as nil") + return fmt.Errorf("can't encode channel#8e87ccd8 as nil") } b.PutID(ChannelTypeID) return c.EncodeBare(b) @@ -1749,14 +1740,14 @@ func (c *Channel) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (c *Channel) EncodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't encode channel#1981ea7e as nil") + return fmt.Errorf("can't encode channel#8e87ccd8 as nil") } c.SetFlags() if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#1981ea7e: field flags: %w", err) + return fmt.Errorf("unable to encode channel#8e87ccd8: field flags: %w", err) } if err := c.Flags2.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#1981ea7e: field flags2: %w", err) + return fmt.Errorf("unable to encode channel#8e87ccd8: field flags2: %w", err) } b.PutLong(c.ID) if c.Flags.Has(13) { @@ -1767,33 +1758,33 @@ func (c *Channel) EncodeBare(b *bin.Buffer) error { b.PutString(c.Username) } if c.Photo == nil { - return fmt.Errorf("unable to encode channel#1981ea7e: field photo is nil") + return fmt.Errorf("unable to encode channel#8e87ccd8: field photo is nil") } if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#1981ea7e: field photo: %w", err) + return fmt.Errorf("unable to encode channel#8e87ccd8: field photo: %w", err) } b.PutInt(c.Date) if c.Flags.Has(9) { b.PutVectorHeader(len(c.RestrictionReason)) for idx, v := range c.RestrictionReason { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#1981ea7e: field restriction_reason element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode channel#8e87ccd8: field restriction_reason element with index %d: %w", idx, err) } } } if c.Flags.Has(14) { if err := c.AdminRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#1981ea7e: field admin_rights: %w", err) + return fmt.Errorf("unable to encode channel#8e87ccd8: field admin_rights: %w", err) } } if c.Flags.Has(15) { if err := c.BannedRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#1981ea7e: field banned_rights: %w", err) + return fmt.Errorf("unable to encode channel#8e87ccd8: field banned_rights: %w", err) } } if c.Flags.Has(18) { if err := c.DefaultBannedRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#1981ea7e: field default_banned_rights: %w", err) + return fmt.Errorf("unable to encode channel#8e87ccd8: field default_banned_rights: %w", err) } } if c.Flags.Has(17) { @@ -1803,18 +1794,17 @@ func (c *Channel) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(c.Usernames)) for idx, v := range c.Usernames { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode channel#1981ea7e: field usernames element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode channel#8e87ccd8: field usernames element with index %d: %w", idx, err) } } } if c.Flags2.Has(4) { b.PutInt(c.StoriesMaxID) } - if c.Flags2.Has(6) { - b.PutInt(c.Color) - } - if c.Flags2.Has(5) { - b.PutLong(c.BackgroundEmojiID) + if c.Flags2.Has(7) { + if err := c.Color.Encode(b); err != nil { + return fmt.Errorf("unable to encode channel#8e87ccd8: field color: %w", err) + } } return nil } @@ -1822,10 +1812,10 @@ func (c *Channel) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (c *Channel) Decode(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channel#1981ea7e to nil") + return fmt.Errorf("can't decode channel#8e87ccd8 to nil") } if err := b.ConsumeID(ChannelTypeID); err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: %w", err) } return c.DecodeBare(b) } @@ -1833,11 +1823,11 @@ func (c *Channel) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (c *Channel) DecodeBare(b *bin.Buffer) error { if c == nil { - return fmt.Errorf("can't decode channel#1981ea7e to nil") + return fmt.Errorf("can't decode channel#8e87ccd8 to nil") } { if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field flags: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field flags: %w", err) } } c.Creator = c.Flags.Has(0) @@ -1862,7 +1852,7 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { c.Forum = c.Flags.Has(30) { if err := c.Flags2.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field flags2: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field flags2: %w", err) } } c.StoriesHidden = c.Flags2.Has(1) @@ -1871,49 +1861,49 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field id: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field id: %w", err) } c.ID = value } if c.Flags.Has(13) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field access_hash: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field access_hash: %w", err) } c.AccessHash = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field title: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field title: %w", err) } c.Title = value } if c.Flags.Has(6) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field username: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field username: %w", err) } c.Username = value } { value, err := DecodeChatPhoto(b) if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field photo: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field photo: %w", err) } c.Photo = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field date: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field date: %w", err) } c.Date = value } if c.Flags.Has(9) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field restriction_reason: %w", err) } if headerLen > 0 { @@ -1922,37 +1912,37 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value RestrictionReason if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field restriction_reason: %w", err) } c.RestrictionReason = append(c.RestrictionReason, value) } } if c.Flags.Has(14) { if err := c.AdminRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field admin_rights: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field admin_rights: %w", err) } } if c.Flags.Has(15) { if err := c.BannedRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field banned_rights: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field banned_rights: %w", err) } } if c.Flags.Has(18) { if err := c.DefaultBannedRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field default_banned_rights: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field default_banned_rights: %w", err) } } if c.Flags.Has(17) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field participants_count: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field participants_count: %w", err) } c.ParticipantsCount = value } if c.Flags2.Has(0) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field usernames: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field usernames: %w", err) } if headerLen > 0 { @@ -1961,7 +1951,7 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value Username if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field usernames: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field usernames: %w", err) } c.Usernames = append(c.Usernames, value) } @@ -1969,23 +1959,14 @@ func (c *Channel) DecodeBare(b *bin.Buffer) error { if c.Flags2.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field stories_max_id: %w", err) + return fmt.Errorf("unable to decode channel#8e87ccd8: field stories_max_id: %w", err) } c.StoriesMaxID = value } - if c.Flags2.Has(6) { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field color: %w", err) - } - c.Color = value - } - if c.Flags2.Has(5) { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode channel#1981ea7e: field background_emoji_id: %w", err) + if c.Flags2.Has(7) { + if err := c.Color.Decode(b); err != nil { + return fmt.Errorf("unable to decode channel#8e87ccd8: field color: %w", err) } - c.BackgroundEmojiID = value } return nil } @@ -2622,41 +2603,23 @@ func (c *Channel) GetStoriesMaxID() (value int, ok bool) { } // SetColor sets value of Color conditional field. -func (c *Channel) SetColor(value int) { - c.Flags2.Set(6) +func (c *Channel) SetColor(value PeerColor) { + c.Flags2.Set(7) c.Color = value } // GetColor returns value of Color conditional field and // boolean which is true if field was set. -func (c *Channel) GetColor() (value int, ok bool) { +func (c *Channel) GetColor() (value PeerColor, ok bool) { if c == nil { return } - if !c.Flags2.Has(6) { + if !c.Flags2.Has(7) { return value, false } return c.Color, true } -// SetBackgroundEmojiID sets value of BackgroundEmojiID conditional field. -func (c *Channel) SetBackgroundEmojiID(value int64) { - c.Flags2.Set(5) - c.BackgroundEmojiID = value -} - -// GetBackgroundEmojiID returns value of BackgroundEmojiID conditional field and -// boolean which is true if field was set. -func (c *Channel) GetBackgroundEmojiID() (value int64, ok bool) { - if c == nil { - return - } - if !c.Flags2.Has(5) { - return value, false - } - return c.BackgroundEmojiID, true -} - // ChannelForbidden represents TL type `channelForbidden#17d493d5`. // Indicates a channel/supergroup we can't access because we were banned, or for some // other reason. @@ -3003,7 +2966,7 @@ const ChatClassName = "Chat" // case *tg.ChatEmpty: // chatEmpty#29562865 // case *tg.Chat: // chat#41cbf256 // case *tg.ChatForbidden: // chatForbidden#6592a1a7 -// case *tg.Channel: // channel#1981ea7e +// case *tg.Channel: // channel#8e87ccd8 // case *tg.ChannelForbidden: // channelForbidden#17d493d5 // default: panic(v) // } @@ -3296,7 +3259,7 @@ func DecodeChat(buf *bin.Buffer) (ChatClass, error) { } return &v, nil case ChannelTypeID: - // Decoding channel#1981ea7e. + // Decoding channel#8e87ccd8. v := Channel{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ChatClass: %w", err) diff --git a/tg/tl_contacts_block_from_replies_gen.go b/tg/tl_contacts_block_from_replies_gen.go index e0bb08489c..22e4f031ad 100644 --- a/tg/tl_contacts_block_from_replies_gen.go +++ b/tg/tl_contacts_block_from_replies_gen.go @@ -32,10 +32,10 @@ var ( ) // ContactsBlockFromRepliesRequest represents TL type `contacts.blockFromReplies#29a8962c`. -// Stop getting notifications about thread replies¹ of a certain user in @replies +// Stop getting notifications about discussion replies¹ of a certain user in @replies // // Links: -// 1. https://core.telegram.org/api/threads +// 1. https://core.telegram.org/api/discussion // // See https://core.telegram.org/method/contacts.blockFromReplies for reference. type ContactsBlockFromRepliesRequest struct { @@ -53,7 +53,7 @@ type ContactsBlockFromRepliesRequest struct { // ID of the message in the @replies¹ chat // // Links: - // 1) https://core.telegram.org/api/threads#replies + // 1) https://core.telegram.org/api/discussion#replies MsgID int } @@ -294,10 +294,10 @@ func (b *ContactsBlockFromRepliesRequest) GetMsgID() (value int) { } // ContactsBlockFromReplies invokes method contacts.blockFromReplies#29a8962c returning error if any. -// Stop getting notifications about thread replies¹ of a certain user in @replies +// Stop getting notifications about discussion replies¹ of a certain user in @replies // // Links: -// 1. https://core.telegram.org/api/threads +// 1. https://core.telegram.org/api/discussion // // See https://core.telegram.org/method/contacts.blockFromReplies for reference. func (c *Client) ContactsBlockFromReplies(ctx context.Context, request *ContactsBlockFromRepliesRequest) (UpdatesClass, error) { diff --git a/tg/tl_contacts_get_saved_gen.go b/tg/tl_contacts_get_saved_gen.go index 32f50153d3..a419a51644 100644 --- a/tg/tl_contacts_get_saved_gen.go +++ b/tg/tl_contacts_get_saved_gen.go @@ -32,7 +32,10 @@ var ( ) // ContactsGetSavedRequest represents TL type `contacts.getSaved#82f1e39f`. -// Get all contacts +// Get all contacts, requires a takeout session, see here » for more info¹. +// +// Links: +// 1. https://core.telegram.org/api/takeout // // See https://core.telegram.org/method/contacts.getSaved for reference. type ContactsGetSavedRequest struct { @@ -129,11 +132,14 @@ func (g *ContactsGetSavedRequest) DecodeBare(b *bin.Buffer) error { } // ContactsGetSaved invokes method contacts.getSaved#82f1e39f returning error if any. -// Get all contacts +// Get all contacts, requires a takeout session, see here » for more info¹. +// +// Links: +// 1. https://core.telegram.org/api/takeout // // Possible errors: // -// 403 TAKEOUT_REQUIRED: A takeout session has to be initialized, first. +// 403 TAKEOUT_REQUIRED: A takeout¹ session needs to be initialized first, see here » for more info². // // See https://core.telegram.org/method/contacts.getSaved for reference. func (c *Client) ContactsGetSaved(ctx context.Context) ([]SavedPhoneContact, error) { diff --git a/tg/tl_dialog_gen.go b/tg/tl_dialog_gen.go index f5401b556f..328d1d22a4 100644 --- a/tg/tl_dialog_gen.go +++ b/tg/tl_dialog_gen.go @@ -45,6 +45,8 @@ type Dialog struct { Pinned bool // Whether the chat was manually marked as unread UnreadMark bool + // ViewForumAsMessages field of Dialog. + ViewForumAsMessages bool // The chat Peer PeerClass // The latest message ID @@ -120,6 +122,9 @@ func (d *Dialog) Zero() bool { if !(d.UnreadMark == false) { return false } + if !(d.ViewForumAsMessages == false) { + return false + } if !(d.Peer == nil) { return false } @@ -173,6 +178,7 @@ func (d *Dialog) String() string { func (d *Dialog) FillFrom(from interface { GetPinned() (value bool) GetUnreadMark() (value bool) + GetViewForumAsMessages() (value bool) GetPeer() (value PeerClass) GetTopMessage() (value int) GetReadInboxMaxID() (value int) @@ -188,6 +194,7 @@ func (d *Dialog) FillFrom(from interface { }) { d.Pinned = from.GetPinned() d.UnreadMark = from.GetUnreadMark() + d.ViewForumAsMessages = from.GetViewForumAsMessages() d.Peer = from.GetPeer() d.TopMessage = from.GetTopMessage() d.ReadInboxMaxID = from.GetReadInboxMaxID() @@ -247,6 +254,11 @@ func (d *Dialog) TypeInfo() tdp.Type { SchemaName: "unread_mark", Null: !d.Flags.Has(3), }, + { + Name: "ViewForumAsMessages", + SchemaName: "view_forum_as_messages", + Null: !d.Flags.Has(6), + }, { Name: "Peer", SchemaName: "peer", @@ -311,6 +323,9 @@ func (d *Dialog) SetFlags() { if !(d.UnreadMark == false) { d.Flags.Set(3) } + if !(d.ViewForumAsMessages == false) { + d.Flags.Set(6) + } if !(d.Pts == 0) { d.Flags.Set(0) } @@ -401,6 +416,7 @@ func (d *Dialog) DecodeBare(b *bin.Buffer) error { } d.Pinned = d.Flags.Has(2) d.UnreadMark = d.Flags.Has(3) + d.ViewForumAsMessages = d.Flags.Has(6) { value, err := DecodePeer(b) if err != nil { @@ -524,6 +540,25 @@ func (d *Dialog) GetUnreadMark() (value bool) { return d.Flags.Has(3) } +// SetViewForumAsMessages sets value of ViewForumAsMessages conditional field. +func (d *Dialog) SetViewForumAsMessages(value bool) { + if value { + d.Flags.Set(6) + d.ViewForumAsMessages = true + } else { + d.Flags.Unset(6) + d.ViewForumAsMessages = false + } +} + +// GetViewForumAsMessages returns value of ViewForumAsMessages conditional field. +func (d *Dialog) GetViewForumAsMessages() (value bool) { + if d == nil { + return + } + return d.Flags.Has(6) +} + // GetPeer returns value of Peer field. func (d *Dialog) GetPeer() (value PeerClass) { if d == nil { diff --git a/tg/tl_draft_message_gen.go b/tg/tl_draft_message_gen.go index 6cedd85ea0..e30390efe0 100644 --- a/tg/tl_draft_message_gen.go +++ b/tg/tl_draft_message_gen.go @@ -223,7 +223,8 @@ type DraftMessage struct { Flags bin.Fields // Whether no webpage preview will be generated NoWebpage bool - // InvertMedia field of DraftMessage. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // ReplyTo field of DraftMessage. // diff --git a/tg/tl_errors_gen.go b/tg/tl_errors_gen.go index f3ff157afe..67a411a58b 100644 --- a/tg/tl_errors_gen.go +++ b/tg/tl_errors_gen.go @@ -42,7 +42,7 @@ const ( ErrAdminIDInvalid = "ADMIN_ID_INVALID" ErrAdminRankEmojiNotAllowed = "ADMIN_RANK_EMOJI_NOT_ALLOWED" ErrAdminRankInvalid = "ADMIN_RANK_INVALID" - ErrAesDecryptFailed = "AES_DECRYPT_FAILED" + ErrAdminRightsEmpty = "ADMIN_RIGHTS_EMPTY" ErrAlbumPhotosTooMany = "ALBUM_PHOTOS_TOO_MANY" ErrAnonymousReactionsDisabled = "ANONYMOUS_REACTIONS_DISABLED" ErrAPIIDInvalid = "API_ID_INVALID" @@ -96,7 +96,6 @@ const ( ErrChannelsAdminPublicTooMuch = "CHANNELS_ADMIN_PUBLIC_TOO_MUCH" ErrChannelsTooMuch = "CHANNELS_TOO_MUCH" ErrChannelForumMissing = "CHANNEL_FORUM_MISSING" - ErrChannelIDGenerateFailed = "CHANNEL_ID_GENERATE_FAILED" ErrChannelIDInvalid = "CHANNEL_ID_INVALID" ErrChannelInvalid = "CHANNEL_INVALID" ErrChannelParicipantMissing = "CHANNEL_PARICIPANT_MISSING" @@ -118,7 +117,6 @@ const ( ErrChatInvalid = "CHAT_INVALID" ErrChatInvitePermanent = "CHAT_INVITE_PERMANENT" ErrChatLinkExists = "CHAT_LINK_EXISTS" - ErrChatMembersChannel = "CHAT_MEMBERS_CHANNEL" ErrChatNotModified = "CHAT_NOT_MODIFIED" ErrChatPublicRequired = "CHAT_PUBLIC_REQUIRED" ErrChatRestricted = "CHAT_RESTRICTED" @@ -141,6 +139,7 @@ const ( ErrCodeEmpty = "CODE_EMPTY" ErrCodeHashInvalid = "CODE_HASH_INVALID" ErrCodeInvalid = "CODE_INVALID" + ErrColorInvalid = "COLOR_INVALID" ErrConnectionAPIIDInvalid = "CONNECTION_API_ID_INVALID" ErrConnectionAppVersionEmpty = "CONNECTION_APP_VERSION_EMPTY" ErrConnectionLayerInvalid = "CONNECTION_LAYER_INVALID" @@ -150,6 +149,7 @@ const ( ErrContactReqMissing = "CONTACT_REQ_MISSING" ErrCreateCallFailed = "CREATE_CALL_FAILED" ErrCurrencyTotalAmountInvalid = "CURRENCY_TOTAL_AMOUNT_INVALID" + ErrCustomReactionsTooMany = "CUSTOM_REACTIONS_TOO_MANY" ErrDataInvalid = "DATA_INVALID" ErrDataJSONInvalid = "DATA_JSON_INVALID" ErrDataTooLong = "DATA_TOO_LONG" @@ -212,6 +212,8 @@ const ( ErrGameBotInvalid = "GAME_BOT_INVALID" ErrGeneralModifyIconForbidden = "GENERAL_MODIFY_ICON_FORBIDDEN" ErrGeoPointInvalid = "GEO_POINT_INVALID" + ErrGiftcodeNotAllowed = "GIFTCODE_NOT_ALLOWED" + ErrGiftSlugInvalid = "GIFT_SLUG_INVALID" ErrGifContentTypeInvalid = "GIF_CONTENT_TYPE_INVALID" ErrGifIDInvalid = "GIF_ID_INVALID" ErrGraphExpiredReload = "GRAPH_EXPIRED_RELOAD" @@ -527,6 +529,7 @@ const ( ErrWallpaperFileInvalid = "WALLPAPER_FILE_INVALID" ErrWallpaperInvalid = "WALLPAPER_INVALID" ErrWallpaperMimeInvalid = "WALLPAPER_MIME_INVALID" + ErrWallpaperNotFound = "WALLPAPER_NOT_FOUND" ErrWcConvertURLInvalid = "WC_CONVERT_URL_INVALID" ErrWebdocumentInvalid = "WEBDOCUMENT_INVALID" ErrWebdocumentMimeInvalid = "WEBDOCUMENT_MIME_INVALID" @@ -585,9 +588,9 @@ func IsAdminRankInvalid(err error) bool { return tgerr.Is(err, ErrAdminRankInvalid) } -// IsAesDecryptFailed reports whether err is AES_DECRYPT_FAILED. -func IsAesDecryptFailed(err error) bool { - return tgerr.Is(err, ErrAesDecryptFailed) +// IsAdminRightsEmpty reports whether err is ADMIN_RIGHTS_EMPTY. +func IsAdminRightsEmpty(err error) bool { + return tgerr.Is(err, ErrAdminRightsEmpty) } // IsAlbumPhotosTooMany reports whether err is ALBUM_PHOTOS_TOO_MANY. @@ -855,11 +858,6 @@ func IsChannelForumMissing(err error) bool { return tgerr.Is(err, ErrChannelForumMissing) } -// IsChannelIDGenerateFailed reports whether err is CHANNEL_ID_GENERATE_FAILED. -func IsChannelIDGenerateFailed(err error) bool { - return tgerr.Is(err, ErrChannelIDGenerateFailed) -} - // IsChannelIDInvalid reports whether err is CHANNEL_ID_INVALID. func IsChannelIDInvalid(err error) bool { return tgerr.Is(err, ErrChannelIDInvalid) @@ -965,11 +963,6 @@ func IsChatLinkExists(err error) bool { return tgerr.Is(err, ErrChatLinkExists) } -// IsChatMembersChannel reports whether err is CHAT_MEMBERS_CHANNEL. -func IsChatMembersChannel(err error) bool { - return tgerr.Is(err, ErrChatMembersChannel) -} - // IsChatNotModified reports whether err is CHAT_NOT_MODIFIED. func IsChatNotModified(err error) bool { return tgerr.Is(err, ErrChatNotModified) @@ -1080,6 +1073,11 @@ func IsCodeInvalid(err error) bool { return tgerr.Is(err, ErrCodeInvalid) } +// IsColorInvalid reports whether err is COLOR_INVALID. +func IsColorInvalid(err error) bool { + return tgerr.Is(err, ErrColorInvalid) +} + // IsConnectionAPIIDInvalid reports whether err is CONNECTION_API_ID_INVALID. func IsConnectionAPIIDInvalid(err error) bool { return tgerr.Is(err, ErrConnectionAPIIDInvalid) @@ -1125,6 +1123,11 @@ func IsCurrencyTotalAmountInvalid(err error) bool { return tgerr.Is(err, ErrCurrencyTotalAmountInvalid) } +// IsCustomReactionsTooMany reports whether err is CUSTOM_REACTIONS_TOO_MANY. +func IsCustomReactionsTooMany(err error) bool { + return tgerr.Is(err, ErrCustomReactionsTooMany) +} + // IsDataInvalid reports whether err is DATA_INVALID. func IsDataInvalid(err error) bool { return tgerr.Is(err, ErrDataInvalid) @@ -1435,6 +1438,16 @@ func IsGeoPointInvalid(err error) bool { return tgerr.Is(err, ErrGeoPointInvalid) } +// IsGiftcodeNotAllowed reports whether err is GIFTCODE_NOT_ALLOWED. +func IsGiftcodeNotAllowed(err error) bool { + return tgerr.Is(err, ErrGiftcodeNotAllowed) +} + +// IsGiftSlugInvalid reports whether err is GIFT_SLUG_INVALID. +func IsGiftSlugInvalid(err error) bool { + return tgerr.Is(err, ErrGiftSlugInvalid) +} + // IsGifContentTypeInvalid reports whether err is GIF_CONTENT_TYPE_INVALID. func IsGifContentTypeInvalid(err error) bool { return tgerr.Is(err, ErrGifContentTypeInvalid) @@ -3010,6 +3023,11 @@ func IsWallpaperMimeInvalid(err error) bool { return tgerr.Is(err, ErrWallpaperMimeInvalid) } +// IsWallpaperNotFound reports whether err is WALLPAPER_NOT_FOUND. +func IsWallpaperNotFound(err error) bool { + return tgerr.Is(err, ErrWallpaperNotFound) +} + // IsWcConvertURLInvalid reports whether err is WC_CONVERT_URL_INVALID. func IsWcConvertURLInvalid(err error) bool { return tgerr.Is(err, ErrWcConvertURLInvalid) diff --git a/tg/tl_handlers_gen.go b/tg/tl_handlers_gen.go index 20f2f80d05..c00f3cc11a 100644 --- a/tg/tl_handlers_gen.go +++ b/tg/tl_handlers_gen.go @@ -1275,3 +1275,33 @@ func (u UpdateDispatcher) OnSentStoryReaction(handler SentStoryReactionHandler) return handler(ctx, e, update.(*UpdateSentStoryReaction)) } } + +// BotChatBoostHandler is a BotChatBoost event handler. +type BotChatBoostHandler func(ctx context.Context, e Entities, update *UpdateBotChatBoost) error + +// OnBotChatBoost sets BotChatBoost handler. +func (u UpdateDispatcher) OnBotChatBoost(handler BotChatBoostHandler) { + u.handlers[UpdateBotChatBoostTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateBotChatBoost)) + } +} + +// ChannelViewForumAsMessagesHandler is a ChannelViewForumAsMessages event handler. +type ChannelViewForumAsMessagesHandler func(ctx context.Context, e Entities, update *UpdateChannelViewForumAsMessages) error + +// OnChannelViewForumAsMessages sets ChannelViewForumAsMessages handler. +func (u UpdateDispatcher) OnChannelViewForumAsMessages(handler ChannelViewForumAsMessagesHandler) { + u.handlers[UpdateChannelViewForumAsMessagesTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdateChannelViewForumAsMessages)) + } +} + +// PeerWallpaperHandler is a PeerWallpaper event handler. +type PeerWallpaperHandler func(ctx context.Context, e Entities, update *UpdatePeerWallpaper) error + +// OnPeerWallpaper sets PeerWallpaper handler. +func (u UpdateDispatcher) OnPeerWallpaper(handler PeerWallpaperHandler) { + u.handlers[UpdatePeerWallpaperTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error { + return handler(ctx, e, update.(*UpdatePeerWallpaper)) + } +} diff --git a/tg/tl_help_get_peer_colors_gen.go b/tg/tl_help_get_peer_colors_gen.go new file mode 100644 index 0000000000..ca028929da --- /dev/null +++ b/tg/tl_help_get_peer_colors_gen.go @@ -0,0 +1,187 @@ +// 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{} +) + +// HelpGetPeerColorsRequest represents TL type `help.getPeerColors#da80f42f`. +// Get the set of accent color palettes »¹ that can be used for messages +// +// Links: +// 1. https://core.telegram.org/api/colors +// +// See https://core.telegram.org/method/help.getPeerColors for reference. +type HelpGetPeerColorsRequest struct { + // Hash for pagination, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation + Hash int +} + +// HelpGetPeerColorsRequestTypeID is TL type id of HelpGetPeerColorsRequest. +const HelpGetPeerColorsRequestTypeID = 0xda80f42f + +// Ensuring interfaces in compile-time for HelpGetPeerColorsRequest. +var ( + _ bin.Encoder = &HelpGetPeerColorsRequest{} + _ bin.Decoder = &HelpGetPeerColorsRequest{} + _ bin.BareEncoder = &HelpGetPeerColorsRequest{} + _ bin.BareDecoder = &HelpGetPeerColorsRequest{} +) + +func (g *HelpGetPeerColorsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Hash == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *HelpGetPeerColorsRequest) String() string { + if g == nil { + return "HelpGetPeerColorsRequest(nil)" + } + type Alias HelpGetPeerColorsRequest + return fmt.Sprintf("HelpGetPeerColorsRequest%+v", Alias(*g)) +} + +// FillFrom fills HelpGetPeerColorsRequest from given interface. +func (g *HelpGetPeerColorsRequest) FillFrom(from interface { + GetHash() (value int) +}) { + g.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpGetPeerColorsRequest) TypeID() uint32 { + return HelpGetPeerColorsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpGetPeerColorsRequest) TypeName() string { + return "help.getPeerColors" +} + +// TypeInfo returns info about TL type. +func (g *HelpGetPeerColorsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.getPeerColors", + ID: HelpGetPeerColorsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *HelpGetPeerColorsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode help.getPeerColors#da80f42f as nil") + } + b.PutID(HelpGetPeerColorsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *HelpGetPeerColorsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode help.getPeerColors#da80f42f as nil") + } + b.PutInt(g.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (g *HelpGetPeerColorsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode help.getPeerColors#da80f42f to nil") + } + if err := b.ConsumeID(HelpGetPeerColorsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode help.getPeerColors#da80f42f: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *HelpGetPeerColorsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode help.getPeerColors#da80f42f to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.getPeerColors#da80f42f: field hash: %w", err) + } + g.Hash = value + } + return nil +} + +// GetHash returns value of Hash field. +func (g *HelpGetPeerColorsRequest) GetHash() (value int) { + if g == nil { + return + } + return g.Hash +} + +// HelpGetPeerColors invokes method help.getPeerColors#da80f42f returning error if any. +// Get the set of accent color palettes »¹ that can be used for messages +// +// Links: +// 1. https://core.telegram.org/api/colors +// +// See https://core.telegram.org/method/help.getPeerColors for reference. +func (c *Client) HelpGetPeerColors(ctx context.Context, hash int) (HelpPeerColorsClass, error) { + var result HelpPeerColorsBox + + request := &HelpGetPeerColorsRequest{ + Hash: hash, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.PeerColors, nil +} diff --git a/tg/tl_help_get_peer_colors_slices_gen.go b/tg/tl_help_get_peer_colors_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_help_get_peer_colors_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_help_get_peer_profile_colors_gen.go b/tg/tl_help_get_peer_profile_colors_gen.go new file mode 100644 index 0000000000..8b9e472d32 --- /dev/null +++ b/tg/tl_help_get_peer_profile_colors_gen.go @@ -0,0 +1,187 @@ +// 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{} +) + +// HelpGetPeerProfileColorsRequest represents TL type `help.getPeerProfileColors#abcfa9fd`. +// Get the set of accent color palettes »¹ that can be used for profiles +// +// Links: +// 1. https://core.telegram.org/api/colors +// +// See https://core.telegram.org/method/help.getPeerProfileColors for reference. +type HelpGetPeerProfileColorsRequest struct { + // Hash for pagination, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation + Hash int +} + +// HelpGetPeerProfileColorsRequestTypeID is TL type id of HelpGetPeerProfileColorsRequest. +const HelpGetPeerProfileColorsRequestTypeID = 0xabcfa9fd + +// Ensuring interfaces in compile-time for HelpGetPeerProfileColorsRequest. +var ( + _ bin.Encoder = &HelpGetPeerProfileColorsRequest{} + _ bin.Decoder = &HelpGetPeerProfileColorsRequest{} + _ bin.BareEncoder = &HelpGetPeerProfileColorsRequest{} + _ bin.BareDecoder = &HelpGetPeerProfileColorsRequest{} +) + +func (g *HelpGetPeerProfileColorsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Hash == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *HelpGetPeerProfileColorsRequest) String() string { + if g == nil { + return "HelpGetPeerProfileColorsRequest(nil)" + } + type Alias HelpGetPeerProfileColorsRequest + return fmt.Sprintf("HelpGetPeerProfileColorsRequest%+v", Alias(*g)) +} + +// FillFrom fills HelpGetPeerProfileColorsRequest from given interface. +func (g *HelpGetPeerProfileColorsRequest) FillFrom(from interface { + GetHash() (value int) +}) { + g.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpGetPeerProfileColorsRequest) TypeID() uint32 { + return HelpGetPeerProfileColorsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpGetPeerProfileColorsRequest) TypeName() string { + return "help.getPeerProfileColors" +} + +// TypeInfo returns info about TL type. +func (g *HelpGetPeerProfileColorsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.getPeerProfileColors", + ID: HelpGetPeerProfileColorsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *HelpGetPeerProfileColorsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode help.getPeerProfileColors#abcfa9fd as nil") + } + b.PutID(HelpGetPeerProfileColorsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *HelpGetPeerProfileColorsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode help.getPeerProfileColors#abcfa9fd as nil") + } + b.PutInt(g.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (g *HelpGetPeerProfileColorsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode help.getPeerProfileColors#abcfa9fd to nil") + } + if err := b.ConsumeID(HelpGetPeerProfileColorsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode help.getPeerProfileColors#abcfa9fd: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *HelpGetPeerProfileColorsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode help.getPeerProfileColors#abcfa9fd to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.getPeerProfileColors#abcfa9fd: field hash: %w", err) + } + g.Hash = value + } + return nil +} + +// GetHash returns value of Hash field. +func (g *HelpGetPeerProfileColorsRequest) GetHash() (value int) { + if g == nil { + return + } + return g.Hash +} + +// HelpGetPeerProfileColors invokes method help.getPeerProfileColors#abcfa9fd returning error if any. +// Get the set of accent color palettes »¹ that can be used for profiles +// +// Links: +// 1. https://core.telegram.org/api/colors +// +// See https://core.telegram.org/method/help.getPeerProfileColors for reference. +func (c *Client) HelpGetPeerProfileColors(ctx context.Context, hash int) (HelpPeerColorsClass, error) { + var result HelpPeerColorsBox + + request := &HelpGetPeerProfileColorsRequest{ + Hash: hash, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.PeerColors, nil +} diff --git a/tg/tl_help_get_peer_profile_colors_slices_gen.go b/tg/tl_help_get_peer_profile_colors_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_help_get_peer_profile_colors_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_help_peer_color_option_gen.go b/tg/tl_help_peer_color_option_gen.go new file mode 100644 index 0000000000..e36558168c --- /dev/null +++ b/tg/tl_help_peer_color_option_gen.go @@ -0,0 +1,323 @@ +// 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{} +) + +// HelpPeerColorOption represents TL type `help.peerColorOption#135bd42f`. +// +// See https://core.telegram.org/constructor/help.peerColorOption for reference. +type HelpPeerColorOption struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Hidden field of HelpPeerColorOption. + Hidden bool + // ColorID field of HelpPeerColorOption. + ColorID int + // Colors field of HelpPeerColorOption. + // + // Use SetColors and GetColors helpers. + Colors HelpPeerColorSetClass + // DarkColors field of HelpPeerColorOption. + // + // Use SetDarkColors and GetDarkColors helpers. + DarkColors HelpPeerColorSetClass +} + +// HelpPeerColorOptionTypeID is TL type id of HelpPeerColorOption. +const HelpPeerColorOptionTypeID = 0x135bd42f + +// Ensuring interfaces in compile-time for HelpPeerColorOption. +var ( + _ bin.Encoder = &HelpPeerColorOption{} + _ bin.Decoder = &HelpPeerColorOption{} + _ bin.BareEncoder = &HelpPeerColorOption{} + _ bin.BareDecoder = &HelpPeerColorOption{} +) + +func (p *HelpPeerColorOption) Zero() bool { + if p == nil { + return true + } + if !(p.Flags.Zero()) { + return false + } + if !(p.Hidden == false) { + return false + } + if !(p.ColorID == 0) { + return false + } + if !(p.Colors == nil) { + return false + } + if !(p.DarkColors == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *HelpPeerColorOption) String() string { + if p == nil { + return "HelpPeerColorOption(nil)" + } + type Alias HelpPeerColorOption + return fmt.Sprintf("HelpPeerColorOption%+v", Alias(*p)) +} + +// FillFrom fills HelpPeerColorOption from given interface. +func (p *HelpPeerColorOption) FillFrom(from interface { + GetHidden() (value bool) + GetColorID() (value int) + GetColors() (value HelpPeerColorSetClass, ok bool) + GetDarkColors() (value HelpPeerColorSetClass, ok bool) +}) { + p.Hidden = from.GetHidden() + p.ColorID = from.GetColorID() + if val, ok := from.GetColors(); ok { + p.Colors = val + } + + if val, ok := from.GetDarkColors(); ok { + p.DarkColors = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpPeerColorOption) TypeID() uint32 { + return HelpPeerColorOptionTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpPeerColorOption) TypeName() string { + return "help.peerColorOption" +} + +// TypeInfo returns info about TL type. +func (p *HelpPeerColorOption) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.peerColorOption", + ID: HelpPeerColorOptionTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hidden", + SchemaName: "hidden", + Null: !p.Flags.Has(0), + }, + { + Name: "ColorID", + SchemaName: "color_id", + }, + { + Name: "Colors", + SchemaName: "colors", + Null: !p.Flags.Has(1), + }, + { + Name: "DarkColors", + SchemaName: "dark_colors", + Null: !p.Flags.Has(2), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (p *HelpPeerColorOption) SetFlags() { + if !(p.Hidden == false) { + p.Flags.Set(0) + } + if !(p.Colors == nil) { + p.Flags.Set(1) + } + if !(p.DarkColors == nil) { + p.Flags.Set(2) + } +} + +// Encode implements bin.Encoder. +func (p *HelpPeerColorOption) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColorOption#135bd42f as nil") + } + b.PutID(HelpPeerColorOptionTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *HelpPeerColorOption) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColorOption#135bd42f as nil") + } + p.SetFlags() + if err := p.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field flags: %w", err) + } + b.PutInt(p.ColorID) + if p.Flags.Has(1) { + if p.Colors == nil { + return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field colors is nil") + } + if err := p.Colors.Encode(b); err != nil { + return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field colors: %w", err) + } + } + if p.Flags.Has(2) { + if p.DarkColors == nil { + return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field dark_colors is nil") + } + if err := p.DarkColors.Encode(b); err != nil { + return fmt.Errorf("unable to encode help.peerColorOption#135bd42f: field dark_colors: %w", err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (p *HelpPeerColorOption) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColorOption#135bd42f to nil") + } + if err := b.ConsumeID(HelpPeerColorOptionTypeID); err != nil { + return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *HelpPeerColorOption) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColorOption#135bd42f to nil") + } + { + if err := p.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: field flags: %w", err) + } + } + p.Hidden = p.Flags.Has(0) + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: field color_id: %w", err) + } + p.ColorID = value + } + if p.Flags.Has(1) { + value, err := DecodeHelpPeerColorSet(b) + if err != nil { + return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: field colors: %w", err) + } + p.Colors = value + } + if p.Flags.Has(2) { + value, err := DecodeHelpPeerColorSet(b) + if err != nil { + return fmt.Errorf("unable to decode help.peerColorOption#135bd42f: field dark_colors: %w", err) + } + p.DarkColors = value + } + return nil +} + +// SetHidden sets value of Hidden conditional field. +func (p *HelpPeerColorOption) SetHidden(value bool) { + if value { + p.Flags.Set(0) + p.Hidden = true + } else { + p.Flags.Unset(0) + p.Hidden = false + } +} + +// GetHidden returns value of Hidden conditional field. +func (p *HelpPeerColorOption) GetHidden() (value bool) { + if p == nil { + return + } + return p.Flags.Has(0) +} + +// GetColorID returns value of ColorID field. +func (p *HelpPeerColorOption) GetColorID() (value int) { + if p == nil { + return + } + return p.ColorID +} + +// SetColors sets value of Colors conditional field. +func (p *HelpPeerColorOption) SetColors(value HelpPeerColorSetClass) { + p.Flags.Set(1) + p.Colors = value +} + +// GetColors returns value of Colors conditional field and +// boolean which is true if field was set. +func (p *HelpPeerColorOption) GetColors() (value HelpPeerColorSetClass, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(1) { + return value, false + } + return p.Colors, true +} + +// SetDarkColors sets value of DarkColors conditional field. +func (p *HelpPeerColorOption) SetDarkColors(value HelpPeerColorSetClass) { + p.Flags.Set(2) + p.DarkColors = value +} + +// GetDarkColors returns value of DarkColors conditional field and +// boolean which is true if field was set. +func (p *HelpPeerColorOption) GetDarkColors() (value HelpPeerColorSetClass, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(2) { + return value, false + } + return p.DarkColors, true +} diff --git a/tg/tl_help_peer_color_option_slices_gen.go b/tg/tl_help_peer_color_option_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_help_peer_color_option_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_help_peer_color_set_gen.go b/tg/tl_help_peer_color_set_gen.go new file mode 100644 index 0000000000..2ba295dfea --- /dev/null +++ b/tg/tl_help_peer_color_set_gen.go @@ -0,0 +1,495 @@ +// 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{} +) + +// HelpPeerColorSet represents TL type `help.peerColorSet#26219a58`. +// +// See https://core.telegram.org/constructor/help.peerColorSet for reference. +type HelpPeerColorSet struct { + // Colors field of HelpPeerColorSet. + Colors []int +} + +// HelpPeerColorSetTypeID is TL type id of HelpPeerColorSet. +const HelpPeerColorSetTypeID = 0x26219a58 + +// construct implements constructor of HelpPeerColorSetClass. +func (p HelpPeerColorSet) construct() HelpPeerColorSetClass { return &p } + +// Ensuring interfaces in compile-time for HelpPeerColorSet. +var ( + _ bin.Encoder = &HelpPeerColorSet{} + _ bin.Decoder = &HelpPeerColorSet{} + _ bin.BareEncoder = &HelpPeerColorSet{} + _ bin.BareDecoder = &HelpPeerColorSet{} + + _ HelpPeerColorSetClass = &HelpPeerColorSet{} +) + +func (p *HelpPeerColorSet) Zero() bool { + if p == nil { + return true + } + if !(p.Colors == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *HelpPeerColorSet) String() string { + if p == nil { + return "HelpPeerColorSet(nil)" + } + type Alias HelpPeerColorSet + return fmt.Sprintf("HelpPeerColorSet%+v", Alias(*p)) +} + +// FillFrom fills HelpPeerColorSet from given interface. +func (p *HelpPeerColorSet) FillFrom(from interface { + GetColors() (value []int) +}) { + p.Colors = from.GetColors() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpPeerColorSet) TypeID() uint32 { + return HelpPeerColorSetTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpPeerColorSet) TypeName() string { + return "help.peerColorSet" +} + +// TypeInfo returns info about TL type. +func (p *HelpPeerColorSet) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.peerColorSet", + ID: HelpPeerColorSetTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Colors", + SchemaName: "colors", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *HelpPeerColorSet) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColorSet#26219a58 as nil") + } + b.PutID(HelpPeerColorSetTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *HelpPeerColorSet) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColorSet#26219a58 as nil") + } + b.PutVectorHeader(len(p.Colors)) + for _, v := range p.Colors { + b.PutInt(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *HelpPeerColorSet) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColorSet#26219a58 to nil") + } + if err := b.ConsumeID(HelpPeerColorSetTypeID); err != nil { + return fmt.Errorf("unable to decode help.peerColorSet#26219a58: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *HelpPeerColorSet) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColorSet#26219a58 to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorSet#26219a58: field colors: %w", err) + } + + if headerLen > 0 { + p.Colors = make([]int, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorSet#26219a58: field colors: %w", err) + } + p.Colors = append(p.Colors, value) + } + } + return nil +} + +// GetColors returns value of Colors field. +func (p *HelpPeerColorSet) GetColors() (value []int) { + if p == nil { + return + } + return p.Colors +} + +// HelpPeerColorProfileSet represents TL type `help.peerColorProfileSet#767d61eb`. +// +// See https://core.telegram.org/constructor/help.peerColorProfileSet for reference. +type HelpPeerColorProfileSet struct { + // PaletteColors field of HelpPeerColorProfileSet. + PaletteColors []int + // BgColors field of HelpPeerColorProfileSet. + BgColors []int + // StoryColors field of HelpPeerColorProfileSet. + StoryColors []int +} + +// HelpPeerColorProfileSetTypeID is TL type id of HelpPeerColorProfileSet. +const HelpPeerColorProfileSetTypeID = 0x767d61eb + +// construct implements constructor of HelpPeerColorSetClass. +func (p HelpPeerColorProfileSet) construct() HelpPeerColorSetClass { return &p } + +// Ensuring interfaces in compile-time for HelpPeerColorProfileSet. +var ( + _ bin.Encoder = &HelpPeerColorProfileSet{} + _ bin.Decoder = &HelpPeerColorProfileSet{} + _ bin.BareEncoder = &HelpPeerColorProfileSet{} + _ bin.BareDecoder = &HelpPeerColorProfileSet{} + + _ HelpPeerColorSetClass = &HelpPeerColorProfileSet{} +) + +func (p *HelpPeerColorProfileSet) Zero() bool { + if p == nil { + return true + } + if !(p.PaletteColors == nil) { + return false + } + if !(p.BgColors == nil) { + return false + } + if !(p.StoryColors == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *HelpPeerColorProfileSet) String() string { + if p == nil { + return "HelpPeerColorProfileSet(nil)" + } + type Alias HelpPeerColorProfileSet + return fmt.Sprintf("HelpPeerColorProfileSet%+v", Alias(*p)) +} + +// FillFrom fills HelpPeerColorProfileSet from given interface. +func (p *HelpPeerColorProfileSet) FillFrom(from interface { + GetPaletteColors() (value []int) + GetBgColors() (value []int) + GetStoryColors() (value []int) +}) { + p.PaletteColors = from.GetPaletteColors() + p.BgColors = from.GetBgColors() + p.StoryColors = from.GetStoryColors() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpPeerColorProfileSet) TypeID() uint32 { + return HelpPeerColorProfileSetTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpPeerColorProfileSet) TypeName() string { + return "help.peerColorProfileSet" +} + +// TypeInfo returns info about TL type. +func (p *HelpPeerColorProfileSet) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.peerColorProfileSet", + ID: HelpPeerColorProfileSetTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "PaletteColors", + SchemaName: "palette_colors", + }, + { + Name: "BgColors", + SchemaName: "bg_colors", + }, + { + Name: "StoryColors", + SchemaName: "story_colors", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *HelpPeerColorProfileSet) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColorProfileSet#767d61eb as nil") + } + b.PutID(HelpPeerColorProfileSetTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *HelpPeerColorProfileSet) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColorProfileSet#767d61eb as nil") + } + b.PutVectorHeader(len(p.PaletteColors)) + for _, v := range p.PaletteColors { + b.PutInt(v) + } + b.PutVectorHeader(len(p.BgColors)) + for _, v := range p.BgColors { + b.PutInt(v) + } + b.PutVectorHeader(len(p.StoryColors)) + for _, v := range p.StoryColors { + b.PutInt(v) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *HelpPeerColorProfileSet) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColorProfileSet#767d61eb to nil") + } + if err := b.ConsumeID(HelpPeerColorProfileSetTypeID); err != nil { + return fmt.Errorf("unable to decode help.peerColorProfileSet#767d61eb: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *HelpPeerColorProfileSet) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColorProfileSet#767d61eb to nil") + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorProfileSet#767d61eb: field palette_colors: %w", err) + } + + if headerLen > 0 { + p.PaletteColors = make([]int, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorProfileSet#767d61eb: field palette_colors: %w", err) + } + p.PaletteColors = append(p.PaletteColors, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorProfileSet#767d61eb: field bg_colors: %w", err) + } + + if headerLen > 0 { + p.BgColors = make([]int, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorProfileSet#767d61eb: field bg_colors: %w", err) + } + p.BgColors = append(p.BgColors, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorProfileSet#767d61eb: field story_colors: %w", err) + } + + if headerLen > 0 { + p.StoryColors = make([]int, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.peerColorProfileSet#767d61eb: field story_colors: %w", err) + } + p.StoryColors = append(p.StoryColors, value) + } + } + return nil +} + +// GetPaletteColors returns value of PaletteColors field. +func (p *HelpPeerColorProfileSet) GetPaletteColors() (value []int) { + if p == nil { + return + } + return p.PaletteColors +} + +// GetBgColors returns value of BgColors field. +func (p *HelpPeerColorProfileSet) GetBgColors() (value []int) { + if p == nil { + return + } + return p.BgColors +} + +// GetStoryColors returns value of StoryColors field. +func (p *HelpPeerColorProfileSet) GetStoryColors() (value []int) { + if p == nil { + return + } + return p.StoryColors +} + +// HelpPeerColorSetClassName is schema name of HelpPeerColorSetClass. +const HelpPeerColorSetClassName = "help.PeerColorSet" + +// HelpPeerColorSetClass represents help.PeerColorSet generic type. +// +// See https://core.telegram.org/type/help.PeerColorSet for reference. +// +// Example: +// +// g, err := tg.DecodeHelpPeerColorSet(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.HelpPeerColorSet: // help.peerColorSet#26219a58 +// case *tg.HelpPeerColorProfileSet: // help.peerColorProfileSet#767d61eb +// default: panic(v) +// } +type HelpPeerColorSetClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() HelpPeerColorSetClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool +} + +// DecodeHelpPeerColorSet implements binary de-serialization for HelpPeerColorSetClass. +func DecodeHelpPeerColorSet(buf *bin.Buffer) (HelpPeerColorSetClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case HelpPeerColorSetTypeID: + // Decoding help.peerColorSet#26219a58. + v := HelpPeerColorSet{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode HelpPeerColorSetClass: %w", err) + } + return &v, nil + case HelpPeerColorProfileSetTypeID: + // Decoding help.peerColorProfileSet#767d61eb. + v := HelpPeerColorProfileSet{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode HelpPeerColorSetClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode HelpPeerColorSetClass: %w", bin.NewUnexpectedID(id)) + } +} + +// HelpPeerColorSet boxes the HelpPeerColorSetClass providing a helper. +type HelpPeerColorSetBox struct { + PeerColorSet HelpPeerColorSetClass +} + +// Decode implements bin.Decoder for HelpPeerColorSetBox. +func (b *HelpPeerColorSetBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode HelpPeerColorSetBox to nil") + } + v, err := DecodeHelpPeerColorSet(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.PeerColorSet = v + return nil +} + +// Encode implements bin.Encode for HelpPeerColorSetBox. +func (b *HelpPeerColorSetBox) Encode(buf *bin.Buffer) error { + if b == nil || b.PeerColorSet == nil { + return fmt.Errorf("unable to encode HelpPeerColorSetClass as nil") + } + return b.PeerColorSet.Encode(buf) +} diff --git a/tg/tl_help_peer_color_set_slices_gen.go b/tg/tl_help_peer_color_set_slices_gen.go new file mode 100644 index 0000000000..889477382f --- /dev/null +++ b/tg/tl_help_peer_color_set_slices_gen.go @@ -0,0 +1,307 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "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{} +) + +// HelpPeerColorSetClassArray is adapter for slice of HelpPeerColorSetClass. +type HelpPeerColorSetClassArray []HelpPeerColorSetClass + +// Sort sorts slice of HelpPeerColorSetClass. +func (s HelpPeerColorSetClassArray) Sort(less func(a, b HelpPeerColorSetClass) bool) HelpPeerColorSetClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of HelpPeerColorSetClass. +func (s HelpPeerColorSetClassArray) SortStable(less func(a, b HelpPeerColorSetClass) bool) HelpPeerColorSetClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of HelpPeerColorSetClass. +func (s HelpPeerColorSetClassArray) Retain(keep func(x HelpPeerColorSetClass) bool) HelpPeerColorSetClassArray { + 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 HelpPeerColorSetClassArray) First() (v HelpPeerColorSetClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s HelpPeerColorSetClassArray) Last() (v HelpPeerColorSetClass, 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 *HelpPeerColorSetClassArray) PopFirst() (v HelpPeerColorSetClass, 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 HelpPeerColorSetClass + 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 *HelpPeerColorSetClassArray) Pop() (v HelpPeerColorSetClass, 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 +} + +// AsHelpPeerColorSet returns copy with only HelpPeerColorSet constructors. +func (s HelpPeerColorSetClassArray) AsHelpPeerColorSet() (to HelpPeerColorSetArray) { + for _, elem := range s { + value, ok := elem.(*HelpPeerColorSet) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsHelpPeerColorProfileSet returns copy with only HelpPeerColorProfileSet constructors. +func (s HelpPeerColorSetClassArray) AsHelpPeerColorProfileSet() (to HelpPeerColorProfileSetArray) { + for _, elem := range s { + value, ok := elem.(*HelpPeerColorProfileSet) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// HelpPeerColorSetArray is adapter for slice of HelpPeerColorSet. +type HelpPeerColorSetArray []HelpPeerColorSet + +// Sort sorts slice of HelpPeerColorSet. +func (s HelpPeerColorSetArray) Sort(less func(a, b HelpPeerColorSet) bool) HelpPeerColorSetArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of HelpPeerColorSet. +func (s HelpPeerColorSetArray) SortStable(less func(a, b HelpPeerColorSet) bool) HelpPeerColorSetArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of HelpPeerColorSet. +func (s HelpPeerColorSetArray) Retain(keep func(x HelpPeerColorSet) bool) HelpPeerColorSetArray { + 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 HelpPeerColorSetArray) First() (v HelpPeerColorSet, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s HelpPeerColorSetArray) Last() (v HelpPeerColorSet, 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 *HelpPeerColorSetArray) PopFirst() (v HelpPeerColorSet, 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 HelpPeerColorSet + 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 *HelpPeerColorSetArray) Pop() (v HelpPeerColorSet, 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 +} + +// HelpPeerColorProfileSetArray is adapter for slice of HelpPeerColorProfileSet. +type HelpPeerColorProfileSetArray []HelpPeerColorProfileSet + +// Sort sorts slice of HelpPeerColorProfileSet. +func (s HelpPeerColorProfileSetArray) Sort(less func(a, b HelpPeerColorProfileSet) bool) HelpPeerColorProfileSetArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of HelpPeerColorProfileSet. +func (s HelpPeerColorProfileSetArray) SortStable(less func(a, b HelpPeerColorProfileSet) bool) HelpPeerColorProfileSetArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of HelpPeerColorProfileSet. +func (s HelpPeerColorProfileSetArray) Retain(keep func(x HelpPeerColorProfileSet) bool) HelpPeerColorProfileSetArray { + 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 HelpPeerColorProfileSetArray) First() (v HelpPeerColorProfileSet, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s HelpPeerColorProfileSetArray) Last() (v HelpPeerColorProfileSet, 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 *HelpPeerColorProfileSetArray) PopFirst() (v HelpPeerColorProfileSet, 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 HelpPeerColorProfileSet + 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 *HelpPeerColorProfileSetArray) Pop() (v HelpPeerColorProfileSet, 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_help_peer_colors_gen.go b/tg/tl_help_peer_colors_gen.go new file mode 100644 index 0000000000..30edef648d --- /dev/null +++ b/tg/tl_help_peer_colors_gen.go @@ -0,0 +1,414 @@ +// 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{} +) + +// HelpPeerColorsNotModified represents TL type `help.peerColorsNotModified#2ba1f5ce`. +// +// See https://core.telegram.org/constructor/help.peerColorsNotModified for reference. +type HelpPeerColorsNotModified struct { +} + +// HelpPeerColorsNotModifiedTypeID is TL type id of HelpPeerColorsNotModified. +const HelpPeerColorsNotModifiedTypeID = 0x2ba1f5ce + +// construct implements constructor of HelpPeerColorsClass. +func (p HelpPeerColorsNotModified) construct() HelpPeerColorsClass { return &p } + +// Ensuring interfaces in compile-time for HelpPeerColorsNotModified. +var ( + _ bin.Encoder = &HelpPeerColorsNotModified{} + _ bin.Decoder = &HelpPeerColorsNotModified{} + _ bin.BareEncoder = &HelpPeerColorsNotModified{} + _ bin.BareDecoder = &HelpPeerColorsNotModified{} + + _ HelpPeerColorsClass = &HelpPeerColorsNotModified{} +) + +func (p *HelpPeerColorsNotModified) Zero() bool { + if p == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (p *HelpPeerColorsNotModified) String() string { + if p == nil { + return "HelpPeerColorsNotModified(nil)" + } + type Alias HelpPeerColorsNotModified + return fmt.Sprintf("HelpPeerColorsNotModified%+v", Alias(*p)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpPeerColorsNotModified) TypeID() uint32 { + return HelpPeerColorsNotModifiedTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpPeerColorsNotModified) TypeName() string { + return "help.peerColorsNotModified" +} + +// TypeInfo returns info about TL type. +func (p *HelpPeerColorsNotModified) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.peerColorsNotModified", + ID: HelpPeerColorsNotModifiedTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (p *HelpPeerColorsNotModified) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColorsNotModified#2ba1f5ce as nil") + } + b.PutID(HelpPeerColorsNotModifiedTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *HelpPeerColorsNotModified) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColorsNotModified#2ba1f5ce as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (p *HelpPeerColorsNotModified) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColorsNotModified#2ba1f5ce to nil") + } + if err := b.ConsumeID(HelpPeerColorsNotModifiedTypeID); err != nil { + return fmt.Errorf("unable to decode help.peerColorsNotModified#2ba1f5ce: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *HelpPeerColorsNotModified) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColorsNotModified#2ba1f5ce to nil") + } + return nil +} + +// HelpPeerColors represents TL type `help.peerColors#f8ed08`. +// +// See https://core.telegram.org/constructor/help.peerColors for reference. +type HelpPeerColors struct { + // Hash for pagination, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation + Hash int + // Colors field of HelpPeerColors. + Colors []HelpPeerColorOption +} + +// HelpPeerColorsTypeID is TL type id of HelpPeerColors. +const HelpPeerColorsTypeID = 0xf8ed08 + +// construct implements constructor of HelpPeerColorsClass. +func (p HelpPeerColors) construct() HelpPeerColorsClass { return &p } + +// Ensuring interfaces in compile-time for HelpPeerColors. +var ( + _ bin.Encoder = &HelpPeerColors{} + _ bin.Decoder = &HelpPeerColors{} + _ bin.BareEncoder = &HelpPeerColors{} + _ bin.BareDecoder = &HelpPeerColors{} + + _ HelpPeerColorsClass = &HelpPeerColors{} +) + +func (p *HelpPeerColors) Zero() bool { + if p == nil { + return true + } + if !(p.Hash == 0) { + return false + } + if !(p.Colors == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *HelpPeerColors) String() string { + if p == nil { + return "HelpPeerColors(nil)" + } + type Alias HelpPeerColors + return fmt.Sprintf("HelpPeerColors%+v", Alias(*p)) +} + +// FillFrom fills HelpPeerColors from given interface. +func (p *HelpPeerColors) FillFrom(from interface { + GetHash() (value int) + GetColors() (value []HelpPeerColorOption) +}) { + p.Hash = from.GetHash() + p.Colors = from.GetColors() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*HelpPeerColors) TypeID() uint32 { + return HelpPeerColorsTypeID +} + +// TypeName returns name of type in TL schema. +func (*HelpPeerColors) TypeName() string { + return "help.peerColors" +} + +// TypeInfo returns info about TL type. +func (p *HelpPeerColors) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "help.peerColors", + ID: HelpPeerColorsTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Hash", + SchemaName: "hash", + }, + { + Name: "Colors", + SchemaName: "colors", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *HelpPeerColors) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColors#f8ed08 as nil") + } + b.PutID(HelpPeerColorsTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *HelpPeerColors) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode help.peerColors#f8ed08 as nil") + } + b.PutInt(p.Hash) + b.PutVectorHeader(len(p.Colors)) + for idx, v := range p.Colors { + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode help.peerColors#f8ed08: field colors element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (p *HelpPeerColors) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColors#f8ed08 to nil") + } + if err := b.ConsumeID(HelpPeerColorsTypeID); err != nil { + return fmt.Errorf("unable to decode help.peerColors#f8ed08: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *HelpPeerColors) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode help.peerColors#f8ed08 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode help.peerColors#f8ed08: field hash: %w", err) + } + p.Hash = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode help.peerColors#f8ed08: field colors: %w", err) + } + + if headerLen > 0 { + p.Colors = make([]HelpPeerColorOption, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + var value HelpPeerColorOption + if err := value.Decode(b); err != nil { + return fmt.Errorf("unable to decode help.peerColors#f8ed08: field colors: %w", err) + } + p.Colors = append(p.Colors, value) + } + } + return nil +} + +// GetHash returns value of Hash field. +func (p *HelpPeerColors) GetHash() (value int) { + if p == nil { + return + } + return p.Hash +} + +// GetColors returns value of Colors field. +func (p *HelpPeerColors) GetColors() (value []HelpPeerColorOption) { + if p == nil { + return + } + return p.Colors +} + +// HelpPeerColorsClassName is schema name of HelpPeerColorsClass. +const HelpPeerColorsClassName = "help.PeerColors" + +// HelpPeerColorsClass represents help.PeerColors generic type. +// +// See https://core.telegram.org/type/help.PeerColors for reference. +// +// Example: +// +// g, err := tg.DecodeHelpPeerColors(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.HelpPeerColorsNotModified: // help.peerColorsNotModified#2ba1f5ce +// case *tg.HelpPeerColors: // help.peerColors#f8ed08 +// default: panic(v) +// } +type HelpPeerColorsClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() HelpPeerColorsClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + // AsModified tries to map HelpPeerColorsClass to HelpPeerColors. + AsModified() (*HelpPeerColors, bool) +} + +// AsModified tries to map HelpPeerColorsNotModified to HelpPeerColors. +func (p *HelpPeerColorsNotModified) AsModified() (*HelpPeerColors, bool) { + return nil, false +} + +// AsModified tries to map HelpPeerColors to HelpPeerColors. +func (p *HelpPeerColors) AsModified() (*HelpPeerColors, bool) { + return p, true +} + +// DecodeHelpPeerColors implements binary de-serialization for HelpPeerColorsClass. +func DecodeHelpPeerColors(buf *bin.Buffer) (HelpPeerColorsClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case HelpPeerColorsNotModifiedTypeID: + // Decoding help.peerColorsNotModified#2ba1f5ce. + v := HelpPeerColorsNotModified{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode HelpPeerColorsClass: %w", err) + } + return &v, nil + case HelpPeerColorsTypeID: + // Decoding help.peerColors#f8ed08. + v := HelpPeerColors{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode HelpPeerColorsClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode HelpPeerColorsClass: %w", bin.NewUnexpectedID(id)) + } +} + +// HelpPeerColors boxes the HelpPeerColorsClass providing a helper. +type HelpPeerColorsBox struct { + PeerColors HelpPeerColorsClass +} + +// Decode implements bin.Decoder for HelpPeerColorsBox. +func (b *HelpPeerColorsBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode HelpPeerColorsBox to nil") + } + v, err := DecodeHelpPeerColors(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.PeerColors = v + return nil +} + +// Encode implements bin.Encode for HelpPeerColorsBox. +func (b *HelpPeerColorsBox) Encode(buf *bin.Buffer) error { + if b == nil || b.PeerColors == nil { + return fmt.Errorf("unable to encode HelpPeerColorsClass as nil") + } + return b.PeerColors.Encode(buf) +} diff --git a/tg/tl_help_peer_colors_slices_gen.go b/tg/tl_help_peer_colors_slices_gen.go new file mode 100644 index 0000000000..a7d6c41e60 --- /dev/null +++ b/tg/tl_help_peer_colors_slices_gen.go @@ -0,0 +1,267 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "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{} +) + +// HelpPeerColorsClassArray is adapter for slice of HelpPeerColorsClass. +type HelpPeerColorsClassArray []HelpPeerColorsClass + +// Sort sorts slice of HelpPeerColorsClass. +func (s HelpPeerColorsClassArray) Sort(less func(a, b HelpPeerColorsClass) bool) HelpPeerColorsClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of HelpPeerColorsClass. +func (s HelpPeerColorsClassArray) SortStable(less func(a, b HelpPeerColorsClass) bool) HelpPeerColorsClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of HelpPeerColorsClass. +func (s HelpPeerColorsClassArray) Retain(keep func(x HelpPeerColorsClass) bool) HelpPeerColorsClassArray { + 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 HelpPeerColorsClassArray) First() (v HelpPeerColorsClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s HelpPeerColorsClassArray) Last() (v HelpPeerColorsClass, 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 *HelpPeerColorsClassArray) PopFirst() (v HelpPeerColorsClass, 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 HelpPeerColorsClass + 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 *HelpPeerColorsClassArray) Pop() (v HelpPeerColorsClass, 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 +} + +// AsHelpPeerColors returns copy with only HelpPeerColors constructors. +func (s HelpPeerColorsClassArray) AsHelpPeerColors() (to HelpPeerColorsArray) { + for _, elem := range s { + value, ok := elem.(*HelpPeerColors) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AppendOnlyModified appends only Modified constructors to +// given slice. +func (s HelpPeerColorsClassArray) AppendOnlyModified(to []*HelpPeerColors) []*HelpPeerColors { + for _, elem := range s { + value, ok := elem.AsModified() + if !ok { + continue + } + to = append(to, value) + } + + return to +} + +// AsModified returns copy with only Modified constructors. +func (s HelpPeerColorsClassArray) AsModified() (to []*HelpPeerColors) { + return s.AppendOnlyModified(to) +} + +// FirstAsModified returns first element of slice (if exists). +func (s HelpPeerColorsClassArray) FirstAsModified() (v *HelpPeerColors, ok bool) { + value, ok := s.First() + if !ok { + return + } + return value.AsModified() +} + +// LastAsModified returns last element of slice (if exists). +func (s HelpPeerColorsClassArray) LastAsModified() (v *HelpPeerColors, ok bool) { + value, ok := s.Last() + if !ok { + return + } + return value.AsModified() +} + +// PopFirstAsModified returns element of slice (if exists). +func (s *HelpPeerColorsClassArray) PopFirstAsModified() (v *HelpPeerColors, ok bool) { + value, ok := s.PopFirst() + if !ok { + return + } + return value.AsModified() +} + +// PopAsModified returns element of slice (if exists). +func (s *HelpPeerColorsClassArray) PopAsModified() (v *HelpPeerColors, ok bool) { + value, ok := s.Pop() + if !ok { + return + } + return value.AsModified() +} + +// HelpPeerColorsArray is adapter for slice of HelpPeerColors. +type HelpPeerColorsArray []HelpPeerColors + +// Sort sorts slice of HelpPeerColors. +func (s HelpPeerColorsArray) Sort(less func(a, b HelpPeerColors) bool) HelpPeerColorsArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of HelpPeerColors. +func (s HelpPeerColorsArray) SortStable(less func(a, b HelpPeerColors) bool) HelpPeerColorsArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of HelpPeerColors. +func (s HelpPeerColorsArray) Retain(keep func(x HelpPeerColors) bool) HelpPeerColorsArray { + 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 HelpPeerColorsArray) First() (v HelpPeerColors, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s HelpPeerColorsArray) Last() (v HelpPeerColors, 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 *HelpPeerColorsArray) PopFirst() (v HelpPeerColors, 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 HelpPeerColors + 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 *HelpPeerColorsArray) Pop() (v HelpPeerColors, 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_inline_bot_web_view_gen.go b/tg/tl_inline_bot_web_view_gen.go index 4fb88d74ec..4d313db6e3 100644 --- a/tg/tl_inline_bot_web_view_gen.go +++ b/tg/tl_inline_bot_web_view_gen.go @@ -32,10 +32,11 @@ var ( ) // InlineBotWebView represents TL type `inlineBotWebView#b57295d5`. -// Specifies a bot mini app¹ button, shown on top of the inline query results list. +// Specifies an inline mode mini app¹ button, shown on top of the inline query results +// list. // // Links: -// 1. https://core.telegram.org/api/bots/webapps#simple-mini-apps +// 1. https://core.telegram.org/api/bots/webapps#inline-mode-mini-apps // // See https://core.telegram.org/constructor/inlineBotWebView for reference. type InlineBotWebView struct { diff --git a/tg/tl_input_bot_app_gen.go b/tg/tl_input_bot_app_gen.go index e1a19a8e5c..f684455fa8 100644 --- a/tg/tl_input_bot_app_gen.go +++ b/tg/tl_input_bot_app_gen.go @@ -32,17 +32,17 @@ var ( ) // InputBotAppID represents TL type `inputBotAppID#a920bd7a`. -// Used to fetch information about a named bot mini app¹ by its ID +// Used to fetch information about a named Mini App¹ by its ID // // Links: -// 1. https://core.telegram.org/api/bots/webapps#named-bot-mini-apps +// 1. https://core.telegram.org/api/bots/webapps#named-mini-apps // // See https://core.telegram.org/constructor/inputBotAppID for reference. type InputBotAppID struct { - // named bot mini app¹ ID. + // named Mini App¹ ID. // // Links: - // 1) https://core.telegram.org/api/bots/webapps#named-bot-mini-apps + // 1) https://core.telegram.org/api/bots/webapps#named-mini-apps ID int64 // Access hash, obtained from the botApp¹ constructor. // @@ -203,19 +203,19 @@ func (i *InputBotAppID) GetAccessHash() (value int64) { } // InputBotAppShortName represents TL type `inputBotAppShortName#908c0407`. -// Used to fetch information about a named bot mini app¹ by its short name +// Used to fetch information about a named Mini App¹ by its short name // // Links: -// 1. https://core.telegram.org/api/bots/webapps#named-bot-mini-apps +// 1. https://core.telegram.org/api/bots/webapps#named-mini-apps // // See https://core.telegram.org/constructor/inputBotAppShortName for reference. type InputBotAppShortName struct { // ID of the bot that owns the bot mini app BotID InputUserClass - // Short name, obtained from a named bot mini app deep link¹ + // Short name, obtained from a named Mini App deep link¹ // // Links: - // 1) https://core.telegram.org/api/links#named-bot-mini-app-links + // 1) https://core.telegram.org/api/links#named-mini-app-links ShortName string } diff --git a/tg/tl_input_bot_inline_message_gen.go b/tg/tl_input_bot_inline_message_gen.go index 18bd60cf42..2fae14bdc7 100644 --- a/tg/tl_input_bot_inline_message_gen.go +++ b/tg/tl_input_bot_inline_message_gen.go @@ -41,7 +41,8 @@ type InputBotInlineMessageMediaAuto struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // InvertMedia field of InputBotInlineMessageMediaAuto. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // Caption Message string @@ -364,7 +365,8 @@ type InputBotInlineMessageText struct { Flags bin.Fields // Disable webpage preview NoWebpage bool - // InvertMedia field of InputBotInlineMessageText. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // Message Message string @@ -2297,9 +2299,13 @@ func (i *InputBotInlineMessageMediaInvoice) GetReplyMarkup() (value ReplyMarkupC // // See https://core.telegram.org/constructor/inputBotInlineMessageMediaWebPage for reference. type InputBotInlineMessageMediaWebPage struct { - // Flags field of InputBotInlineMessageMediaWebPage. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // InvertMedia field of InputBotInlineMessageMediaWebPage. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // ForceLargeMedia field of InputBotInlineMessageMediaWebPage. ForceLargeMedia bool @@ -2309,7 +2315,10 @@ type InputBotInlineMessageMediaWebPage struct { Optional bool // Message field of InputBotInlineMessageMediaWebPage. Message string - // Entities field of InputBotInlineMessageMediaWebPage. + // Message entities for styled text¹ + // + // Links: + // 1) https://core.telegram.org/api/entities // // Use SetEntities and GetEntities helpers. Entities []MessageEntityClass diff --git a/tg/tl_input_file_location_gen.go b/tg/tl_input_file_location_gen.go index c58df5ea81..7a48b85e05 100644 --- a/tg/tl_input_file_location_gen.go +++ b/tg/tl_input_file_location_gen.go @@ -812,7 +812,13 @@ func (i *InputSecureFileLocation) GetAccessHash() (value int64) { } // InputTakeoutFileLocation represents TL type `inputTakeoutFileLocation#29be5899`. -// Empty constructor for takeout +// Used to download a JSON file that will contain all personal data related to features +// that do not have a specialized takeout method¹ yet, see here »² for more info on +// the takeout API. +// +// Links: +// 1. https://core.telegram.org/api/takeout +// 2. https://core.telegram.org/api/takeout // // See https://core.telegram.org/constructor/inputTakeoutFileLocation for reference. type InputTakeoutFileLocation struct { diff --git a/tg/tl_input_media_gen.go b/tg/tl_input_media_gen.go index a650405ba0..b812ed02ac 100644 --- a/tg/tl_input_media_gen.go +++ b/tg/tl_input_media_gen.go @@ -4221,7 +4221,10 @@ func (i *InputMediaStory) GetID() (value int) { // // See https://core.telegram.org/constructor/inputMediaWebPage for reference. type InputMediaWebPage struct { - // Flags field of InputMediaWebPage. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // ForceLargeMedia field of InputMediaWebPage. ForceLargeMedia bool diff --git a/tg/tl_input_reply_to_gen.go b/tg/tl_input_reply_to_gen.go index c082f2caa0..a07df294be 100644 --- a/tg/tl_input_reply_to_gen.go +++ b/tg/tl_input_reply_to_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// InputReplyToMessage represents TL type `inputReplyToMessage#73ec805`. +// InputReplyToMessage represents TL type `inputReplyToMessage#22c0f6d5`. // Reply to a message. // // See https://core.telegram.org/constructor/inputReplyToMessage for reference. @@ -59,14 +59,21 @@ type InputReplyToMessage struct { // // Use SetQuoteText and GetQuoteText helpers. QuoteText string - // QuoteEntities field of InputReplyToMessage. + // Message entities for styled text¹ + // + // Links: + // 1) https://core.telegram.org/api/entities // // Use SetQuoteEntities and GetQuoteEntities helpers. QuoteEntities []MessageEntityClass + // QuoteOffset field of InputReplyToMessage. + // + // Use SetQuoteOffset and GetQuoteOffset helpers. + QuoteOffset int } // InputReplyToMessageTypeID is TL type id of InputReplyToMessage. -const InputReplyToMessageTypeID = 0x73ec805 +const InputReplyToMessageTypeID = 0x22c0f6d5 // construct implements constructor of InputReplyToClass. func (i InputReplyToMessage) construct() InputReplyToClass { return &i } @@ -103,6 +110,9 @@ func (i *InputReplyToMessage) Zero() bool { if !(i.QuoteEntities == nil) { return false } + if !(i.QuoteOffset == 0) { + return false + } return true } @@ -123,6 +133,7 @@ func (i *InputReplyToMessage) FillFrom(from interface { GetReplyToPeerID() (value InputPeerClass, ok bool) GetQuoteText() (value string, ok bool) GetQuoteEntities() (value []MessageEntityClass, ok bool) + GetQuoteOffset() (value int, ok bool) }) { i.ReplyToMsgID = from.GetReplyToMsgID() if val, ok := from.GetTopMsgID(); ok { @@ -141,6 +152,10 @@ func (i *InputReplyToMessage) FillFrom(from interface { i.QuoteEntities = val } + if val, ok := from.GetQuoteOffset(); ok { + i.QuoteOffset = val + } + } // TypeID returns type id in TL schema. @@ -190,6 +205,11 @@ func (i *InputReplyToMessage) TypeInfo() tdp.Type { SchemaName: "quote_entities", Null: !i.Flags.Has(3), }, + { + Name: "QuoteOffset", + SchemaName: "quote_offset", + Null: !i.Flags.Has(4), + }, } return typ } @@ -208,12 +228,15 @@ func (i *InputReplyToMessage) SetFlags() { if !(i.QuoteEntities == nil) { i.Flags.Set(3) } + if !(i.QuoteOffset == 0) { + i.Flags.Set(4) + } } // Encode implements bin.Encoder. func (i *InputReplyToMessage) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputReplyToMessage#73ec805 as nil") + return fmt.Errorf("can't encode inputReplyToMessage#22c0f6d5 as nil") } b.PutID(InputReplyToMessageTypeID) return i.EncodeBare(b) @@ -222,11 +245,11 @@ func (i *InputReplyToMessage) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputReplyToMessage) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputReplyToMessage#73ec805 as nil") + return fmt.Errorf("can't encode inputReplyToMessage#22c0f6d5 as nil") } i.SetFlags() if err := i.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputReplyToMessage#73ec805: field flags: %w", err) + return fmt.Errorf("unable to encode inputReplyToMessage#22c0f6d5: field flags: %w", err) } b.PutInt(i.ReplyToMsgID) if i.Flags.Has(0) { @@ -234,10 +257,10 @@ func (i *InputReplyToMessage) EncodeBare(b *bin.Buffer) error { } if i.Flags.Has(1) { if i.ReplyToPeerID == nil { - return fmt.Errorf("unable to encode inputReplyToMessage#73ec805: field reply_to_peer_id is nil") + return fmt.Errorf("unable to encode inputReplyToMessage#22c0f6d5: field reply_to_peer_id is nil") } if err := i.ReplyToPeerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputReplyToMessage#73ec805: field reply_to_peer_id: %w", err) + return fmt.Errorf("unable to encode inputReplyToMessage#22c0f6d5: field reply_to_peer_id: %w", err) } } if i.Flags.Has(2) { @@ -247,23 +270,26 @@ func (i *InputReplyToMessage) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(i.QuoteEntities)) for idx, v := range i.QuoteEntities { if v == nil { - return fmt.Errorf("unable to encode inputReplyToMessage#73ec805: field quote_entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode inputReplyToMessage#22c0f6d5: field quote_entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputReplyToMessage#73ec805: field quote_entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode inputReplyToMessage#22c0f6d5: field quote_entities element with index %d: %w", idx, err) } } } + if i.Flags.Has(4) { + b.PutInt(i.QuoteOffset) + } return nil } // Decode implements bin.Decoder. func (i *InputReplyToMessage) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputReplyToMessage#73ec805 to nil") + return fmt.Errorf("can't decode inputReplyToMessage#22c0f6d5 to nil") } if err := b.ConsumeID(InputReplyToMessageTypeID); err != nil { - return fmt.Errorf("unable to decode inputReplyToMessage#73ec805: %w", err) + return fmt.Errorf("unable to decode inputReplyToMessage#22c0f6d5: %w", err) } return i.DecodeBare(b) } @@ -271,45 +297,45 @@ func (i *InputReplyToMessage) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputReplyToMessage) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputReplyToMessage#73ec805 to nil") + return fmt.Errorf("can't decode inputReplyToMessage#22c0f6d5 to nil") } { if err := i.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputReplyToMessage#73ec805: field flags: %w", err) + return fmt.Errorf("unable to decode inputReplyToMessage#22c0f6d5: field flags: %w", err) } } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode inputReplyToMessage#73ec805: field reply_to_msg_id: %w", err) + return fmt.Errorf("unable to decode inputReplyToMessage#22c0f6d5: field reply_to_msg_id: %w", err) } i.ReplyToMsgID = value } if i.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode inputReplyToMessage#73ec805: field top_msg_id: %w", err) + return fmt.Errorf("unable to decode inputReplyToMessage#22c0f6d5: field top_msg_id: %w", err) } i.TopMsgID = value } if i.Flags.Has(1) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode inputReplyToMessage#73ec805: field reply_to_peer_id: %w", err) + return fmt.Errorf("unable to decode inputReplyToMessage#22c0f6d5: field reply_to_peer_id: %w", err) } i.ReplyToPeerID = value } if i.Flags.Has(2) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputReplyToMessage#73ec805: field quote_text: %w", err) + return fmt.Errorf("unable to decode inputReplyToMessage#22c0f6d5: field quote_text: %w", err) } i.QuoteText = value } if i.Flags.Has(3) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode inputReplyToMessage#73ec805: field quote_entities: %w", err) + return fmt.Errorf("unable to decode inputReplyToMessage#22c0f6d5: field quote_entities: %w", err) } if headerLen > 0 { @@ -318,11 +344,18 @@ func (i *InputReplyToMessage) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode inputReplyToMessage#73ec805: field quote_entities: %w", err) + return fmt.Errorf("unable to decode inputReplyToMessage#22c0f6d5: field quote_entities: %w", err) } i.QuoteEntities = append(i.QuoteEntities, value) } } + if i.Flags.Has(4) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode inputReplyToMessage#22c0f6d5: field quote_offset: %w", err) + } + i.QuoteOffset = value + } return nil } @@ -406,6 +439,24 @@ func (i *InputReplyToMessage) GetQuoteEntities() (value []MessageEntityClass, ok return i.QuoteEntities, true } +// SetQuoteOffset sets value of QuoteOffset conditional field. +func (i *InputReplyToMessage) SetQuoteOffset(value int) { + i.Flags.Set(4) + i.QuoteOffset = value +} + +// GetQuoteOffset returns value of QuoteOffset conditional field and +// boolean which is true if field was set. +func (i *InputReplyToMessage) GetQuoteOffset() (value int, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(4) { + return value, false + } + return i.QuoteOffset, true +} + // MapQuoteEntities returns field QuoteEntities wrapped in MessageEntityClassArray helper. func (i *InputReplyToMessage) MapQuoteEntities() (value MessageEntityClassArray, ok bool) { if !i.Flags.Has(3) { @@ -595,7 +646,7 @@ const InputReplyToClassName = "InputReplyTo" // panic(err) // } // switch v := g.(type) { -// case *tg.InputReplyToMessage: // inputReplyToMessage#73ec805 +// case *tg.InputReplyToMessage: // inputReplyToMessage#22c0f6d5 // case *tg.InputReplyToStory: // inputReplyToStory#15b0f283 // default: panic(v) // } @@ -626,7 +677,7 @@ func DecodeInputReplyTo(buf *bin.Buffer) (InputReplyToClass, error) { } switch id { case InputReplyToMessageTypeID: - // Decoding inputReplyToMessage#73ec805. + // Decoding inputReplyToMessage#22c0f6d5. v := InputReplyToMessage{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputReplyToClass: %w", err) diff --git a/tg/tl_input_store_payment_purpose_gen.go b/tg/tl_input_store_payment_purpose_gen.go index 0397733e3d..723aa877cb 100644 --- a/tg/tl_input_store_payment_purpose_gen.go +++ b/tg/tl_input_store_payment_purpose_gen.go @@ -438,7 +438,10 @@ func (i *InputStorePaymentGiftPremium) GetAmount() (value int64) { // // See https://core.telegram.org/constructor/inputStorePaymentPremiumGiftCode for reference. type InputStorePaymentPremiumGiftCode struct { - // Flags field of InputStorePaymentPremiumGiftCode. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Users field of InputStorePaymentPremiumGiftCode. Users []InputUserClass @@ -720,7 +723,10 @@ func (i *InputStorePaymentPremiumGiftCode) MapUsers() (value InputUserClassArray // // See https://core.telegram.org/constructor/inputStorePaymentPremiumGiveaway for reference. type InputStorePaymentPremiumGiveaway struct { - // Flags field of InputStorePaymentPremiumGiveaway. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // OnlyNewSubscribers field of InputStorePaymentPremiumGiveaway. OnlyNewSubscribers bool diff --git a/tg/tl_invoke_with_takeout_gen.go b/tg/tl_invoke_with_takeout_gen.go index 87e56e58cc..cac5ed377c 100644 --- a/tg/tl_invoke_with_takeout_gen.go +++ b/tg/tl_invoke_with_takeout_gen.go @@ -32,11 +32,17 @@ var ( ) // InvokeWithTakeoutRequest represents TL type `invokeWithTakeout#aca9fd2e`. -// Invoke a method within a takeout session +// Invoke a method within a takeout session, see here » for more info¹. +// +// Links: +// 1. https://core.telegram.org/api/takeout // // See https://core.telegram.org/constructor/invokeWithTakeout for reference. type InvokeWithTakeoutRequest struct { - // Takeout session ID + // Takeout session ID »¹ + // + // Links: + // 1) https://core.telegram.org/api/takeout TakeoutID int64 // Query Query bin.Object diff --git a/tg/tl_message_action_gen.go b/tg/tl_message_action_gen.go index b26c022b49..7dd28127f1 100644 --- a/tg/tl_message_action_gen.go +++ b/tg/tl_message_action_gen.go @@ -3181,7 +3181,10 @@ type MessageActionBotAllowed struct { // Links: // 1) https://core.telegram.org/api/bots/attach AttachMenu bool - // FromRequest field of MessageActionBotAllowed. + // We have allowed the bot to send us messages using bots.allowSendMessage »¹. + // + // Links: + // 1) https://core.telegram.org/method/bots.allowSendMessage FromRequest bool // We have authorized the bot to send us messages by logging into a website via Telegram // Login »¹; this field contains the domain name of the website on which the user has @@ -6623,7 +6626,7 @@ func (m *MessageActionRequestedPeer) GetPeer() (value PeerClass) { return m.Peer } -// MessageActionSetChatWallPaper represents TL type `messageActionSetChatWallPaper#bc44a927`. +// MessageActionSetChatWallPaper represents TL type `messageActionSetChatWallPaper#5060a3f4`. // The wallpaper »¹ of the current chat was changed. // // Links: @@ -6631,6 +6634,15 @@ func (m *MessageActionRequestedPeer) GetPeer() (value PeerClass) { // // See https://core.telegram.org/constructor/messageActionSetChatWallPaper for reference. type MessageActionSetChatWallPaper struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Same field of MessageActionSetChatWallPaper. + Same bool + // ForBoth field of MessageActionSetChatWallPaper. + ForBoth bool // New wallpaper¹ // // Links: @@ -6639,7 +6651,7 @@ type MessageActionSetChatWallPaper struct { } // MessageActionSetChatWallPaperTypeID is TL type id of MessageActionSetChatWallPaper. -const MessageActionSetChatWallPaperTypeID = 0xbc44a927 +const MessageActionSetChatWallPaperTypeID = 0x5060a3f4 // construct implements constructor of MessageActionClass. func (m MessageActionSetChatWallPaper) construct() MessageActionClass { return &m } @@ -6658,6 +6670,15 @@ func (m *MessageActionSetChatWallPaper) Zero() bool { if m == nil { return true } + if !(m.Flags.Zero()) { + return false + } + if !(m.Same == false) { + return false + } + if !(m.ForBoth == false) { + return false + } if !(m.Wallpaper == nil) { return false } @@ -6676,8 +6697,12 @@ func (m *MessageActionSetChatWallPaper) String() string { // FillFrom fills MessageActionSetChatWallPaper from given interface. func (m *MessageActionSetChatWallPaper) FillFrom(from interface { + GetSame() (value bool) + GetForBoth() (value bool) GetWallpaper() (value WallPaperClass) }) { + m.Same = from.GetSame() + m.ForBoth = from.GetForBoth() m.Wallpaper = from.GetWallpaper() } @@ -6704,6 +6729,16 @@ func (m *MessageActionSetChatWallPaper) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "Same", + SchemaName: "same", + Null: !m.Flags.Has(0), + }, + { + Name: "ForBoth", + SchemaName: "for_both", + Null: !m.Flags.Has(1), + }, { Name: "Wallpaper", SchemaName: "wallpaper", @@ -6712,10 +6747,20 @@ func (m *MessageActionSetChatWallPaper) TypeInfo() tdp.Type { return typ } +// SetFlags sets flags for non-zero fields. +func (m *MessageActionSetChatWallPaper) SetFlags() { + if !(m.Same == false) { + m.Flags.Set(0) + } + if !(m.ForBoth == false) { + m.Flags.Set(1) + } +} + // Encode implements bin.Encoder. func (m *MessageActionSetChatWallPaper) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionSetChatWallPaper#bc44a927 as nil") + return fmt.Errorf("can't encode messageActionSetChatWallPaper#5060a3f4 as nil") } b.PutID(MessageActionSetChatWallPaperTypeID) return m.EncodeBare(b) @@ -6724,13 +6769,17 @@ func (m *MessageActionSetChatWallPaper) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionSetChatWallPaper) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionSetChatWallPaper#bc44a927 as nil") + return fmt.Errorf("can't encode messageActionSetChatWallPaper#5060a3f4 as nil") + } + m.SetFlags() + if err := m.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionSetChatWallPaper#5060a3f4: field flags: %w", err) } if m.Wallpaper == nil { - return fmt.Errorf("unable to encode messageActionSetChatWallPaper#bc44a927: field wallpaper is nil") + return fmt.Errorf("unable to encode messageActionSetChatWallPaper#5060a3f4: field wallpaper is nil") } if err := m.Wallpaper.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionSetChatWallPaper#bc44a927: field wallpaper: %w", err) + return fmt.Errorf("unable to encode messageActionSetChatWallPaper#5060a3f4: field wallpaper: %w", err) } return nil } @@ -6738,10 +6787,10 @@ func (m *MessageActionSetChatWallPaper) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *MessageActionSetChatWallPaper) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionSetChatWallPaper#bc44a927 to nil") + return fmt.Errorf("can't decode messageActionSetChatWallPaper#5060a3f4 to nil") } if err := b.ConsumeID(MessageActionSetChatWallPaperTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionSetChatWallPaper#bc44a927: %w", err) + return fmt.Errorf("unable to decode messageActionSetChatWallPaper#5060a3f4: %w", err) } return m.DecodeBare(b) } @@ -6749,168 +6798,65 @@ func (m *MessageActionSetChatWallPaper) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionSetChatWallPaper) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionSetChatWallPaper#bc44a927 to nil") + return fmt.Errorf("can't decode messageActionSetChatWallPaper#5060a3f4 to nil") + } + { + if err := m.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionSetChatWallPaper#5060a3f4: field flags: %w", err) + } } + m.Same = m.Flags.Has(0) + m.ForBoth = m.Flags.Has(1) { value, err := DecodeWallPaper(b) if err != nil { - return fmt.Errorf("unable to decode messageActionSetChatWallPaper#bc44a927: field wallpaper: %w", err) + return fmt.Errorf("unable to decode messageActionSetChatWallPaper#5060a3f4: field wallpaper: %w", err) } m.Wallpaper = value } return nil } -// GetWallpaper returns value of Wallpaper field. -func (m *MessageActionSetChatWallPaper) GetWallpaper() (value WallPaperClass) { - if m == nil { - return - } - return m.Wallpaper -} - -// MessageActionSetSameChatWallPaper represents TL type `messageActionSetSameChatWallPaper#c0787d6d`. -// The user applied a wallpaper »¹ previously sent by the other user in a -// messageActionSetChatWallPaper² message. -// -// Links: -// 1. https://core.telegram.org/api/wallpapers -// 2. https://core.telegram.org/constructor/messageActionSetChatWallPaper -// -// See https://core.telegram.org/constructor/messageActionSetSameChatWallPaper for reference. -type MessageActionSetSameChatWallPaper struct { - // The wallpaper¹ - // - // Links: - // 1) https://core.telegram.org/api/wallpapers - Wallpaper WallPaperClass -} - -// MessageActionSetSameChatWallPaperTypeID is TL type id of MessageActionSetSameChatWallPaper. -const MessageActionSetSameChatWallPaperTypeID = 0xc0787d6d - -// construct implements constructor of MessageActionClass. -func (m MessageActionSetSameChatWallPaper) construct() MessageActionClass { return &m } - -// Ensuring interfaces in compile-time for MessageActionSetSameChatWallPaper. -var ( - _ bin.Encoder = &MessageActionSetSameChatWallPaper{} - _ bin.Decoder = &MessageActionSetSameChatWallPaper{} - _ bin.BareEncoder = &MessageActionSetSameChatWallPaper{} - _ bin.BareDecoder = &MessageActionSetSameChatWallPaper{} - - _ MessageActionClass = &MessageActionSetSameChatWallPaper{} -) - -func (m *MessageActionSetSameChatWallPaper) Zero() bool { - if m == nil { - return true - } - if !(m.Wallpaper == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageActionSetSameChatWallPaper) String() string { - if m == nil { - return "MessageActionSetSameChatWallPaper(nil)" - } - type Alias MessageActionSetSameChatWallPaper - return fmt.Sprintf("MessageActionSetSameChatWallPaper%+v", Alias(*m)) -} - -// FillFrom fills MessageActionSetSameChatWallPaper from given interface. -func (m *MessageActionSetSameChatWallPaper) FillFrom(from interface { - GetWallpaper() (value WallPaperClass) -}) { - m.Wallpaper = from.GetWallpaper() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageActionSetSameChatWallPaper) TypeID() uint32 { - return MessageActionSetSameChatWallPaperTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageActionSetSameChatWallPaper) TypeName() string { - return "messageActionSetSameChatWallPaper" -} - -// TypeInfo returns info about TL type. -func (m *MessageActionSetSameChatWallPaper) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageActionSetSameChatWallPaper", - ID: MessageActionSetSameChatWallPaperTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Wallpaper", - SchemaName: "wallpaper", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageActionSetSameChatWallPaper) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageActionSetSameChatWallPaper#c0787d6d as nil") +// SetSame sets value of Same conditional field. +func (m *MessageActionSetChatWallPaper) SetSame(value bool) { + if value { + m.Flags.Set(0) + m.Same = true + } else { + m.Flags.Unset(0) + m.Same = false } - b.PutID(MessageActionSetSameChatWallPaperTypeID) - return m.EncodeBare(b) } -// EncodeBare implements bin.BareEncoder. -func (m *MessageActionSetSameChatWallPaper) EncodeBare(b *bin.Buffer) error { +// GetSame returns value of Same conditional field. +func (m *MessageActionSetChatWallPaper) GetSame() (value bool) { if m == nil { - return fmt.Errorf("can't encode messageActionSetSameChatWallPaper#c0787d6d as nil") - } - if m.Wallpaper == nil { - return fmt.Errorf("unable to encode messageActionSetSameChatWallPaper#c0787d6d: field wallpaper is nil") - } - if err := m.Wallpaper.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionSetSameChatWallPaper#c0787d6d: field wallpaper: %w", err) + return } - return nil + return m.Flags.Has(0) } -// Decode implements bin.Decoder. -func (m *MessageActionSetSameChatWallPaper) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageActionSetSameChatWallPaper#c0787d6d to nil") - } - if err := b.ConsumeID(MessageActionSetSameChatWallPaperTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionSetSameChatWallPaper#c0787d6d: %w", err) +// SetForBoth sets value of ForBoth conditional field. +func (m *MessageActionSetChatWallPaper) SetForBoth(value bool) { + if value { + m.Flags.Set(1) + m.ForBoth = true + } else { + m.Flags.Unset(1) + m.ForBoth = false } - return m.DecodeBare(b) } -// DecodeBare implements bin.BareDecoder. -func (m *MessageActionSetSameChatWallPaper) DecodeBare(b *bin.Buffer) error { +// GetForBoth returns value of ForBoth conditional field. +func (m *MessageActionSetChatWallPaper) GetForBoth() (value bool) { if m == nil { - return fmt.Errorf("can't decode messageActionSetSameChatWallPaper#c0787d6d to nil") - } - { - value, err := DecodeWallPaper(b) - if err != nil { - return fmt.Errorf("unable to decode messageActionSetSameChatWallPaper#c0787d6d: field wallpaper: %w", err) - } - m.Wallpaper = value + return } - return nil + return m.Flags.Has(1) } // GetWallpaper returns value of Wallpaper field. -func (m *MessageActionSetSameChatWallPaper) GetWallpaper() (value WallPaperClass) { +func (m *MessageActionSetChatWallPaper) GetWallpaper() (value WallPaperClass) { if m == nil { return } @@ -6921,7 +6867,10 @@ func (m *MessageActionSetSameChatWallPaper) GetWallpaper() (value WallPaperClass // // See https://core.telegram.org/constructor/messageActionGiftCode for reference. type MessageActionGiftCode struct { - // Flags field of MessageActionGiftCode. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // ViaGiveaway field of MessageActionGiftCode. ViaGiveaway bool @@ -7320,6 +7269,167 @@ func (m *MessageActionGiveawayLaunch) DecodeBare(b *bin.Buffer) error { return nil } +// MessageActionGiveawayResults represents TL type `messageActionGiveawayResults#2a9fadc5`. +// +// See https://core.telegram.org/constructor/messageActionGiveawayResults for reference. +type MessageActionGiveawayResults struct { + // WinnersCount field of MessageActionGiveawayResults. + WinnersCount int + // UnclaimedCount field of MessageActionGiveawayResults. + UnclaimedCount int +} + +// MessageActionGiveawayResultsTypeID is TL type id of MessageActionGiveawayResults. +const MessageActionGiveawayResultsTypeID = 0x2a9fadc5 + +// construct implements constructor of MessageActionClass. +func (m MessageActionGiveawayResults) construct() MessageActionClass { return &m } + +// Ensuring interfaces in compile-time for MessageActionGiveawayResults. +var ( + _ bin.Encoder = &MessageActionGiveawayResults{} + _ bin.Decoder = &MessageActionGiveawayResults{} + _ bin.BareEncoder = &MessageActionGiveawayResults{} + _ bin.BareDecoder = &MessageActionGiveawayResults{} + + _ MessageActionClass = &MessageActionGiveawayResults{} +) + +func (m *MessageActionGiveawayResults) Zero() bool { + if m == nil { + return true + } + if !(m.WinnersCount == 0) { + return false + } + if !(m.UnclaimedCount == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (m *MessageActionGiveawayResults) String() string { + if m == nil { + return "MessageActionGiveawayResults(nil)" + } + type Alias MessageActionGiveawayResults + return fmt.Sprintf("MessageActionGiveawayResults%+v", Alias(*m)) +} + +// FillFrom fills MessageActionGiveawayResults from given interface. +func (m *MessageActionGiveawayResults) FillFrom(from interface { + GetWinnersCount() (value int) + GetUnclaimedCount() (value int) +}) { + m.WinnersCount = from.GetWinnersCount() + m.UnclaimedCount = from.GetUnclaimedCount() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessageActionGiveawayResults) TypeID() uint32 { + return MessageActionGiveawayResultsTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessageActionGiveawayResults) TypeName() string { + return "messageActionGiveawayResults" +} + +// TypeInfo returns info about TL type. +func (m *MessageActionGiveawayResults) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messageActionGiveawayResults", + ID: MessageActionGiveawayResultsTypeID, + } + if m == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "WinnersCount", + SchemaName: "winners_count", + }, + { + Name: "UnclaimedCount", + SchemaName: "unclaimed_count", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (m *MessageActionGiveawayResults) Encode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionGiveawayResults#2a9fadc5 as nil") + } + b.PutID(MessageActionGiveawayResultsTypeID) + return m.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (m *MessageActionGiveawayResults) EncodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't encode messageActionGiveawayResults#2a9fadc5 as nil") + } + b.PutInt(m.WinnersCount) + b.PutInt(m.UnclaimedCount) + return nil +} + +// Decode implements bin.Decoder. +func (m *MessageActionGiveawayResults) Decode(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionGiveawayResults#2a9fadc5 to nil") + } + if err := b.ConsumeID(MessageActionGiveawayResultsTypeID); err != nil { + return fmt.Errorf("unable to decode messageActionGiveawayResults#2a9fadc5: %w", err) + } + return m.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (m *MessageActionGiveawayResults) DecodeBare(b *bin.Buffer) error { + if m == nil { + return fmt.Errorf("can't decode messageActionGiveawayResults#2a9fadc5 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiveawayResults#2a9fadc5: field winners_count: %w", err) + } + m.WinnersCount = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageActionGiveawayResults#2a9fadc5: field unclaimed_count: %w", err) + } + m.UnclaimedCount = value + } + return nil +} + +// GetWinnersCount returns value of WinnersCount field. +func (m *MessageActionGiveawayResults) GetWinnersCount() (value int) { + if m == nil { + return + } + return m.WinnersCount +} + +// GetUnclaimedCount returns value of UnclaimedCount field. +func (m *MessageActionGiveawayResults) GetUnclaimedCount() (value int) { + if m == nil { + return + } + return m.UnclaimedCount +} + // MessageActionClassName is schema name of MessageActionClass. const MessageActionClassName = "MessageAction" @@ -7371,10 +7481,10 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionTopicEdit: // messageActionTopicEdit#c0944820 // case *tg.MessageActionSuggestProfilePhoto: // messageActionSuggestProfilePhoto#57de635e // case *tg.MessageActionRequestedPeer: // messageActionRequestedPeer#fe77345d -// case *tg.MessageActionSetChatWallPaper: // messageActionSetChatWallPaper#bc44a927 -// case *tg.MessageActionSetSameChatWallPaper: // messageActionSetSameChatWallPaper#c0787d6d +// case *tg.MessageActionSetChatWallPaper: // messageActionSetChatWallPaper#5060a3f4 // case *tg.MessageActionGiftCode: // messageActionGiftCode#d2cfdb0e // case *tg.MessageActionGiveawayLaunch: // messageActionGiveawayLaunch#332ba9ed +// case *tg.MessageActionGiveawayResults: // messageActionGiveawayResults#2a9fadc5 // default: panic(v) // } type MessageActionClass interface { @@ -7663,19 +7773,12 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionSetChatWallPaperTypeID: - // Decoding messageActionSetChatWallPaper#bc44a927. + // Decoding messageActionSetChatWallPaper#5060a3f4. v := MessageActionSetChatWallPaper{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) } return &v, nil - case MessageActionSetSameChatWallPaperTypeID: - // Decoding messageActionSetSameChatWallPaper#c0787d6d. - v := MessageActionSetSameChatWallPaper{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) - } - return &v, nil case MessageActionGiftCodeTypeID: // Decoding messageActionGiftCode#d2cfdb0e. v := MessageActionGiftCode{} @@ -7690,6 +7793,13 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) } return &v, nil + case MessageActionGiveawayResultsTypeID: + // Decoding messageActionGiveawayResults#2a9fadc5. + v := MessageActionGiveawayResults{} + 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 061198950a..b1d178f868 100644 --- a/tg/tl_message_action_slices_gen.go +++ b/tg/tl_message_action_slices_gen.go @@ -519,10 +519,10 @@ func (s MessageActionClassArray) AsMessageActionSetChatWallPaper() (to MessageAc return to } -// AsMessageActionSetSameChatWallPaper returns copy with only MessageActionSetSameChatWallPaper constructors. -func (s MessageActionClassArray) AsMessageActionSetSameChatWallPaper() (to MessageActionSetSameChatWallPaperArray) { +// AsMessageActionGiftCode returns copy with only MessageActionGiftCode constructors. +func (s MessageActionClassArray) AsMessageActionGiftCode() (to MessageActionGiftCodeArray) { for _, elem := range s { - value, ok := elem.(*MessageActionSetSameChatWallPaper) + value, ok := elem.(*MessageActionGiftCode) if !ok { continue } @@ -532,10 +532,10 @@ func (s MessageActionClassArray) AsMessageActionSetSameChatWallPaper() (to Messa return to } -// AsMessageActionGiftCode returns copy with only MessageActionGiftCode constructors. -func (s MessageActionClassArray) AsMessageActionGiftCode() (to MessageActionGiftCodeArray) { +// AsMessageActionGiveawayResults returns copy with only MessageActionGiveawayResults constructors. +func (s MessageActionClassArray) AsMessageActionGiveawayResults() (to MessageActionGiveawayResultsArray) { for _, elem := range s { - value, ok := elem.(*MessageActionGiftCode) + value, ok := elem.(*MessageActionGiveawayResults) if !ok { continue } @@ -3087,27 +3087,27 @@ func (s *MessageActionSetChatWallPaperArray) Pop() (v MessageActionSetChatWallPa return v, true } -// MessageActionSetSameChatWallPaperArray is adapter for slice of MessageActionSetSameChatWallPaper. -type MessageActionSetSameChatWallPaperArray []MessageActionSetSameChatWallPaper +// MessageActionGiftCodeArray is adapter for slice of MessageActionGiftCode. +type MessageActionGiftCodeArray []MessageActionGiftCode -// Sort sorts slice of MessageActionSetSameChatWallPaper. -func (s MessageActionSetSameChatWallPaperArray) Sort(less func(a, b MessageActionSetSameChatWallPaper) bool) MessageActionSetSameChatWallPaperArray { +// Sort sorts slice of MessageActionGiftCode. +func (s MessageActionGiftCodeArray) Sort(less func(a, b MessageActionGiftCode) bool) MessageActionGiftCodeArray { sort.Slice(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// SortStable sorts slice of MessageActionSetSameChatWallPaper. -func (s MessageActionSetSameChatWallPaperArray) SortStable(less func(a, b MessageActionSetSameChatWallPaper) bool) MessageActionSetSameChatWallPaperArray { +// SortStable sorts slice of MessageActionGiftCode. +func (s MessageActionGiftCodeArray) SortStable(less func(a, b MessageActionGiftCode) bool) MessageActionGiftCodeArray { sort.SliceStable(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// Retain filters in-place slice of MessageActionSetSameChatWallPaper. -func (s MessageActionSetSameChatWallPaperArray) Retain(keep func(x MessageActionSetSameChatWallPaper) bool) MessageActionSetSameChatWallPaperArray { +// Retain filters in-place slice of MessageActionGiftCode. +func (s MessageActionGiftCodeArray) Retain(keep func(x MessageActionGiftCode) bool) MessageActionGiftCodeArray { n := 0 for _, x := range s { if keep(x) { @@ -3121,7 +3121,7 @@ func (s MessageActionSetSameChatWallPaperArray) Retain(keep func(x MessageAction } // First returns first element of slice (if exists). -func (s MessageActionSetSameChatWallPaperArray) First() (v MessageActionSetSameChatWallPaper, ok bool) { +func (s MessageActionGiftCodeArray) First() (v MessageActionGiftCode, ok bool) { if len(s) < 1 { return } @@ -3129,7 +3129,7 @@ func (s MessageActionSetSameChatWallPaperArray) First() (v MessageActionSetSameC } // Last returns last element of slice (if exists). -func (s MessageActionSetSameChatWallPaperArray) Last() (v MessageActionSetSameChatWallPaper, ok bool) { +func (s MessageActionGiftCodeArray) Last() (v MessageActionGiftCode, ok bool) { if len(s) < 1 { return } @@ -3137,7 +3137,7 @@ func (s MessageActionSetSameChatWallPaperArray) Last() (v MessageActionSetSameCh } // PopFirst returns first element of slice (if exists) and deletes it. -func (s *MessageActionSetSameChatWallPaperArray) PopFirst() (v MessageActionSetSameChatWallPaper, ok bool) { +func (s *MessageActionGiftCodeArray) PopFirst() (v MessageActionGiftCode, ok bool) { if s == nil || len(*s) < 1 { return } @@ -3147,7 +3147,7 @@ func (s *MessageActionSetSameChatWallPaperArray) PopFirst() (v MessageActionSetS // Delete by index from SliceTricks. copy(a[0:], a[1:]) - var zero MessageActionSetSameChatWallPaper + var zero MessageActionGiftCode a[len(a)-1] = zero a = a[:len(a)-1] *s = a @@ -3156,7 +3156,7 @@ func (s *MessageActionSetSameChatWallPaperArray) PopFirst() (v MessageActionSetS } // Pop returns last element of slice (if exists) and deletes it. -func (s *MessageActionSetSameChatWallPaperArray) Pop() (v MessageActionSetSameChatWallPaper, ok bool) { +func (s *MessageActionGiftCodeArray) Pop() (v MessageActionGiftCode, ok bool) { if s == nil || len(*s) < 1 { return } @@ -3169,27 +3169,27 @@ func (s *MessageActionSetSameChatWallPaperArray) Pop() (v MessageActionSetSameCh return v, true } -// MessageActionGiftCodeArray is adapter for slice of MessageActionGiftCode. -type MessageActionGiftCodeArray []MessageActionGiftCode +// MessageActionGiveawayResultsArray is adapter for slice of MessageActionGiveawayResults. +type MessageActionGiveawayResultsArray []MessageActionGiveawayResults -// Sort sorts slice of MessageActionGiftCode. -func (s MessageActionGiftCodeArray) Sort(less func(a, b MessageActionGiftCode) bool) MessageActionGiftCodeArray { +// Sort sorts slice of MessageActionGiveawayResults. +func (s MessageActionGiveawayResultsArray) Sort(less func(a, b MessageActionGiveawayResults) bool) MessageActionGiveawayResultsArray { sort.Slice(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// SortStable sorts slice of MessageActionGiftCode. -func (s MessageActionGiftCodeArray) SortStable(less func(a, b MessageActionGiftCode) bool) MessageActionGiftCodeArray { +// SortStable sorts slice of MessageActionGiveawayResults. +func (s MessageActionGiveawayResultsArray) SortStable(less func(a, b MessageActionGiveawayResults) bool) MessageActionGiveawayResultsArray { sort.SliceStable(s, func(i, j int) bool { return less(s[i], s[j]) }) return s } -// Retain filters in-place slice of MessageActionGiftCode. -func (s MessageActionGiftCodeArray) Retain(keep func(x MessageActionGiftCode) bool) MessageActionGiftCodeArray { +// Retain filters in-place slice of MessageActionGiveawayResults. +func (s MessageActionGiveawayResultsArray) Retain(keep func(x MessageActionGiveawayResults) bool) MessageActionGiveawayResultsArray { n := 0 for _, x := range s { if keep(x) { @@ -3203,7 +3203,7 @@ func (s MessageActionGiftCodeArray) Retain(keep func(x MessageActionGiftCode) bo } // First returns first element of slice (if exists). -func (s MessageActionGiftCodeArray) First() (v MessageActionGiftCode, ok bool) { +func (s MessageActionGiveawayResultsArray) First() (v MessageActionGiveawayResults, ok bool) { if len(s) < 1 { return } @@ -3211,7 +3211,7 @@ func (s MessageActionGiftCodeArray) First() (v MessageActionGiftCode, ok bool) { } // Last returns last element of slice (if exists). -func (s MessageActionGiftCodeArray) Last() (v MessageActionGiftCode, ok bool) { +func (s MessageActionGiveawayResultsArray) Last() (v MessageActionGiveawayResults, ok bool) { if len(s) < 1 { return } @@ -3219,7 +3219,7 @@ func (s MessageActionGiftCodeArray) Last() (v MessageActionGiftCode, ok bool) { } // PopFirst returns first element of slice (if exists) and deletes it. -func (s *MessageActionGiftCodeArray) PopFirst() (v MessageActionGiftCode, ok bool) { +func (s *MessageActionGiveawayResultsArray) PopFirst() (v MessageActionGiveawayResults, ok bool) { if s == nil || len(*s) < 1 { return } @@ -3229,7 +3229,7 @@ func (s *MessageActionGiftCodeArray) PopFirst() (v MessageActionGiftCode, ok boo // Delete by index from SliceTricks. copy(a[0:], a[1:]) - var zero MessageActionGiftCode + var zero MessageActionGiveawayResults a[len(a)-1] = zero a = a[:len(a)-1] *s = a @@ -3238,7 +3238,7 @@ func (s *MessageActionGiftCodeArray) PopFirst() (v MessageActionGiftCode, ok boo } // Pop returns last element of slice (if exists) and deletes it. -func (s *MessageActionGiftCodeArray) Pop() (v MessageActionGiftCode, ok bool) { +func (s *MessageActionGiveawayResultsArray) Pop() (v MessageActionGiveawayResults, ok bool) { if s == nil || len(*s) < 1 { return } diff --git a/tg/tl_message_entity_gen.go b/tg/tl_message_entity_gen.go index 5cf6c00e0e..fc32a77f81 100644 --- a/tg/tl_message_entity_gen.go +++ b/tg/tl_message_entity_gen.go @@ -3578,12 +3578,19 @@ func (m *MessageEntityCustomEmoji) GetDocumentID() (value int64) { } // MessageEntityBlockquote represents TL type `messageEntityBlockquote#20df5d0`. +// Message entity representing a block quote. // // See https://core.telegram.org/constructor/messageEntityBlockquote for reference. type MessageEntityBlockquote struct { - // Offset field of MessageEntityBlockquote. + // Offset of message entity within message (in UTF-16 code units¹) + // + // Links: + // 1) https://core.telegram.org/api/entities#entity-length Offset int - // Length field of MessageEntityBlockquote. + // Length of message entity within message (in UTF-16 code units¹) + // + // Links: + // 1) https://core.telegram.org/api/entities#entity-length Length int } diff --git a/tg/tl_message_gen.go b/tg/tl_message_gen.go index f45c93502d..eb30914c6d 100644 --- a/tg/tl_message_gen.go +++ b/tg/tl_message_gen.go @@ -285,7 +285,8 @@ type Message struct { // Links: // 1) https://telegram.org/blog/protected-content-delete-by-date-and-more Noforwards bool - // InvertMedia field of Message. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // ID of the message ID int diff --git a/tg/tl_message_interaction_counters_gen.go b/tg/tl_message_interaction_counters_gen.go deleted file mode 100644 index 5a8d28531e..0000000000 --- a/tg/tl_message_interaction_counters_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tg - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "go.uber.org/multierr" - - "github.com/gotd/td/bin" - "github.com/gotd/td/tdjson" - "github.com/gotd/td/tdp" - "github.com/gotd/td/tgerr" -) - -// No-op definition for keeping imports. -var ( - _ = bin.Buffer{} - _ = context.Background() - _ = fmt.Stringer(nil) - _ = strings.Builder{} - _ = errors.Is - _ = multierr.AppendInto - _ = sort.Ints - _ = tdp.Format - _ = tgerr.Error{} - _ = tdjson.Encoder{} -) - -// MessageInteractionCounters represents TL type `messageInteractionCounters#ad4fc9bd`. -// Message interaction counters -// -// See https://core.telegram.org/constructor/messageInteractionCounters for reference. -type MessageInteractionCounters struct { - // Message ID - MsgID int - // Views - Views int - // Number of times this message was forwarded - Forwards int -} - -// MessageInteractionCountersTypeID is TL type id of MessageInteractionCounters. -const MessageInteractionCountersTypeID = 0xad4fc9bd - -// Ensuring interfaces in compile-time for MessageInteractionCounters. -var ( - _ bin.Encoder = &MessageInteractionCounters{} - _ bin.Decoder = &MessageInteractionCounters{} - _ bin.BareEncoder = &MessageInteractionCounters{} - _ bin.BareDecoder = &MessageInteractionCounters{} -) - -func (m *MessageInteractionCounters) Zero() bool { - if m == nil { - return true - } - if !(m.MsgID == 0) { - return false - } - if !(m.Views == 0) { - return false - } - if !(m.Forwards == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageInteractionCounters) String() string { - if m == nil { - return "MessageInteractionCounters(nil)" - } - type Alias MessageInteractionCounters - return fmt.Sprintf("MessageInteractionCounters%+v", Alias(*m)) -} - -// FillFrom fills MessageInteractionCounters from given interface. -func (m *MessageInteractionCounters) FillFrom(from interface { - GetMsgID() (value int) - GetViews() (value int) - GetForwards() (value int) -}) { - m.MsgID = from.GetMsgID() - m.Views = from.GetViews() - m.Forwards = from.GetForwards() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageInteractionCounters) TypeID() uint32 { - return MessageInteractionCountersTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageInteractionCounters) TypeName() string { - return "messageInteractionCounters" -} - -// TypeInfo returns info about TL type. -func (m *MessageInteractionCounters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageInteractionCounters", - ID: MessageInteractionCountersTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MsgID", - SchemaName: "msg_id", - }, - { - Name: "Views", - SchemaName: "views", - }, - { - Name: "Forwards", - SchemaName: "forwards", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageInteractionCounters) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageInteractionCounters#ad4fc9bd as nil") - } - b.PutID(MessageInteractionCountersTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageInteractionCounters) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageInteractionCounters#ad4fc9bd as nil") - } - b.PutInt(m.MsgID) - b.PutInt(m.Views) - b.PutInt(m.Forwards) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageInteractionCounters) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageInteractionCounters#ad4fc9bd to nil") - } - if err := b.ConsumeID(MessageInteractionCountersTypeID); err != nil { - return fmt.Errorf("unable to decode messageInteractionCounters#ad4fc9bd: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageInteractionCounters) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageInteractionCounters#ad4fc9bd to nil") - } - { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageInteractionCounters#ad4fc9bd: field msg_id: %w", err) - } - m.MsgID = value - } - { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageInteractionCounters#ad4fc9bd: field views: %w", err) - } - m.Views = value - } - { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageInteractionCounters#ad4fc9bd: field forwards: %w", err) - } - m.Forwards = value - } - return nil -} - -// GetMsgID returns value of MsgID field. -func (m *MessageInteractionCounters) GetMsgID() (value int) { - if m == nil { - return - } - return m.MsgID -} - -// GetViews returns value of Views field. -func (m *MessageInteractionCounters) GetViews() (value int) { - if m == nil { - return - } - return m.Views -} - -// GetForwards returns value of Forwards field. -func (m *MessageInteractionCounters) GetForwards() (value int) { - if m == nil { - return - } - return m.Forwards -} diff --git a/tg/tl_message_media_gen.go b/tg/tl_message_media_gen.go index 9dddd5611d..e172c969d5 100644 --- a/tg/tl_message_media_gen.go +++ b/tg/tl_message_media_gen.go @@ -1244,7 +1244,10 @@ func (m *MessageMediaDocument) GetTTLSeconds() (value int, ok bool) { // // See https://core.telegram.org/constructor/messageMediaWebPage for reference. type MessageMediaWebPage struct { - // Flags field of MessageMediaWebPage. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // ForceLargeMedia field of MessageMediaWebPage. ForceLargeMedia bool @@ -3077,6 +3080,10 @@ func (m *MessageMediaDice) GetEmoticon() (value string) { } // MessageMediaStory represents TL type `messageMediaStory#68cb6283`. +// Represents a forwarded story¹ or a story mention. +// +// Links: +// 1. https://core.telegram.org/api/stories // // See https://core.telegram.org/constructor/messageMediaStory for reference. type MessageMediaStory struct { @@ -3085,13 +3092,19 @@ type MessageMediaStory struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // ViaMention field of MessageMediaStory. + // If set, indicates that this someone has mentioned us in this story (i.e. by tagging us + // in the description) or vice versa, we have mentioned the other peer (if the message is + // outgoing). ViaMention bool - // Peer field of MessageMediaStory. + // Peer that posted the story. Peer PeerClass - // ID field of MessageMediaStory. + // Story ID ID int - // Story field of MessageMediaStory. + // The story itself, if absent fetch it using stories.getStoriesByID¹ and the peer/id + // parameters specified above. + // + // Links: + // 1) https://core.telegram.org/method/stories.getStoriesByID // // Use SetStory and GetStory helpers. Story StoryItemClass @@ -3355,7 +3368,10 @@ func (m *MessageMediaStory) GetStory() (value StoryItemClass, ok bool) { // // See https://core.telegram.org/constructor/messageMediaGiveaway for reference. type MessageMediaGiveaway struct { - // Flags field of MessageMediaGiveaway. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // OnlyNewSubscribers field of MessageMediaGiveaway. OnlyNewSubscribers bool diff --git a/tg/tl_message_reply_header_gen.go b/tg/tl_message_reply_header_gen.go index 27873686d3..d3452eac90 100644 --- a/tg/tl_message_reply_header_gen.go +++ b/tg/tl_message_reply_header_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessageReplyHeader represents TL type `messageReplyHeader#6eebcabd`. +// MessageReplyHeader represents TL type `messageReplyHeader#afbc09db`. // Message replies and thread¹ information // // Links: @@ -84,14 +84,21 @@ type MessageReplyHeader struct { // // Use SetQuoteText and GetQuoteText helpers. QuoteText string - // QuoteEntities field of MessageReplyHeader. + // Message entities for styled text¹ + // + // Links: + // 1) https://core.telegram.org/api/entities // // Use SetQuoteEntities and GetQuoteEntities helpers. QuoteEntities []MessageEntityClass + // QuoteOffset field of MessageReplyHeader. + // + // Use SetQuoteOffset and GetQuoteOffset helpers. + QuoteOffset int } // MessageReplyHeaderTypeID is TL type id of MessageReplyHeader. -const MessageReplyHeaderTypeID = 0x6eebcabd +const MessageReplyHeaderTypeID = 0xafbc09db // construct implements constructor of MessageReplyHeaderClass. func (m MessageReplyHeader) construct() MessageReplyHeaderClass { return &m } @@ -143,6 +150,9 @@ func (m *MessageReplyHeader) Zero() bool { if !(m.QuoteEntities == nil) { return false } + if !(m.QuoteOffset == 0) { + return false + } return true } @@ -168,6 +178,7 @@ func (m *MessageReplyHeader) FillFrom(from interface { GetReplyToTopID() (value int, ok bool) GetQuoteText() (value string, ok bool) GetQuoteEntities() (value []MessageEntityClass, ok bool) + GetQuoteOffset() (value int, ok bool) }) { m.ReplyToScheduled = from.GetReplyToScheduled() m.ForumTopic = from.GetForumTopic() @@ -200,6 +211,10 @@ func (m *MessageReplyHeader) FillFrom(from interface { m.QuoteEntities = val } + if val, ok := from.GetQuoteOffset(); ok { + m.QuoteOffset = val + } + } // TypeID returns type id in TL schema. @@ -275,6 +290,11 @@ func (m *MessageReplyHeader) TypeInfo() tdp.Type { SchemaName: "quote_entities", Null: !m.Flags.Has(7), }, + { + Name: "QuoteOffset", + SchemaName: "quote_offset", + Null: !m.Flags.Has(10), + }, } return typ } @@ -311,12 +331,15 @@ func (m *MessageReplyHeader) SetFlags() { if !(m.QuoteEntities == nil) { m.Flags.Set(7) } + if !(m.QuoteOffset == 0) { + m.Flags.Set(10) + } } // Encode implements bin.Encoder. func (m *MessageReplyHeader) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReplyHeader#6eebcabd as nil") + return fmt.Errorf("can't encode messageReplyHeader#afbc09db as nil") } b.PutID(MessageReplyHeaderTypeID) return m.EncodeBare(b) @@ -325,34 +348,34 @@ func (m *MessageReplyHeader) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageReplyHeader) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageReplyHeader#6eebcabd as nil") + return fmt.Errorf("can't encode messageReplyHeader#afbc09db as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyHeader#6eebcabd: field flags: %w", err) + return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field flags: %w", err) } if m.Flags.Has(4) { b.PutInt(m.ReplyToMsgID) } if m.Flags.Has(0) { if m.ReplyToPeerID == nil { - return fmt.Errorf("unable to encode messageReplyHeader#6eebcabd: field reply_to_peer_id is nil") + return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_to_peer_id is nil") } if err := m.ReplyToPeerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyHeader#6eebcabd: field reply_to_peer_id: %w", err) + return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_to_peer_id: %w", err) } } if m.Flags.Has(5) { if err := m.ReplyFrom.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyHeader#6eebcabd: field reply_from: %w", err) + return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_from: %w", err) } } if m.Flags.Has(8) { if m.ReplyMedia == nil { - return fmt.Errorf("unable to encode messageReplyHeader#6eebcabd: field reply_media is nil") + return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_media is nil") } if err := m.ReplyMedia.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyHeader#6eebcabd: field reply_media: %w", err) + return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field reply_media: %w", err) } } if m.Flags.Has(1) { @@ -365,23 +388,26 @@ func (m *MessageReplyHeader) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(m.QuoteEntities)) for idx, v := range m.QuoteEntities { if v == nil { - return fmt.Errorf("unable to encode messageReplyHeader#6eebcabd: field quote_entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field quote_entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyHeader#6eebcabd: field quote_entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode messageReplyHeader#afbc09db: field quote_entities element with index %d: %w", idx, err) } } } + if m.Flags.Has(10) { + b.PutInt(m.QuoteOffset) + } return nil } // Decode implements bin.Decoder. func (m *MessageReplyHeader) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReplyHeader#6eebcabd to nil") + return fmt.Errorf("can't decode messageReplyHeader#afbc09db to nil") } if err := b.ConsumeID(MessageReplyHeaderTypeID); err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: %w", err) } return m.DecodeBare(b) } @@ -389,11 +415,11 @@ func (m *MessageReplyHeader) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageReplyHeader) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageReplyHeader#6eebcabd to nil") + return fmt.Errorf("can't decode messageReplyHeader#afbc09db to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: field flags: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field flags: %w", err) } } m.ReplyToScheduled = m.Flags.Has(2) @@ -402,47 +428,47 @@ func (m *MessageReplyHeader) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(4) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: field reply_to_msg_id: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_to_msg_id: %w", err) } m.ReplyToMsgID = value } if m.Flags.Has(0) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: field reply_to_peer_id: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_to_peer_id: %w", err) } m.ReplyToPeerID = value } if m.Flags.Has(5) { if err := m.ReplyFrom.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: field reply_from: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_from: %w", err) } } if m.Flags.Has(8) { value, err := DecodeMessageMedia(b) if err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: field reply_media: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_media: %w", err) } m.ReplyMedia = value } if m.Flags.Has(1) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: field reply_to_top_id: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field reply_to_top_id: %w", err) } m.ReplyToTopID = value } if m.Flags.Has(6) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: field quote_text: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field quote_text: %w", err) } m.QuoteText = value } if m.Flags.Has(7) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: field quote_entities: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field quote_entities: %w", err) } if headerLen > 0 { @@ -451,11 +477,18 @@ func (m *MessageReplyHeader) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode messageReplyHeader#6eebcabd: field quote_entities: %w", err) + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field quote_entities: %w", err) } m.QuoteEntities = append(m.QuoteEntities, value) } } + if m.Flags.Has(10) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messageReplyHeader#afbc09db: field quote_offset: %w", err) + } + m.QuoteOffset = value + } return nil } @@ -642,6 +675,24 @@ func (m *MessageReplyHeader) GetQuoteEntities() (value []MessageEntityClass, ok return m.QuoteEntities, true } +// SetQuoteOffset sets value of QuoteOffset conditional field. +func (m *MessageReplyHeader) SetQuoteOffset(value int) { + m.Flags.Set(10) + m.QuoteOffset = value +} + +// GetQuoteOffset returns value of QuoteOffset conditional field and +// boolean which is true if field was set. +func (m *MessageReplyHeader) GetQuoteOffset() (value int, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(10) { + return value, false + } + return m.QuoteOffset, true +} + // MapQuoteEntities returns field QuoteEntities wrapped in MessageEntityClassArray helper. func (m *MessageReplyHeader) MapQuoteEntities() (value MessageEntityClassArray, ok bool) { if !m.Flags.Has(7) { @@ -829,7 +880,7 @@ const MessageReplyHeaderClassName = "MessageReplyHeader" // panic(err) // } // switch v := g.(type) { -// case *tg.MessageReplyHeader: // messageReplyHeader#6eebcabd +// case *tg.MessageReplyHeader: // messageReplyHeader#afbc09db // case *tg.MessageReplyStoryHeader: // messageReplyStoryHeader#9c98bfc1 // default: panic(v) // } @@ -860,7 +911,7 @@ func DecodeMessageReplyHeader(buf *bin.Buffer) (MessageReplyHeaderClass, error) } switch id { case MessageReplyHeaderTypeID: - // Decoding messageReplyHeader#6eebcabd. + // Decoding messageReplyHeader#afbc09db. v := MessageReplyHeader{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageReplyHeaderClass: %w", err) diff --git a/tg/tl_messages_bot_app_gen.go b/tg/tl_messages_bot_app_gen.go index 22db3c194d..3ef091cca7 100644 --- a/tg/tl_messages_bot_app_gen.go +++ b/tg/tl_messages_bot_app_gen.go @@ -32,10 +32,10 @@ var ( ) // MessagesBotApp represents TL type `messages.botApp#eb50adf5`. -// Contains information about a named bot mini app¹ +// Contains information about a named Mini App¹ // // Links: -// 1. https://core.telegram.org/api/bots/webapps#named-bot-mini-apps +// 1. https://core.telegram.org/api/bots/webapps#named-mini-apps // // See https://core.telegram.org/constructor/messages.botApp for reference. type MessagesBotApp struct { diff --git a/tg/tl_messages_bot_results_gen.go b/tg/tl_messages_bot_results_gen.go index 5afed05600..8faa351631 100644 --- a/tg/tl_messages_bot_results_gen.go +++ b/tg/tl_messages_bot_results_gen.go @@ -55,10 +55,10 @@ type MessagesBotResults struct { // Use SetSwitchPm and GetSwitchPm helpers. SwitchPm InlineBotSwitchPM // Shown as a button on top of the remaining inline result list; if clicked, opens the - // specified bot mini app¹. + // specified inline mode mini app¹. // // Links: - // 1) https://core.telegram.org/api/bots/webapps#simple-mini-apps + // 1) https://core.telegram.org/api/bots/webapps#inline-mode-mini-apps // // Use SetSwitchWebview and GetSwitchWebview helpers. SwitchWebview InlineBotWebView diff --git a/tg/tl_messages_check_chat_invite_gen.go b/tg/tl_messages_check_chat_invite_gen.go index 4269b30f97..ea9b50660d 100644 --- a/tg/tl_messages_check_chat_invite_gen.go +++ b/tg/tl_messages_check_chat_invite_gen.go @@ -170,7 +170,6 @@ func (c *MessagesCheckChatInviteRequest) GetHash() (value string) { // Possible errors: // // 406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. -// 500 CHAT_MEMBERS_CHANNEL: // 400 INVITE_HASH_EMPTY: The invite hash is empty. // 406 INVITE_HASH_EXPIRED: The invite link has expired. // 400 INVITE_HASH_INVALID: The invite hash is invalid. diff --git a/tg/tl_messages_discussion_message_gen.go b/tg/tl_messages_discussion_message_gen.go index 374e1e4a25..0368c31f47 100644 --- a/tg/tl_messages_discussion_message_gen.go +++ b/tg/tl_messages_discussion_message_gen.go @@ -44,7 +44,8 @@ type MessagesDiscussionMessage struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Discussion messages + // The messages from which the thread starts. The messages are returned in reverse + // chronological order (i.e., in order of decreasing message ID). Messages []MessageClass // Message ID of latest reply in this thread¹ // diff --git a/tg/tl_messages_edit_inline_bot_message_gen.go b/tg/tl_messages_edit_inline_bot_message_gen.go index f5f6f623d9..56023411b5 100644 --- a/tg/tl_messages_edit_inline_bot_message_gen.go +++ b/tg/tl_messages_edit_inline_bot_message_gen.go @@ -43,7 +43,8 @@ type MessagesEditInlineBotMessageRequest struct { Flags bin.Fields // Disable webpage preview NoWebpage bool - // InvertMedia field of MessagesEditInlineBotMessageRequest. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // Sent inline message ID ID InputBotInlineMessageIDClass diff --git a/tg/tl_messages_edit_message_gen.go b/tg/tl_messages_edit_message_gen.go index 7782016ecd..f6682d030b 100644 --- a/tg/tl_messages_edit_message_gen.go +++ b/tg/tl_messages_edit_message_gen.go @@ -43,7 +43,8 @@ type MessagesEditMessageRequest struct { Flags bin.Fields // Disable webpage preview NoWebpage bool - // InvertMedia field of MessagesEditMessageRequest. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // Where was the message sent Peer InputPeerClass diff --git a/tg/tl_messages_forum_topics_gen.go b/tg/tl_messages_forum_topics_gen.go index 56d806ed11..0c2965d26a 100644 --- a/tg/tl_messages_forum_topics_gen.go +++ b/tg/tl_messages_forum_topics_gen.go @@ -45,7 +45,7 @@ type MessagesForumTopics struct { // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Whether the returned topics are ordered by creation date; if set, pagination by - // next_offset should use forumTopic¹.date; otherwise topics are ordered by the last + // offset_date should use forumTopic¹.date; otherwise topics are ordered by the last // message date, so paginate by the date of the message² referenced by forumTopic³ // top_message. // @@ -54,7 +54,7 @@ type MessagesForumTopics struct { // 2) https://core.telegram.org/type/Message // 3) https://core.telegram.org/constructor/forumTopic OrderByCreateDate bool - // Total number of topics matching query; may be less than the topics contained in topics + // Total number of topics matching query; may be more than the topics contained in topics // in which case pagination¹ is required. // // Links: diff --git a/tg/tl_messages_get_bot_app_gen.go b/tg/tl_messages_get_bot_app_gen.go index 67a2bd98d3..a77d4c0dd4 100644 --- a/tg/tl_messages_get_bot_app_gen.go +++ b/tg/tl_messages_get_bot_app_gen.go @@ -32,17 +32,17 @@ var ( ) // MessagesGetBotAppRequest represents TL type `messages.getBotApp#34fdc5c3`. -// Obtain information about a named bot mini app¹ +// Obtain information about a named Mini App¹ // // Links: -// 1. https://core.telegram.org/api/bots/webapps#named-bot-mini-apps +// 1. https://core.telegram.org/api/bots/webapps#named-mini-apps // // See https://core.telegram.org/method/messages.getBotApp for reference. type MessagesGetBotAppRequest struct { - // Bot app information obtained from a named bot mini app deep link »¹. + // Bot app information obtained from a named Mini App deep link »¹. // // Links: - // 1) https://core.telegram.org/api/links#named-bot-mini-app-links + // 1) https://core.telegram.org/api/links#named-mini-app-links App InputBotAppClass // Hash for pagination, for more info click here¹ // @@ -203,10 +203,10 @@ func (g *MessagesGetBotAppRequest) GetHash() (value int64) { } // MessagesGetBotApp invokes method messages.getBotApp#34fdc5c3 returning error if any. -// Obtain information about a named bot mini app¹ +// Obtain information about a named Mini App¹ // // Links: -// 1. https://core.telegram.org/api/bots/webapps#named-bot-mini-apps +// 1. https://core.telegram.org/api/bots/webapps#named-mini-apps // // Possible errors: // diff --git a/tg/tl_messages_migrate_chat_gen.go b/tg/tl_messages_migrate_chat_gen.go index db465487f2..41a92d9c0b 100644 --- a/tg/tl_messages_migrate_chat_gen.go +++ b/tg/tl_messages_migrate_chat_gen.go @@ -176,7 +176,6 @@ func (m *MessagesMigrateChatRequest) GetChatID() (value int64) { // Possible errors: // // 400 CHANNELS_TOO_MUCH: You have joined too many channels/supergroups. -// 500 CHANNEL_ID_GENERATE_FAILED: // 403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 400 CHAT_ID_INVALID: The provided chat id is invalid. // 500 CHAT_INVALID: Invalid chat. diff --git a/tg/tl_messages_request_app_web_view_gen.go b/tg/tl_messages_request_app_web_view_gen.go index e99c968298..1246020e82 100644 --- a/tg/tl_messages_request_app_web_view_gen.go +++ b/tg/tl_messages_request_app_web_view_gen.go @@ -32,14 +32,14 @@ var ( ) // MessagesRequestAppWebViewRequest represents TL type `messages.requestAppWebView#8c5a3b3c`. -// Open a bot mini app¹ from a named bot mini app deep link², sending over user -// information after user confirmation. +// Open a bot mini app¹ from a named Mini App deep link², sending over user information +// after user confirmation. // After calling this method, until the user closes the webview, messages // prolongWebView¹ must be called every 60 seconds. // // Links: // 1. https://core.telegram.org/bots/webapps -// 2. https://core.telegram.org/api/links#named-bot-mini-app-links +// 2. https://core.telegram.org/api/links#named-mini-app-links // 3. https://core.telegram.org/method/messages.prolongWebView // // See https://core.telegram.org/method/messages.requestAppWebView for reference. @@ -50,26 +50,26 @@ type MessagesRequestAppWebViewRequest struct { // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Set this flag if the bot is asking permission to send messages to the user as - // specified in the named bot mini app deep link¹ docs, and the user agreed. + // specified in the named Mini App deep link¹ docs, and the user agreed. // // Links: - // 1) https://core.telegram.org/api/links#named-bot-mini-app-links + // 1) https://core.telegram.org/api/links#named-mini-app-links WriteAllowed bool // If the client has clicked on the link in a Telegram chat, pass the chat's peer // information; otherwise pass the bot's peer information, instead. Peer InputPeerClass - // The app obtained by invoking messages.getBotApp¹ as specified in the named bot mini - // app deep link² docs. + // The app obtained by invoking messages.getBotApp¹ as specified in the named Mini App + // deep link² docs. // // Links: // 1) https://core.telegram.org/method/messages.getBotApp - // 2) https://core.telegram.org/api/links#named-bot-mini-app-links + // 2) https://core.telegram.org/api/links#named-mini-app-links App InputBotAppClass - // If the startapp query string parameter is present in the named bot mini app deep - // link¹, pass it to start_param. + // If the startapp query string parameter is present in the named Mini App deep link¹, + // pass it to start_param. // // Links: - // 1) https://core.telegram.org/api/links#named-bot-mini-app-links + // 1) https://core.telegram.org/api/links#named-mini-app-links // // Use SetStartParam and GetStartParam helpers. StartParam string @@ -403,14 +403,14 @@ func (r *MessagesRequestAppWebViewRequest) GetPlatform() (value string) { } // MessagesRequestAppWebView invokes method messages.requestAppWebView#8c5a3b3c returning error if any. -// Open a bot mini app¹ from a named bot mini app deep link², sending over user -// information after user confirmation. +// Open a bot mini app¹ from a named Mini App deep link², sending over user information +// after user confirmation. // After calling this method, until the user closes the webview, messages // prolongWebView¹ must be called every 60 seconds. // // Links: // 1. https://core.telegram.org/bots/webapps -// 2. https://core.telegram.org/api/links#named-bot-mini-app-links +// 2. https://core.telegram.org/api/links#named-mini-app-links // 3. https://core.telegram.org/method/messages.prolongWebView // // See https://core.telegram.org/method/messages.requestAppWebView for reference. diff --git a/tg/tl_messages_request_simple_web_view_gen.go b/tg/tl_messages_request_simple_web_view_gen.go index 4265e5baeb..49c6aeb7c3 100644 --- a/tg/tl_messages_request_simple_web_view_gen.go +++ b/tg/tl_messages_request_simple_web_view_gen.go @@ -50,15 +50,23 @@ type MessagesRequestSimpleWebViewRequest struct { // Links: // 1) https://core.telegram.org/method/messages.getInlineBotResults FromSwitchWebview bool - // FromSideMenu field of MessagesRequestSimpleWebViewRequest. + // Set this flag if opening the Mini App from the installed side menu entry »¹ or from + // a Mini App link »². + // + // Links: + // 1) https://core.telegram.org/api/bots/attach + // 2) https://core.telegram.org/api/links#mini-app-links FromSideMenu bool // Bot that owns the mini app Bot InputUserClass - // Web app URL + // Web app URL, if opening from a keyboard button or inline result // // Use SetURL and GetURL helpers. URL string - // StartParam field of MessagesRequestSimpleWebViewRequest. + // Start parameter, if opening from a Mini App link »¹. + // + // Links: + // 1) https://core.telegram.org/api/links#mini-app-links // // Use SetStartParam and GetStartParam helpers. StartParam string diff --git a/tg/tl_messages_request_web_view_gen.go b/tg/tl_messages_request_web_view_gen.go index fa99edff90..f4dae1624e 100644 --- a/tg/tl_messages_request_web_view_gen.go +++ b/tg/tl_messages_request_web_view_gen.go @@ -81,7 +81,7 @@ type MessagesRequestWebViewRequest struct { // start_param should contain the data from the startattach parameter. // // Links: - // 1) https://core.telegram.org/api/links#bot-attachment-menu-links + // 1) https://core.telegram.org/api/links#bot-attachment-or-side-menu-links // // Use SetStartParam and GetStartParam helpers. StartParam string diff --git a/tg/tl_messages_save_draft_gen.go b/tg/tl_messages_save_draft_gen.go index 86f965cf4b..8301f49193 100644 --- a/tg/tl_messages_save_draft_gen.go +++ b/tg/tl_messages_save_draft_gen.go @@ -46,9 +46,11 @@ type MessagesSaveDraftRequest struct { Flags bin.Fields // Disable generation of the webpage preview NoWebpage bool - // InvertMedia field of MessagesSaveDraftRequest. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool - // ReplyTo field of MessagesSaveDraftRequest. + // If set, indicates that the message should be sent in reply to the specified message or + // story. // // Use SetReplyTo and GetReplyTo helpers. ReplyTo InputReplyToClass @@ -63,7 +65,7 @@ type MessagesSaveDraftRequest struct { // // Use SetEntities and GetEntities helpers. Entities []MessageEntityClass - // Media field of MessagesSaveDraftRequest. + // Attached media // // Use SetMedia and GetMedia helpers. Media InputMediaClass diff --git a/tg/tl_messages_search_emoji_sticker_sets_gen.go b/tg/tl_messages_search_emoji_sticker_sets_gen.go new file mode 100644 index 0000000000..9a0cca4258 --- /dev/null +++ b/tg/tl_messages_search_emoji_sticker_sets_gen.go @@ -0,0 +1,259 @@ +// 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{} +) + +// MessagesSearchEmojiStickerSetsRequest represents TL type `messages.searchEmojiStickerSets#92b4494c`. +// +// See https://core.telegram.org/method/messages.searchEmojiStickerSets for reference. +type MessagesSearchEmojiStickerSetsRequest struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // ExcludeFeatured field of MessagesSearchEmojiStickerSetsRequest. + ExcludeFeatured bool + // Q field of MessagesSearchEmojiStickerSetsRequest. + Q string + // Hash for pagination, for more info click here¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets#hash-generation + Hash int64 +} + +// MessagesSearchEmojiStickerSetsRequestTypeID is TL type id of MessagesSearchEmojiStickerSetsRequest. +const MessagesSearchEmojiStickerSetsRequestTypeID = 0x92b4494c + +// Ensuring interfaces in compile-time for MessagesSearchEmojiStickerSetsRequest. +var ( + _ bin.Encoder = &MessagesSearchEmojiStickerSetsRequest{} + _ bin.Decoder = &MessagesSearchEmojiStickerSetsRequest{} + _ bin.BareEncoder = &MessagesSearchEmojiStickerSetsRequest{} + _ bin.BareDecoder = &MessagesSearchEmojiStickerSetsRequest{} +) + +func (s *MessagesSearchEmojiStickerSetsRequest) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.ExcludeFeatured == false) { + return false + } + if !(s.Q == "") { + return false + } + if !(s.Hash == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *MessagesSearchEmojiStickerSetsRequest) String() string { + if s == nil { + return "MessagesSearchEmojiStickerSetsRequest(nil)" + } + type Alias MessagesSearchEmojiStickerSetsRequest + return fmt.Sprintf("MessagesSearchEmojiStickerSetsRequest%+v", Alias(*s)) +} + +// FillFrom fills MessagesSearchEmojiStickerSetsRequest from given interface. +func (s *MessagesSearchEmojiStickerSetsRequest) FillFrom(from interface { + GetExcludeFeatured() (value bool) + GetQ() (value string) + GetHash() (value int64) +}) { + s.ExcludeFeatured = from.GetExcludeFeatured() + s.Q = from.GetQ() + s.Hash = from.GetHash() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesSearchEmojiStickerSetsRequest) TypeID() uint32 { + return MessagesSearchEmojiStickerSetsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesSearchEmojiStickerSetsRequest) TypeName() string { + return "messages.searchEmojiStickerSets" +} + +// TypeInfo returns info about TL type. +func (s *MessagesSearchEmojiStickerSetsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.searchEmojiStickerSets", + ID: MessagesSearchEmojiStickerSetsRequestTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ExcludeFeatured", + SchemaName: "exclude_featured", + Null: !s.Flags.Has(0), + }, + { + Name: "Q", + SchemaName: "q", + }, + { + Name: "Hash", + SchemaName: "hash", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *MessagesSearchEmojiStickerSetsRequest) SetFlags() { + if !(s.ExcludeFeatured == false) { + s.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (s *MessagesSearchEmojiStickerSetsRequest) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.searchEmojiStickerSets#92b4494c as nil") + } + b.PutID(MessagesSearchEmojiStickerSetsRequestTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *MessagesSearchEmojiStickerSetsRequest) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode messages.searchEmojiStickerSets#92b4494c as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.searchEmojiStickerSets#92b4494c: field flags: %w", err) + } + b.PutString(s.Q) + b.PutLong(s.Hash) + return nil +} + +// Decode implements bin.Decoder. +func (s *MessagesSearchEmojiStickerSetsRequest) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.searchEmojiStickerSets#92b4494c to nil") + } + if err := b.ConsumeID(MessagesSearchEmojiStickerSetsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.searchEmojiStickerSets#92b4494c: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *MessagesSearchEmojiStickerSetsRequest) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode messages.searchEmojiStickerSets#92b4494c to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.searchEmojiStickerSets#92b4494c: field flags: %w", err) + } + } + s.ExcludeFeatured = s.Flags.Has(0) + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode messages.searchEmojiStickerSets#92b4494c: field q: %w", err) + } + s.Q = value + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode messages.searchEmojiStickerSets#92b4494c: field hash: %w", err) + } + s.Hash = value + } + return nil +} + +// SetExcludeFeatured sets value of ExcludeFeatured conditional field. +func (s *MessagesSearchEmojiStickerSetsRequest) SetExcludeFeatured(value bool) { + if value { + s.Flags.Set(0) + s.ExcludeFeatured = true + } else { + s.Flags.Unset(0) + s.ExcludeFeatured = false + } +} + +// GetExcludeFeatured returns value of ExcludeFeatured conditional field. +func (s *MessagesSearchEmojiStickerSetsRequest) GetExcludeFeatured() (value bool) { + if s == nil { + return + } + return s.Flags.Has(0) +} + +// GetQ returns value of Q field. +func (s *MessagesSearchEmojiStickerSetsRequest) GetQ() (value string) { + if s == nil { + return + } + return s.Q +} + +// GetHash returns value of Hash field. +func (s *MessagesSearchEmojiStickerSetsRequest) GetHash() (value int64) { + if s == nil { + return + } + return s.Hash +} + +// MessagesSearchEmojiStickerSets invokes method messages.searchEmojiStickerSets#92b4494c returning error if any. +// +// See https://core.telegram.org/method/messages.searchEmojiStickerSets for reference. +func (c *Client) MessagesSearchEmojiStickerSets(ctx context.Context, request *MessagesSearchEmojiStickerSetsRequest) (MessagesFoundStickerSetsClass, error) { + var result MessagesFoundStickerSetsBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.FoundStickerSets, nil +} diff --git a/tg/tl_messages_search_emoji_sticker_sets_slices_gen.go b/tg/tl_messages_search_emoji_sticker_sets_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_search_emoji_sticker_sets_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_messages_search_gen.go b/tg/tl_messages_search_gen.go index 0bfbb0b3e6..d8fb9b0c40 100644 --- a/tg/tl_messages_search_gen.go +++ b/tg/tl_messages_search_gen.go @@ -32,7 +32,7 @@ var ( ) // MessagesSearchRequest represents TL type `messages.search#a0fda762`. -// Returns found messages +// Search for messages. // // See https://core.telegram.org/method/messages.search for reference. type MessagesSearchRequest struct { @@ -41,11 +41,14 @@ type MessagesSearchRequest struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // User or chat, histories with which are searched, or (inputPeerEmpty)¹ constructor for - // global search + // User or chat, histories with which are searched, or (inputPeerEmpty)¹ constructor to + // search in all private chats and normal groups (not channels) »². Use messages + // searchGlobal³ to search globally in all chats, groups, supergroups and channels. // // Links: // 1) https://core.telegram.org/constructor/inputPeerEmpty + // 2) https://core.telegram.org/api/channel + // 3) https://core.telegram.org/method/messages.searchGlobal Peer InputPeerClass // Text search request Q string @@ -588,7 +591,7 @@ func (s *MessagesSearchRequest) GetHash() (value int64) { } // MessagesSearch invokes method messages.search#a0fda762 returning error if any. -// Returns found messages +// Search for messages. // // Possible errors: // diff --git a/tg/tl_messages_send_media_gen.go b/tg/tl_messages_send_media_gen.go index 1e99820423..95d708e248 100644 --- a/tg/tl_messages_send_media_gen.go +++ b/tg/tl_messages_send_media_gen.go @@ -58,7 +58,8 @@ type MessagesSendMediaRequest struct { // Links: // 1) https://core.telegram.org/api/stickers#recent-stickersets UpdateStickersetsOrder bool - // InvertMedia field of MessagesSendMediaRequest. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // Destination Peer InputPeerClass diff --git a/tg/tl_messages_send_message_gen.go b/tg/tl_messages_send_message_gen.go index b089329918..125396043c 100644 --- a/tg/tl_messages_send_message_gen.go +++ b/tg/tl_messages_send_message_gen.go @@ -60,7 +60,8 @@ type MessagesSendMessageRequest struct { // Links: // 1) https://core.telegram.org/api/stickers#recent-stickersets UpdateStickersetsOrder bool - // InvertMedia field of MessagesSendMessageRequest. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // The destination where the message will be sent Peer InputPeerClass @@ -786,6 +787,7 @@ func (s *MessagesSendMessageRequest) MapEntities() (value MessageEntityClassArra // // Possible errors: // +// 400 ADMIN_RIGHTS_EMPTY: // 400 BOT_DOMAIN_INVALID: Bot domain invalid. // 400 BOT_INVALID: This is not a valid bot. // 400 BUTTON_DATA_INVALID: The data of one or more of the buttons you provided is invalid. diff --git a/tg/tl_messages_send_multi_media_gen.go b/tg/tl_messages_send_multi_media_gen.go index 53cf228040..84154be5e1 100644 --- a/tg/tl_messages_send_multi_media_gen.go +++ b/tg/tl_messages_send_multi_media_gen.go @@ -64,7 +64,8 @@ type MessagesSendMultiMediaRequest struct { // Links: // 1) https://core.telegram.org/api/stickers#recent-stickersets UpdateStickersetsOrder bool - // InvertMedia field of MessagesSendMultiMediaRequest. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // The destination chat Peer InputPeerClass diff --git a/tg/tl_messages_send_reaction_gen.go b/tg/tl_messages_send_reaction_gen.go index a608d58496..62c334c80b 100644 --- a/tg/tl_messages_send_reaction_gen.go +++ b/tg/tl_messages_send_reaction_gen.go @@ -380,6 +380,7 @@ func (s *MessagesSendReactionRequest) MapReaction() (value ReactionClassArray, o // 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat. +// 400 CUSTOM_REACTIONS_TOO_MANY: // 400 MESSAGE_ID_INVALID: The provided message id is invalid. // 400 MESSAGE_NOT_MODIFIED: The provided message data is identical to the previous message data, the message wasn't modified. // 400 MSG_ID_INVALID: Invalid message ID provided. diff --git a/tg/tl_messages_set_chat_wall_paper_gen.go b/tg/tl_messages_set_chat_wall_paper_gen.go index 16ee031b2a..3a8ca7e4a0 100644 --- a/tg/tl_messages_set_chat_wall_paper_gen.go +++ b/tg/tl_messages_set_chat_wall_paper_gen.go @@ -44,6 +44,16 @@ type MessagesSetChatWallPaperRequest struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields + // Only for Premium¹ users, sets the specified wallpaper for both users of the chat, + // without requiring confirmation from the other user. + // + // Links: + // 1) https://core.telegram.org/api/premium + ForBoth bool + // If we don't like the new wallpaper the other user of the chat has chosen for us using + // the for_both flag, we can re-set our previous wallpaper just on our side using this + // flag. + Revert bool // The private chat where the wallpaper will be set Peer InputPeerClass // The wallpaper »¹, obtained as described in the wallpaper documentation »²; must @@ -94,6 +104,12 @@ func (s *MessagesSetChatWallPaperRequest) Zero() bool { if !(s.Flags.Zero()) { return false } + if !(s.ForBoth == false) { + return false + } + if !(s.Revert == false) { + return false + } if !(s.Peer == nil) { return false } @@ -121,11 +137,15 @@ func (s *MessagesSetChatWallPaperRequest) String() string { // FillFrom fills MessagesSetChatWallPaperRequest from given interface. func (s *MessagesSetChatWallPaperRequest) FillFrom(from interface { + GetForBoth() (value bool) + GetRevert() (value bool) GetPeer() (value InputPeerClass) GetWallpaper() (value InputWallPaperClass, ok bool) GetSettings() (value WallPaperSettings, ok bool) GetID() (value int, ok bool) }) { + s.ForBoth = from.GetForBoth() + s.Revert = from.GetRevert() s.Peer = from.GetPeer() if val, ok := from.GetWallpaper(); ok { s.Wallpaper = val @@ -164,6 +184,16 @@ func (s *MessagesSetChatWallPaperRequest) TypeInfo() tdp.Type { return typ } typ.Fields = []tdp.Field{ + { + Name: "ForBoth", + SchemaName: "for_both", + Null: !s.Flags.Has(3), + }, + { + Name: "Revert", + SchemaName: "revert", + Null: !s.Flags.Has(4), + }, { Name: "Peer", SchemaName: "peer", @@ -189,6 +219,12 @@ func (s *MessagesSetChatWallPaperRequest) TypeInfo() tdp.Type { // SetFlags sets flags for non-zero fields. func (s *MessagesSetChatWallPaperRequest) SetFlags() { + if !(s.ForBoth == false) { + s.Flags.Set(3) + } + if !(s.Revert == false) { + s.Flags.Set(4) + } if !(s.Wallpaper == nil) { s.Flags.Set(0) } @@ -264,6 +300,8 @@ func (s *MessagesSetChatWallPaperRequest) DecodeBare(b *bin.Buffer) error { return fmt.Errorf("unable to decode messages.setChatWallPaper#8ffacae1: field flags: %w", err) } } + s.ForBoth = s.Flags.Has(3) + s.Revert = s.Flags.Has(4) { value, err := DecodeInputPeer(b) if err != nil { @@ -293,6 +331,44 @@ func (s *MessagesSetChatWallPaperRequest) DecodeBare(b *bin.Buffer) error { return nil } +// SetForBoth sets value of ForBoth conditional field. +func (s *MessagesSetChatWallPaperRequest) SetForBoth(value bool) { + if value { + s.Flags.Set(3) + s.ForBoth = true + } else { + s.Flags.Unset(3) + s.ForBoth = false + } +} + +// GetForBoth returns value of ForBoth conditional field. +func (s *MessagesSetChatWallPaperRequest) GetForBoth() (value bool) { + if s == nil { + return + } + return s.Flags.Has(3) +} + +// SetRevert sets value of Revert conditional field. +func (s *MessagesSetChatWallPaperRequest) SetRevert(value bool) { + if value { + s.Flags.Set(4) + s.Revert = true + } else { + s.Flags.Unset(4) + s.Revert = false + } +} + +// GetRevert returns value of Revert conditional field. +func (s *MessagesSetChatWallPaperRequest) GetRevert() (value bool) { + if s == nil { + return + } + return s.Flags.Has(4) +} + // GetPeer returns value of Peer field. func (s *MessagesSetChatWallPaperRequest) GetPeer() (value InputPeerClass) { if s == nil { @@ -365,6 +441,7 @@ func (s *MessagesSetChatWallPaperRequest) GetID() (value int, ok bool) { // // 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 WALLPAPER_INVALID: The specified wallpaper is invalid. +// 400 WALLPAPER_NOT_FOUND: // // See https://core.telegram.org/method/messages.setChatWallPaper for reference. // Can be used by bots. diff --git a/tg/tl_messages_set_inline_bot_results_gen.go b/tg/tl_messages_set_inline_bot_results_gen.go index 0569c4b262..ff925dea39 100644 --- a/tg/tl_messages_set_inline_bot_results_gen.go +++ b/tg/tl_messages_set_inline_bot_results_gen.go @@ -66,10 +66,11 @@ type MessagesSetInlineBotResultsRequest struct { // Use SetSwitchPm and GetSwitchPm helpers. SwitchPm InlineBotSwitchPM // If passed, clients will display a button on top of the remaining inline result list - // with the specified text, that switches the user to the specified bot mini app¹. + // with the specified text, that switches the user to the specified inline mode mini + // app¹. // // Links: - // 1) https://core.telegram.org/api/bots/webapps#simple-mini-apps + // 1) https://core.telegram.org/api/bots/webapps#inline-mode-mini-apps // // Use SetSwitchWebview and GetSwitchWebview helpers. SwitchWebview InlineBotWebView diff --git a/tg/tl_messages_transcribe_audio_gen.go b/tg/tl_messages_transcribe_audio_gen.go index bf2cd47b0a..fe6f65d040 100644 --- a/tg/tl_messages_transcribe_audio_gen.go +++ b/tg/tl_messages_transcribe_audio_gen.go @@ -204,6 +204,7 @@ func (t *MessagesTranscribeAudioRequest) GetMsgID() (value int) { // // Possible errors: // +// 400 PEER_ID_INVALID: The provided peer id is invalid. // 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. // 400 TRANSCRIPTION_FAILED: Audio transcription failed. // diff --git a/tg/tl_messages_transcribed_audio_gen.go b/tg/tl_messages_transcribed_audio_gen.go index e819fe2488..730565dacd 100644 --- a/tg/tl_messages_transcribed_audio_gen.go +++ b/tg/tl_messages_transcribed_audio_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesTranscribedAudio represents TL type `messages.transcribedAudio#93752c52`. +// MessagesTranscribedAudio represents TL type `messages.transcribedAudio#cfb9d957`. // Transcribed text from a voice message »¹ // // Links: @@ -55,10 +55,18 @@ type MessagesTranscribedAudio struct { TranscriptionID int64 // Transcripted text Text string + // TrialRemainsNum field of MessagesTranscribedAudio. + // + // Use SetTrialRemainsNum and GetTrialRemainsNum helpers. + TrialRemainsNum int + // TrialRemainsUntilDate field of MessagesTranscribedAudio. + // + // Use SetTrialRemainsUntilDate and GetTrialRemainsUntilDate helpers. + TrialRemainsUntilDate int } // MessagesTranscribedAudioTypeID is TL type id of MessagesTranscribedAudio. -const MessagesTranscribedAudioTypeID = 0x93752c52 +const MessagesTranscribedAudioTypeID = 0xcfb9d957 // Ensuring interfaces in compile-time for MessagesTranscribedAudio. var ( @@ -84,6 +92,12 @@ func (t *MessagesTranscribedAudio) Zero() bool { if !(t.Text == "") { return false } + if !(t.TrialRemainsNum == 0) { + return false + } + if !(t.TrialRemainsUntilDate == 0) { + return false + } return true } @@ -102,10 +116,20 @@ func (t *MessagesTranscribedAudio) FillFrom(from interface { GetPending() (value bool) GetTranscriptionID() (value int64) GetText() (value string) + GetTrialRemainsNum() (value int, ok bool) + GetTrialRemainsUntilDate() (value int, ok bool) }) { t.Pending = from.GetPending() t.TranscriptionID = from.GetTranscriptionID() t.Text = from.GetText() + if val, ok := from.GetTrialRemainsNum(); ok { + t.TrialRemainsNum = val + } + + if val, ok := from.GetTrialRemainsUntilDate(); ok { + t.TrialRemainsUntilDate = val + } + } // TypeID returns type id in TL schema. @@ -144,6 +168,16 @@ func (t *MessagesTranscribedAudio) TypeInfo() tdp.Type { Name: "Text", SchemaName: "text", }, + { + Name: "TrialRemainsNum", + SchemaName: "trial_remains_num", + Null: !t.Flags.Has(1), + }, + { + Name: "TrialRemainsUntilDate", + SchemaName: "trial_remains_until_date", + Null: !t.Flags.Has(1), + }, } return typ } @@ -153,12 +187,18 @@ func (t *MessagesTranscribedAudio) SetFlags() { if !(t.Pending == false) { t.Flags.Set(0) } + if !(t.TrialRemainsNum == 0) { + t.Flags.Set(1) + } + if !(t.TrialRemainsUntilDate == 0) { + t.Flags.Set(1) + } } // Encode implements bin.Encoder. func (t *MessagesTranscribedAudio) Encode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode messages.transcribedAudio#93752c52 as nil") + return fmt.Errorf("can't encode messages.transcribedAudio#cfb9d957 as nil") } b.PutID(MessagesTranscribedAudioTypeID) return t.EncodeBare(b) @@ -167,24 +207,30 @@ func (t *MessagesTranscribedAudio) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (t *MessagesTranscribedAudio) EncodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't encode messages.transcribedAudio#93752c52 as nil") + return fmt.Errorf("can't encode messages.transcribedAudio#cfb9d957 as nil") } t.SetFlags() if err := t.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messages.transcribedAudio#93752c52: field flags: %w", err) + return fmt.Errorf("unable to encode messages.transcribedAudio#cfb9d957: field flags: %w", err) } b.PutLong(t.TranscriptionID) b.PutString(t.Text) + if t.Flags.Has(1) { + b.PutInt(t.TrialRemainsNum) + } + if t.Flags.Has(1) { + b.PutInt(t.TrialRemainsUntilDate) + } return nil } // Decode implements bin.Decoder. func (t *MessagesTranscribedAudio) Decode(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode messages.transcribedAudio#93752c52 to nil") + return fmt.Errorf("can't decode messages.transcribedAudio#cfb9d957 to nil") } if err := b.ConsumeID(MessagesTranscribedAudioTypeID); err != nil { - return fmt.Errorf("unable to decode messages.transcribedAudio#93752c52: %w", err) + return fmt.Errorf("unable to decode messages.transcribedAudio#cfb9d957: %w", err) } return t.DecodeBare(b) } @@ -192,28 +238,42 @@ func (t *MessagesTranscribedAudio) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (t *MessagesTranscribedAudio) DecodeBare(b *bin.Buffer) error { if t == nil { - return fmt.Errorf("can't decode messages.transcribedAudio#93752c52 to nil") + return fmt.Errorf("can't decode messages.transcribedAudio#cfb9d957 to nil") } { if err := t.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messages.transcribedAudio#93752c52: field flags: %w", err) + return fmt.Errorf("unable to decode messages.transcribedAudio#cfb9d957: field flags: %w", err) } } t.Pending = t.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messages.transcribedAudio#93752c52: field transcription_id: %w", err) + return fmt.Errorf("unable to decode messages.transcribedAudio#cfb9d957: field transcription_id: %w", err) } t.TranscriptionID = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.transcribedAudio#93752c52: field text: %w", err) + return fmt.Errorf("unable to decode messages.transcribedAudio#cfb9d957: field text: %w", err) } t.Text = value } + if t.Flags.Has(1) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.transcribedAudio#cfb9d957: field trial_remains_num: %w", err) + } + t.TrialRemainsNum = value + } + if t.Flags.Has(1) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode messages.transcribedAudio#cfb9d957: field trial_remains_until_date: %w", err) + } + t.TrialRemainsUntilDate = value + } return nil } @@ -251,3 +311,39 @@ func (t *MessagesTranscribedAudio) GetText() (value string) { } return t.Text } + +// SetTrialRemainsNum sets value of TrialRemainsNum conditional field. +func (t *MessagesTranscribedAudio) SetTrialRemainsNum(value int) { + t.Flags.Set(1) + t.TrialRemainsNum = value +} + +// GetTrialRemainsNum returns value of TrialRemainsNum conditional field and +// boolean which is true if field was set. +func (t *MessagesTranscribedAudio) GetTrialRemainsNum() (value int, ok bool) { + if t == nil { + return + } + if !t.Flags.Has(1) { + return value, false + } + return t.TrialRemainsNum, true +} + +// SetTrialRemainsUntilDate sets value of TrialRemainsUntilDate conditional field. +func (t *MessagesTranscribedAudio) SetTrialRemainsUntilDate(value int) { + t.Flags.Set(1) + t.TrialRemainsUntilDate = value +} + +// GetTrialRemainsUntilDate returns value of TrialRemainsUntilDate conditional field and +// boolean which is true if field was set. +func (t *MessagesTranscribedAudio) GetTrialRemainsUntilDate() (value int, ok bool) { + if t == nil { + return + } + if !t.Flags.Has(1) { + return value, false + } + return t.TrialRemainsUntilDate, true +} diff --git a/tg/tl_my_boost_gen.go b/tg/tl_my_boost_gen.go index 623e3973d5..d43b6abef0 100644 --- a/tg/tl_my_boost_gen.go +++ b/tg/tl_my_boost_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/constructor/myBoost for reference. type MyBoost struct { - // Flags field of MyBoost. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Slot field of MyBoost. Slot int diff --git a/tg/tl_payments_apply_gift_code_gen.go b/tg/tl_payments_apply_gift_code_gen.go index 1b35a1cef1..ecf94ec85f 100644 --- a/tg/tl_payments_apply_gift_code_gen.go +++ b/tg/tl_payments_apply_gift_code_gen.go @@ -162,6 +162,10 @@ func (a *PaymentsApplyGiftCodeRequest) GetSlug() (value string) { // PaymentsApplyGiftCode invokes method payments.applyGiftCode#f6e26854 returning error if any. // +// Possible errors: +// +// 406 GIFTCODE_NOT_ALLOWED: +// // See https://core.telegram.org/method/payments.applyGiftCode for reference. func (c *Client) PaymentsApplyGiftCode(ctx context.Context, slug string) (UpdatesClass, error) { var result UpdatesBox diff --git a/tg/tl_payments_check_gift_code_gen.go b/tg/tl_payments_check_gift_code_gen.go index a35f02d0e2..6b88d94907 100644 --- a/tg/tl_payments_check_gift_code_gen.go +++ b/tg/tl_payments_check_gift_code_gen.go @@ -162,6 +162,10 @@ func (c *PaymentsCheckGiftCodeRequest) GetSlug() (value string) { // PaymentsCheckGiftCode invokes method payments.checkGiftCode#8e51b4c1 returning error if any. // +// Possible errors: +// +// 400 GIFT_SLUG_INVALID: +// // See https://core.telegram.org/method/payments.checkGiftCode for reference. func (c *Client) PaymentsCheckGiftCode(ctx context.Context, slug string) (*PaymentsCheckedGiftCode, error) { var result PaymentsCheckedGiftCode diff --git a/tg/tl_payments_checked_gift_code_gen.go b/tg/tl_payments_checked_gift_code_gen.go index a75c3d563c..26441c9814 100644 --- a/tg/tl_payments_checked_gift_code_gen.go +++ b/tg/tl_payments_checked_gift_code_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/constructor/payments.checkedGiftCode for reference. type PaymentsCheckedGiftCode struct { - // Flags field of PaymentsCheckedGiftCode. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // ViaGiveaway field of PaymentsCheckedGiftCode. ViaGiveaway bool diff --git a/tg/tl_payments_get_giveaway_info_gen.go b/tg/tl_payments_get_giveaway_info_gen.go index 34f65a6130..7e6ec8604f 100644 --- a/tg/tl_payments_get_giveaway_info_gen.go +++ b/tg/tl_payments_get_giveaway_info_gen.go @@ -194,6 +194,10 @@ func (g *PaymentsGetGiveawayInfoRequest) GetMsgID() (value int) { // PaymentsGetGiveawayInfo invokes method payments.getGiveawayInfo#f4239425 returning error if any. // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/payments.getGiveawayInfo for reference. func (c *Client) PaymentsGetGiveawayInfo(ctx context.Context, request *PaymentsGetGiveawayInfoRequest) (PaymentsGiveawayInfoClass, error) { var result PaymentsGiveawayInfoBox diff --git a/tg/tl_payments_get_premium_gift_code_options_gen.go b/tg/tl_payments_get_premium_gift_code_options_gen.go index ec3a3cc812..ac63eb45f0 100644 --- a/tg/tl_payments_get_premium_gift_code_options_gen.go +++ b/tg/tl_payments_get_premium_gift_code_options_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/method/payments.getPremiumGiftCodeOptions for reference. type PaymentsGetPremiumGiftCodeOptionsRequest struct { - // Flags field of PaymentsGetPremiumGiftCodeOptionsRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // BoostPeer field of PaymentsGetPremiumGiftCodeOptionsRequest. // diff --git a/tg/tl_payments_giveaway_info_gen.go b/tg/tl_payments_giveaway_info_gen.go index 697e60412f..47bce0dc8e 100644 --- a/tg/tl_payments_giveaway_info_gen.go +++ b/tg/tl_payments_giveaway_info_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/constructor/payments.giveawayInfo for reference. type PaymentsGiveawayInfo struct { - // Flags field of PaymentsGiveawayInfo. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Participating field of PaymentsGiveawayInfo. Participating bool @@ -401,7 +404,10 @@ func (g *PaymentsGiveawayInfo) GetDisallowedCountry() (value string, ok bool) { // // See https://core.telegram.org/constructor/payments.giveawayInfoResults for reference. type PaymentsGiveawayInfoResults struct { - // Flags field of PaymentsGiveawayInfoResults. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Winner field of PaymentsGiveawayInfoResults. Winner bool diff --git a/tg/tl_payments_launch_prepaid_giveaway_gen.go b/tg/tl_payments_launch_prepaid_giveaway_gen.go index fe97ba60f1..ce847fae98 100644 --- a/tg/tl_payments_launch_prepaid_giveaway_gen.go +++ b/tg/tl_payments_launch_prepaid_giveaway_gen.go @@ -226,6 +226,10 @@ func (l *PaymentsLaunchPrepaidGiveawayRequest) GetPurpose() (value InputStorePay // PaymentsLaunchPrepaidGiveaway invokes method payments.launchPrepaidGiveaway#5ff58f20 returning error if any. // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/payments.launchPrepaidGiveaway for reference. func (c *Client) PaymentsLaunchPrepaidGiveaway(ctx context.Context, request *PaymentsLaunchPrepaidGiveawayRequest) (UpdatesClass, error) { var result UpdatesBox diff --git a/tg/tl_peer_color_gen.go b/tg/tl_peer_color_gen.go new file mode 100644 index 0000000000..a0d5c32701 --- /dev/null +++ b/tg/tl_peer_color_gen.go @@ -0,0 +1,251 @@ +// 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{} +) + +// PeerColor represents TL type `peerColor#b54b5acf`. +// +// See https://core.telegram.org/constructor/peerColor for reference. +type PeerColor struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Color field of PeerColor. + // + // Use SetColor and GetColor helpers. + Color int + // BackgroundEmojiID field of PeerColor. + // + // Use SetBackgroundEmojiID and GetBackgroundEmojiID helpers. + BackgroundEmojiID int64 +} + +// PeerColorTypeID is TL type id of PeerColor. +const PeerColorTypeID = 0xb54b5acf + +// Ensuring interfaces in compile-time for PeerColor. +var ( + _ bin.Encoder = &PeerColor{} + _ bin.Decoder = &PeerColor{} + _ bin.BareEncoder = &PeerColor{} + _ bin.BareDecoder = &PeerColor{} +) + +func (p *PeerColor) Zero() bool { + if p == nil { + return true + } + if !(p.Flags.Zero()) { + return false + } + if !(p.Color == 0) { + return false + } + if !(p.BackgroundEmojiID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *PeerColor) String() string { + if p == nil { + return "PeerColor(nil)" + } + type Alias PeerColor + return fmt.Sprintf("PeerColor%+v", Alias(*p)) +} + +// FillFrom fills PeerColor from given interface. +func (p *PeerColor) FillFrom(from interface { + GetColor() (value int, ok bool) + GetBackgroundEmojiID() (value int64, ok bool) +}) { + if val, ok := from.GetColor(); ok { + p.Color = val + } + + if val, ok := from.GetBackgroundEmojiID(); ok { + p.BackgroundEmojiID = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PeerColor) TypeID() uint32 { + return PeerColorTypeID +} + +// TypeName returns name of type in TL schema. +func (*PeerColor) TypeName() string { + return "peerColor" +} + +// TypeInfo returns info about TL type. +func (p *PeerColor) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "peerColor", + ID: PeerColorTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Color", + SchemaName: "color", + Null: !p.Flags.Has(0), + }, + { + Name: "BackgroundEmojiID", + SchemaName: "background_emoji_id", + Null: !p.Flags.Has(1), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (p *PeerColor) SetFlags() { + if !(p.Color == 0) { + p.Flags.Set(0) + } + if !(p.BackgroundEmojiID == 0) { + p.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (p *PeerColor) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode peerColor#b54b5acf as nil") + } + b.PutID(PeerColorTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PeerColor) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode peerColor#b54b5acf as nil") + } + p.SetFlags() + if err := p.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode peerColor#b54b5acf: field flags: %w", err) + } + if p.Flags.Has(0) { + b.PutInt(p.Color) + } + if p.Flags.Has(1) { + b.PutLong(p.BackgroundEmojiID) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PeerColor) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode peerColor#b54b5acf to nil") + } + if err := b.ConsumeID(PeerColorTypeID); err != nil { + return fmt.Errorf("unable to decode peerColor#b54b5acf: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PeerColor) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode peerColor#b54b5acf to nil") + } + { + if err := p.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode peerColor#b54b5acf: field flags: %w", err) + } + } + if p.Flags.Has(0) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode peerColor#b54b5acf: field color: %w", err) + } + p.Color = value + } + if p.Flags.Has(1) { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode peerColor#b54b5acf: field background_emoji_id: %w", err) + } + p.BackgroundEmojiID = value + } + return nil +} + +// SetColor sets value of Color conditional field. +func (p *PeerColor) SetColor(value int) { + p.Flags.Set(0) + p.Color = value +} + +// GetColor returns value of Color conditional field and +// boolean which is true if field was set. +func (p *PeerColor) GetColor() (value int, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(0) { + return value, false + } + return p.Color, true +} + +// SetBackgroundEmojiID sets value of BackgroundEmojiID conditional field. +func (p *PeerColor) SetBackgroundEmojiID(value int64) { + p.Flags.Set(1) + p.BackgroundEmojiID = value +} + +// GetBackgroundEmojiID returns value of BackgroundEmojiID conditional field and +// boolean which is true if field was set. +func (p *PeerColor) GetBackgroundEmojiID() (value int64, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(1) { + return value, false + } + return p.BackgroundEmojiID, true +} diff --git a/tg/tl_peer_color_slices_gen.go b/tg/tl_peer_color_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_peer_color_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_photos_get_user_photos_gen.go b/tg/tl_photos_get_user_photos_gen.go index ca6431fd95..9634df012f 100644 --- a/tg/tl_photos_get_user_photos_gen.go +++ b/tg/tl_photos_get_user_photos_gen.go @@ -41,7 +41,13 @@ type PhotosGetUserPhotosRequest struct { // Number of list elements to be skipped Offset int // If a positive value was transferred, the method will return only photos with IDs less - // than the set one + // than the set one. This parameter is often useful when refetching file references »¹, + // as in conjuction with limit=1 and offset=-1 the photo² object with the id specified + // in max_id can be fetched. + // + // Links: + // 1) https://core.telegram.org/api/file_reference + // 2) https://core.telegram.org/constructor/photo MaxID int64 // Number of list elements to be returned Limit int diff --git a/tg/tl_post_interaction_counters_gen.go b/tg/tl_post_interaction_counters_gen.go new file mode 100644 index 0000000000..025ff5b2f0 --- /dev/null +++ b/tg/tl_post_interaction_counters_gen.go @@ -0,0 +1,560 @@ +// 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{} +) + +// PostInteractionCountersMessage represents TL type `postInteractionCountersMessage#e7058e7f`. +// +// See https://core.telegram.org/constructor/postInteractionCountersMessage for reference. +type PostInteractionCountersMessage struct { + // MsgID field of PostInteractionCountersMessage. + MsgID int + // Views field of PostInteractionCountersMessage. + Views int + // Forwards field of PostInteractionCountersMessage. + Forwards int + // Reactions field of PostInteractionCountersMessage. + Reactions int +} + +// PostInteractionCountersMessageTypeID is TL type id of PostInteractionCountersMessage. +const PostInteractionCountersMessageTypeID = 0xe7058e7f + +// construct implements constructor of PostInteractionCountersClass. +func (p PostInteractionCountersMessage) construct() PostInteractionCountersClass { return &p } + +// Ensuring interfaces in compile-time for PostInteractionCountersMessage. +var ( + _ bin.Encoder = &PostInteractionCountersMessage{} + _ bin.Decoder = &PostInteractionCountersMessage{} + _ bin.BareEncoder = &PostInteractionCountersMessage{} + _ bin.BareDecoder = &PostInteractionCountersMessage{} + + _ PostInteractionCountersClass = &PostInteractionCountersMessage{} +) + +func (p *PostInteractionCountersMessage) Zero() bool { + if p == nil { + return true + } + if !(p.MsgID == 0) { + return false + } + if !(p.Views == 0) { + return false + } + if !(p.Forwards == 0) { + return false + } + if !(p.Reactions == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *PostInteractionCountersMessage) String() string { + if p == nil { + return "PostInteractionCountersMessage(nil)" + } + type Alias PostInteractionCountersMessage + return fmt.Sprintf("PostInteractionCountersMessage%+v", Alias(*p)) +} + +// FillFrom fills PostInteractionCountersMessage from given interface. +func (p *PostInteractionCountersMessage) FillFrom(from interface { + GetMsgID() (value int) + GetViews() (value int) + GetForwards() (value int) + GetReactions() (value int) +}) { + p.MsgID = from.GetMsgID() + p.Views = from.GetViews() + p.Forwards = from.GetForwards() + p.Reactions = from.GetReactions() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PostInteractionCountersMessage) TypeID() uint32 { + return PostInteractionCountersMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*PostInteractionCountersMessage) TypeName() string { + return "postInteractionCountersMessage" +} + +// TypeInfo returns info about TL type. +func (p *PostInteractionCountersMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "postInteractionCountersMessage", + ID: PostInteractionCountersMessageTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "MsgID", + SchemaName: "msg_id", + }, + { + Name: "Views", + SchemaName: "views", + }, + { + Name: "Forwards", + SchemaName: "forwards", + }, + { + Name: "Reactions", + SchemaName: "reactions", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *PostInteractionCountersMessage) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode postInteractionCountersMessage#e7058e7f as nil") + } + b.PutID(PostInteractionCountersMessageTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PostInteractionCountersMessage) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode postInteractionCountersMessage#e7058e7f as nil") + } + b.PutInt(p.MsgID) + b.PutInt(p.Views) + b.PutInt(p.Forwards) + b.PutInt(p.Reactions) + return nil +} + +// Decode implements bin.Decoder. +func (p *PostInteractionCountersMessage) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode postInteractionCountersMessage#e7058e7f to nil") + } + if err := b.ConsumeID(PostInteractionCountersMessageTypeID); err != nil { + return fmt.Errorf("unable to decode postInteractionCountersMessage#e7058e7f: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PostInteractionCountersMessage) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode postInteractionCountersMessage#e7058e7f to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode postInteractionCountersMessage#e7058e7f: field msg_id: %w", err) + } + p.MsgID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode postInteractionCountersMessage#e7058e7f: field views: %w", err) + } + p.Views = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode postInteractionCountersMessage#e7058e7f: field forwards: %w", err) + } + p.Forwards = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode postInteractionCountersMessage#e7058e7f: field reactions: %w", err) + } + p.Reactions = value + } + return nil +} + +// GetMsgID returns value of MsgID field. +func (p *PostInteractionCountersMessage) GetMsgID() (value int) { + if p == nil { + return + } + return p.MsgID +} + +// GetViews returns value of Views field. +func (p *PostInteractionCountersMessage) GetViews() (value int) { + if p == nil { + return + } + return p.Views +} + +// GetForwards returns value of Forwards field. +func (p *PostInteractionCountersMessage) GetForwards() (value int) { + if p == nil { + return + } + return p.Forwards +} + +// GetReactions returns value of Reactions field. +func (p *PostInteractionCountersMessage) GetReactions() (value int) { + if p == nil { + return + } + return p.Reactions +} + +// PostInteractionCountersStory represents TL type `postInteractionCountersStory#8a480e27`. +// +// See https://core.telegram.org/constructor/postInteractionCountersStory for reference. +type PostInteractionCountersStory struct { + // StoryID field of PostInteractionCountersStory. + StoryID int + // Views field of PostInteractionCountersStory. + Views int + // Forwards field of PostInteractionCountersStory. + Forwards int + // Reactions field of PostInteractionCountersStory. + Reactions int +} + +// PostInteractionCountersStoryTypeID is TL type id of PostInteractionCountersStory. +const PostInteractionCountersStoryTypeID = 0x8a480e27 + +// construct implements constructor of PostInteractionCountersClass. +func (p PostInteractionCountersStory) construct() PostInteractionCountersClass { return &p } + +// Ensuring interfaces in compile-time for PostInteractionCountersStory. +var ( + _ bin.Encoder = &PostInteractionCountersStory{} + _ bin.Decoder = &PostInteractionCountersStory{} + _ bin.BareEncoder = &PostInteractionCountersStory{} + _ bin.BareDecoder = &PostInteractionCountersStory{} + + _ PostInteractionCountersClass = &PostInteractionCountersStory{} +) + +func (p *PostInteractionCountersStory) Zero() bool { + if p == nil { + return true + } + if !(p.StoryID == 0) { + return false + } + if !(p.Views == 0) { + return false + } + if !(p.Forwards == 0) { + return false + } + if !(p.Reactions == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *PostInteractionCountersStory) String() string { + if p == nil { + return "PostInteractionCountersStory(nil)" + } + type Alias PostInteractionCountersStory + return fmt.Sprintf("PostInteractionCountersStory%+v", Alias(*p)) +} + +// FillFrom fills PostInteractionCountersStory from given interface. +func (p *PostInteractionCountersStory) FillFrom(from interface { + GetStoryID() (value int) + GetViews() (value int) + GetForwards() (value int) + GetReactions() (value int) +}) { + p.StoryID = from.GetStoryID() + p.Views = from.GetViews() + p.Forwards = from.GetForwards() + p.Reactions = from.GetReactions() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PostInteractionCountersStory) TypeID() uint32 { + return PostInteractionCountersStoryTypeID +} + +// TypeName returns name of type in TL schema. +func (*PostInteractionCountersStory) TypeName() string { + return "postInteractionCountersStory" +} + +// TypeInfo returns info about TL type. +func (p *PostInteractionCountersStory) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "postInteractionCountersStory", + ID: PostInteractionCountersStoryTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "StoryID", + SchemaName: "story_id", + }, + { + Name: "Views", + SchemaName: "views", + }, + { + Name: "Forwards", + SchemaName: "forwards", + }, + { + Name: "Reactions", + SchemaName: "reactions", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *PostInteractionCountersStory) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode postInteractionCountersStory#8a480e27 as nil") + } + b.PutID(PostInteractionCountersStoryTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PostInteractionCountersStory) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode postInteractionCountersStory#8a480e27 as nil") + } + b.PutInt(p.StoryID) + b.PutInt(p.Views) + b.PutInt(p.Forwards) + b.PutInt(p.Reactions) + return nil +} + +// Decode implements bin.Decoder. +func (p *PostInteractionCountersStory) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode postInteractionCountersStory#8a480e27 to nil") + } + if err := b.ConsumeID(PostInteractionCountersStoryTypeID); err != nil { + return fmt.Errorf("unable to decode postInteractionCountersStory#8a480e27: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PostInteractionCountersStory) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode postInteractionCountersStory#8a480e27 to nil") + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode postInteractionCountersStory#8a480e27: field story_id: %w", err) + } + p.StoryID = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode postInteractionCountersStory#8a480e27: field views: %w", err) + } + p.Views = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode postInteractionCountersStory#8a480e27: field forwards: %w", err) + } + p.Forwards = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode postInteractionCountersStory#8a480e27: field reactions: %w", err) + } + p.Reactions = value + } + return nil +} + +// GetStoryID returns value of StoryID field. +func (p *PostInteractionCountersStory) GetStoryID() (value int) { + if p == nil { + return + } + return p.StoryID +} + +// GetViews returns value of Views field. +func (p *PostInteractionCountersStory) GetViews() (value int) { + if p == nil { + return + } + return p.Views +} + +// GetForwards returns value of Forwards field. +func (p *PostInteractionCountersStory) GetForwards() (value int) { + if p == nil { + return + } + return p.Forwards +} + +// GetReactions returns value of Reactions field. +func (p *PostInteractionCountersStory) GetReactions() (value int) { + if p == nil { + return + } + return p.Reactions +} + +// PostInteractionCountersClassName is schema name of PostInteractionCountersClass. +const PostInteractionCountersClassName = "PostInteractionCounters" + +// PostInteractionCountersClass represents PostInteractionCounters generic type. +// +// See https://core.telegram.org/type/PostInteractionCounters for reference. +// +// Example: +// +// g, err := tg.DecodePostInteractionCounters(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.PostInteractionCountersMessage: // postInteractionCountersMessage#e7058e7f +// case *tg.PostInteractionCountersStory: // postInteractionCountersStory#8a480e27 +// default: panic(v) +// } +type PostInteractionCountersClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() PostInteractionCountersClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool + + // Views field of PostInteractionCountersMessage. + GetViews() (value int) + + // Forwards field of PostInteractionCountersMessage. + GetForwards() (value int) + + // Reactions field of PostInteractionCountersMessage. + GetReactions() (value int) +} + +// DecodePostInteractionCounters implements binary de-serialization for PostInteractionCountersClass. +func DecodePostInteractionCounters(buf *bin.Buffer) (PostInteractionCountersClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case PostInteractionCountersMessageTypeID: + // Decoding postInteractionCountersMessage#e7058e7f. + v := PostInteractionCountersMessage{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PostInteractionCountersClass: %w", err) + } + return &v, nil + case PostInteractionCountersStoryTypeID: + // Decoding postInteractionCountersStory#8a480e27. + v := PostInteractionCountersStory{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PostInteractionCountersClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode PostInteractionCountersClass: %w", bin.NewUnexpectedID(id)) + } +} + +// PostInteractionCounters boxes the PostInteractionCountersClass providing a helper. +type PostInteractionCountersBox struct { + PostInteractionCounters PostInteractionCountersClass +} + +// Decode implements bin.Decoder for PostInteractionCountersBox. +func (b *PostInteractionCountersBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode PostInteractionCountersBox to nil") + } + v, err := DecodePostInteractionCounters(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.PostInteractionCounters = v + return nil +} + +// Encode implements bin.Encode for PostInteractionCountersBox. +func (b *PostInteractionCountersBox) Encode(buf *bin.Buffer) error { + if b == nil || b.PostInteractionCounters == nil { + return fmt.Errorf("unable to encode PostInteractionCountersClass as nil") + } + return b.PostInteractionCounters.Encode(buf) +} diff --git a/tg/tl_post_interaction_counters_slices_gen.go b/tg/tl_post_interaction_counters_slices_gen.go new file mode 100644 index 0000000000..3a55e192c9 --- /dev/null +++ b/tg/tl_post_interaction_counters_slices_gen.go @@ -0,0 +1,307 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "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{} +) + +// PostInteractionCountersClassArray is adapter for slice of PostInteractionCountersClass. +type PostInteractionCountersClassArray []PostInteractionCountersClass + +// Sort sorts slice of PostInteractionCountersClass. +func (s PostInteractionCountersClassArray) Sort(less func(a, b PostInteractionCountersClass) bool) PostInteractionCountersClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of PostInteractionCountersClass. +func (s PostInteractionCountersClassArray) SortStable(less func(a, b PostInteractionCountersClass) bool) PostInteractionCountersClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of PostInteractionCountersClass. +func (s PostInteractionCountersClassArray) Retain(keep func(x PostInteractionCountersClass) bool) PostInteractionCountersClassArray { + 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 PostInteractionCountersClassArray) First() (v PostInteractionCountersClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s PostInteractionCountersClassArray) Last() (v PostInteractionCountersClass, 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 *PostInteractionCountersClassArray) PopFirst() (v PostInteractionCountersClass, 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 PostInteractionCountersClass + 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 *PostInteractionCountersClassArray) Pop() (v PostInteractionCountersClass, 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 +} + +// AsPostInteractionCountersMessage returns copy with only PostInteractionCountersMessage constructors. +func (s PostInteractionCountersClassArray) AsPostInteractionCountersMessage() (to PostInteractionCountersMessageArray) { + for _, elem := range s { + value, ok := elem.(*PostInteractionCountersMessage) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsPostInteractionCountersStory returns copy with only PostInteractionCountersStory constructors. +func (s PostInteractionCountersClassArray) AsPostInteractionCountersStory() (to PostInteractionCountersStoryArray) { + for _, elem := range s { + value, ok := elem.(*PostInteractionCountersStory) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// PostInteractionCountersMessageArray is adapter for slice of PostInteractionCountersMessage. +type PostInteractionCountersMessageArray []PostInteractionCountersMessage + +// Sort sorts slice of PostInteractionCountersMessage. +func (s PostInteractionCountersMessageArray) Sort(less func(a, b PostInteractionCountersMessage) bool) PostInteractionCountersMessageArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of PostInteractionCountersMessage. +func (s PostInteractionCountersMessageArray) SortStable(less func(a, b PostInteractionCountersMessage) bool) PostInteractionCountersMessageArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of PostInteractionCountersMessage. +func (s PostInteractionCountersMessageArray) Retain(keep func(x PostInteractionCountersMessage) bool) PostInteractionCountersMessageArray { + 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 PostInteractionCountersMessageArray) First() (v PostInteractionCountersMessage, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s PostInteractionCountersMessageArray) Last() (v PostInteractionCountersMessage, 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 *PostInteractionCountersMessageArray) PopFirst() (v PostInteractionCountersMessage, 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 PostInteractionCountersMessage + 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 *PostInteractionCountersMessageArray) Pop() (v PostInteractionCountersMessage, 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 +} + +// PostInteractionCountersStoryArray is adapter for slice of PostInteractionCountersStory. +type PostInteractionCountersStoryArray []PostInteractionCountersStory + +// Sort sorts slice of PostInteractionCountersStory. +func (s PostInteractionCountersStoryArray) Sort(less func(a, b PostInteractionCountersStory) bool) PostInteractionCountersStoryArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of PostInteractionCountersStory. +func (s PostInteractionCountersStoryArray) SortStable(less func(a, b PostInteractionCountersStory) bool) PostInteractionCountersStoryArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of PostInteractionCountersStory. +func (s PostInteractionCountersStoryArray) Retain(keep func(x PostInteractionCountersStory) bool) PostInteractionCountersStoryArray { + 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 PostInteractionCountersStoryArray) First() (v PostInteractionCountersStory, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s PostInteractionCountersStoryArray) Last() (v PostInteractionCountersStory, 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 *PostInteractionCountersStoryArray) PopFirst() (v PostInteractionCountersStory, 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 PostInteractionCountersStory + 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 *PostInteractionCountersStoryArray) Pop() (v PostInteractionCountersStory, 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_premium_apply_boost_gen.go b/tg/tl_premium_apply_boost_gen.go index fb948c65f6..b651ebd192 100644 --- a/tg/tl_premium_apply_boost_gen.go +++ b/tg/tl_premium_apply_boost_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/method/premium.applyBoost for reference. type PremiumApplyBoostRequest struct { - // Flags field of PremiumApplyBoostRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Slots field of PremiumApplyBoostRequest. // @@ -246,6 +249,10 @@ func (a *PremiumApplyBoostRequest) GetPeer() (value InputPeerClass) { // PremiumApplyBoost invokes method premium.applyBoost#6b7da746 returning error if any. // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/premium.applyBoost for reference. func (c *Client) PremiumApplyBoost(ctx context.Context, request *PremiumApplyBoostRequest) (*PremiumMyBoosts, error) { var result PremiumMyBoosts diff --git a/tg/tl_premium_boosts_list_gen.go b/tg/tl_premium_boosts_list_gen.go index 75e2df60f5..27bf994aed 100644 --- a/tg/tl_premium_boosts_list_gen.go +++ b/tg/tl_premium_boosts_list_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/constructor/premium.boostsList for reference. type PremiumBoostsList struct { - // Flags field of PremiumBoostsList. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Count field of PremiumBoostsList. Count int diff --git a/tg/tl_premium_boosts_status_gen.go b/tg/tl_premium_boosts_status_gen.go index 1d3ad1f1bc..af958a191a 100644 --- a/tg/tl_premium_boosts_status_gen.go +++ b/tg/tl_premium_boosts_status_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/constructor/premium.boostsStatus for reference. type PremiumBoostsStatus struct { - // Flags field of PremiumBoostsStatus. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // MyBoost field of PremiumBoostsStatus. MyBoost bool diff --git a/tg/tl_premium_get_boosts_list_gen.go b/tg/tl_premium_get_boosts_list_gen.go index a758789f49..6d7649442e 100644 --- a/tg/tl_premium_get_boosts_list_gen.go +++ b/tg/tl_premium_get_boosts_list_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/method/premium.getBoostsList for reference. type PremiumGetBoostsListRequest struct { - // Flags field of PremiumGetBoostsListRequest. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Gifts field of PremiumGetBoostsListRequest. Gifts bool @@ -43,7 +46,10 @@ type PremiumGetBoostsListRequest struct { Peer InputPeerClass // Offset field of PremiumGetBoostsListRequest. Offset string - // Limit field of PremiumGetBoostsListRequest. + // Maximum number of results to return, see pagination¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets Limit int } @@ -274,6 +280,10 @@ func (g *PremiumGetBoostsListRequest) GetLimit() (value int) { // PremiumGetBoostsList invokes method premium.getBoostsList#60f67660 returning error if any. // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/premium.getBoostsList for reference. func (c *Client) PremiumGetBoostsList(ctx context.Context, request *PremiumGetBoostsListRequest) (*PremiumBoostsList, error) { var result PremiumBoostsList diff --git a/tg/tl_premium_get_boosts_status_gen.go b/tg/tl_premium_get_boosts_status_gen.go index 29331f21a2..2a2e995961 100644 --- a/tg/tl_premium_get_boosts_status_gen.go +++ b/tg/tl_premium_get_boosts_status_gen.go @@ -167,6 +167,10 @@ func (g *PremiumGetBoostsStatusRequest) GetPeer() (value InputPeerClass) { // PremiumGetBoostsStatus invokes method premium.getBoostsStatus#42f1f61 returning error if any. // +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// // See https://core.telegram.org/method/premium.getBoostsStatus for reference. func (c *Client) PremiumGetBoostsStatus(ctx context.Context, peer InputPeerClass) (*PremiumBoostsStatus, error) { var result PremiumBoostsStatus diff --git a/tg/tl_premium_get_user_boosts_gen.go b/tg/tl_premium_get_user_boosts_gen.go new file mode 100644 index 0000000000..bf38056a55 --- /dev/null +++ b/tg/tl_premium_get_user_boosts_gen.go @@ -0,0 +1,215 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "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{} +) + +// PremiumGetUserBoostsRequest represents TL type `premium.getUserBoosts#39854d1f`. +// +// See https://core.telegram.org/method/premium.getUserBoosts for reference. +type PremiumGetUserBoostsRequest struct { + // Peer field of PremiumGetUserBoostsRequest. + Peer InputPeerClass + // UserID field of PremiumGetUserBoostsRequest. + UserID InputUserClass +} + +// PremiumGetUserBoostsRequestTypeID is TL type id of PremiumGetUserBoostsRequest. +const PremiumGetUserBoostsRequestTypeID = 0x39854d1f + +// Ensuring interfaces in compile-time for PremiumGetUserBoostsRequest. +var ( + _ bin.Encoder = &PremiumGetUserBoostsRequest{} + _ bin.Decoder = &PremiumGetUserBoostsRequest{} + _ bin.BareEncoder = &PremiumGetUserBoostsRequest{} + _ bin.BareDecoder = &PremiumGetUserBoostsRequest{} +) + +func (g *PremiumGetUserBoostsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Peer == nil) { + return false + } + if !(g.UserID == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *PremiumGetUserBoostsRequest) String() string { + if g == nil { + return "PremiumGetUserBoostsRequest(nil)" + } + type Alias PremiumGetUserBoostsRequest + return fmt.Sprintf("PremiumGetUserBoostsRequest%+v", Alias(*g)) +} + +// FillFrom fills PremiumGetUserBoostsRequest from given interface. +func (g *PremiumGetUserBoostsRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetUserID() (value InputUserClass) +}) { + g.Peer = from.GetPeer() + g.UserID = from.GetUserID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PremiumGetUserBoostsRequest) TypeID() uint32 { + return PremiumGetUserBoostsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*PremiumGetUserBoostsRequest) TypeName() string { + return "premium.getUserBoosts" +} + +// TypeInfo returns info about TL type. +func (g *PremiumGetUserBoostsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "premium.getUserBoosts", + ID: PremiumGetUserBoostsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "UserID", + SchemaName: "user_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *PremiumGetUserBoostsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode premium.getUserBoosts#39854d1f as nil") + } + b.PutID(PremiumGetUserBoostsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *PremiumGetUserBoostsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode premium.getUserBoosts#39854d1f as nil") + } + if g.Peer == nil { + return fmt.Errorf("unable to encode premium.getUserBoosts#39854d1f: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode premium.getUserBoosts#39854d1f: field peer: %w", err) + } + if g.UserID == nil { + return fmt.Errorf("unable to encode premium.getUserBoosts#39854d1f: field user_id is nil") + } + if err := g.UserID.Encode(b); err != nil { + return fmt.Errorf("unable to encode premium.getUserBoosts#39854d1f: field user_id: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *PremiumGetUserBoostsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode premium.getUserBoosts#39854d1f to nil") + } + if err := b.ConsumeID(PremiumGetUserBoostsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode premium.getUserBoosts#39854d1f: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *PremiumGetUserBoostsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode premium.getUserBoosts#39854d1f to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode premium.getUserBoosts#39854d1f: field peer: %w", err) + } + g.Peer = value + } + { + value, err := DecodeInputUser(b) + if err != nil { + return fmt.Errorf("unable to decode premium.getUserBoosts#39854d1f: field user_id: %w", err) + } + g.UserID = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (g *PremiumGetUserBoostsRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// GetUserID returns value of UserID field. +func (g *PremiumGetUserBoostsRequest) GetUserID() (value InputUserClass) { + if g == nil { + return + } + return g.UserID +} + +// PremiumGetUserBoosts invokes method premium.getUserBoosts#39854d1f returning error if any. +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// +// See https://core.telegram.org/method/premium.getUserBoosts for reference. +// Can be used by bots. +func (c *Client) PremiumGetUserBoosts(ctx context.Context, request *PremiumGetUserBoostsRequest) (*PremiumBoostsList, error) { + var result PremiumBoostsList + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_premium_get_user_boosts_slices_gen.go b/tg/tl_premium_get_user_boosts_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_premium_get_user_boosts_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_premium_gift_code_option_gen.go b/tg/tl_premium_gift_code_option_gen.go index d19ad8991a..48637b969e 100644 --- a/tg/tl_premium_gift_code_option_gen.go +++ b/tg/tl_premium_gift_code_option_gen.go @@ -35,7 +35,10 @@ var ( // // See https://core.telegram.org/constructor/premiumGiftCodeOption for reference. type PremiumGiftCodeOption struct { - // Flags field of PremiumGiftCodeOption. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Users field of PremiumGiftCodeOption. Users int diff --git a/tg/tl_public_forward_gen.go b/tg/tl_public_forward_gen.go new file mode 100644 index 0000000000..950d344eb8 --- /dev/null +++ b/tg/tl_public_forward_gen.go @@ -0,0 +1,431 @@ +// 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{} +) + +// PublicForwardMessage represents TL type `publicForwardMessage#1f2bf4a`. +// +// See https://core.telegram.org/constructor/publicForwardMessage for reference. +type PublicForwardMessage struct { + // Message field of PublicForwardMessage. + Message MessageClass +} + +// PublicForwardMessageTypeID is TL type id of PublicForwardMessage. +const PublicForwardMessageTypeID = 0x1f2bf4a + +// construct implements constructor of PublicForwardClass. +func (p PublicForwardMessage) construct() PublicForwardClass { return &p } + +// Ensuring interfaces in compile-time for PublicForwardMessage. +var ( + _ bin.Encoder = &PublicForwardMessage{} + _ bin.Decoder = &PublicForwardMessage{} + _ bin.BareEncoder = &PublicForwardMessage{} + _ bin.BareDecoder = &PublicForwardMessage{} + + _ PublicForwardClass = &PublicForwardMessage{} +) + +func (p *PublicForwardMessage) Zero() bool { + if p == nil { + return true + } + if !(p.Message == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *PublicForwardMessage) String() string { + if p == nil { + return "PublicForwardMessage(nil)" + } + type Alias PublicForwardMessage + return fmt.Sprintf("PublicForwardMessage%+v", Alias(*p)) +} + +// FillFrom fills PublicForwardMessage from given interface. +func (p *PublicForwardMessage) FillFrom(from interface { + GetMessage() (value MessageClass) +}) { + p.Message = from.GetMessage() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PublicForwardMessage) TypeID() uint32 { + return PublicForwardMessageTypeID +} + +// TypeName returns name of type in TL schema. +func (*PublicForwardMessage) TypeName() string { + return "publicForwardMessage" +} + +// TypeInfo returns info about TL type. +func (p *PublicForwardMessage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "publicForwardMessage", + ID: PublicForwardMessageTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Message", + SchemaName: "message", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *PublicForwardMessage) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode publicForwardMessage#1f2bf4a as nil") + } + b.PutID(PublicForwardMessageTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PublicForwardMessage) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode publicForwardMessage#1f2bf4a as nil") + } + if p.Message == nil { + return fmt.Errorf("unable to encode publicForwardMessage#1f2bf4a: field message is nil") + } + if err := p.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode publicForwardMessage#1f2bf4a: field message: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PublicForwardMessage) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode publicForwardMessage#1f2bf4a to nil") + } + if err := b.ConsumeID(PublicForwardMessageTypeID); err != nil { + return fmt.Errorf("unable to decode publicForwardMessage#1f2bf4a: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PublicForwardMessage) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode publicForwardMessage#1f2bf4a to nil") + } + { + value, err := DecodeMessage(b) + if err != nil { + return fmt.Errorf("unable to decode publicForwardMessage#1f2bf4a: field message: %w", err) + } + p.Message = value + } + return nil +} + +// GetMessage returns value of Message field. +func (p *PublicForwardMessage) GetMessage() (value MessageClass) { + if p == nil { + return + } + return p.Message +} + +// PublicForwardStory represents TL type `publicForwardStory#edf3add0`. +// +// See https://core.telegram.org/constructor/publicForwardStory for reference. +type PublicForwardStory struct { + // Peer field of PublicForwardStory. + Peer PeerClass + // Story field of PublicForwardStory. + Story StoryItemClass +} + +// PublicForwardStoryTypeID is TL type id of PublicForwardStory. +const PublicForwardStoryTypeID = 0xedf3add0 + +// construct implements constructor of PublicForwardClass. +func (p PublicForwardStory) construct() PublicForwardClass { return &p } + +// Ensuring interfaces in compile-time for PublicForwardStory. +var ( + _ bin.Encoder = &PublicForwardStory{} + _ bin.Decoder = &PublicForwardStory{} + _ bin.BareEncoder = &PublicForwardStory{} + _ bin.BareDecoder = &PublicForwardStory{} + + _ PublicForwardClass = &PublicForwardStory{} +) + +func (p *PublicForwardStory) Zero() bool { + if p == nil { + return true + } + if !(p.Peer == nil) { + return false + } + if !(p.Story == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *PublicForwardStory) String() string { + if p == nil { + return "PublicForwardStory(nil)" + } + type Alias PublicForwardStory + return fmt.Sprintf("PublicForwardStory%+v", Alias(*p)) +} + +// FillFrom fills PublicForwardStory from given interface. +func (p *PublicForwardStory) FillFrom(from interface { + GetPeer() (value PeerClass) + GetStory() (value StoryItemClass) +}) { + p.Peer = from.GetPeer() + p.Story = from.GetStory() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*PublicForwardStory) TypeID() uint32 { + return PublicForwardStoryTypeID +} + +// TypeName returns name of type in TL schema. +func (*PublicForwardStory) TypeName() string { + return "publicForwardStory" +} + +// TypeInfo returns info about TL type. +func (p *PublicForwardStory) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "publicForwardStory", + ID: PublicForwardStoryTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Story", + SchemaName: "story", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (p *PublicForwardStory) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode publicForwardStory#edf3add0 as nil") + } + b.PutID(PublicForwardStoryTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *PublicForwardStory) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode publicForwardStory#edf3add0 as nil") + } + if p.Peer == nil { + return fmt.Errorf("unable to encode publicForwardStory#edf3add0: field peer is nil") + } + if err := p.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode publicForwardStory#edf3add0: field peer: %w", err) + } + if p.Story == nil { + return fmt.Errorf("unable to encode publicForwardStory#edf3add0: field story is nil") + } + if err := p.Story.Encode(b); err != nil { + return fmt.Errorf("unable to encode publicForwardStory#edf3add0: field story: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (p *PublicForwardStory) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode publicForwardStory#edf3add0 to nil") + } + if err := b.ConsumeID(PublicForwardStoryTypeID); err != nil { + return fmt.Errorf("unable to decode publicForwardStory#edf3add0: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *PublicForwardStory) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode publicForwardStory#edf3add0 to nil") + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode publicForwardStory#edf3add0: field peer: %w", err) + } + p.Peer = value + } + { + value, err := DecodeStoryItem(b) + if err != nil { + return fmt.Errorf("unable to decode publicForwardStory#edf3add0: field story: %w", err) + } + p.Story = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (p *PublicForwardStory) GetPeer() (value PeerClass) { + if p == nil { + return + } + return p.Peer +} + +// GetStory returns value of Story field. +func (p *PublicForwardStory) GetStory() (value StoryItemClass) { + if p == nil { + return + } + return p.Story +} + +// PublicForwardClassName is schema name of PublicForwardClass. +const PublicForwardClassName = "PublicForward" + +// PublicForwardClass represents PublicForward generic type. +// +// See https://core.telegram.org/type/PublicForward for reference. +// +// Example: +// +// g, err := tg.DecodePublicForward(buf) +// if err != nil { +// panic(err) +// } +// switch v := g.(type) { +// case *tg.PublicForwardMessage: // publicForwardMessage#1f2bf4a +// case *tg.PublicForwardStory: // publicForwardStory#edf3add0 +// default: panic(v) +// } +type PublicForwardClass interface { + bin.Encoder + bin.Decoder + bin.BareEncoder + bin.BareDecoder + construct() PublicForwardClass + + // TypeID returns type id in TL schema. + // + // See https://core.telegram.org/mtproto/TL-tl#remarks. + TypeID() uint32 + // TypeName returns name of type in TL schema. + TypeName() string + // String implements fmt.Stringer. + String() string + // Zero returns true if current object has a zero value. + Zero() bool +} + +// DecodePublicForward implements binary de-serialization for PublicForwardClass. +func DecodePublicForward(buf *bin.Buffer) (PublicForwardClass, error) { + id, err := buf.PeekID() + if err != nil { + return nil, err + } + switch id { + case PublicForwardMessageTypeID: + // Decoding publicForwardMessage#1f2bf4a. + v := PublicForwardMessage{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PublicForwardClass: %w", err) + } + return &v, nil + case PublicForwardStoryTypeID: + // Decoding publicForwardStory#edf3add0. + v := PublicForwardStory{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode PublicForwardClass: %w", err) + } + return &v, nil + default: + return nil, fmt.Errorf("unable to decode PublicForwardClass: %w", bin.NewUnexpectedID(id)) + } +} + +// PublicForward boxes the PublicForwardClass providing a helper. +type PublicForwardBox struct { + PublicForward PublicForwardClass +} + +// Decode implements bin.Decoder for PublicForwardBox. +func (b *PublicForwardBox) Decode(buf *bin.Buffer) error { + if b == nil { + return fmt.Errorf("unable to decode PublicForwardBox to nil") + } + v, err := DecodePublicForward(buf) + if err != nil { + return fmt.Errorf("unable to decode boxed value: %w", err) + } + b.PublicForward = v + return nil +} + +// Encode implements bin.Encode for PublicForwardBox. +func (b *PublicForwardBox) Encode(buf *bin.Buffer) error { + if b == nil || b.PublicForward == nil { + return fmt.Errorf("unable to encode PublicForwardClass as nil") + } + return b.PublicForward.Encode(buf) +} diff --git a/tg/tl_public_forward_slices_gen.go b/tg/tl_public_forward_slices_gen.go new file mode 100644 index 0000000000..fc89ae7dd3 --- /dev/null +++ b/tg/tl_public_forward_slices_gen.go @@ -0,0 +1,307 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "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{} +) + +// PublicForwardClassArray is adapter for slice of PublicForwardClass. +type PublicForwardClassArray []PublicForwardClass + +// Sort sorts slice of PublicForwardClass. +func (s PublicForwardClassArray) Sort(less func(a, b PublicForwardClass) bool) PublicForwardClassArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of PublicForwardClass. +func (s PublicForwardClassArray) SortStable(less func(a, b PublicForwardClass) bool) PublicForwardClassArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of PublicForwardClass. +func (s PublicForwardClassArray) Retain(keep func(x PublicForwardClass) bool) PublicForwardClassArray { + 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 PublicForwardClassArray) First() (v PublicForwardClass, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s PublicForwardClassArray) Last() (v PublicForwardClass, 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 *PublicForwardClassArray) PopFirst() (v PublicForwardClass, 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 PublicForwardClass + 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 *PublicForwardClassArray) Pop() (v PublicForwardClass, 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 +} + +// AsPublicForwardMessage returns copy with only PublicForwardMessage constructors. +func (s PublicForwardClassArray) AsPublicForwardMessage() (to PublicForwardMessageArray) { + for _, elem := range s { + value, ok := elem.(*PublicForwardMessage) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsPublicForwardStory returns copy with only PublicForwardStory constructors. +func (s PublicForwardClassArray) AsPublicForwardStory() (to PublicForwardStoryArray) { + for _, elem := range s { + value, ok := elem.(*PublicForwardStory) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// PublicForwardMessageArray is adapter for slice of PublicForwardMessage. +type PublicForwardMessageArray []PublicForwardMessage + +// Sort sorts slice of PublicForwardMessage. +func (s PublicForwardMessageArray) Sort(less func(a, b PublicForwardMessage) bool) PublicForwardMessageArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of PublicForwardMessage. +func (s PublicForwardMessageArray) SortStable(less func(a, b PublicForwardMessage) bool) PublicForwardMessageArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of PublicForwardMessage. +func (s PublicForwardMessageArray) Retain(keep func(x PublicForwardMessage) bool) PublicForwardMessageArray { + 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 PublicForwardMessageArray) First() (v PublicForwardMessage, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s PublicForwardMessageArray) Last() (v PublicForwardMessage, 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 *PublicForwardMessageArray) PopFirst() (v PublicForwardMessage, 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 PublicForwardMessage + 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 *PublicForwardMessageArray) Pop() (v PublicForwardMessage, 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 +} + +// PublicForwardStoryArray is adapter for slice of PublicForwardStory. +type PublicForwardStoryArray []PublicForwardStory + +// Sort sorts slice of PublicForwardStory. +func (s PublicForwardStoryArray) Sort(less func(a, b PublicForwardStory) bool) PublicForwardStoryArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of PublicForwardStory. +func (s PublicForwardStoryArray) SortStable(less func(a, b PublicForwardStory) bool) PublicForwardStoryArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of PublicForwardStory. +func (s PublicForwardStoryArray) Retain(keep func(x PublicForwardStory) bool) PublicForwardStoryArray { + 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 PublicForwardStoryArray) First() (v PublicForwardStory, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s PublicForwardStoryArray) Last() (v PublicForwardStory, 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 *PublicForwardStoryArray) PopFirst() (v PublicForwardStory, 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 PublicForwardStory + 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 *PublicForwardStoryArray) Pop() (v PublicForwardStory, 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_registry_gen.go b/tg/tl_registry_gen.go index 0c4ca40555..e5e294d013 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 166 +const Layer = 167 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -104,7 +104,7 @@ func TypesMap() map[uint32]string { StorageFileMp4TypeID: "storage.fileMp4#b3cea0e4", StorageFileWebpTypeID: "storage.fileWebp#1081464c", UserEmptyTypeID: "userEmpty#d3bc4b7a", - UserTypeID: "user#eb602f25", + UserTypeID: "user#215c4438", UserProfilePhotoEmptyTypeID: "userProfilePhotoEmpty#4f11bae1", UserProfilePhotoTypeID: "userProfilePhoto#82d1f706", UserStatusEmptyTypeID: "userStatusEmpty#9d05049", @@ -116,7 +116,7 @@ func TypesMap() map[uint32]string { ChatEmptyTypeID: "chatEmpty#29562865", ChatTypeID: "chat#41cbf256", ChatForbiddenTypeID: "chatForbidden#6592a1a7", - ChannelTypeID: "channel#1981ea7e", + ChannelTypeID: "channel#8e87ccd8", ChannelForbiddenTypeID: "channelForbidden#17d493d5", ChatFullTypeID: "chatFull#c9d31138", ChannelFullTypeID: "channelFull#723027bd", @@ -182,10 +182,10 @@ func TypesMap() map[uint32]string { MessageActionTopicEditTypeID: "messageActionTopicEdit#c0944820", MessageActionSuggestProfilePhotoTypeID: "messageActionSuggestProfilePhoto#57de635e", MessageActionRequestedPeerTypeID: "messageActionRequestedPeer#fe77345d", - MessageActionSetChatWallPaperTypeID: "messageActionSetChatWallPaper#bc44a927", - MessageActionSetSameChatWallPaperTypeID: "messageActionSetSameChatWallPaper#c0787d6d", + MessageActionSetChatWallPaperTypeID: "messageActionSetChatWallPaper#5060a3f4", MessageActionGiftCodeTypeID: "messageActionGiftCode#d2cfdb0e", MessageActionGiveawayLaunchTypeID: "messageActionGiveawayLaunch#332ba9ed", + MessageActionGiveawayResultsTypeID: "messageActionGiveawayResults#2a9fadc5", DialogTypeID: "dialog#d58a08c6", DialogFolderTypeID: "dialogFolder#71bd134c", PhotoEmptyTypeID: "photoEmpty#2331b22d", @@ -377,6 +377,9 @@ func TypesMap() map[uint32]string { UpdateStoryIDTypeID: "updateStoryID#1bf335b9", UpdateStoriesStealthModeTypeID: "updateStoriesStealthMode#2c084dc1", UpdateSentStoryReactionTypeID: "updateSentStoryReaction#7d627683", + UpdateBotChatBoostTypeID: "updateBotChatBoost#904dd49c", + UpdateChannelViewForumAsMessagesTypeID: "updateChannelViewForumAsMessages#7b68920", + UpdatePeerWallpaperTypeID: "updatePeerWallpaper#ae3f101d", UpdatesStateTypeID: "updates.state#a56c2a3e", UpdatesDifferenceEmptyTypeID: "updates.differenceEmpty#5d75a138", UpdatesDifferenceTypeID: "updates.difference#f49ca0", @@ -989,8 +992,7 @@ func TypesMap() map[uint32]string { StatsGraphAsyncTypeID: "statsGraphAsync#4a27eb2d", StatsGraphErrorTypeID: "statsGraphError#bedc9822", StatsGraphTypeID: "statsGraph#8ea464b6", - MessageInteractionCountersTypeID: "messageInteractionCounters#ad4fc9bd", - StatsBroadcastStatsTypeID: "stats.broadcastStats#bdf78394", + StatsBroadcastStatsTypeID: "stats.broadcastStats#396ca5fc", HelpPromoDataEmptyTypeID: "help.promoDataEmpty#98f6ac75", HelpPromoDataTypeID: "help.promoData#8c39793f", VideoSizeTypeID: "videoSize#de33b094", @@ -1008,11 +1010,11 @@ func TypesMap() map[uint32]string { MessageViewsTypeID: "messageViews#455b853d", MessagesMessageViewsTypeID: "messages.messageViews#b6c4f543", MessagesDiscussionMessageTypeID: "messages.discussionMessage#a6341782", - MessageReplyHeaderTypeID: "messageReplyHeader#6eebcabd", + MessageReplyHeaderTypeID: "messageReplyHeader#afbc09db", MessageReplyStoryHeaderTypeID: "messageReplyStoryHeader#9c98bfc1", MessageRepliesTypeID: "messageReplies#83d60fc2", PeerBlockedTypeID: "peerBlocked#e8fd8014", - StatsMessageStatsTypeID: "stats.messageStats#8999f295", + StatsMessageStatsTypeID: "stats.messageStats#7fe91c14", GroupCallDiscardedTypeID: "groupCallDiscarded#7780bcb4", GroupCallTypeID: "groupCall#d597650c", InputGroupCallTypeID: "inputGroupCall#d8aa840f", @@ -1051,7 +1053,7 @@ func TypesMap() map[uint32]string { AccountResetPasswordFailedWaitTypeID: "account.resetPasswordFailedWait#e3779861", AccountResetPasswordRequestedWaitTypeID: "account.resetPasswordRequestedWait#e9effc7d", AccountResetPasswordOkTypeID: "account.resetPasswordOk#e926d63e", - SponsoredMessageTypeID: "sponsoredMessage#daafff6b", + SponsoredMessageTypeID: "sponsoredMessage#ed5383f7", MessagesSponsoredMessagesTypeID: "messages.sponsoredMessages#c9ee1d87", MessagesSponsoredMessagesEmptyTypeID: "messages.sponsoredMessagesEmpty#1839490f", SearchResultsCalendarPeriodTypeID: "searchResultsCalendarPeriod#c9b0539f", @@ -1101,7 +1103,7 @@ func TypesMap() map[uint32]string { InputInvoiceSlugTypeID: "inputInvoiceSlug#c326caef", InputInvoicePremiumGiftCodeTypeID: "inputInvoicePremiumGiftCode#98986c0d", PaymentsExportedInvoiceTypeID: "payments.exportedInvoice#aed0cbd9", - MessagesTranscribedAudioTypeID: "messages.transcribedAudio#93752c52", + MessagesTranscribedAudioTypeID: "messages.transcribedAudio#cfb9d957", HelpPremiumPromoTypeID: "help.premiumPromo#5334759c", InputStorePaymentPremiumSubscriptionTypeID: "inputStorePaymentPremiumSubscription#a6751e66", InputStorePaymentGiftPremiumTypeID: "inputStorePaymentGiftPremium#616f7fe8", @@ -1179,14 +1181,14 @@ func TypesMap() map[uint32]string { StoryViewsTypeID: "storyViews#8d595cd6", StoryItemDeletedTypeID: "storyItemDeleted#51e6ee4f", StoryItemSkippedTypeID: "storyItemSkipped#ffadc913", - StoryItemTypeID: "storyItem#44c457ce", + StoryItemTypeID: "storyItem#af6365a1", StoriesAllStoriesNotModifiedTypeID: "stories.allStoriesNotModified#1158fe3e", StoriesAllStoriesTypeID: "stories.allStories#6efc5e81", StoriesStoriesTypeID: "stories.stories#5dd8c3c8", StoryViewTypeID: "storyView#b0bdeac5", StoriesStoryViewsListTypeID: "stories.storyViewsList#46e9b9ec", StoriesStoryViewsTypeID: "stories.storyViews#de9eed1d", - InputReplyToMessageTypeID: "inputReplyToMessage#73ec805", + InputReplyToMessageTypeID: "inputReplyToMessage#22c0f6d5", InputReplyToStoryTypeID: "inputReplyToStory#15b0f283", ExportedStoryLinkTypeID: "exportedStoryLink#3fc9053b", StoriesStealthModeTypeID: "storiesStealthMode#712e27fd", @@ -1208,6 +1210,19 @@ func TypesMap() map[uint32]string { MyBoostTypeID: "myBoost#c448415c", PremiumMyBoostsTypeID: "premium.myBoosts#9ae228e2", PremiumBoostsStatusTypeID: "premium.boostsStatus#4959427a", + StoryFwdHeaderTypeID: "storyFwdHeader#b826e150", + PostInteractionCountersMessageTypeID: "postInteractionCountersMessage#e7058e7f", + PostInteractionCountersStoryTypeID: "postInteractionCountersStory#8a480e27", + StatsStoryStatsTypeID: "stats.storyStats#50cd067c", + PublicForwardMessageTypeID: "publicForwardMessage#1f2bf4a", + PublicForwardStoryTypeID: "publicForwardStory#edf3add0", + StatsPublicForwardsTypeID: "stats.publicForwards#93037e20", + PeerColorTypeID: "peerColor#b54b5acf", + HelpPeerColorSetTypeID: "help.peerColorSet#26219a58", + HelpPeerColorProfileSetTypeID: "help.peerColorProfileSet#767d61eb", + HelpPeerColorOptionTypeID: "help.peerColorOption#135bd42f", + HelpPeerColorsNotModifiedTypeID: "help.peerColorsNotModified#2ba1f5ce", + HelpPeerColorsTypeID: "help.peerColors#f8ed08", InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d", InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0", InitConnectionRequestTypeID: "initConnection#c1cd5ea9", @@ -1325,7 +1340,7 @@ func TypesMap() map[uint32]string { AccountSaveAutoSaveSettingsRequestTypeID: "account.saveAutoSaveSettings#d69b8361", AccountDeleteAutoSaveExceptionsRequestTypeID: "account.deleteAutoSaveExceptions#53bc0020", AccountInvalidateSignInCodesRequestTypeID: "account.invalidateSignInCodes#ca8ae8ba", - AccountUpdateColorRequestTypeID: "account.updateColor#a001cc43", + AccountUpdateColorRequestTypeID: "account.updateColor#7cefa15d", AccountGetDefaultBackgroundEmojisRequestTypeID: "account.getDefaultBackgroundEmojis#a60ab9ce", UsersGetUsersRequestTypeID: "users.getUsers#d91a548", UsersGetFullUserRequestTypeID: "users.getFullUser#b60f5918", @@ -1542,6 +1557,7 @@ func TypesMap() map[uint32]string { MessagesGetBotAppRequestTypeID: "messages.getBotApp#34fdc5c3", MessagesRequestAppWebViewRequestTypeID: "messages.requestAppWebView#8c5a3b3c", MessagesSetChatWallPaperRequestTypeID: "messages.setChatWallPaper#8ffacae1", + MessagesSearchEmojiStickerSetsRequestTypeID: "messages.searchEmojiStickerSets#92b4494c", UpdatesGetStateRequestTypeID: "updates.getState#edd4882a", UpdatesGetDifferenceRequestTypeID: "updates.getDifference#19c2f763", UpdatesGetChannelDifferenceRequestTypeID: "updates.getChannelDifference#3173d78", @@ -1581,6 +1597,8 @@ func TypesMap() map[uint32]string { HelpDismissSuggestionRequestTypeID: "help.dismissSuggestion#f50dbaa1", HelpGetCountriesListRequestTypeID: "help.getCountriesList#735787a8", HelpGetPremiumPromoRequestTypeID: "help.getPremiumPromo#b81b93d4", + HelpGetPeerColorsRequestTypeID: "help.getPeerColors#da80f42f", + HelpGetPeerProfileColorsRequestTypeID: "help.getPeerProfileColors#abcfa9fd", ChannelsReadHistoryRequestTypeID: "channels.readHistory#cc104937", ChannelsDeleteMessagesRequestTypeID: "channels.deleteMessages#84c1fd4e", ChannelsReportSpamRequestTypeID: "channels.reportSpam#f44a8315", @@ -1638,6 +1656,8 @@ func TypesMap() map[uint32]string { ChannelsToggleParticipantsHiddenRequestTypeID: "channels.toggleParticipantsHidden#6a6e7854", ChannelsClickSponsoredMessageRequestTypeID: "channels.clickSponsoredMessage#18afbc93", ChannelsUpdateColorRequestTypeID: "channels.updateColor#621a201f", + ChannelsToggleViewForumAsMessagesRequestTypeID: "channels.toggleViewForumAsMessages#9738bb15", + ChannelsGetChannelRecommendationsRequestTypeID: "channels.getChannelRecommendations#83b70d97", BotsSendCustomRequestRequestTypeID: "bots.sendCustomRequest#aa2769ed", BotsAnswerWebhookJSONQueryRequestTypeID: "bots.answerWebhookJSONQuery#e6213f4d", BotsSetBotCommandsRequestTypeID: "bots.setBotCommands#517165a", @@ -1722,6 +1742,8 @@ func TypesMap() map[uint32]string { StatsGetMegagroupStatsRequestTypeID: "stats.getMegagroupStats#dcdf8607", StatsGetMessagePublicForwardsRequestTypeID: "stats.getMessagePublicForwards#5630281b", StatsGetMessageStatsRequestTypeID: "stats.getMessageStats#b6e0a3f5", + StatsGetStoryStatsRequestTypeID: "stats.getStoryStats#374fef40", + StatsGetStoryPublicForwardsRequestTypeID: "stats.getStoryPublicForwards#a6437ef6", ChatlistsExportChatlistInviteRequestTypeID: "chatlists.exportChatlistInvite#8472478e", ChatlistsDeleteExportedInviteRequestTypeID: "chatlists.deleteExportedInvite#719c5c5e", ChatlistsEditExportedInviteRequestTypeID: "chatlists.editExportedInvite#653db63d", @@ -1734,7 +1756,7 @@ func TypesMap() map[uint32]string { ChatlistsGetLeaveChatlistSuggestionsRequestTypeID: "chatlists.getLeaveChatlistSuggestions#fdbcd714", ChatlistsLeaveChatlistRequestTypeID: "chatlists.leaveChatlist#74fae13a", StoriesCanSendStoryRequestTypeID: "stories.canSendStory#c7dfdfdd", - StoriesSendStoryRequestTypeID: "stories.sendStory#bcb73644", + StoriesSendStoryRequestTypeID: "stories.sendStory#e4e6694b", StoriesEditStoryRequestTypeID: "stories.editStory#b583ba46", StoriesDeleteStoriesRequestTypeID: "stories.deleteStories#ae59db5f", StoriesTogglePinnedRequestTypeID: "stories.togglePinned#9a75a1ef", @@ -1760,6 +1782,7 @@ func TypesMap() map[uint32]string { PremiumGetMyBoostsRequestTypeID: "premium.getMyBoosts#be77b4a", PremiumApplyBoostRequestTypeID: "premium.applyBoost#6b7da746", PremiumGetBoostsStatusRequestTypeID: "premium.getBoostsStatus#42f1f61", + PremiumGetUserBoostsRequestTypeID: "premium.getUserBoosts#39854d1f", IntTypeID: "int#a8509bda", LongTypeID: "long#22076cba", DoubleTypeID: "double#2210c154", @@ -1925,9 +1948,9 @@ func NamesMap() map[string]uint32 { "messageActionSuggestProfilePhoto": MessageActionSuggestProfilePhotoTypeID, "messageActionRequestedPeer": MessageActionRequestedPeerTypeID, "messageActionSetChatWallPaper": MessageActionSetChatWallPaperTypeID, - "messageActionSetSameChatWallPaper": MessageActionSetSameChatWallPaperTypeID, "messageActionGiftCode": MessageActionGiftCodeTypeID, "messageActionGiveawayLaunch": MessageActionGiveawayLaunchTypeID, + "messageActionGiveawayResults": MessageActionGiveawayResultsTypeID, "dialog": DialogTypeID, "dialogFolder": DialogFolderTypeID, "photoEmpty": PhotoEmptyTypeID, @@ -2119,6 +2142,9 @@ func NamesMap() map[string]uint32 { "updateStoryID": UpdateStoryIDTypeID, "updateStoriesStealthMode": UpdateStoriesStealthModeTypeID, "updateSentStoryReaction": UpdateSentStoryReactionTypeID, + "updateBotChatBoost": UpdateBotChatBoostTypeID, + "updateChannelViewForumAsMessages": UpdateChannelViewForumAsMessagesTypeID, + "updatePeerWallpaper": UpdatePeerWallpaperTypeID, "updates.state": UpdatesStateTypeID, "updates.differenceEmpty": UpdatesDifferenceEmptyTypeID, "updates.difference": UpdatesDifferenceTypeID, @@ -2731,7 +2757,6 @@ func NamesMap() map[string]uint32 { "statsGraphAsync": StatsGraphAsyncTypeID, "statsGraphError": StatsGraphErrorTypeID, "statsGraph": StatsGraphTypeID, - "messageInteractionCounters": MessageInteractionCountersTypeID, "stats.broadcastStats": StatsBroadcastStatsTypeID, "help.promoDataEmpty": HelpPromoDataEmptyTypeID, "help.promoData": HelpPromoDataTypeID, @@ -2950,6 +2975,19 @@ func NamesMap() map[string]uint32 { "myBoost": MyBoostTypeID, "premium.myBoosts": PremiumMyBoostsTypeID, "premium.boostsStatus": PremiumBoostsStatusTypeID, + "storyFwdHeader": StoryFwdHeaderTypeID, + "postInteractionCountersMessage": PostInteractionCountersMessageTypeID, + "postInteractionCountersStory": PostInteractionCountersStoryTypeID, + "stats.storyStats": StatsStoryStatsTypeID, + "publicForwardMessage": PublicForwardMessageTypeID, + "publicForwardStory": PublicForwardStoryTypeID, + "stats.publicForwards": StatsPublicForwardsTypeID, + "peerColor": PeerColorTypeID, + "help.peerColorSet": HelpPeerColorSetTypeID, + "help.peerColorProfileSet": HelpPeerColorProfileSetTypeID, + "help.peerColorOption": HelpPeerColorOptionTypeID, + "help.peerColorsNotModified": HelpPeerColorsNotModifiedTypeID, + "help.peerColors": HelpPeerColorsTypeID, "invokeAfterMsg": InvokeAfterMsgRequestTypeID, "invokeAfterMsgs": InvokeAfterMsgsRequestTypeID, "initConnection": InitConnectionRequestTypeID, @@ -3284,6 +3322,7 @@ func NamesMap() map[string]uint32 { "messages.getBotApp": MessagesGetBotAppRequestTypeID, "messages.requestAppWebView": MessagesRequestAppWebViewRequestTypeID, "messages.setChatWallPaper": MessagesSetChatWallPaperRequestTypeID, + "messages.searchEmojiStickerSets": MessagesSearchEmojiStickerSetsRequestTypeID, "updates.getState": UpdatesGetStateRequestTypeID, "updates.getDifference": UpdatesGetDifferenceRequestTypeID, "updates.getChannelDifference": UpdatesGetChannelDifferenceRequestTypeID, @@ -3323,6 +3362,8 @@ func NamesMap() map[string]uint32 { "help.dismissSuggestion": HelpDismissSuggestionRequestTypeID, "help.getCountriesList": HelpGetCountriesListRequestTypeID, "help.getPremiumPromo": HelpGetPremiumPromoRequestTypeID, + "help.getPeerColors": HelpGetPeerColorsRequestTypeID, + "help.getPeerProfileColors": HelpGetPeerProfileColorsRequestTypeID, "channels.readHistory": ChannelsReadHistoryRequestTypeID, "channels.deleteMessages": ChannelsDeleteMessagesRequestTypeID, "channels.reportSpam": ChannelsReportSpamRequestTypeID, @@ -3380,6 +3421,8 @@ func NamesMap() map[string]uint32 { "channels.toggleParticipantsHidden": ChannelsToggleParticipantsHiddenRequestTypeID, "channels.clickSponsoredMessage": ChannelsClickSponsoredMessageRequestTypeID, "channels.updateColor": ChannelsUpdateColorRequestTypeID, + "channels.toggleViewForumAsMessages": ChannelsToggleViewForumAsMessagesRequestTypeID, + "channels.getChannelRecommendations": ChannelsGetChannelRecommendationsRequestTypeID, "bots.sendCustomRequest": BotsSendCustomRequestRequestTypeID, "bots.answerWebhookJSONQuery": BotsAnswerWebhookJSONQueryRequestTypeID, "bots.setBotCommands": BotsSetBotCommandsRequestTypeID, @@ -3464,6 +3507,8 @@ func NamesMap() map[string]uint32 { "stats.getMegagroupStats": StatsGetMegagroupStatsRequestTypeID, "stats.getMessagePublicForwards": StatsGetMessagePublicForwardsRequestTypeID, "stats.getMessageStats": StatsGetMessageStatsRequestTypeID, + "stats.getStoryStats": StatsGetStoryStatsRequestTypeID, + "stats.getStoryPublicForwards": StatsGetStoryPublicForwardsRequestTypeID, "chatlists.exportChatlistInvite": ChatlistsExportChatlistInviteRequestTypeID, "chatlists.deleteExportedInvite": ChatlistsDeleteExportedInviteRequestTypeID, "chatlists.editExportedInvite": ChatlistsEditExportedInviteRequestTypeID, @@ -3502,6 +3547,7 @@ func NamesMap() map[string]uint32 { "premium.getMyBoosts": PremiumGetMyBoostsRequestTypeID, "premium.applyBoost": PremiumApplyBoostRequestTypeID, "premium.getBoostsStatus": PremiumGetBoostsStatusRequestTypeID, + "premium.getUserBoosts": PremiumGetUserBoostsRequestTypeID, "int": IntTypeID, "long": LongTypeID, "double": DoubleTypeID, @@ -3667,9 +3713,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessageActionSuggestProfilePhotoTypeID: func() bin.Object { return &MessageActionSuggestProfilePhoto{} }, MessageActionRequestedPeerTypeID: func() bin.Object { return &MessageActionRequestedPeer{} }, MessageActionSetChatWallPaperTypeID: func() bin.Object { return &MessageActionSetChatWallPaper{} }, - MessageActionSetSameChatWallPaperTypeID: func() bin.Object { return &MessageActionSetSameChatWallPaper{} }, MessageActionGiftCodeTypeID: func() bin.Object { return &MessageActionGiftCode{} }, MessageActionGiveawayLaunchTypeID: func() bin.Object { return &MessageActionGiveawayLaunch{} }, + MessageActionGiveawayResultsTypeID: func() bin.Object { return &MessageActionGiveawayResults{} }, DialogTypeID: func() bin.Object { return &Dialog{} }, DialogFolderTypeID: func() bin.Object { return &DialogFolder{} }, PhotoEmptyTypeID: func() bin.Object { return &PhotoEmpty{} }, @@ -3861,6 +3907,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object { UpdateStoryIDTypeID: func() bin.Object { return &UpdateStoryID{} }, UpdateStoriesStealthModeTypeID: func() bin.Object { return &UpdateStoriesStealthMode{} }, UpdateSentStoryReactionTypeID: func() bin.Object { return &UpdateSentStoryReaction{} }, + UpdateBotChatBoostTypeID: func() bin.Object { return &UpdateBotChatBoost{} }, + UpdateChannelViewForumAsMessagesTypeID: func() bin.Object { return &UpdateChannelViewForumAsMessages{} }, + UpdatePeerWallpaperTypeID: func() bin.Object { return &UpdatePeerWallpaper{} }, UpdatesStateTypeID: func() bin.Object { return &UpdatesState{} }, UpdatesDifferenceEmptyTypeID: func() bin.Object { return &UpdatesDifferenceEmpty{} }, UpdatesDifferenceTypeID: func() bin.Object { return &UpdatesDifference{} }, @@ -4473,7 +4522,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StatsGraphAsyncTypeID: func() bin.Object { return &StatsGraphAsync{} }, StatsGraphErrorTypeID: func() bin.Object { return &StatsGraphError{} }, StatsGraphTypeID: func() bin.Object { return &StatsGraph{} }, - MessageInteractionCountersTypeID: func() bin.Object { return &MessageInteractionCounters{} }, StatsBroadcastStatsTypeID: func() bin.Object { return &StatsBroadcastStats{} }, HelpPromoDataEmptyTypeID: func() bin.Object { return &HelpPromoDataEmpty{} }, HelpPromoDataTypeID: func() bin.Object { return &HelpPromoData{} }, @@ -4692,6 +4740,19 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MyBoostTypeID: func() bin.Object { return &MyBoost{} }, PremiumMyBoostsTypeID: func() bin.Object { return &PremiumMyBoosts{} }, PremiumBoostsStatusTypeID: func() bin.Object { return &PremiumBoostsStatus{} }, + StoryFwdHeaderTypeID: func() bin.Object { return &StoryFwdHeader{} }, + PostInteractionCountersMessageTypeID: func() bin.Object { return &PostInteractionCountersMessage{} }, + PostInteractionCountersStoryTypeID: func() bin.Object { return &PostInteractionCountersStory{} }, + StatsStoryStatsTypeID: func() bin.Object { return &StatsStoryStats{} }, + PublicForwardMessageTypeID: func() bin.Object { return &PublicForwardMessage{} }, + PublicForwardStoryTypeID: func() bin.Object { return &PublicForwardStory{} }, + StatsPublicForwardsTypeID: func() bin.Object { return &StatsPublicForwards{} }, + PeerColorTypeID: func() bin.Object { return &PeerColor{} }, + HelpPeerColorSetTypeID: func() bin.Object { return &HelpPeerColorSet{} }, + HelpPeerColorProfileSetTypeID: func() bin.Object { return &HelpPeerColorProfileSet{} }, + HelpPeerColorOptionTypeID: func() bin.Object { return &HelpPeerColorOption{} }, + HelpPeerColorsNotModifiedTypeID: func() bin.Object { return &HelpPeerColorsNotModified{} }, + HelpPeerColorsTypeID: func() bin.Object { return &HelpPeerColors{} }, InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} }, InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} }, InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} }, @@ -5026,6 +5087,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagesGetBotAppRequestTypeID: func() bin.Object { return &MessagesGetBotAppRequest{} }, MessagesRequestAppWebViewRequestTypeID: func() bin.Object { return &MessagesRequestAppWebViewRequest{} }, MessagesSetChatWallPaperRequestTypeID: func() bin.Object { return &MessagesSetChatWallPaperRequest{} }, + MessagesSearchEmojiStickerSetsRequestTypeID: func() bin.Object { return &MessagesSearchEmojiStickerSetsRequest{} }, UpdatesGetStateRequestTypeID: func() bin.Object { return &UpdatesGetStateRequest{} }, UpdatesGetDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetDifferenceRequest{} }, UpdatesGetChannelDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} }, @@ -5065,6 +5127,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { HelpDismissSuggestionRequestTypeID: func() bin.Object { return &HelpDismissSuggestionRequest{} }, HelpGetCountriesListRequestTypeID: func() bin.Object { return &HelpGetCountriesListRequest{} }, HelpGetPremiumPromoRequestTypeID: func() bin.Object { return &HelpGetPremiumPromoRequest{} }, + HelpGetPeerColorsRequestTypeID: func() bin.Object { return &HelpGetPeerColorsRequest{} }, + HelpGetPeerProfileColorsRequestTypeID: func() bin.Object { return &HelpGetPeerProfileColorsRequest{} }, ChannelsReadHistoryRequestTypeID: func() bin.Object { return &ChannelsReadHistoryRequest{} }, ChannelsDeleteMessagesRequestTypeID: func() bin.Object { return &ChannelsDeleteMessagesRequest{} }, ChannelsReportSpamRequestTypeID: func() bin.Object { return &ChannelsReportSpamRequest{} }, @@ -5122,6 +5186,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelsToggleParticipantsHiddenRequestTypeID: func() bin.Object { return &ChannelsToggleParticipantsHiddenRequest{} }, ChannelsClickSponsoredMessageRequestTypeID: func() bin.Object { return &ChannelsClickSponsoredMessageRequest{} }, ChannelsUpdateColorRequestTypeID: func() bin.Object { return &ChannelsUpdateColorRequest{} }, + ChannelsToggleViewForumAsMessagesRequestTypeID: func() bin.Object { return &ChannelsToggleViewForumAsMessagesRequest{} }, + ChannelsGetChannelRecommendationsRequestTypeID: func() bin.Object { return &ChannelsGetChannelRecommendationsRequest{} }, BotsSendCustomRequestRequestTypeID: func() bin.Object { return &BotsSendCustomRequestRequest{} }, BotsAnswerWebhookJSONQueryRequestTypeID: func() bin.Object { return &BotsAnswerWebhookJSONQueryRequest{} }, BotsSetBotCommandsRequestTypeID: func() bin.Object { return &BotsSetBotCommandsRequest{} }, @@ -5206,6 +5272,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StatsGetMegagroupStatsRequestTypeID: func() bin.Object { return &StatsGetMegagroupStatsRequest{} }, StatsGetMessagePublicForwardsRequestTypeID: func() bin.Object { return &StatsGetMessagePublicForwardsRequest{} }, StatsGetMessageStatsRequestTypeID: func() bin.Object { return &StatsGetMessageStatsRequest{} }, + StatsGetStoryStatsRequestTypeID: func() bin.Object { return &StatsGetStoryStatsRequest{} }, + StatsGetStoryPublicForwardsRequestTypeID: func() bin.Object { return &StatsGetStoryPublicForwardsRequest{} }, ChatlistsExportChatlistInviteRequestTypeID: func() bin.Object { return &ChatlistsExportChatlistInviteRequest{} }, ChatlistsDeleteExportedInviteRequestTypeID: func() bin.Object { return &ChatlistsDeleteExportedInviteRequest{} }, ChatlistsEditExportedInviteRequestTypeID: func() bin.Object { return &ChatlistsEditExportedInviteRequest{} }, @@ -5244,6 +5312,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { PremiumGetMyBoostsRequestTypeID: func() bin.Object { return &PremiumGetMyBoostsRequest{} }, PremiumApplyBoostRequestTypeID: func() bin.Object { return &PremiumApplyBoostRequest{} }, PremiumGetBoostsStatusRequestTypeID: func() bin.Object { return &PremiumGetBoostsStatusRequest{} }, + PremiumGetUserBoostsRequestTypeID: func() bin.Object { return &PremiumGetUserBoostsRequest{} }, IntTypeID: func() bin.Object { return &Int{} }, LongTypeID: func() bin.Object { return &Long{} }, DoubleTypeID: func() bin.Object { return &Double{} }, @@ -5609,6 +5678,14 @@ func ClassConstructorsMap() map[string][]uint32 { HelpPassportConfigNotModifiedTypeID, HelpPassportConfigTypeID, }, + HelpPeerColorSetClassName: { + HelpPeerColorSetTypeID, + HelpPeerColorProfileSetTypeID, + }, + HelpPeerColorsClassName: { + HelpPeerColorsNotModifiedTypeID, + HelpPeerColorsTypeID, + }, HelpPromoDataClassName: { HelpPromoDataEmptyTypeID, HelpPromoDataTypeID, @@ -5916,9 +5993,9 @@ func ClassConstructorsMap() map[string][]uint32 { MessageActionSuggestProfilePhotoTypeID, MessageActionRequestedPeerTypeID, MessageActionSetChatWallPaperTypeID, - MessageActionSetSameChatWallPaperTypeID, MessageActionGiftCodeTypeID, MessageActionGiveawayLaunchTypeID, + MessageActionGiveawayResultsTypeID, }, MessageClassName: { MessageEmptyTypeID, @@ -6183,6 +6260,10 @@ func ClassConstructorsMap() map[string][]uint32 { PhotosPhotosTypeID, PhotosPhotosSliceTypeID, }, + PostInteractionCountersClassName: { + PostInteractionCountersMessageTypeID, + PostInteractionCountersStoryTypeID, + }, PrivacyKeyClassName: { PrivacyKeyStatusTimestampTypeID, PrivacyKeyChatInviteTypeID, @@ -6206,6 +6287,10 @@ func ClassConstructorsMap() map[string][]uint32 { PrivacyValueDisallowChatParticipantsTypeID, PrivacyValueAllowCloseFriendsTypeID, }, + PublicForwardClassName: { + PublicForwardMessageTypeID, + PublicForwardStoryTypeID, + }, ReactionClassName: { ReactionEmptyTypeID, ReactionEmojiTypeID, @@ -6487,6 +6572,9 @@ func ClassConstructorsMap() map[string][]uint32 { UpdateStoryIDTypeID, UpdateStoriesStealthModeTypeID, UpdateSentStoryReactionTypeID, + UpdateBotChatBoostTypeID, + UpdateChannelViewForumAsMessagesTypeID, + UpdatePeerWallpaperTypeID, }, UpdatesChannelDifferenceClassName: { UpdatesChannelDifferenceEmptyTypeID, diff --git a/tg/tl_server_gen.go b/tg/tl_server_gen.go index 8e58181b1f..0512e1f153 100644 --- a/tg/tl_server_gen.go +++ b/tg/tl_server_gen.go @@ -6028,6 +6028,23 @@ func (s *ServerDispatcher) OnMessagesSetChatWallPaper(f func(ctx context.Context s.handlers[MessagesSetChatWallPaperRequestTypeID] = handler } +func (s *ServerDispatcher) OnMessagesSearchEmojiStickerSets(f func(ctx context.Context, request *MessagesSearchEmojiStickerSetsRequest) (MessagesFoundStickerSetsClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesSearchEmojiStickerSetsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &MessagesFoundStickerSetsBox{FoundStickerSets: response}, nil + } + + s.handlers[MessagesSearchEmojiStickerSetsRequestTypeID] = handler +} + func (s *ServerDispatcher) OnUpdatesGetState(f func(ctx context.Context) (*UpdatesState, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request UpdatesGetStateRequest @@ -6719,6 +6736,40 @@ func (s *ServerDispatcher) OnHelpGetPremiumPromo(f func(ctx context.Context) (*H s.handlers[HelpGetPremiumPromoRequestTypeID] = handler } +func (s *ServerDispatcher) OnHelpGetPeerColors(f func(ctx context.Context, hash int) (HelpPeerColorsClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request HelpGetPeerColorsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Hash) + if err != nil { + return nil, err + } + return &HelpPeerColorsBox{PeerColors: response}, nil + } + + s.handlers[HelpGetPeerColorsRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnHelpGetPeerProfileColors(f func(ctx context.Context, hash int) (HelpPeerColorsClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request HelpGetPeerProfileColorsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Hash) + if err != nil { + return nil, err + } + return &HelpPeerColorsBox{PeerColors: response}, nil + } + + s.handlers[HelpGetPeerProfileColorsRequestTypeID] = handler +} + func (s *ServerDispatcher) OnChannelsReadHistory(f func(ctx context.Context, request *ChannelsReadHistoryRequest) (bool, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request ChannelsReadHistoryRequest @@ -7744,6 +7795,40 @@ func (s *ServerDispatcher) OnChannelsUpdateColor(f func(ctx context.Context, req s.handlers[ChannelsUpdateColorRequestTypeID] = handler } +func (s *ServerDispatcher) OnChannelsToggleViewForumAsMessages(f func(ctx context.Context, request *ChannelsToggleViewForumAsMessagesRequest) (UpdatesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request ChannelsToggleViewForumAsMessagesRequest + 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[ChannelsToggleViewForumAsMessagesRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnChannelsGetChannelRecommendations(f func(ctx context.Context, channel InputChannelClass) (MessagesChatsClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request ChannelsGetChannelRecommendationsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Channel) + if err != nil { + return nil, err + } + return &MessagesChatsBox{Chats: response}, nil + } + + s.handlers[ChannelsGetChannelRecommendationsRequestTypeID] = 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 @@ -9248,6 +9333,40 @@ func (s *ServerDispatcher) OnStatsGetMessageStats(f func(ctx context.Context, re s.handlers[StatsGetMessageStatsRequestTypeID] = handler } +func (s *ServerDispatcher) OnStatsGetStoryStats(f func(ctx context.Context, request *StatsGetStoryStatsRequest) (*StatsStoryStats, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request StatsGetStoryStatsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[StatsGetStoryStatsRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnStatsGetStoryPublicForwards(f func(ctx context.Context, request *StatsGetStoryPublicForwardsRequest) (*StatsPublicForwards, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request StatsGetStoryPublicForwardsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[StatsGetStoryPublicForwardsRequestTypeID] = handler +} + func (s *ServerDispatcher) OnChatlistsExportChatlistInvite(f func(ctx context.Context, request *ChatlistsExportChatlistInviteRequest) (*ChatlistsExportedChatlistInvite, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request ChatlistsExportChatlistInviteRequest @@ -9922,6 +10041,23 @@ func (s *ServerDispatcher) OnPremiumGetBoostsStatus(f func(ctx context.Context, s.handlers[PremiumGetBoostsStatusRequestTypeID] = handler } +func (s *ServerDispatcher) OnPremiumGetUserBoosts(f func(ctx context.Context, request *PremiumGetUserBoostsRequest) (*PremiumBoostsList, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request PremiumGetUserBoostsRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return response, nil + } + + s.handlers[PremiumGetUserBoostsRequestTypeID] = handler +} + func (s *ServerDispatcher) OnTestUseError(f func(ctx context.Context) (*Error, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request TestUseErrorRequest diff --git a/tg/tl_sponsored_message_gen.go b/tg/tl_sponsored_message_gen.go index 2676975dc4..7ada2e947d 100644 --- a/tg/tl_sponsored_message_gen.go +++ b/tg/tl_sponsored_message_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// SponsoredMessage represents TL type `sponsoredMessage#daafff6b`. +// SponsoredMessage represents TL type `sponsoredMessage#ed5383f7`. // A sponsored message¹. // // Links: @@ -76,6 +76,10 @@ type SponsoredMessage struct { // // Use SetWebpage and GetWebpage helpers. Webpage SponsoredWebPage + // App field of SponsoredMessage. + // + // Use SetApp and GetApp helpers. + App BotAppClass // Sponsored message Message string // Message entities for styled text¹ @@ -85,6 +89,10 @@ type SponsoredMessage struct { // // Use SetEntities and GetEntities helpers. Entities []MessageEntityClass + // ButtonText field of SponsoredMessage. + // + // Use SetButtonText and GetButtonText helpers. + ButtonText string // If set, contains additional information about the sponsor to be shown along with the // message. // @@ -98,7 +106,7 @@ type SponsoredMessage struct { } // SponsoredMessageTypeID is TL type id of SponsoredMessage. -const SponsoredMessageTypeID = 0xdaafff6b +const SponsoredMessageTypeID = 0xed5383f7 // Ensuring interfaces in compile-time for SponsoredMessage. var ( @@ -142,12 +150,18 @@ func (s *SponsoredMessage) Zero() bool { if !(s.Webpage.Zero()) { return false } + if !(s.App == nil) { + return false + } if !(s.Message == "") { return false } if !(s.Entities == nil) { return false } + if !(s.ButtonText == "") { + return false + } if !(s.SponsorInfo == "") { return false } @@ -178,8 +192,10 @@ func (s *SponsoredMessage) FillFrom(from interface { GetChannelPost() (value int, ok bool) GetStartParam() (value string, ok bool) GetWebpage() (value SponsoredWebPage, ok bool) + GetApp() (value BotAppClass, ok bool) GetMessage() (value string) GetEntities() (value []MessageEntityClass, ok bool) + GetButtonText() (value string, ok bool) GetSponsorInfo() (value string, ok bool) GetAdditionalInfo() (value string, ok bool) }) { @@ -210,11 +226,19 @@ func (s *SponsoredMessage) FillFrom(from interface { s.Webpage = val } + if val, ok := from.GetApp(); ok { + s.App = val + } + s.Message = from.GetMessage() if val, ok := from.GetEntities(); ok { s.Entities = val } + if val, ok := from.GetButtonText(); ok { + s.ButtonText = val + } + if val, ok := from.GetSponsorInfo(); ok { s.SponsorInfo = val } @@ -292,6 +316,11 @@ func (s *SponsoredMessage) TypeInfo() tdp.Type { SchemaName: "webpage", Null: !s.Flags.Has(9), }, + { + Name: "App", + SchemaName: "app", + Null: !s.Flags.Has(10), + }, { Name: "Message", SchemaName: "message", @@ -301,6 +330,11 @@ func (s *SponsoredMessage) TypeInfo() tdp.Type { SchemaName: "entities", Null: !s.Flags.Has(1), }, + { + Name: "ButtonText", + SchemaName: "button_text", + Null: !s.Flags.Has(11), + }, { Name: "SponsorInfo", SchemaName: "sponsor_info", @@ -341,9 +375,15 @@ func (s *SponsoredMessage) SetFlags() { if !(s.Webpage.Zero()) { s.Flags.Set(9) } + if !(s.App == nil) { + s.Flags.Set(10) + } if !(s.Entities == nil) { s.Flags.Set(1) } + if !(s.ButtonText == "") { + s.Flags.Set(11) + } if !(s.SponsorInfo == "") { s.Flags.Set(7) } @@ -355,7 +395,7 @@ func (s *SponsoredMessage) SetFlags() { // Encode implements bin.Encoder. func (s *SponsoredMessage) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#daafff6b as nil") + return fmt.Errorf("can't encode sponsoredMessage#ed5383f7 as nil") } b.PutID(SponsoredMessageTypeID) return s.EncodeBare(b) @@ -364,27 +404,27 @@ func (s *SponsoredMessage) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#daafff6b as nil") + return fmt.Errorf("can't encode sponsoredMessage#ed5383f7 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#daafff6b: field flags: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field flags: %w", err) } b.PutBytes(s.RandomID) if s.Flags.Has(3) { if s.FromID == nil { - return fmt.Errorf("unable to encode sponsoredMessage#daafff6b: field from_id is nil") + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field from_id is nil") } if err := s.FromID.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#daafff6b: field from_id: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field from_id: %w", err) } } if s.Flags.Has(4) { if s.ChatInvite == nil { - return fmt.Errorf("unable to encode sponsoredMessage#daafff6b: field chat_invite is nil") + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field chat_invite is nil") } if err := s.ChatInvite.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#daafff6b: field chat_invite: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field chat_invite: %w", err) } } if s.Flags.Has(4) { @@ -398,7 +438,15 @@ func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { } if s.Flags.Has(9) { if err := s.Webpage.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#daafff6b: field webpage: %w", err) + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field webpage: %w", err) + } + } + if s.Flags.Has(10) { + if s.App == nil { + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field app is nil") + } + if err := s.App.Encode(b); err != nil { + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field app: %w", err) } } b.PutString(s.Message) @@ -406,13 +454,16 @@ func (s *SponsoredMessage) 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 sponsoredMessage#daafff6b: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#daafff6b: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode sponsoredMessage#ed5383f7: field entities element with index %d: %w", idx, err) } } } + if s.Flags.Has(11) { + b.PutString(s.ButtonText) + } if s.Flags.Has(7) { b.PutString(s.SponsorInfo) } @@ -425,10 +476,10 @@ func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *SponsoredMessage) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#daafff6b to nil") + return fmt.Errorf("can't decode sponsoredMessage#ed5383f7 to nil") } if err := b.ConsumeID(SponsoredMessageTypeID); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: %w", err) } return s.DecodeBare(b) } @@ -436,11 +487,11 @@ func (s *SponsoredMessage) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#daafff6b to nil") + return fmt.Errorf("can't decode sponsoredMessage#ed5383f7 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field flags: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field flags: %w", err) } } s.Recommended = s.Flags.Has(5) @@ -448,61 +499,68 @@ func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { { value, err := b.Bytes() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field random_id: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field random_id: %w", err) } s.RandomID = value } if s.Flags.Has(3) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field from_id: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field from_id: %w", err) } s.FromID = value } if s.Flags.Has(4) { value, err := DecodeChatInvite(b) if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field chat_invite: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field chat_invite: %w", err) } s.ChatInvite = value } if s.Flags.Has(4) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field chat_invite_hash: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field chat_invite_hash: %w", err) } s.ChatInviteHash = value } if s.Flags.Has(2) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field channel_post: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field channel_post: %w", err) } s.ChannelPost = value } if s.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field start_param: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field start_param: %w", err) } s.StartParam = value } if s.Flags.Has(9) { if err := s.Webpage.Decode(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field webpage: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field webpage: %w", err) } } + if s.Flags.Has(10) { + value, err := DecodeBotApp(b) + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field app: %w", err) + } + s.App = value + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field message: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field message: %w", err) } s.Message = value } if s.Flags.Has(1) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field entities: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field entities: %w", err) } if headerLen > 0 { @@ -511,22 +569,29 @@ func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field entities: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field entities: %w", err) } s.Entities = append(s.Entities, value) } } + if s.Flags.Has(11) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field button_text: %w", err) + } + s.ButtonText = value + } if s.Flags.Has(7) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field sponsor_info: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field sponsor_info: %w", err) } s.SponsorInfo = value } if s.Flags.Has(8) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#daafff6b: field additional_info: %w", err) + return fmt.Errorf("unable to decode sponsoredMessage#ed5383f7: field additional_info: %w", err) } s.AdditionalInfo = value } @@ -687,6 +752,24 @@ func (s *SponsoredMessage) GetWebpage() (value SponsoredWebPage, ok bool) { return s.Webpage, true } +// SetApp sets value of App conditional field. +func (s *SponsoredMessage) SetApp(value BotAppClass) { + s.Flags.Set(10) + s.App = value +} + +// GetApp returns value of App conditional field and +// boolean which is true if field was set. +func (s *SponsoredMessage) GetApp() (value BotAppClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(10) { + return value, false + } + return s.App, true +} + // GetMessage returns value of Message field. func (s *SponsoredMessage) GetMessage() (value string) { if s == nil { @@ -713,6 +796,24 @@ func (s *SponsoredMessage) GetEntities() (value []MessageEntityClass, ok bool) { return s.Entities, true } +// SetButtonText sets value of ButtonText conditional field. +func (s *SponsoredMessage) SetButtonText(value string) { + s.Flags.Set(11) + s.ButtonText = value +} + +// GetButtonText returns value of ButtonText conditional field and +// boolean which is true if field was set. +func (s *SponsoredMessage) GetButtonText() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(11) { + return value, false + } + return s.ButtonText, true +} + // SetSponsorInfo sets value of SponsorInfo conditional field. func (s *SponsoredMessage) SetSponsorInfo(value string) { s.Flags.Set(7) @@ -749,6 +850,15 @@ func (s *SponsoredMessage) GetAdditionalInfo() (value string, ok bool) { return s.AdditionalInfo, true } +// GetAppAsModified returns mapped value of App conditional field and +// boolean which is true if field was set. +func (s *SponsoredMessage) GetAppAsModified() (*BotApp, bool) { + if value, ok := s.GetApp(); ok { + return value.AsModified() + } + return nil, false +} + // MapEntities returns field Entities wrapped in MessageEntityClassArray helper. func (s *SponsoredMessage) MapEntities() (value MessageEntityClassArray, ok bool) { if !s.Flags.Has(1) { diff --git a/tg/tl_stats_broadcast_stats_gen.go b/tg/tl_stats_broadcast_stats_gen.go index 90d060b52a..08d7e9038f 100644 --- a/tg/tl_stats_broadcast_stats_gen.go +++ b/tg/tl_stats_broadcast_stats_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StatsBroadcastStats represents TL type `stats.broadcastStats#bdf78394`. +// StatsBroadcastStats represents TL type `stats.broadcastStats#396ca5fc`. // Channel statistics¹. // // Links: @@ -53,6 +53,14 @@ type StatsBroadcastStats struct { // consideration (min_date till max_date), and prev refers to the previous period // ((min_date - (max_date - min_date)) till min_date) SharesPerPost StatsAbsValueAndPrev + // ReactionsPerPost field of StatsBroadcastStats. + ReactionsPerPost StatsAbsValueAndPrev + // ViewsPerStory field of StatsBroadcastStats. + ViewsPerStory StatsAbsValueAndPrev + // SharesPerStory field of StatsBroadcastStats. + SharesPerStory StatsAbsValueAndPrev + // ReactionsPerStory field of StatsBroadcastStats. + ReactionsPerStory StatsAbsValueAndPrev // Percentage of subscribers with enabled notifications EnabledNotifications StatsPercentValue // Channel growth graph (absolute subscriber count) @@ -73,12 +81,18 @@ type StatsBroadcastStats struct { NewFollowersBySourceGraph StatsGraphClass // Subscriber language graph (pie chart) LanguagesGraph StatsGraphClass - // Recent message interactions - RecentMessageInteractions []MessageInteractionCounters + // ReactionsByEmotionGraph field of StatsBroadcastStats. + ReactionsByEmotionGraph StatsGraphClass + // StoryInteractionsGraph field of StatsBroadcastStats. + StoryInteractionsGraph StatsGraphClass + // StoryReactionsByEmotionGraph field of StatsBroadcastStats. + StoryReactionsByEmotionGraph StatsGraphClass + // RecentPostsInteractions field of StatsBroadcastStats. + RecentPostsInteractions []PostInteractionCountersClass } // StatsBroadcastStatsTypeID is TL type id of StatsBroadcastStats. -const StatsBroadcastStatsTypeID = 0xbdf78394 +const StatsBroadcastStatsTypeID = 0x396ca5fc // Ensuring interfaces in compile-time for StatsBroadcastStats. var ( @@ -104,6 +118,18 @@ func (b *StatsBroadcastStats) Zero() bool { if !(b.SharesPerPost.Zero()) { return false } + if !(b.ReactionsPerPost.Zero()) { + return false + } + if !(b.ViewsPerStory.Zero()) { + return false + } + if !(b.SharesPerStory.Zero()) { + return false + } + if !(b.ReactionsPerStory.Zero()) { + return false + } if !(b.EnabledNotifications.Zero()) { return false } @@ -134,7 +160,16 @@ func (b *StatsBroadcastStats) Zero() bool { if !(b.LanguagesGraph == nil) { return false } - if !(b.RecentMessageInteractions == nil) { + if !(b.ReactionsByEmotionGraph == nil) { + return false + } + if !(b.StoryInteractionsGraph == nil) { + return false + } + if !(b.StoryReactionsByEmotionGraph == nil) { + return false + } + if !(b.RecentPostsInteractions == nil) { return false } @@ -156,6 +191,10 @@ func (b *StatsBroadcastStats) FillFrom(from interface { GetFollowers() (value StatsAbsValueAndPrev) GetViewsPerPost() (value StatsAbsValueAndPrev) GetSharesPerPost() (value StatsAbsValueAndPrev) + GetReactionsPerPost() (value StatsAbsValueAndPrev) + GetViewsPerStory() (value StatsAbsValueAndPrev) + GetSharesPerStory() (value StatsAbsValueAndPrev) + GetReactionsPerStory() (value StatsAbsValueAndPrev) GetEnabledNotifications() (value StatsPercentValue) GetGrowthGraph() (value StatsGraphClass) GetFollowersGraph() (value StatsGraphClass) @@ -166,12 +205,19 @@ func (b *StatsBroadcastStats) FillFrom(from interface { GetViewsBySourceGraph() (value StatsGraphClass) GetNewFollowersBySourceGraph() (value StatsGraphClass) GetLanguagesGraph() (value StatsGraphClass) - GetRecentMessageInteractions() (value []MessageInteractionCounters) + GetReactionsByEmotionGraph() (value StatsGraphClass) + GetStoryInteractionsGraph() (value StatsGraphClass) + GetStoryReactionsByEmotionGraph() (value StatsGraphClass) + GetRecentPostsInteractions() (value []PostInteractionCountersClass) }) { b.Period = from.GetPeriod() b.Followers = from.GetFollowers() b.ViewsPerPost = from.GetViewsPerPost() b.SharesPerPost = from.GetSharesPerPost() + b.ReactionsPerPost = from.GetReactionsPerPost() + b.ViewsPerStory = from.GetViewsPerStory() + b.SharesPerStory = from.GetSharesPerStory() + b.ReactionsPerStory = from.GetReactionsPerStory() b.EnabledNotifications = from.GetEnabledNotifications() b.GrowthGraph = from.GetGrowthGraph() b.FollowersGraph = from.GetFollowersGraph() @@ -182,7 +228,10 @@ func (b *StatsBroadcastStats) FillFrom(from interface { b.ViewsBySourceGraph = from.GetViewsBySourceGraph() b.NewFollowersBySourceGraph = from.GetNewFollowersBySourceGraph() b.LanguagesGraph = from.GetLanguagesGraph() - b.RecentMessageInteractions = from.GetRecentMessageInteractions() + b.ReactionsByEmotionGraph = from.GetReactionsByEmotionGraph() + b.StoryInteractionsGraph = from.GetStoryInteractionsGraph() + b.StoryReactionsByEmotionGraph = from.GetStoryReactionsByEmotionGraph() + b.RecentPostsInteractions = from.GetRecentPostsInteractions() } // TypeID returns type id in TL schema. @@ -224,6 +273,22 @@ func (b *StatsBroadcastStats) TypeInfo() tdp.Type { Name: "SharesPerPost", SchemaName: "shares_per_post", }, + { + Name: "ReactionsPerPost", + SchemaName: "reactions_per_post", + }, + { + Name: "ViewsPerStory", + SchemaName: "views_per_story", + }, + { + Name: "SharesPerStory", + SchemaName: "shares_per_story", + }, + { + Name: "ReactionsPerStory", + SchemaName: "reactions_per_story", + }, { Name: "EnabledNotifications", SchemaName: "enabled_notifications", @@ -265,8 +330,20 @@ func (b *StatsBroadcastStats) TypeInfo() tdp.Type { SchemaName: "languages_graph", }, { - Name: "RecentMessageInteractions", - SchemaName: "recent_message_interactions", + Name: "ReactionsByEmotionGraph", + SchemaName: "reactions_by_emotion_graph", + }, + { + Name: "StoryInteractionsGraph", + SchemaName: "story_interactions_graph", + }, + { + Name: "StoryReactionsByEmotionGraph", + SchemaName: "story_reactions_by_emotion_graph", + }, + { + Name: "RecentPostsInteractions", + SchemaName: "recent_posts_interactions", }, } return typ @@ -275,7 +352,7 @@ func (b *StatsBroadcastStats) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (b *StatsBroadcastStats) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode stats.broadcastStats#bdf78394 as nil") + return fmt.Errorf("can't encode stats.broadcastStats#396ca5fc as nil") } buf.PutID(StatsBroadcastStatsTypeID) return b.EncodeBare(buf) @@ -284,81 +361,114 @@ func (b *StatsBroadcastStats) Encode(buf *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (b *StatsBroadcastStats) EncodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode stats.broadcastStats#bdf78394 as nil") + return fmt.Errorf("can't encode stats.broadcastStats#396ca5fc as nil") } if err := b.Period.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field period: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field period: %w", err) } if err := b.Followers.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field followers: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field followers: %w", err) } if err := b.ViewsPerPost.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field views_per_post: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field views_per_post: %w", err) } if err := b.SharesPerPost.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field shares_per_post: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field shares_per_post: %w", err) + } + if err := b.ReactionsPerPost.Encode(buf); err != nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field reactions_per_post: %w", err) + } + if err := b.ViewsPerStory.Encode(buf); err != nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field views_per_story: %w", err) + } + if err := b.SharesPerStory.Encode(buf); err != nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field shares_per_story: %w", err) + } + if err := b.ReactionsPerStory.Encode(buf); err != nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field reactions_per_story: %w", err) } if err := b.EnabledNotifications.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field enabled_notifications: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field enabled_notifications: %w", err) } if b.GrowthGraph == nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field growth_graph is nil") + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field growth_graph is nil") } if err := b.GrowthGraph.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field growth_graph: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field growth_graph: %w", err) } if b.FollowersGraph == nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field followers_graph is nil") + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field followers_graph is nil") } if err := b.FollowersGraph.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field followers_graph: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field followers_graph: %w", err) } if b.MuteGraph == nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field mute_graph is nil") + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field mute_graph is nil") } if err := b.MuteGraph.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field mute_graph: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field mute_graph: %w", err) } if b.TopHoursGraph == nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field top_hours_graph is nil") + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field top_hours_graph is nil") } if err := b.TopHoursGraph.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field top_hours_graph: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field top_hours_graph: %w", err) } if b.InteractionsGraph == nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field interactions_graph is nil") + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field interactions_graph is nil") } if err := b.InteractionsGraph.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field interactions_graph: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field interactions_graph: %w", err) } if b.IvInteractionsGraph == nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field iv_interactions_graph is nil") + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field iv_interactions_graph is nil") } if err := b.IvInteractionsGraph.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field iv_interactions_graph: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field iv_interactions_graph: %w", err) } if b.ViewsBySourceGraph == nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field views_by_source_graph is nil") + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field views_by_source_graph is nil") } if err := b.ViewsBySourceGraph.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field views_by_source_graph: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field views_by_source_graph: %w", err) } if b.NewFollowersBySourceGraph == nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field new_followers_by_source_graph is nil") + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field new_followers_by_source_graph is nil") } if err := b.NewFollowersBySourceGraph.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field new_followers_by_source_graph: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field new_followers_by_source_graph: %w", err) } if b.LanguagesGraph == nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field languages_graph is nil") + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field languages_graph is nil") } if err := b.LanguagesGraph.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field languages_graph: %w", err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field languages_graph: %w", err) + } + if b.ReactionsByEmotionGraph == nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field reactions_by_emotion_graph is nil") } - buf.PutVectorHeader(len(b.RecentMessageInteractions)) - for idx, v := range b.RecentMessageInteractions { + if err := b.ReactionsByEmotionGraph.Encode(buf); err != nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field reactions_by_emotion_graph: %w", err) + } + if b.StoryInteractionsGraph == nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field story_interactions_graph is nil") + } + if err := b.StoryInteractionsGraph.Encode(buf); err != nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field story_interactions_graph: %w", err) + } + if b.StoryReactionsByEmotionGraph == nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field story_reactions_by_emotion_graph is nil") + } + if err := b.StoryReactionsByEmotionGraph.Encode(buf); err != nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field story_reactions_by_emotion_graph: %w", err) + } + buf.PutVectorHeader(len(b.RecentPostsInteractions)) + for idx, v := range b.RecentPostsInteractions { + if v == nil { + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field recent_posts_interactions element with index %d is nil", idx) + } if err := v.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stats.broadcastStats#bdf78394: field recent_message_interactions element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stats.broadcastStats#396ca5fc: field recent_posts_interactions element with index %d: %w", idx, err) } } return nil @@ -367,10 +477,10 @@ func (b *StatsBroadcastStats) EncodeBare(buf *bin.Buffer) error { // Decode implements bin.Decoder. func (b *StatsBroadcastStats) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode stats.broadcastStats#bdf78394 to nil") + return fmt.Errorf("can't decode stats.broadcastStats#396ca5fc to nil") } if err := buf.ConsumeID(StatsBroadcastStatsTypeID); err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: %w", err) } return b.DecodeBare(buf) } @@ -378,111 +488,152 @@ func (b *StatsBroadcastStats) Decode(buf *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (b *StatsBroadcastStats) DecodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode stats.broadcastStats#bdf78394 to nil") + return fmt.Errorf("can't decode stats.broadcastStats#396ca5fc to nil") } { if err := b.Period.Decode(buf); err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field period: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field period: %w", err) } } { if err := b.Followers.Decode(buf); err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field followers: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field followers: %w", err) } } { if err := b.ViewsPerPost.Decode(buf); err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field views_per_post: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field views_per_post: %w", err) } } { if err := b.SharesPerPost.Decode(buf); err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field shares_per_post: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field shares_per_post: %w", err) + } + } + { + if err := b.ReactionsPerPost.Decode(buf); err != nil { + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field reactions_per_post: %w", err) + } + } + { + if err := b.ViewsPerStory.Decode(buf); err != nil { + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field views_per_story: %w", err) + } + } + { + if err := b.SharesPerStory.Decode(buf); err != nil { + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field shares_per_story: %w", err) + } + } + { + if err := b.ReactionsPerStory.Decode(buf); err != nil { + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field reactions_per_story: %w", err) } } { if err := b.EnabledNotifications.Decode(buf); err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field enabled_notifications: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field enabled_notifications: %w", err) } } { value, err := DecodeStatsGraph(buf) if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field growth_graph: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field growth_graph: %w", err) } b.GrowthGraph = value } { value, err := DecodeStatsGraph(buf) if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field followers_graph: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field followers_graph: %w", err) } b.FollowersGraph = value } { value, err := DecodeStatsGraph(buf) if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field mute_graph: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field mute_graph: %w", err) } b.MuteGraph = value } { value, err := DecodeStatsGraph(buf) if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field top_hours_graph: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field top_hours_graph: %w", err) } b.TopHoursGraph = value } { value, err := DecodeStatsGraph(buf) if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field interactions_graph: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field interactions_graph: %w", err) } b.InteractionsGraph = value } { value, err := DecodeStatsGraph(buf) if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field iv_interactions_graph: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field iv_interactions_graph: %w", err) } b.IvInteractionsGraph = value } { value, err := DecodeStatsGraph(buf) if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field views_by_source_graph: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field views_by_source_graph: %w", err) } b.ViewsBySourceGraph = value } { value, err := DecodeStatsGraph(buf) if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field new_followers_by_source_graph: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field new_followers_by_source_graph: %w", err) } b.NewFollowersBySourceGraph = value } { value, err := DecodeStatsGraph(buf) if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field languages_graph: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field languages_graph: %w", err) } b.LanguagesGraph = value } + { + value, err := DecodeStatsGraph(buf) + if err != nil { + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field reactions_by_emotion_graph: %w", err) + } + b.ReactionsByEmotionGraph = value + } + { + value, err := DecodeStatsGraph(buf) + if err != nil { + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field story_interactions_graph: %w", err) + } + b.StoryInteractionsGraph = value + } + { + value, err := DecodeStatsGraph(buf) + if err != nil { + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field story_reactions_by_emotion_graph: %w", err) + } + b.StoryReactionsByEmotionGraph = value + } { headerLen, err := buf.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field recent_message_interactions: %w", err) + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field recent_posts_interactions: %w", err) } if headerLen > 0 { - b.RecentMessageInteractions = make([]MessageInteractionCounters, 0, headerLen%bin.PreallocateLimit) + b.RecentPostsInteractions = make([]PostInteractionCountersClass, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { - var value MessageInteractionCounters - if err := value.Decode(buf); err != nil { - return fmt.Errorf("unable to decode stats.broadcastStats#bdf78394: field recent_message_interactions: %w", err) + value, err := DecodePostInteractionCounters(buf) + if err != nil { + return fmt.Errorf("unable to decode stats.broadcastStats#396ca5fc: field recent_posts_interactions: %w", err) } - b.RecentMessageInteractions = append(b.RecentMessageInteractions, value) + b.RecentPostsInteractions = append(b.RecentPostsInteractions, value) } } return nil @@ -520,6 +671,38 @@ func (b *StatsBroadcastStats) GetSharesPerPost() (value StatsAbsValueAndPrev) { return b.SharesPerPost } +// GetReactionsPerPost returns value of ReactionsPerPost field. +func (b *StatsBroadcastStats) GetReactionsPerPost() (value StatsAbsValueAndPrev) { + if b == nil { + return + } + return b.ReactionsPerPost +} + +// GetViewsPerStory returns value of ViewsPerStory field. +func (b *StatsBroadcastStats) GetViewsPerStory() (value StatsAbsValueAndPrev) { + if b == nil { + return + } + return b.ViewsPerStory +} + +// GetSharesPerStory returns value of SharesPerStory field. +func (b *StatsBroadcastStats) GetSharesPerStory() (value StatsAbsValueAndPrev) { + if b == nil { + return + } + return b.SharesPerStory +} + +// GetReactionsPerStory returns value of ReactionsPerStory field. +func (b *StatsBroadcastStats) GetReactionsPerStory() (value StatsAbsValueAndPrev) { + if b == nil { + return + } + return b.ReactionsPerStory +} + // GetEnabledNotifications returns value of EnabledNotifications field. func (b *StatsBroadcastStats) GetEnabledNotifications() (value StatsPercentValue) { if b == nil { @@ -600,10 +783,39 @@ func (b *StatsBroadcastStats) GetLanguagesGraph() (value StatsGraphClass) { return b.LanguagesGraph } -// GetRecentMessageInteractions returns value of RecentMessageInteractions field. -func (b *StatsBroadcastStats) GetRecentMessageInteractions() (value []MessageInteractionCounters) { +// GetReactionsByEmotionGraph returns value of ReactionsByEmotionGraph field. +func (b *StatsBroadcastStats) GetReactionsByEmotionGraph() (value StatsGraphClass) { + if b == nil { + return + } + return b.ReactionsByEmotionGraph +} + +// GetStoryInteractionsGraph returns value of StoryInteractionsGraph field. +func (b *StatsBroadcastStats) GetStoryInteractionsGraph() (value StatsGraphClass) { if b == nil { return } - return b.RecentMessageInteractions + return b.StoryInteractionsGraph +} + +// GetStoryReactionsByEmotionGraph returns value of StoryReactionsByEmotionGraph field. +func (b *StatsBroadcastStats) GetStoryReactionsByEmotionGraph() (value StatsGraphClass) { + if b == nil { + return + } + return b.StoryReactionsByEmotionGraph +} + +// GetRecentPostsInteractions returns value of RecentPostsInteractions field. +func (b *StatsBroadcastStats) GetRecentPostsInteractions() (value []PostInteractionCountersClass) { + if b == nil { + return + } + return b.RecentPostsInteractions +} + +// MapRecentPostsInteractions returns field RecentPostsInteractions wrapped in PostInteractionCountersClassArray helper. +func (b *StatsBroadcastStats) MapRecentPostsInteractions() (value PostInteractionCountersClassArray) { + return PostInteractionCountersClassArray(b.RecentPostsInteractions) } diff --git a/tg/tl_stats_get_story_public_forwards_gen.go b/tg/tl_stats_get_story_public_forwards_gen.go new file mode 100644 index 0000000000..8446cf8756 --- /dev/null +++ b/tg/tl_stats_get_story_public_forwards_gen.go @@ -0,0 +1,266 @@ +// 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{} +) + +// StatsGetStoryPublicForwardsRequest represents TL type `stats.getStoryPublicForwards#a6437ef6`. +// +// See https://core.telegram.org/method/stats.getStoryPublicForwards for reference. +type StatsGetStoryPublicForwardsRequest struct { + // Peer field of StatsGetStoryPublicForwardsRequest. + Peer InputPeerClass + // ID field of StatsGetStoryPublicForwardsRequest. + ID int + // Offset field of StatsGetStoryPublicForwardsRequest. + Offset string + // Maximum number of results to return, see pagination¹ + // + // Links: + // 1) https://core.telegram.org/api/offsets + Limit int +} + +// StatsGetStoryPublicForwardsRequestTypeID is TL type id of StatsGetStoryPublicForwardsRequest. +const StatsGetStoryPublicForwardsRequestTypeID = 0xa6437ef6 + +// Ensuring interfaces in compile-time for StatsGetStoryPublicForwardsRequest. +var ( + _ bin.Encoder = &StatsGetStoryPublicForwardsRequest{} + _ bin.Decoder = &StatsGetStoryPublicForwardsRequest{} + _ bin.BareEncoder = &StatsGetStoryPublicForwardsRequest{} + _ bin.BareDecoder = &StatsGetStoryPublicForwardsRequest{} +) + +func (g *StatsGetStoryPublicForwardsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Peer == nil) { + return false + } + if !(g.ID == 0) { + return false + } + if !(g.Offset == "") { + return false + } + if !(g.Limit == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *StatsGetStoryPublicForwardsRequest) String() string { + if g == nil { + return "StatsGetStoryPublicForwardsRequest(nil)" + } + type Alias StatsGetStoryPublicForwardsRequest + return fmt.Sprintf("StatsGetStoryPublicForwardsRequest%+v", Alias(*g)) +} + +// FillFrom fills StatsGetStoryPublicForwardsRequest from given interface. +func (g *StatsGetStoryPublicForwardsRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetID() (value int) + GetOffset() (value string) + GetLimit() (value int) +}) { + g.Peer = from.GetPeer() + g.ID = from.GetID() + g.Offset = from.GetOffset() + g.Limit = from.GetLimit() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StatsGetStoryPublicForwardsRequest) TypeID() uint32 { + return StatsGetStoryPublicForwardsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*StatsGetStoryPublicForwardsRequest) TypeName() string { + return "stats.getStoryPublicForwards" +} + +// TypeInfo returns info about TL type. +func (g *StatsGetStoryPublicForwardsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stats.getStoryPublicForwards", + ID: StatsGetStoryPublicForwardsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "ID", + SchemaName: "id", + }, + { + Name: "Offset", + SchemaName: "offset", + }, + { + Name: "Limit", + SchemaName: "limit", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *StatsGetStoryPublicForwardsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode stats.getStoryPublicForwards#a6437ef6 as nil") + } + b.PutID(StatsGetStoryPublicForwardsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *StatsGetStoryPublicForwardsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode stats.getStoryPublicForwards#a6437ef6 as nil") + } + if g.Peer == nil { + return fmt.Errorf("unable to encode stats.getStoryPublicForwards#a6437ef6: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.getStoryPublicForwards#a6437ef6: field peer: %w", err) + } + b.PutInt(g.ID) + b.PutString(g.Offset) + b.PutInt(g.Limit) + return nil +} + +// Decode implements bin.Decoder. +func (g *StatsGetStoryPublicForwardsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode stats.getStoryPublicForwards#a6437ef6 to nil") + } + if err := b.ConsumeID(StatsGetStoryPublicForwardsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode stats.getStoryPublicForwards#a6437ef6: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *StatsGetStoryPublicForwardsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode stats.getStoryPublicForwards#a6437ef6 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode stats.getStoryPublicForwards#a6437ef6: field peer: %w", err) + } + g.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stats.getStoryPublicForwards#a6437ef6: field id: %w", err) + } + g.ID = value + } + { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode stats.getStoryPublicForwards#a6437ef6: field offset: %w", err) + } + g.Offset = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stats.getStoryPublicForwards#a6437ef6: field limit: %w", err) + } + g.Limit = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (g *StatsGetStoryPublicForwardsRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// GetID returns value of ID field. +func (g *StatsGetStoryPublicForwardsRequest) GetID() (value int) { + if g == nil { + return + } + return g.ID +} + +// GetOffset returns value of Offset field. +func (g *StatsGetStoryPublicForwardsRequest) GetOffset() (value string) { + if g == nil { + return + } + return g.Offset +} + +// GetLimit returns value of Limit field. +func (g *StatsGetStoryPublicForwardsRequest) GetLimit() (value int) { + if g == nil { + return + } + return g.Limit +} + +// StatsGetStoryPublicForwards invokes method stats.getStoryPublicForwards#a6437ef6 returning error if any. +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// +// See https://core.telegram.org/method/stats.getStoryPublicForwards for reference. +func (c *Client) StatsGetStoryPublicForwards(ctx context.Context, request *StatsGetStoryPublicForwardsRequest) (*StatsPublicForwards, error) { + var result StatsPublicForwards + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_stats_get_story_public_forwards_slices_gen.go b/tg/tl_stats_get_story_public_forwards_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_stats_get_story_public_forwards_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_stats_get_story_stats_gen.go b/tg/tl_stats_get_story_stats_gen.go new file mode 100644 index 0000000000..d9841cfc97 --- /dev/null +++ b/tg/tl_stats_get_story_stats_gen.go @@ -0,0 +1,265 @@ +// 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{} +) + +// StatsGetStoryStatsRequest represents TL type `stats.getStoryStats#374fef40`. +// +// See https://core.telegram.org/method/stats.getStoryStats for reference. +type StatsGetStoryStatsRequest struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Dark field of StatsGetStoryStatsRequest. + Dark bool + // Peer field of StatsGetStoryStatsRequest. + Peer InputPeerClass + // ID field of StatsGetStoryStatsRequest. + ID int +} + +// StatsGetStoryStatsRequestTypeID is TL type id of StatsGetStoryStatsRequest. +const StatsGetStoryStatsRequestTypeID = 0x374fef40 + +// Ensuring interfaces in compile-time for StatsGetStoryStatsRequest. +var ( + _ bin.Encoder = &StatsGetStoryStatsRequest{} + _ bin.Decoder = &StatsGetStoryStatsRequest{} + _ bin.BareEncoder = &StatsGetStoryStatsRequest{} + _ bin.BareDecoder = &StatsGetStoryStatsRequest{} +) + +func (g *StatsGetStoryStatsRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Flags.Zero()) { + return false + } + if !(g.Dark == false) { + return false + } + if !(g.Peer == nil) { + return false + } + if !(g.ID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *StatsGetStoryStatsRequest) String() string { + if g == nil { + return "StatsGetStoryStatsRequest(nil)" + } + type Alias StatsGetStoryStatsRequest + return fmt.Sprintf("StatsGetStoryStatsRequest%+v", Alias(*g)) +} + +// FillFrom fills StatsGetStoryStatsRequest from given interface. +func (g *StatsGetStoryStatsRequest) FillFrom(from interface { + GetDark() (value bool) + GetPeer() (value InputPeerClass) + GetID() (value int) +}) { + g.Dark = from.GetDark() + g.Peer = from.GetPeer() + g.ID = from.GetID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StatsGetStoryStatsRequest) TypeID() uint32 { + return StatsGetStoryStatsRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*StatsGetStoryStatsRequest) TypeName() string { + return "stats.getStoryStats" +} + +// TypeInfo returns info about TL type. +func (g *StatsGetStoryStatsRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stats.getStoryStats", + ID: StatsGetStoryStatsRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Dark", + SchemaName: "dark", + Null: !g.Flags.Has(0), + }, + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "ID", + SchemaName: "id", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (g *StatsGetStoryStatsRequest) SetFlags() { + if !(g.Dark == false) { + g.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (g *StatsGetStoryStatsRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode stats.getStoryStats#374fef40 as nil") + } + b.PutID(StatsGetStoryStatsRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *StatsGetStoryStatsRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode stats.getStoryStats#374fef40 as nil") + } + g.SetFlags() + if err := g.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.getStoryStats#374fef40: field flags: %w", err) + } + if g.Peer == nil { + return fmt.Errorf("unable to encode stats.getStoryStats#374fef40: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.getStoryStats#374fef40: field peer: %w", err) + } + b.PutInt(g.ID) + return nil +} + +// Decode implements bin.Decoder. +func (g *StatsGetStoryStatsRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode stats.getStoryStats#374fef40 to nil") + } + if err := b.ConsumeID(StatsGetStoryStatsRequestTypeID); err != nil { + return fmt.Errorf("unable to decode stats.getStoryStats#374fef40: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *StatsGetStoryStatsRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode stats.getStoryStats#374fef40 to nil") + } + { + if err := g.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode stats.getStoryStats#374fef40: field flags: %w", err) + } + } + g.Dark = g.Flags.Has(0) + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode stats.getStoryStats#374fef40: field peer: %w", err) + } + g.Peer = value + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stats.getStoryStats#374fef40: field id: %w", err) + } + g.ID = value + } + return nil +} + +// SetDark sets value of Dark conditional field. +func (g *StatsGetStoryStatsRequest) SetDark(value bool) { + if value { + g.Flags.Set(0) + g.Dark = true + } else { + g.Flags.Unset(0) + g.Dark = false + } +} + +// GetDark returns value of Dark conditional field. +func (g *StatsGetStoryStatsRequest) GetDark() (value bool) { + if g == nil { + return + } + return g.Flags.Has(0) +} + +// GetPeer returns value of Peer field. +func (g *StatsGetStoryStatsRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// GetID returns value of ID field. +func (g *StatsGetStoryStatsRequest) GetID() (value int) { + if g == nil { + return + } + return g.ID +} + +// StatsGetStoryStats invokes method stats.getStoryStats#374fef40 returning error if any. +// +// Possible errors: +// +// 400 PEER_ID_INVALID: The provided peer id is invalid. +// +// See https://core.telegram.org/method/stats.getStoryStats for reference. +func (c *Client) StatsGetStoryStats(ctx context.Context, request *StatsGetStoryStatsRequest) (*StatsStoryStats, error) { + var result StatsStoryStats + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/tg/tl_stats_get_story_stats_slices_gen.go b/tg/tl_stats_get_story_stats_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_stats_get_story_stats_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_stats_message_stats_gen.go b/tg/tl_stats_message_stats_gen.go index a2d0e3f925..7e3609e25b 100644 --- a/tg/tl_stats_message_stats_gen.go +++ b/tg/tl_stats_message_stats_gen.go @@ -31,17 +31,19 @@ var ( _ = tdjson.Encoder{} ) -// StatsMessageStats represents TL type `stats.messageStats#8999f295`. +// StatsMessageStats represents TL type `stats.messageStats#7fe91c14`. // Message statistics // // See https://core.telegram.org/constructor/stats.messageStats for reference. type StatsMessageStats struct { // Message view graph ViewsGraph StatsGraphClass + // ReactionsByEmotionGraph field of StatsMessageStats. + ReactionsByEmotionGraph StatsGraphClass } // StatsMessageStatsTypeID is TL type id of StatsMessageStats. -const StatsMessageStatsTypeID = 0x8999f295 +const StatsMessageStatsTypeID = 0x7fe91c14 // Ensuring interfaces in compile-time for StatsMessageStats. var ( @@ -58,6 +60,9 @@ func (m *StatsMessageStats) Zero() bool { if !(m.ViewsGraph == nil) { return false } + if !(m.ReactionsByEmotionGraph == nil) { + return false + } return true } @@ -74,8 +79,10 @@ func (m *StatsMessageStats) String() string { // FillFrom fills StatsMessageStats from given interface. func (m *StatsMessageStats) FillFrom(from interface { GetViewsGraph() (value StatsGraphClass) + GetReactionsByEmotionGraph() (value StatsGraphClass) }) { m.ViewsGraph = from.GetViewsGraph() + m.ReactionsByEmotionGraph = from.GetReactionsByEmotionGraph() } // TypeID returns type id in TL schema. @@ -105,6 +112,10 @@ func (m *StatsMessageStats) TypeInfo() tdp.Type { Name: "ViewsGraph", SchemaName: "views_graph", }, + { + Name: "ReactionsByEmotionGraph", + SchemaName: "reactions_by_emotion_graph", + }, } return typ } @@ -112,7 +123,7 @@ func (m *StatsMessageStats) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (m *StatsMessageStats) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode stats.messageStats#8999f295 as nil") + return fmt.Errorf("can't encode stats.messageStats#7fe91c14 as nil") } b.PutID(StatsMessageStatsTypeID) return m.EncodeBare(b) @@ -121,13 +132,19 @@ func (m *StatsMessageStats) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *StatsMessageStats) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode stats.messageStats#8999f295 as nil") + return fmt.Errorf("can't encode stats.messageStats#7fe91c14 as nil") } if m.ViewsGraph == nil { - return fmt.Errorf("unable to encode stats.messageStats#8999f295: field views_graph is nil") + return fmt.Errorf("unable to encode stats.messageStats#7fe91c14: field views_graph is nil") } if err := m.ViewsGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode stats.messageStats#8999f295: field views_graph: %w", err) + return fmt.Errorf("unable to encode stats.messageStats#7fe91c14: field views_graph: %w", err) + } + if m.ReactionsByEmotionGraph == nil { + return fmt.Errorf("unable to encode stats.messageStats#7fe91c14: field reactions_by_emotion_graph is nil") + } + if err := m.ReactionsByEmotionGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.messageStats#7fe91c14: field reactions_by_emotion_graph: %w", err) } return nil } @@ -135,10 +152,10 @@ func (m *StatsMessageStats) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (m *StatsMessageStats) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode stats.messageStats#8999f295 to nil") + return fmt.Errorf("can't decode stats.messageStats#7fe91c14 to nil") } if err := b.ConsumeID(StatsMessageStatsTypeID); err != nil { - return fmt.Errorf("unable to decode stats.messageStats#8999f295: %w", err) + return fmt.Errorf("unable to decode stats.messageStats#7fe91c14: %w", err) } return m.DecodeBare(b) } @@ -146,15 +163,22 @@ func (m *StatsMessageStats) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *StatsMessageStats) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode stats.messageStats#8999f295 to nil") + return fmt.Errorf("can't decode stats.messageStats#7fe91c14 to nil") } { value, err := DecodeStatsGraph(b) if err != nil { - return fmt.Errorf("unable to decode stats.messageStats#8999f295: field views_graph: %w", err) + return fmt.Errorf("unable to decode stats.messageStats#7fe91c14: field views_graph: %w", err) } m.ViewsGraph = value } + { + value, err := DecodeStatsGraph(b) + if err != nil { + return fmt.Errorf("unable to decode stats.messageStats#7fe91c14: field reactions_by_emotion_graph: %w", err) + } + m.ReactionsByEmotionGraph = value + } return nil } @@ -165,3 +189,11 @@ func (m *StatsMessageStats) GetViewsGraph() (value StatsGraphClass) { } return m.ViewsGraph } + +// GetReactionsByEmotionGraph returns value of ReactionsByEmotionGraph field. +func (m *StatsMessageStats) GetReactionsByEmotionGraph() (value StatsGraphClass) { + if m == nil { + return + } + return m.ReactionsByEmotionGraph +} diff --git a/tg/tl_stats_public_forwards_gen.go b/tg/tl_stats_public_forwards_gen.go new file mode 100644 index 0000000000..b9924e292a --- /dev/null +++ b/tg/tl_stats_public_forwards_gen.go @@ -0,0 +1,380 @@ +// 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{} +) + +// StatsPublicForwards represents TL type `stats.publicForwards#93037e20`. +// +// See https://core.telegram.org/constructor/stats.publicForwards for reference. +type StatsPublicForwards struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Count field of StatsPublicForwards. + Count int + // Forwards field of StatsPublicForwards. + Forwards []PublicForwardClass + // NextOffset field of StatsPublicForwards. + // + // Use SetNextOffset and GetNextOffset helpers. + NextOffset string + // Chats field of StatsPublicForwards. + Chats []ChatClass + // Users field of StatsPublicForwards. + Users []UserClass +} + +// StatsPublicForwardsTypeID is TL type id of StatsPublicForwards. +const StatsPublicForwardsTypeID = 0x93037e20 + +// Ensuring interfaces in compile-time for StatsPublicForwards. +var ( + _ bin.Encoder = &StatsPublicForwards{} + _ bin.Decoder = &StatsPublicForwards{} + _ bin.BareEncoder = &StatsPublicForwards{} + _ bin.BareDecoder = &StatsPublicForwards{} +) + +func (p *StatsPublicForwards) Zero() bool { + if p == nil { + return true + } + if !(p.Flags.Zero()) { + return false + } + if !(p.Count == 0) { + return false + } + if !(p.Forwards == nil) { + return false + } + if !(p.NextOffset == "") { + return false + } + if !(p.Chats == nil) { + return false + } + if !(p.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (p *StatsPublicForwards) String() string { + if p == nil { + return "StatsPublicForwards(nil)" + } + type Alias StatsPublicForwards + return fmt.Sprintf("StatsPublicForwards%+v", Alias(*p)) +} + +// FillFrom fills StatsPublicForwards from given interface. +func (p *StatsPublicForwards) FillFrom(from interface { + GetCount() (value int) + GetForwards() (value []PublicForwardClass) + GetNextOffset() (value string, ok bool) + GetChats() (value []ChatClass) + GetUsers() (value []UserClass) +}) { + p.Count = from.GetCount() + p.Forwards = from.GetForwards() + if val, ok := from.GetNextOffset(); ok { + p.NextOffset = val + } + + p.Chats = from.GetChats() + p.Users = from.GetUsers() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StatsPublicForwards) TypeID() uint32 { + return StatsPublicForwardsTypeID +} + +// TypeName returns name of type in TL schema. +func (*StatsPublicForwards) TypeName() string { + return "stats.publicForwards" +} + +// TypeInfo returns info about TL type. +func (p *StatsPublicForwards) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stats.publicForwards", + ID: StatsPublicForwardsTypeID, + } + if p == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Count", + SchemaName: "count", + }, + { + Name: "Forwards", + SchemaName: "forwards", + }, + { + Name: "NextOffset", + SchemaName: "next_offset", + Null: !p.Flags.Has(0), + }, + { + Name: "Chats", + SchemaName: "chats", + }, + { + Name: "Users", + SchemaName: "users", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (p *StatsPublicForwards) SetFlags() { + if !(p.NextOffset == "") { + p.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (p *StatsPublicForwards) Encode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode stats.publicForwards#93037e20 as nil") + } + b.PutID(StatsPublicForwardsTypeID) + return p.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (p *StatsPublicForwards) EncodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't encode stats.publicForwards#93037e20 as nil") + } + p.SetFlags() + if err := p.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.publicForwards#93037e20: field flags: %w", err) + } + b.PutInt(p.Count) + b.PutVectorHeader(len(p.Forwards)) + for idx, v := range p.Forwards { + if v == nil { + return fmt.Errorf("unable to encode stats.publicForwards#93037e20: field forwards element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.publicForwards#93037e20: field forwards element with index %d: %w", idx, err) + } + } + if p.Flags.Has(0) { + b.PutString(p.NextOffset) + } + b.PutVectorHeader(len(p.Chats)) + for idx, v := range p.Chats { + if v == nil { + return fmt.Errorf("unable to encode stats.publicForwards#93037e20: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.publicForwards#93037e20: field chats element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(p.Users)) + for idx, v := range p.Users { + if v == nil { + return fmt.Errorf("unable to encode stats.publicForwards#93037e20: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.publicForwards#93037e20: field users element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (p *StatsPublicForwards) Decode(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode stats.publicForwards#93037e20 to nil") + } + if err := b.ConsumeID(StatsPublicForwardsTypeID); err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: %w", err) + } + return p.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (p *StatsPublicForwards) DecodeBare(b *bin.Buffer) error { + if p == nil { + return fmt.Errorf("can't decode stats.publicForwards#93037e20 to nil") + } + { + if err := p.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: field flags: %w", err) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: field count: %w", err) + } + p.Count = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: field forwards: %w", err) + } + + if headerLen > 0 { + p.Forwards = make([]PublicForwardClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodePublicForward(b) + if err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: field forwards: %w", err) + } + p.Forwards = append(p.Forwards, value) + } + } + if p.Flags.Has(0) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: field next_offset: %w", err) + } + p.NextOffset = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: field chats: %w", err) + } + + if headerLen > 0 { + p.Chats = make([]ChatClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChat(b) + if err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: field chats: %w", err) + } + p.Chats = append(p.Chats, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: field users: %w", err) + } + + if headerLen > 0 { + p.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeUser(b) + if err != nil { + return fmt.Errorf("unable to decode stats.publicForwards#93037e20: field users: %w", err) + } + p.Users = append(p.Users, value) + } + } + return nil +} + +// GetCount returns value of Count field. +func (p *StatsPublicForwards) GetCount() (value int) { + if p == nil { + return + } + return p.Count +} + +// GetForwards returns value of Forwards field. +func (p *StatsPublicForwards) GetForwards() (value []PublicForwardClass) { + if p == nil { + return + } + return p.Forwards +} + +// SetNextOffset sets value of NextOffset conditional field. +func (p *StatsPublicForwards) SetNextOffset(value string) { + p.Flags.Set(0) + p.NextOffset = value +} + +// GetNextOffset returns value of NextOffset conditional field and +// boolean which is true if field was set. +func (p *StatsPublicForwards) GetNextOffset() (value string, ok bool) { + if p == nil { + return + } + if !p.Flags.Has(0) { + return value, false + } + return p.NextOffset, true +} + +// GetChats returns value of Chats field. +func (p *StatsPublicForwards) GetChats() (value []ChatClass) { + if p == nil { + return + } + return p.Chats +} + +// GetUsers returns value of Users field. +func (p *StatsPublicForwards) GetUsers() (value []UserClass) { + if p == nil { + return + } + return p.Users +} + +// MapForwards returns field Forwards wrapped in PublicForwardClassArray helper. +func (p *StatsPublicForwards) MapForwards() (value PublicForwardClassArray) { + return PublicForwardClassArray(p.Forwards) +} + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (p *StatsPublicForwards) MapChats() (value ChatClassArray) { + return ChatClassArray(p.Chats) +} + +// MapUsers returns field Users wrapped in UserClassArray helper. +func (p *StatsPublicForwards) MapUsers() (value UserClassArray) { + return UserClassArray(p.Users) +} diff --git a/tg/tl_stats_public_forwards_slices_gen.go b/tg/tl_stats_public_forwards_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_stats_public_forwards_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_stats_story_stats_gen.go b/tg/tl_stats_story_stats_gen.go new file mode 100644 index 0000000000..e3d69ddef1 --- /dev/null +++ b/tg/tl_stats_story_stats_gen.go @@ -0,0 +1,198 @@ +// 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{} +) + +// StatsStoryStats represents TL type `stats.storyStats#50cd067c`. +// +// See https://core.telegram.org/constructor/stats.storyStats for reference. +type StatsStoryStats struct { + // ViewsGraph field of StatsStoryStats. + ViewsGraph StatsGraphClass + // ReactionsByEmotionGraph field of StatsStoryStats. + ReactionsByEmotionGraph StatsGraphClass +} + +// StatsStoryStatsTypeID is TL type id of StatsStoryStats. +const StatsStoryStatsTypeID = 0x50cd067c + +// Ensuring interfaces in compile-time for StatsStoryStats. +var ( + _ bin.Encoder = &StatsStoryStats{} + _ bin.Decoder = &StatsStoryStats{} + _ bin.BareEncoder = &StatsStoryStats{} + _ bin.BareDecoder = &StatsStoryStats{} +) + +func (s *StatsStoryStats) Zero() bool { + if s == nil { + return true + } + if !(s.ViewsGraph == nil) { + return false + } + if !(s.ReactionsByEmotionGraph == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StatsStoryStats) String() string { + if s == nil { + return "StatsStoryStats(nil)" + } + type Alias StatsStoryStats + return fmt.Sprintf("StatsStoryStats%+v", Alias(*s)) +} + +// FillFrom fills StatsStoryStats from given interface. +func (s *StatsStoryStats) FillFrom(from interface { + GetViewsGraph() (value StatsGraphClass) + GetReactionsByEmotionGraph() (value StatsGraphClass) +}) { + s.ViewsGraph = from.GetViewsGraph() + s.ReactionsByEmotionGraph = from.GetReactionsByEmotionGraph() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StatsStoryStats) TypeID() uint32 { + return StatsStoryStatsTypeID +} + +// TypeName returns name of type in TL schema. +func (*StatsStoryStats) TypeName() string { + return "stats.storyStats" +} + +// TypeInfo returns info about TL type. +func (s *StatsStoryStats) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "stats.storyStats", + ID: StatsStoryStatsTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ViewsGraph", + SchemaName: "views_graph", + }, + { + Name: "ReactionsByEmotionGraph", + SchemaName: "reactions_by_emotion_graph", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (s *StatsStoryStats) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stats.storyStats#50cd067c as nil") + } + b.PutID(StatsStoryStatsTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StatsStoryStats) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode stats.storyStats#50cd067c as nil") + } + if s.ViewsGraph == nil { + return fmt.Errorf("unable to encode stats.storyStats#50cd067c: field views_graph is nil") + } + if err := s.ViewsGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.storyStats#50cd067c: field views_graph: %w", err) + } + if s.ReactionsByEmotionGraph == nil { + return fmt.Errorf("unable to encode stats.storyStats#50cd067c: field reactions_by_emotion_graph is nil") + } + if err := s.ReactionsByEmotionGraph.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.storyStats#50cd067c: field reactions_by_emotion_graph: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StatsStoryStats) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stats.storyStats#50cd067c to nil") + } + if err := b.ConsumeID(StatsStoryStatsTypeID); err != nil { + return fmt.Errorf("unable to decode stats.storyStats#50cd067c: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StatsStoryStats) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode stats.storyStats#50cd067c to nil") + } + { + value, err := DecodeStatsGraph(b) + if err != nil { + return fmt.Errorf("unable to decode stats.storyStats#50cd067c: field views_graph: %w", err) + } + s.ViewsGraph = value + } + { + value, err := DecodeStatsGraph(b) + if err != nil { + return fmt.Errorf("unable to decode stats.storyStats#50cd067c: field reactions_by_emotion_graph: %w", err) + } + s.ReactionsByEmotionGraph = value + } + return nil +} + +// GetViewsGraph returns value of ViewsGraph field. +func (s *StatsStoryStats) GetViewsGraph() (value StatsGraphClass) { + if s == nil { + return + } + return s.ViewsGraph +} + +// GetReactionsByEmotionGraph returns value of ReactionsByEmotionGraph field. +func (s *StatsStoryStats) GetReactionsByEmotionGraph() (value StatsGraphClass) { + if s == nil { + return + } + return s.ReactionsByEmotionGraph +} diff --git a/tg/tl_stats_story_stats_slices_gen.go b/tg/tl_stats_story_stats_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_stats_story_stats_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_stories_can_send_story_gen.go b/tg/tl_stories_can_send_story_gen.go index 02a9e5b7e0..76c6d74112 100644 --- a/tg/tl_stories_can_send_story_gen.go +++ b/tg/tl_stories_can_send_story_gen.go @@ -171,7 +171,7 @@ func (c *StoriesCanSendStoryRequest) GetPeer() (value InputPeerClass) { // // Possible errors: // -// 400 BOOSTS_REQUIRED: The specified channel must first be boosted by its users in order to be able to post stories. +// 400 BOOSTS_REQUIRED: The specified channel must first be boosted by its users in order to perform this action. // 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this. // 400 PEER_ID_INVALID: The provided peer id is invalid. // 400 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. diff --git a/tg/tl_stories_get_peer_stories_gen.go b/tg/tl_stories_get_peer_stories_gen.go index 40138a1c66..099ab70ba2 100644 --- a/tg/tl_stories_get_peer_stories_gen.go +++ b/tg/tl_stories_get_peer_stories_gen.go @@ -177,7 +177,9 @@ func (g *StoriesGetPeerStoriesRequest) GetPeer() (value InputPeerClass) { // // Possible errors: // +// 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. +// 400 MSG_ID_INVALID: Invalid message ID provided. // 400 PEER_ID_INVALID: The provided peer id is invalid. // // See https://core.telegram.org/method/stories.getPeerStories for reference. diff --git a/tg/tl_stories_get_stories_views_gen.go b/tg/tl_stories_get_stories_views_gen.go index bca60d9aae..fe7c050881 100644 --- a/tg/tl_stories_get_stories_views_gen.go +++ b/tg/tl_stories_get_stories_views_gen.go @@ -222,6 +222,7 @@ func (g *StoriesGetStoriesViewsRequest) GetID() (value []int) { // 400 CHANNEL_INVALID: The provided channel is invalid. // 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. // 400 PEER_ID_INVALID: The provided peer id is invalid. +// 400 STORY_ID_EMPTY: You specified no story IDs. // // See https://core.telegram.org/method/stories.getStoriesViews for reference. func (c *Client) StoriesGetStoriesViews(ctx context.Context, request *StoriesGetStoriesViewsRequest) (*StoriesStoryViews, error) { diff --git a/tg/tl_stories_get_story_views_list_gen.go b/tg/tl_stories_get_story_views_list_gen.go index be1515021e..30c9fb5e6a 100644 --- a/tg/tl_stories_get_story_views_list_gen.go +++ b/tg/tl_stories_get_story_views_list_gen.go @@ -49,7 +49,13 @@ type StoriesGetStoryViewsListRequest struct { // Links: // 1) https://core.telegram.org/api/contacts JustContacts bool - // ReactionsFirst field of StoriesGetStoryViewsListRequest. + // Whether to return storyView¹ info about users that reacted to the story (i.e. if set, + // the server will first sort results by view date as usual, and then also additionally + // sort the list by putting storyView²s with an associated reaction first in the list). + // + // Links: + // 1) https://core.telegram.org/constructor/storyView + // 2) https://core.telegram.org/constructor/storyView ReactionsFirst bool // Peer where the story was posted Peer InputPeerClass diff --git a/tg/tl_stories_send_story_gen.go b/tg/tl_stories_send_story_gen.go index 63c0165b2e..fc5259fe97 100644 --- a/tg/tl_stories_send_story_gen.go +++ b/tg/tl_stories_send_story_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StoriesSendStoryRequest represents TL type `stories.sendStory#bcb73644`. +// StoriesSendStoryRequest represents TL type `stories.sendStory#e4e6694b`. // Uploads a Telegram Story¹. // // Links: @@ -52,6 +52,8 @@ type StoriesSendStoryRequest struct { Pinned bool // If set, disables forwards, screenshots, and downloads. Noforwards bool + // FwdModified field of StoriesSendStoryRequest. + FwdModified bool // The peer to send the story as. Peer InputPeerClass // The story media. @@ -90,10 +92,18 @@ type StoriesSendStoryRequest struct { // // Use SetPeriod and GetPeriod helpers. Period int + // FwdFromID field of StoriesSendStoryRequest. + // + // Use SetFwdFromID and GetFwdFromID helpers. + FwdFromID InputPeerClass + // FwdFromStory field of StoriesSendStoryRequest. + // + // Use SetFwdFromStory and GetFwdFromStory helpers. + FwdFromStory int } // StoriesSendStoryRequestTypeID is TL type id of StoriesSendStoryRequest. -const StoriesSendStoryRequestTypeID = 0xbcb73644 +const StoriesSendStoryRequestTypeID = 0xe4e6694b // Ensuring interfaces in compile-time for StoriesSendStoryRequest. var ( @@ -116,6 +126,9 @@ func (s *StoriesSendStoryRequest) Zero() bool { if !(s.Noforwards == false) { return false } + if !(s.FwdModified == false) { + return false + } if !(s.Peer == nil) { return false } @@ -140,6 +153,12 @@ func (s *StoriesSendStoryRequest) Zero() bool { if !(s.Period == 0) { return false } + if !(s.FwdFromID == nil) { + return false + } + if !(s.FwdFromStory == 0) { + return false + } return true } @@ -157,6 +176,7 @@ func (s *StoriesSendStoryRequest) String() string { func (s *StoriesSendStoryRequest) FillFrom(from interface { GetPinned() (value bool) GetNoforwards() (value bool) + GetFwdModified() (value bool) GetPeer() (value InputPeerClass) GetMedia() (value InputMediaClass) GetMediaAreas() (value []MediaAreaClass, ok bool) @@ -165,9 +185,12 @@ func (s *StoriesSendStoryRequest) FillFrom(from interface { GetPrivacyRules() (value []InputPrivacyRuleClass) GetRandomID() (value int64) GetPeriod() (value int, ok bool) + GetFwdFromID() (value InputPeerClass, ok bool) + GetFwdFromStory() (value int, ok bool) }) { s.Pinned = from.GetPinned() s.Noforwards = from.GetNoforwards() + s.FwdModified = from.GetFwdModified() s.Peer = from.GetPeer() s.Media = from.GetMedia() if val, ok := from.GetMediaAreas(); ok { @@ -188,6 +211,14 @@ func (s *StoriesSendStoryRequest) FillFrom(from interface { s.Period = val } + if val, ok := from.GetFwdFromID(); ok { + s.FwdFromID = val + } + + if val, ok := from.GetFwdFromStory(); ok { + s.FwdFromStory = val + } + } // TypeID returns type id in TL schema. @@ -223,6 +254,11 @@ func (s *StoriesSendStoryRequest) TypeInfo() tdp.Type { SchemaName: "noforwards", Null: !s.Flags.Has(4), }, + { + Name: "FwdModified", + SchemaName: "fwd_modified", + Null: !s.Flags.Has(7), + }, { Name: "Peer", SchemaName: "peer", @@ -259,6 +295,16 @@ func (s *StoriesSendStoryRequest) TypeInfo() tdp.Type { SchemaName: "period", Null: !s.Flags.Has(3), }, + { + Name: "FwdFromID", + SchemaName: "fwd_from_id", + Null: !s.Flags.Has(6), + }, + { + Name: "FwdFromStory", + SchemaName: "fwd_from_story", + Null: !s.Flags.Has(6), + }, } return typ } @@ -271,6 +317,9 @@ func (s *StoriesSendStoryRequest) SetFlags() { if !(s.Noforwards == false) { s.Flags.Set(4) } + if !(s.FwdModified == false) { + s.Flags.Set(7) + } if !(s.MediaAreas == nil) { s.Flags.Set(5) } @@ -283,12 +332,18 @@ func (s *StoriesSendStoryRequest) SetFlags() { if !(s.Period == 0) { s.Flags.Set(3) } + if !(s.FwdFromID == nil) { + s.Flags.Set(6) + } + if !(s.FwdFromStory == 0) { + s.Flags.Set(6) + } } // Encode implements bin.Encoder. func (s *StoriesSendStoryRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stories.sendStory#bcb73644 as nil") + return fmt.Errorf("can't encode stories.sendStory#e4e6694b as nil") } b.PutID(StoriesSendStoryRequestTypeID) return s.EncodeBare(b) @@ -297,32 +352,32 @@ func (s *StoriesSendStoryRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StoriesSendStoryRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stories.sendStory#bcb73644 as nil") + return fmt.Errorf("can't encode stories.sendStory#e4e6694b as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field flags: %w", err) + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field flags: %w", err) } if s.Peer == nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field peer is nil") + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field peer: %w", err) + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field peer: %w", err) } if s.Media == nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field media is nil") + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field media is nil") } if err := s.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field media: %w", err) + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field media: %w", err) } if s.Flags.Has(5) { b.PutVectorHeader(len(s.MediaAreas)) for idx, v := range s.MediaAreas { if v == nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field media_areas element with index %d is nil", idx) + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field media_areas element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field media_areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field media_areas element with index %d: %w", idx, err) } } } @@ -333,36 +388,47 @@ func (s *StoriesSendStoryRequest) 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 stories.sendStory#bcb73644: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field entities element with index %d: %w", idx, err) } } } b.PutVectorHeader(len(s.PrivacyRules)) for idx, v := range s.PrivacyRules { if v == nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field privacy_rules element with index %d is nil", idx) + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field privacy_rules element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.sendStory#bcb73644: field privacy_rules element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field privacy_rules element with index %d: %w", idx, err) } } b.PutLong(s.RandomID) if s.Flags.Has(3) { b.PutInt(s.Period) } + if s.Flags.Has(6) { + if s.FwdFromID == nil { + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field fwd_from_id is nil") + } + if err := s.FwdFromID.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.sendStory#e4e6694b: field fwd_from_id: %w", err) + } + } + if s.Flags.Has(6) { + b.PutInt(s.FwdFromStory) + } return nil } // Decode implements bin.Decoder. func (s *StoriesSendStoryRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stories.sendStory#bcb73644 to nil") + return fmt.Errorf("can't decode stories.sendStory#e4e6694b to nil") } if err := b.ConsumeID(StoriesSendStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: %w", err) } return s.DecodeBare(b) } @@ -370,33 +436,34 @@ func (s *StoriesSendStoryRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stories.sendStory#bcb73644 to nil") + return fmt.Errorf("can't decode stories.sendStory#e4e6694b to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field flags: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field flags: %w", err) } } s.Pinned = s.Flags.Has(2) s.Noforwards = s.Flags.Has(4) + s.FwdModified = s.Flags.Has(7) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field peer: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field peer: %w", err) } s.Peer = value } { value, err := DecodeInputMedia(b) if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field media: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field media: %w", err) } s.Media = value } if s.Flags.Has(5) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field media_areas: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field media_areas: %w", err) } if headerLen > 0 { @@ -405,7 +472,7 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMediaArea(b) if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field media_areas: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field media_areas: %w", err) } s.MediaAreas = append(s.MediaAreas, value) } @@ -413,14 +480,14 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field caption: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: 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 stories.sendStory#bcb73644: field entities: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field entities: %w", err) } if headerLen > 0 { @@ -429,7 +496,7 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageEntity(b) if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field entities: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field entities: %w", err) } s.Entities = append(s.Entities, value) } @@ -437,7 +504,7 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error { { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field privacy_rules: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field privacy_rules: %w", err) } if headerLen > 0 { @@ -446,7 +513,7 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputPrivacyRule(b) if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field privacy_rules: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field privacy_rules: %w", err) } s.PrivacyRules = append(s.PrivacyRules, value) } @@ -454,17 +521,31 @@ func (s *StoriesSendStoryRequest) DecodeBare(b *bin.Buffer) error { { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field random_id: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field random_id: %w", err) } s.RandomID = value } if s.Flags.Has(3) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stories.sendStory#bcb73644: field period: %w", err) + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field period: %w", err) } s.Period = value } + if s.Flags.Has(6) { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field fwd_from_id: %w", err) + } + s.FwdFromID = value + } + if s.Flags.Has(6) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode stories.sendStory#e4e6694b: field fwd_from_story: %w", err) + } + s.FwdFromStory = value + } return nil } @@ -506,6 +587,25 @@ func (s *StoriesSendStoryRequest) GetNoforwards() (value bool) { return s.Flags.Has(4) } +// SetFwdModified sets value of FwdModified conditional field. +func (s *StoriesSendStoryRequest) SetFwdModified(value bool) { + if value { + s.Flags.Set(7) + s.FwdModified = true + } else { + s.Flags.Unset(7) + s.FwdModified = false + } +} + +// GetFwdModified returns value of FwdModified conditional field. +func (s *StoriesSendStoryRequest) GetFwdModified() (value bool) { + if s == nil { + return + } + return s.Flags.Has(7) +} + // GetPeer returns value of Peer field. func (s *StoriesSendStoryRequest) GetPeer() (value InputPeerClass) { if s == nil { @@ -610,6 +710,42 @@ func (s *StoriesSendStoryRequest) GetPeriod() (value int, ok bool) { return s.Period, true } +// SetFwdFromID sets value of FwdFromID conditional field. +func (s *StoriesSendStoryRequest) SetFwdFromID(value InputPeerClass) { + s.Flags.Set(6) + s.FwdFromID = value +} + +// GetFwdFromID returns value of FwdFromID conditional field and +// boolean which is true if field was set. +func (s *StoriesSendStoryRequest) GetFwdFromID() (value InputPeerClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(6) { + return value, false + } + return s.FwdFromID, true +} + +// SetFwdFromStory sets value of FwdFromStory conditional field. +func (s *StoriesSendStoryRequest) SetFwdFromStory(value int) { + s.Flags.Set(6) + s.FwdFromStory = value +} + +// GetFwdFromStory returns value of FwdFromStory conditional field and +// boolean which is true if field was set. +func (s *StoriesSendStoryRequest) GetFwdFromStory() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(6) { + return value, false + } + return s.FwdFromStory, true +} + // MapMediaAreas returns field MediaAreas wrapped in MediaAreaClassArray helper. func (s *StoriesSendStoryRequest) MapMediaAreas() (value MediaAreaClassArray, ok bool) { if !s.Flags.Has(5) { @@ -631,7 +767,7 @@ func (s *StoriesSendStoryRequest) MapPrivacyRules() (value InputPrivacyRuleClass return InputPrivacyRuleClassArray(s.PrivacyRules) } -// StoriesSendStory invokes method stories.sendStory#bcb73644 returning error if any. +// StoriesSendStory invokes method stories.sendStory#e4e6694b returning error if any. // Uploads a Telegram Story¹. // // Links: diff --git a/tg/tl_stories_story_views_list_gen.go b/tg/tl_stories_story_views_list_gen.go index 19a163f6b3..f644bebbbd 100644 --- a/tg/tl_stories_story_views_list_gen.go +++ b/tg/tl_stories_story_views_list_gen.go @@ -46,7 +46,7 @@ type StoriesStoryViewsList struct { Flags bin.Fields // Total number of results that can be fetched Count int - // ReactionsCount field of StoriesStoryViewsList. + // Number of reactions that were added to the story ReactionsCount int // Story view date and reaction information Views []StoryView diff --git a/tg/tl_story_fwd_header_gen.go b/tg/tl_story_fwd_header_gen.go new file mode 100644 index 0000000000..23a8bb6020 --- /dev/null +++ b/tg/tl_story_fwd_header_gen.go @@ -0,0 +1,339 @@ +// 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{} +) + +// StoryFwdHeader represents TL type `storyFwdHeader#b826e150`. +// +// See https://core.telegram.org/constructor/storyFwdHeader for reference. +type StoryFwdHeader struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // Modified field of StoryFwdHeader. + Modified bool + // From field of StoryFwdHeader. + // + // Use SetFrom and GetFrom helpers. + From PeerClass + // FromName field of StoryFwdHeader. + // + // Use SetFromName and GetFromName helpers. + FromName string + // StoryID field of StoryFwdHeader. + // + // Use SetStoryID and GetStoryID helpers. + StoryID int +} + +// StoryFwdHeaderTypeID is TL type id of StoryFwdHeader. +const StoryFwdHeaderTypeID = 0xb826e150 + +// Ensuring interfaces in compile-time for StoryFwdHeader. +var ( + _ bin.Encoder = &StoryFwdHeader{} + _ bin.Decoder = &StoryFwdHeader{} + _ bin.BareEncoder = &StoryFwdHeader{} + _ bin.BareDecoder = &StoryFwdHeader{} +) + +func (s *StoryFwdHeader) Zero() bool { + if s == nil { + return true + } + if !(s.Flags.Zero()) { + return false + } + if !(s.Modified == false) { + return false + } + if !(s.From == nil) { + return false + } + if !(s.FromName == "") { + return false + } + if !(s.StoryID == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (s *StoryFwdHeader) String() string { + if s == nil { + return "StoryFwdHeader(nil)" + } + type Alias StoryFwdHeader + return fmt.Sprintf("StoryFwdHeader%+v", Alias(*s)) +} + +// FillFrom fills StoryFwdHeader from given interface. +func (s *StoryFwdHeader) FillFrom(from interface { + GetModified() (value bool) + GetFrom() (value PeerClass, ok bool) + GetFromName() (value string, ok bool) + GetStoryID() (value int, ok bool) +}) { + s.Modified = from.GetModified() + if val, ok := from.GetFrom(); ok { + s.From = val + } + + if val, ok := from.GetFromName(); ok { + s.FromName = val + } + + if val, ok := from.GetStoryID(); ok { + s.StoryID = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StoryFwdHeader) TypeID() uint32 { + return StoryFwdHeaderTypeID +} + +// TypeName returns name of type in TL schema. +func (*StoryFwdHeader) TypeName() string { + return "storyFwdHeader" +} + +// TypeInfo returns info about TL type. +func (s *StoryFwdHeader) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "storyFwdHeader", + ID: StoryFwdHeaderTypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Modified", + SchemaName: "modified", + Null: !s.Flags.Has(3), + }, + { + Name: "From", + SchemaName: "from", + Null: !s.Flags.Has(0), + }, + { + Name: "FromName", + SchemaName: "from_name", + Null: !s.Flags.Has(1), + }, + { + Name: "StoryID", + SchemaName: "story_id", + Null: !s.Flags.Has(2), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (s *StoryFwdHeader) SetFlags() { + if !(s.Modified == false) { + s.Flags.Set(3) + } + if !(s.From == nil) { + s.Flags.Set(0) + } + if !(s.FromName == "") { + s.Flags.Set(1) + } + if !(s.StoryID == 0) { + s.Flags.Set(2) + } +} + +// Encode implements bin.Encoder. +func (s *StoryFwdHeader) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyFwdHeader#b826e150 as nil") + } + b.PutID(StoryFwdHeaderTypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StoryFwdHeader) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode storyFwdHeader#b826e150 as nil") + } + s.SetFlags() + if err := s.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyFwdHeader#b826e150: field flags: %w", err) + } + if s.Flags.Has(0) { + if s.From == nil { + return fmt.Errorf("unable to encode storyFwdHeader#b826e150: field from is nil") + } + if err := s.From.Encode(b); err != nil { + return fmt.Errorf("unable to encode storyFwdHeader#b826e150: field from: %w", err) + } + } + if s.Flags.Has(1) { + b.PutString(s.FromName) + } + if s.Flags.Has(2) { + b.PutInt(s.StoryID) + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StoryFwdHeader) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyFwdHeader#b826e150 to nil") + } + if err := b.ConsumeID(StoryFwdHeaderTypeID); err != nil { + return fmt.Errorf("unable to decode storyFwdHeader#b826e150: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StoryFwdHeader) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode storyFwdHeader#b826e150 to nil") + } + { + if err := s.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode storyFwdHeader#b826e150: field flags: %w", err) + } + } + s.Modified = s.Flags.Has(3) + if s.Flags.Has(0) { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode storyFwdHeader#b826e150: field from: %w", err) + } + s.From = value + } + if s.Flags.Has(1) { + value, err := b.String() + if err != nil { + return fmt.Errorf("unable to decode storyFwdHeader#b826e150: field from_name: %w", err) + } + s.FromName = value + } + if s.Flags.Has(2) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode storyFwdHeader#b826e150: field story_id: %w", err) + } + s.StoryID = value + } + return nil +} + +// SetModified sets value of Modified conditional field. +func (s *StoryFwdHeader) SetModified(value bool) { + if value { + s.Flags.Set(3) + s.Modified = true + } else { + s.Flags.Unset(3) + s.Modified = false + } +} + +// GetModified returns value of Modified conditional field. +func (s *StoryFwdHeader) GetModified() (value bool) { + if s == nil { + return + } + return s.Flags.Has(3) +} + +// SetFrom sets value of From conditional field. +func (s *StoryFwdHeader) SetFrom(value PeerClass) { + s.Flags.Set(0) + s.From = value +} + +// GetFrom returns value of From conditional field and +// boolean which is true if field was set. +func (s *StoryFwdHeader) GetFrom() (value PeerClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(0) { + return value, false + } + return s.From, true +} + +// SetFromName sets value of FromName conditional field. +func (s *StoryFwdHeader) SetFromName(value string) { + s.Flags.Set(1) + s.FromName = value +} + +// GetFromName returns value of FromName conditional field and +// boolean which is true if field was set. +func (s *StoryFwdHeader) GetFromName() (value string, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(1) { + return value, false + } + return s.FromName, true +} + +// SetStoryID sets value of StoryID conditional field. +func (s *StoryFwdHeader) SetStoryID(value int) { + s.Flags.Set(2) + s.StoryID = value +} + +// GetStoryID returns value of StoryID conditional field and +// boolean which is true if field was set. +func (s *StoryFwdHeader) GetStoryID() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(2) { + return value, false + } + return s.StoryID, true +} diff --git a/tg/tl_story_fwd_header_slices_gen.go b/tg/tl_story_fwd_header_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_story_fwd_header_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_story_item_gen.go b/tg/tl_story_item_gen.go index a4cebb676e..5f6115ab24 100644 --- a/tg/tl_story_item_gen.go +++ b/tg/tl_story_item_gen.go @@ -181,7 +181,11 @@ type StoryItemSkipped struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // CloseFriends field of StoryItemSkipped. + // Whether this story can only be viewed by our close friends, see here »¹ for more + // info + // + // Links: + // 1) https://core.telegram.org/api/privacy CloseFriends bool // Story ID ID int @@ -416,7 +420,7 @@ func (s *StoryItemSkipped) GetExpireDate() (value int) { return s.ExpireDate } -// StoryItem represents TL type `storyItem#44c457ce`. +// StoryItem represents TL type `storyItem#af6365a1`. // Represents a story¹. // // Links: @@ -431,11 +435,19 @@ type StoryItem struct { Flags bin.Fields // Whether this story is pinned on the user's profile Pinned bool - // Whether this story is public + // Whether this story is public and can be viewed by everyone Public bool - // CloseFriends field of StoryItem. + // Whether this story can only be viewed by our close friends, see here »¹ for more + // info + // + // Links: + // 1) https://core.telegram.org/api/privacy CloseFriends bool - // Min field of StoryItem. + // Full information about this story was omitted for space and performance reasons; use + // stories.getStoriesByID¹ to fetch full info about this story when and if needed. + // + // Links: + // 1) https://core.telegram.org/method/stories.getStoriesByID Min bool // Whether this story is protected¹ and thus cannot be forwarded; clients should also // prevent users from saving attached media (i.e. videos should only be streamed, photos @@ -446,9 +458,9 @@ type StoryItem struct { Noforwards bool // Indicates whether the story was edited. Edited bool - // Contacts field of StoryItem. + // Whether this story can only be viewed by our contacts Contacts bool - // SelectedContacts field of StoryItem. + // Whether this story can only be viewed by a select list of our contacts SelectedContacts bool // indicates whether we sent this story. Out bool @@ -456,6 +468,10 @@ type StoryItem struct { ID int // When was the story posted. Date int + // FwdFrom field of StoryItem. + // + // Use SetFwdFrom and GetFwdFrom helpers. + FwdFrom StoryFwdHeader // When does the story expire. ExpireDate int // Story caption. @@ -496,7 +512,7 @@ type StoryItem struct { } // StoryItemTypeID is TL type id of StoryItem. -const StoryItemTypeID = 0x44c457ce +const StoryItemTypeID = 0xaf6365a1 // construct implements constructor of StoryItemClass. func (s StoryItem) construct() StoryItemClass { return &s } @@ -551,6 +567,9 @@ func (s *StoryItem) Zero() bool { if !(s.Date == 0) { return false } + if !(s.FwdFrom.Zero()) { + return false + } if !(s.ExpireDate == 0) { return false } @@ -601,6 +620,7 @@ func (s *StoryItem) FillFrom(from interface { GetOut() (value bool) GetID() (value int) GetDate() (value int) + GetFwdFrom() (value StoryFwdHeader, ok bool) GetExpireDate() (value int) GetCaption() (value string, ok bool) GetEntities() (value []MessageEntityClass, ok bool) @@ -621,6 +641,10 @@ func (s *StoryItem) FillFrom(from interface { s.Out = from.GetOut() s.ID = from.GetID() s.Date = from.GetDate() + if val, ok := from.GetFwdFrom(); ok { + s.FwdFrom = val + } + s.ExpireDate = from.GetExpireDate() if val, ok := from.GetCaption(); ok { s.Caption = val @@ -725,6 +749,11 @@ func (s *StoryItem) TypeInfo() tdp.Type { Name: "Date", SchemaName: "date", }, + { + Name: "FwdFrom", + SchemaName: "fwd_from", + Null: !s.Flags.Has(17), + }, { Name: "ExpireDate", SchemaName: "expire_date", @@ -796,6 +825,9 @@ func (s *StoryItem) SetFlags() { if !(s.Out == false) { s.Flags.Set(16) } + if !(s.FwdFrom.Zero()) { + s.Flags.Set(17) + } if !(s.Caption == "") { s.Flags.Set(0) } @@ -819,7 +851,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#44c457ce as nil") + return fmt.Errorf("can't encode storyItem#af6365a1 as nil") } b.PutID(StoryItemTypeID) return s.EncodeBare(b) @@ -828,14 +860,19 @@ 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#44c457ce as nil") + return fmt.Errorf("can't encode storyItem#af6365a1 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#44c457ce: field flags: %w", err) + return fmt.Errorf("unable to encode storyItem#af6365a1: field flags: %w", err) } b.PutInt(s.ID) b.PutInt(s.Date) + 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) + } + } b.PutInt(s.ExpireDate) if s.Flags.Has(0) { b.PutString(s.Caption) @@ -844,27 +881,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#44c457ce: field entities element with index %d is nil", idx) + return fmt.Errorf("unable to encode storyItem#af6365a1: field entities element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#44c457ce: field entities element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode storyItem#af6365a1: field entities element with index %d: %w", idx, err) } } } if s.Media == nil { - return fmt.Errorf("unable to encode storyItem#44c457ce: field media is nil") + return fmt.Errorf("unable to encode storyItem#af6365a1: field media is nil") } if err := s.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#44c457ce: field media: %w", err) + return fmt.Errorf("unable to encode storyItem#af6365a1: 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#44c457ce: field media_areas element with index %d is nil", idx) + return fmt.Errorf("unable to encode storyItem#af6365a1: field media_areas element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#44c457ce: field media_areas element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode storyItem#af6365a1: field media_areas element with index %d: %w", idx, err) } } } @@ -872,24 +909,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#44c457ce: field privacy element with index %d is nil", idx) + return fmt.Errorf("unable to encode storyItem#af6365a1: field privacy element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#44c457ce: field privacy element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode storyItem#af6365a1: 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#44c457ce: field views: %w", err) + return fmt.Errorf("unable to encode storyItem#af6365a1: field views: %w", err) } } if s.Flags.Has(15) { if s.SentReaction == nil { - return fmt.Errorf("unable to encode storyItem#44c457ce: field sent_reaction is nil") + return fmt.Errorf("unable to encode storyItem#af6365a1: field sent_reaction is nil") } if err := s.SentReaction.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyItem#44c457ce: field sent_reaction: %w", err) + return fmt.Errorf("unable to encode storyItem#af6365a1: field sent_reaction: %w", err) } } return nil @@ -898,10 +935,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#44c457ce to nil") + return fmt.Errorf("can't decode storyItem#af6365a1 to nil") } if err := b.ConsumeID(StoryItemTypeID); err != nil { - return fmt.Errorf("unable to decode storyItem#44c457ce: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: %w", err) } return s.DecodeBare(b) } @@ -909,11 +946,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#44c457ce to nil") + return fmt.Errorf("can't decode storyItem#af6365a1 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyItem#44c457ce: field flags: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field flags: %w", err) } } s.Pinned = s.Flags.Has(5) @@ -928,35 +965,40 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error { { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode storyItem#44c457ce: field id: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field id: %w", err) } s.ID = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode storyItem#44c457ce: field date: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field date: %w", err) } s.Date = 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) + } + } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode storyItem#44c457ce: field expire_date: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: 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#44c457ce: field caption: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: 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#44c457ce: field entities: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field entities: %w", err) } if headerLen > 0 { @@ -965,7 +1007,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#44c457ce: field entities: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field entities: %w", err) } s.Entities = append(s.Entities, value) } @@ -973,14 +1015,14 @@ func (s *StoryItem) DecodeBare(b *bin.Buffer) error { { value, err := DecodeMessageMedia(b) if err != nil { - return fmt.Errorf("unable to decode storyItem#44c457ce: field media: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: 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#44c457ce: field media_areas: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field media_areas: %w", err) } if headerLen > 0 { @@ -989,7 +1031,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#44c457ce: field media_areas: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field media_areas: %w", err) } s.MediaAreas = append(s.MediaAreas, value) } @@ -997,7 +1039,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#44c457ce: field privacy: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field privacy: %w", err) } if headerLen > 0 { @@ -1006,20 +1048,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#44c457ce: field privacy: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: 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#44c457ce: field views: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field views: %w", err) } } if s.Flags.Has(15) { value, err := DecodeReaction(b) if err != nil { - return fmt.Errorf("unable to decode storyItem#44c457ce: field sent_reaction: %w", err) + return fmt.Errorf("unable to decode storyItem#af6365a1: field sent_reaction: %w", err) } s.SentReaction = value } @@ -1213,6 +1255,24 @@ func (s *StoryItem) GetDate() (value int) { return s.Date } +// SetFwdFrom sets value of FwdFrom conditional field. +func (s *StoryItem) SetFwdFrom(value StoryFwdHeader) { + s.Flags.Set(17) + s.FwdFrom = value +} + +// GetFwdFrom returns value of FwdFrom conditional field and +// boolean which is true if field was set. +func (s *StoryItem) GetFwdFrom() (value StoryFwdHeader, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(17) { + return value, false + } + return s.FwdFrom, true +} + // GetExpireDate returns value of ExpireDate field. func (s *StoryItem) GetExpireDate() (value int) { if s == nil { @@ -1377,7 +1437,7 @@ const StoryItemClassName = "StoryItem" // switch v := g.(type) { // case *tg.StoryItemDeleted: // storyItemDeleted#51e6ee4f // case *tg.StoryItemSkipped: // storyItemSkipped#ffadc913 -// case *tg.StoryItem: // storyItem#44c457ce +// case *tg.StoryItem: // storyItem#af6365a1 // default: panic(v) // } type StoryItemClass interface { @@ -1424,7 +1484,7 @@ func DecodeStoryItem(buf *bin.Buffer) (StoryItemClass, error) { } return &v, nil case StoryItemTypeID: - // Decoding storyItem#44c457ce. + // Decoding storyItem#af6365a1. v := StoryItem{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode StoryItemClass: %w", err) diff --git a/tg/tl_story_view_gen.go b/tg/tl_story_view_gen.go index 49c68b3a3d..226b5adf38 100644 --- a/tg/tl_story_view_gen.go +++ b/tg/tl_story_view_gen.go @@ -44,9 +44,16 @@ type StoryView struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Blocked field of StoryView. + // Whether we have completely blocked¹ this user, including from viewing more of our + // stories. + // + // Links: + // 1) https://core.telegram.org/api/block Blocked bool - // BlockedMyStoriesFrom field of StoryView. + // Whether we have blocked¹ this user from viewing more of our stories. + // + // Links: + // 1) https://core.telegram.org/api/block BlockedMyStoriesFrom bool // The user that viewed the story UserID int64 diff --git a/tg/tl_story_views_gen.go b/tg/tl_story_views_gen.go index cb95c07740..a51150878d 100644 --- a/tg/tl_story_views_gen.go +++ b/tg/tl_story_views_gen.go @@ -56,7 +56,7 @@ type StoryViews struct { // // Use SetReactions and GetReactions helpers. Reactions []ReactionCount - // ReactionsCount field of StoryViews. + // Number of reactions added to the story // // Use SetReactionsCount and GetReactionsCount helpers. ReactionsCount int diff --git a/tg/tl_update_gen.go b/tg/tl_update_gen.go index f90ce5e5c8..ac0beead60 100644 --- a/tg/tl_update_gen.go +++ b/tg/tl_update_gen.go @@ -3285,7 +3285,8 @@ type UpdateServiceNotification struct { Flags bin.Fields // If set, the message must be displayed in a popup. Popup bool - // InvertMedia field of UpdateServiceNotification. + // If set, any eventual webpage preview will be shown on top of the message instead of at + // the bottom. InvertMedia bool // When was the notification receivedThe message must also be stored locally as part of // the message history with the user id 777000 (Telegram Notifications). @@ -23536,6 +23537,608 @@ func (u *UpdateSentStoryReaction) GetReaction() (value ReactionClass) { return u.Reaction } +// UpdateBotChatBoost represents TL type `updateBotChatBoost#904dd49c`. +// +// See https://core.telegram.org/constructor/updateBotChatBoost for reference. +type UpdateBotChatBoost struct { + // Peer field of UpdateBotChatBoost. + Peer PeerClass + // Boost field of UpdateBotChatBoost. + Boost Boost + // Qts field of UpdateBotChatBoost. + Qts int +} + +// UpdateBotChatBoostTypeID is TL type id of UpdateBotChatBoost. +const UpdateBotChatBoostTypeID = 0x904dd49c + +// construct implements constructor of UpdateClass. +func (u UpdateBotChatBoost) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateBotChatBoost. +var ( + _ bin.Encoder = &UpdateBotChatBoost{} + _ bin.Decoder = &UpdateBotChatBoost{} + _ bin.BareEncoder = &UpdateBotChatBoost{} + _ bin.BareDecoder = &UpdateBotChatBoost{} + + _ UpdateClass = &UpdateBotChatBoost{} +) + +func (u *UpdateBotChatBoost) Zero() bool { + if u == nil { + return true + } + if !(u.Peer == nil) { + return false + } + if !(u.Boost.Zero()) { + return false + } + if !(u.Qts == 0) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateBotChatBoost) String() string { + if u == nil { + return "UpdateBotChatBoost(nil)" + } + type Alias UpdateBotChatBoost + return fmt.Sprintf("UpdateBotChatBoost%+v", Alias(*u)) +} + +// FillFrom fills UpdateBotChatBoost from given interface. +func (u *UpdateBotChatBoost) FillFrom(from interface { + GetPeer() (value PeerClass) + GetBoost() (value Boost) + GetQts() (value int) +}) { + u.Peer = from.GetPeer() + u.Boost = from.GetBoost() + u.Qts = from.GetQts() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateBotChatBoost) TypeID() uint32 { + return UpdateBotChatBoostTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateBotChatBoost) TypeName() string { + return "updateBotChatBoost" +} + +// TypeInfo returns info about TL type. +func (u *UpdateBotChatBoost) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateBotChatBoost", + ID: UpdateBotChatBoostTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Boost", + SchemaName: "boost", + }, + { + Name: "Qts", + SchemaName: "qts", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateBotChatBoost) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotChatBoost#904dd49c as nil") + } + b.PutID(UpdateBotChatBoostTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateBotChatBoost) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateBotChatBoost#904dd49c as nil") + } + if u.Peer == nil { + return fmt.Errorf("unable to encode updateBotChatBoost#904dd49c: field peer is nil") + } + if err := u.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBotChatBoost#904dd49c: field peer: %w", err) + } + if err := u.Boost.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateBotChatBoost#904dd49c: field boost: %w", err) + } + b.PutInt(u.Qts) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateBotChatBoost) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotChatBoost#904dd49c to nil") + } + if err := b.ConsumeID(UpdateBotChatBoostTypeID); err != nil { + return fmt.Errorf("unable to decode updateBotChatBoost#904dd49c: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateBotChatBoost) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateBotChatBoost#904dd49c to nil") + } + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode updateBotChatBoost#904dd49c: field peer: %w", err) + } + u.Peer = value + } + { + if err := u.Boost.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateBotChatBoost#904dd49c: field boost: %w", err) + } + } + { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode updateBotChatBoost#904dd49c: field qts: %w", err) + } + u.Qts = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (u *UpdateBotChatBoost) GetPeer() (value PeerClass) { + if u == nil { + return + } + return u.Peer +} + +// GetBoost returns value of Boost field. +func (u *UpdateBotChatBoost) GetBoost() (value Boost) { + if u == nil { + return + } + return u.Boost +} + +// GetQts returns value of Qts field. +func (u *UpdateBotChatBoost) GetQts() (value int) { + if u == nil { + return + } + return u.Qts +} + +// UpdateChannelViewForumAsMessages represents TL type `updateChannelViewForumAsMessages#7b68920`. +// +// See https://core.telegram.org/constructor/updateChannelViewForumAsMessages for reference. +type UpdateChannelViewForumAsMessages struct { + // ChannelID field of UpdateChannelViewForumAsMessages. + ChannelID int64 + // Enabled field of UpdateChannelViewForumAsMessages. + Enabled bool +} + +// UpdateChannelViewForumAsMessagesTypeID is TL type id of UpdateChannelViewForumAsMessages. +const UpdateChannelViewForumAsMessagesTypeID = 0x7b68920 + +// construct implements constructor of UpdateClass. +func (u UpdateChannelViewForumAsMessages) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdateChannelViewForumAsMessages. +var ( + _ bin.Encoder = &UpdateChannelViewForumAsMessages{} + _ bin.Decoder = &UpdateChannelViewForumAsMessages{} + _ bin.BareEncoder = &UpdateChannelViewForumAsMessages{} + _ bin.BareDecoder = &UpdateChannelViewForumAsMessages{} + + _ UpdateClass = &UpdateChannelViewForumAsMessages{} +) + +func (u *UpdateChannelViewForumAsMessages) Zero() bool { + if u == nil { + return true + } + if !(u.ChannelID == 0) { + return false + } + if !(u.Enabled == false) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdateChannelViewForumAsMessages) String() string { + if u == nil { + return "UpdateChannelViewForumAsMessages(nil)" + } + type Alias UpdateChannelViewForumAsMessages + return fmt.Sprintf("UpdateChannelViewForumAsMessages%+v", Alias(*u)) +} + +// FillFrom fills UpdateChannelViewForumAsMessages from given interface. +func (u *UpdateChannelViewForumAsMessages) FillFrom(from interface { + GetChannelID() (value int64) + GetEnabled() (value bool) +}) { + u.ChannelID = from.GetChannelID() + u.Enabled = from.GetEnabled() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdateChannelViewForumAsMessages) TypeID() uint32 { + return UpdateChannelViewForumAsMessagesTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdateChannelViewForumAsMessages) TypeName() string { + return "updateChannelViewForumAsMessages" +} + +// TypeInfo returns info about TL type. +func (u *UpdateChannelViewForumAsMessages) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updateChannelViewForumAsMessages", + ID: UpdateChannelViewForumAsMessagesTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "ChannelID", + SchemaName: "channel_id", + }, + { + Name: "Enabled", + SchemaName: "enabled", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (u *UpdateChannelViewForumAsMessages) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChannelViewForumAsMessages#7b68920 as nil") + } + b.PutID(UpdateChannelViewForumAsMessagesTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdateChannelViewForumAsMessages) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updateChannelViewForumAsMessages#7b68920 as nil") + } + b.PutLong(u.ChannelID) + b.PutBool(u.Enabled) + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdateChannelViewForumAsMessages) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChannelViewForumAsMessages#7b68920 to nil") + } + if err := b.ConsumeID(UpdateChannelViewForumAsMessagesTypeID); err != nil { + return fmt.Errorf("unable to decode updateChannelViewForumAsMessages#7b68920: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdateChannelViewForumAsMessages) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updateChannelViewForumAsMessages#7b68920 to nil") + } + { + value, err := b.Long() + if err != nil { + return fmt.Errorf("unable to decode updateChannelViewForumAsMessages#7b68920: field channel_id: %w", err) + } + u.ChannelID = value + } + { + value, err := b.Bool() + if err != nil { + return fmt.Errorf("unable to decode updateChannelViewForumAsMessages#7b68920: field enabled: %w", err) + } + u.Enabled = value + } + return nil +} + +// GetChannelID returns value of ChannelID field. +func (u *UpdateChannelViewForumAsMessages) GetChannelID() (value int64) { + if u == nil { + return + } + return u.ChannelID +} + +// GetEnabled returns value of Enabled field. +func (u *UpdateChannelViewForumAsMessages) GetEnabled() (value bool) { + if u == nil { + return + } + return u.Enabled +} + +// UpdatePeerWallpaper represents TL type `updatePeerWallpaper#ae3f101d`. +// +// See https://core.telegram.org/constructor/updatePeerWallpaper for reference. +type UpdatePeerWallpaper struct { + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields + Flags bin.Fields + // WallpaperOverridden field of UpdatePeerWallpaper. + WallpaperOverridden bool + // Peer field of UpdatePeerWallpaper. + Peer PeerClass + // Wallpaper field of UpdatePeerWallpaper. + // + // Use SetWallpaper and GetWallpaper helpers. + Wallpaper WallPaperClass +} + +// UpdatePeerWallpaperTypeID is TL type id of UpdatePeerWallpaper. +const UpdatePeerWallpaperTypeID = 0xae3f101d + +// construct implements constructor of UpdateClass. +func (u UpdatePeerWallpaper) construct() UpdateClass { return &u } + +// Ensuring interfaces in compile-time for UpdatePeerWallpaper. +var ( + _ bin.Encoder = &UpdatePeerWallpaper{} + _ bin.Decoder = &UpdatePeerWallpaper{} + _ bin.BareEncoder = &UpdatePeerWallpaper{} + _ bin.BareDecoder = &UpdatePeerWallpaper{} + + _ UpdateClass = &UpdatePeerWallpaper{} +) + +func (u *UpdatePeerWallpaper) Zero() bool { + if u == nil { + return true + } + if !(u.Flags.Zero()) { + return false + } + if !(u.WallpaperOverridden == false) { + return false + } + if !(u.Peer == nil) { + return false + } + if !(u.Wallpaper == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (u *UpdatePeerWallpaper) String() string { + if u == nil { + return "UpdatePeerWallpaper(nil)" + } + type Alias UpdatePeerWallpaper + return fmt.Sprintf("UpdatePeerWallpaper%+v", Alias(*u)) +} + +// FillFrom fills UpdatePeerWallpaper from given interface. +func (u *UpdatePeerWallpaper) FillFrom(from interface { + GetWallpaperOverridden() (value bool) + GetPeer() (value PeerClass) + GetWallpaper() (value WallPaperClass, ok bool) +}) { + u.WallpaperOverridden = from.GetWallpaperOverridden() + u.Peer = from.GetPeer() + if val, ok := from.GetWallpaper(); ok { + u.Wallpaper = val + } + +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*UpdatePeerWallpaper) TypeID() uint32 { + return UpdatePeerWallpaperTypeID +} + +// TypeName returns name of type in TL schema. +func (*UpdatePeerWallpaper) TypeName() string { + return "updatePeerWallpaper" +} + +// TypeInfo returns info about TL type. +func (u *UpdatePeerWallpaper) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "updatePeerWallpaper", + ID: UpdatePeerWallpaperTypeID, + } + if u == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "WallpaperOverridden", + SchemaName: "wallpaper_overridden", + Null: !u.Flags.Has(1), + }, + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "Wallpaper", + SchemaName: "wallpaper", + Null: !u.Flags.Has(0), + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (u *UpdatePeerWallpaper) SetFlags() { + if !(u.WallpaperOverridden == false) { + u.Flags.Set(1) + } + if !(u.Wallpaper == nil) { + u.Flags.Set(0) + } +} + +// Encode implements bin.Encoder. +func (u *UpdatePeerWallpaper) Encode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updatePeerWallpaper#ae3f101d as nil") + } + b.PutID(UpdatePeerWallpaperTypeID) + return u.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (u *UpdatePeerWallpaper) EncodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't encode updatePeerWallpaper#ae3f101d as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field flags: %w", err) + } + if u.Peer == nil { + return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field peer is nil") + } + if err := u.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field peer: %w", err) + } + if u.Flags.Has(0) { + if u.Wallpaper == nil { + return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field wallpaper is nil") + } + if err := u.Wallpaper.Encode(b); err != nil { + return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field wallpaper: %w", err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (u *UpdatePeerWallpaper) Decode(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updatePeerWallpaper#ae3f101d to nil") + } + if err := b.ConsumeID(UpdatePeerWallpaperTypeID); err != nil { + return fmt.Errorf("unable to decode updatePeerWallpaper#ae3f101d: %w", err) + } + return u.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (u *UpdatePeerWallpaper) DecodeBare(b *bin.Buffer) error { + if u == nil { + return fmt.Errorf("can't decode updatePeerWallpaper#ae3f101d to nil") + } + { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode updatePeerWallpaper#ae3f101d: field flags: %w", err) + } + } + u.WallpaperOverridden = u.Flags.Has(1) + { + value, err := DecodePeer(b) + if err != nil { + return fmt.Errorf("unable to decode updatePeerWallpaper#ae3f101d: field peer: %w", err) + } + u.Peer = value + } + if u.Flags.Has(0) { + value, err := DecodeWallPaper(b) + if err != nil { + return fmt.Errorf("unable to decode updatePeerWallpaper#ae3f101d: field wallpaper: %w", err) + } + u.Wallpaper = value + } + return nil +} + +// SetWallpaperOverridden sets value of WallpaperOverridden conditional field. +func (u *UpdatePeerWallpaper) SetWallpaperOverridden(value bool) { + if value { + u.Flags.Set(1) + u.WallpaperOverridden = true + } else { + u.Flags.Unset(1) + u.WallpaperOverridden = false + } +} + +// GetWallpaperOverridden returns value of WallpaperOverridden conditional field. +func (u *UpdatePeerWallpaper) GetWallpaperOverridden() (value bool) { + if u == nil { + return + } + return u.Flags.Has(1) +} + +// GetPeer returns value of Peer field. +func (u *UpdatePeerWallpaper) GetPeer() (value PeerClass) { + if u == nil { + return + } + return u.Peer +} + +// SetWallpaper sets value of Wallpaper conditional field. +func (u *UpdatePeerWallpaper) SetWallpaper(value WallPaperClass) { + u.Flags.Set(0) + u.Wallpaper = value +} + +// GetWallpaper returns value of Wallpaper conditional field and +// boolean which is true if field was set. +func (u *UpdatePeerWallpaper) GetWallpaper() (value WallPaperClass, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(0) { + return value, false + } + return u.Wallpaper, true +} + // UpdateClassName is schema name of UpdateClass. const UpdateClassName = "Update" @@ -23667,6 +24270,9 @@ const UpdateClassName = "Update" // case *tg.UpdateStoryID: // updateStoryID#1bf335b9 // case *tg.UpdateStoriesStealthMode: // updateStoriesStealthMode#2c084dc1 // case *tg.UpdateSentStoryReaction: // updateSentStoryReaction#7d627683 +// case *tg.UpdateBotChatBoost: // updateBotChatBoost#904dd49c +// case *tg.UpdateChannelViewForumAsMessages: // updateChannelViewForumAsMessages#7b68920 +// case *tg.UpdatePeerWallpaper: // updatePeerWallpaper#ae3f101d // default: panic(v) // } type UpdateClass interface { @@ -24514,6 +25120,27 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) } return &v, nil + case UpdateBotChatBoostTypeID: + // Decoding updateBotChatBoost#904dd49c. + v := UpdateBotChatBoost{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdateChannelViewForumAsMessagesTypeID: + // Decoding updateChannelViewForumAsMessages#7b68920. + v := UpdateChannelViewForumAsMessages{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil + case UpdatePeerWallpaperTypeID: + // Decoding updatePeerWallpaper#ae3f101d. + v := UpdatePeerWallpaper{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode UpdateClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_update_slices_gen.go b/tg/tl_update_slices_gen.go index 88afe7e123..3868963920 100644 --- a/tg/tl_update_slices_gen.go +++ b/tg/tl_update_slices_gen.go @@ -1442,6 +1442,45 @@ func (s UpdateClassArray) AsUpdateSentStoryReaction() (to UpdateSentStoryReactio return to } +// AsUpdateBotChatBoost returns copy with only UpdateBotChatBoost constructors. +func (s UpdateClassArray) AsUpdateBotChatBoost() (to UpdateBotChatBoostArray) { + for _, elem := range s { + value, ok := elem.(*UpdateBotChatBoost) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdateChannelViewForumAsMessages returns copy with only UpdateChannelViewForumAsMessages constructors. +func (s UpdateClassArray) AsUpdateChannelViewForumAsMessages() (to UpdateChannelViewForumAsMessagesArray) { + for _, elem := range s { + value, ok := elem.(*UpdateChannelViewForumAsMessages) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + +// AsUpdatePeerWallpaper returns copy with only UpdatePeerWallpaper constructors. +func (s UpdateClassArray) AsUpdatePeerWallpaper() (to UpdatePeerWallpaperArray) { + for _, elem := range s { + value, ok := elem.(*UpdatePeerWallpaper) + if !ok { + continue + } + to = append(to, *value) + } + + return to +} + // UpdateNewMessageArray is adapter for slice of UpdateNewMessage. type UpdateNewMessageArray []UpdateNewMessage @@ -10043,3 +10082,249 @@ func (s *UpdateSentStoryReactionArray) Pop() (v UpdateSentStoryReaction, ok bool return v, true } + +// UpdateBotChatBoostArray is adapter for slice of UpdateBotChatBoost. +type UpdateBotChatBoostArray []UpdateBotChatBoost + +// Sort sorts slice of UpdateBotChatBoost. +func (s UpdateBotChatBoostArray) Sort(less func(a, b UpdateBotChatBoost) bool) UpdateBotChatBoostArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateBotChatBoost. +func (s UpdateBotChatBoostArray) SortStable(less func(a, b UpdateBotChatBoost) bool) UpdateBotChatBoostArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateBotChatBoost. +func (s UpdateBotChatBoostArray) Retain(keep func(x UpdateBotChatBoost) bool) UpdateBotChatBoostArray { + 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 UpdateBotChatBoostArray) First() (v UpdateBotChatBoost, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateBotChatBoostArray) Last() (v UpdateBotChatBoost, 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 *UpdateBotChatBoostArray) PopFirst() (v UpdateBotChatBoost, 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 UpdateBotChatBoost + 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 *UpdateBotChatBoostArray) Pop() (v UpdateBotChatBoost, 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 +} + +// UpdateChannelViewForumAsMessagesArray is adapter for slice of UpdateChannelViewForumAsMessages. +type UpdateChannelViewForumAsMessagesArray []UpdateChannelViewForumAsMessages + +// Sort sorts slice of UpdateChannelViewForumAsMessages. +func (s UpdateChannelViewForumAsMessagesArray) Sort(less func(a, b UpdateChannelViewForumAsMessages) bool) UpdateChannelViewForumAsMessagesArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdateChannelViewForumAsMessages. +func (s UpdateChannelViewForumAsMessagesArray) SortStable(less func(a, b UpdateChannelViewForumAsMessages) bool) UpdateChannelViewForumAsMessagesArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdateChannelViewForumAsMessages. +func (s UpdateChannelViewForumAsMessagesArray) Retain(keep func(x UpdateChannelViewForumAsMessages) bool) UpdateChannelViewForumAsMessagesArray { + 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 UpdateChannelViewForumAsMessagesArray) First() (v UpdateChannelViewForumAsMessages, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdateChannelViewForumAsMessagesArray) Last() (v UpdateChannelViewForumAsMessages, 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 *UpdateChannelViewForumAsMessagesArray) PopFirst() (v UpdateChannelViewForumAsMessages, 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 UpdateChannelViewForumAsMessages + 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 *UpdateChannelViewForumAsMessagesArray) Pop() (v UpdateChannelViewForumAsMessages, 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 +} + +// UpdatePeerWallpaperArray is adapter for slice of UpdatePeerWallpaper. +type UpdatePeerWallpaperArray []UpdatePeerWallpaper + +// Sort sorts slice of UpdatePeerWallpaper. +func (s UpdatePeerWallpaperArray) Sort(less func(a, b UpdatePeerWallpaper) bool) UpdatePeerWallpaperArray { + sort.Slice(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// SortStable sorts slice of UpdatePeerWallpaper. +func (s UpdatePeerWallpaperArray) SortStable(less func(a, b UpdatePeerWallpaper) bool) UpdatePeerWallpaperArray { + sort.SliceStable(s, func(i, j int) bool { + return less(s[i], s[j]) + }) + return s +} + +// Retain filters in-place slice of UpdatePeerWallpaper. +func (s UpdatePeerWallpaperArray) Retain(keep func(x UpdatePeerWallpaper) bool) UpdatePeerWallpaperArray { + 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 UpdatePeerWallpaperArray) First() (v UpdatePeerWallpaper, ok bool) { + if len(s) < 1 { + return + } + return s[0], true +} + +// Last returns last element of slice (if exists). +func (s UpdatePeerWallpaperArray) Last() (v UpdatePeerWallpaper, 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 *UpdatePeerWallpaperArray) PopFirst() (v UpdatePeerWallpaper, 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 UpdatePeerWallpaper + 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 *UpdatePeerWallpaperArray) Pop() (v UpdatePeerWallpaper, ok bool) { + if s == nil || len(*s) < 1 { + return + } + + a := *s + v = a[len(a)-1] + a = a[:len(a)-1] + *s = a + + return v, true +} diff --git a/tg/tl_updates_classifier_gen.go b/tg/tl_updates_classifier_gen.go index 285a927962..138d81b6f0 100644 --- a/tg/tl_updates_classifier_gen.go +++ b/tg/tl_updates_classifier_gen.go @@ -70,6 +70,8 @@ func IsQtsUpdate(u UpdateClass) (qts int, ok bool) { return u.Qts, true case *UpdateBotChatInviteRequester: return u.Qts, true + case *UpdateBotChatBoost: + return u.Qts, true } return diff --git a/tg/tl_upload_get_cdn_file_hashes_gen.go b/tg/tl_upload_get_cdn_file_hashes_gen.go index 733ab72f8b..ae1084d5fc 100644 --- a/tg/tl_upload_get_cdn_file_hashes_gen.go +++ b/tg/tl_upload_get_cdn_file_hashes_gen.go @@ -200,6 +200,7 @@ func (g *UploadGetCDNFileHashesRequest) GetOffset() (value int64) { // Possible errors: // // 400 CDN_METHOD_INVALID: You can't call this method in a CDN DC. +// 400 FILE_TOKEN_INVALID: The specified file token is invalid. // 400 RSA_DECRYPT_FAILED: Internal RSA decryption failed. // // See https://core.telegram.org/method/upload.getCdnFileHashes for reference. diff --git a/tg/tl_upload_reupload_cdn_file_gen.go b/tg/tl_upload_reupload_cdn_file_gen.go index 9de34a783c..f231119277 100644 --- a/tg/tl_upload_reupload_cdn_file_gen.go +++ b/tg/tl_upload_reupload_cdn_file_gen.go @@ -199,7 +199,6 @@ func (r *UploadReuploadCDNFileRequest) GetRequestToken() (value []byte) { // // Possible errors: // -// 400 AES_DECRYPT_FAILED: // 400 CDN_METHOD_INVALID: You can't call this method in a CDN DC. // 500 CDN_UPLOAD_TIMEOUT: A server-side timeout occurred while reuploading the file to the CDN DC. // 400 FILE_TOKEN_INVALID: The specified file token is invalid. diff --git a/tg/tl_user_full_gen.go b/tg/tl_user_full_gen.go index 756579ac5e..17d8fe869b 100644 --- a/tg/tl_user_full_gen.go +++ b/tg/tl_user_full_gen.go @@ -64,10 +64,23 @@ type UserFull struct { // Links: // 1) https://core.telegram.org/api/translation TranslationsDisabled bool - // StoriesPinnedAvailable field of UserFull. + // Whether this user has some pinned stories¹. + // + // Links: + // 1) https://core.telegram.org/api/stories#pinned-or-archived-stories StoriesPinnedAvailable bool - // BlockedMyStoriesFrom field of UserFull. + // Whether we've blocked this user, preventing them from seeing our stories »¹. + // + // Links: + // 1) https://core.telegram.org/api/block BlockedMyStoriesFrom bool + // Whether the other user has chosen a custom wallpaper for us using messages + // setChatWallPaper¹ and the for_both flag, see here »² for more info. + // + // Links: + // 1) https://core.telegram.org/method/messages.setChatWallPaper + // 2) https://core.telegram.org/api/wallpapers#installing-wallpapers-in-a-specific-chat + WallpaperOverridden bool // User ID ID int64 // Bio of the user @@ -153,7 +166,10 @@ type UserFull struct { // // Use SetWallpaper and GetWallpaper helpers. Wallpaper WallPaperClass - // Stories field of UserFull. + // Active stories »¹ + // + // Links: + // 1) https://core.telegram.org/api/stories // // Use SetStories and GetStories helpers. Stories PeerStories @@ -207,6 +223,9 @@ func (u *UserFull) Zero() bool { if !(u.BlockedMyStoriesFrom == false) { return false } + if !(u.WallpaperOverridden == false) { + return false + } if !(u.ID == 0) { return false } @@ -289,6 +308,7 @@ func (u *UserFull) FillFrom(from interface { GetTranslationsDisabled() (value bool) GetStoriesPinnedAvailable() (value bool) GetBlockedMyStoriesFrom() (value bool) + GetWallpaperOverridden() (value bool) GetID() (value int64) GetAbout() (value string, ok bool) GetSettings() (value PeerSettings) @@ -319,6 +339,7 @@ func (u *UserFull) FillFrom(from interface { u.TranslationsDisabled = from.GetTranslationsDisabled() u.StoriesPinnedAvailable = from.GetStoriesPinnedAvailable() u.BlockedMyStoriesFrom = from.GetBlockedMyStoriesFrom() + u.WallpaperOverridden = from.GetWallpaperOverridden() u.ID = from.GetID() if val, ok := from.GetAbout(); ok { u.About = val @@ -458,6 +479,11 @@ func (u *UserFull) TypeInfo() tdp.Type { SchemaName: "blocked_my_stories_from", Null: !u.Flags.Has(27), }, + { + Name: "WallpaperOverridden", + SchemaName: "wallpaper_overridden", + Null: !u.Flags.Has(28), + }, { Name: "ID", SchemaName: "id", @@ -585,6 +611,9 @@ func (u *UserFull) SetFlags() { if !(u.BlockedMyStoriesFrom == false) { u.Flags.Set(27) } + if !(u.WallpaperOverridden == false) { + u.Flags.Set(28) + } if !(u.About == "") { u.Flags.Set(1) } @@ -770,6 +799,7 @@ func (u *UserFull) DecodeBare(b *bin.Buffer) error { u.TranslationsDisabled = u.Flags.Has(23) u.StoriesPinnedAvailable = u.Flags.Has(26) u.BlockedMyStoriesFrom = u.Flags.Has(27) + u.WallpaperOverridden = u.Flags.Has(28) { value, err := b.Long() if err != nil { @@ -1094,6 +1124,25 @@ func (u *UserFull) GetBlockedMyStoriesFrom() (value bool) { return u.Flags.Has(27) } +// SetWallpaperOverridden sets value of WallpaperOverridden conditional field. +func (u *UserFull) SetWallpaperOverridden(value bool) { + if value { + u.Flags.Set(28) + u.WallpaperOverridden = true + } else { + u.Flags.Unset(28) + u.WallpaperOverridden = false + } +} + +// GetWallpaperOverridden returns value of WallpaperOverridden conditional field. +func (u *UserFull) GetWallpaperOverridden() (value bool) { + if u == nil { + return + } + return u.Flags.Has(28) +} + // GetID returns value of ID field. func (u *UserFull) GetID() (value int64) { if u == nil { diff --git a/tg/tl_user_gen.go b/tg/tl_user_gen.go index f3dfcd5dcc..8bf68f9440 100644 --- a/tg/tl_user_gen.go +++ b/tg/tl_user_gen.go @@ -166,7 +166,7 @@ func (u *UserEmpty) GetID() (value int64) { return u.ID } -// User represents TL type `user#eb602f25`. +// User represents TL type `user#215c4438`. // Indicates info about a certain user // // See https://core.telegram.org/constructor/user for reference. @@ -230,7 +230,10 @@ type User struct { // Whether we can edit the profile picture, name, about text and description of this bot // because we own it. BotCanEdit bool - // CloseFriend field of User. + // Whether we marked this user as a close friend, see here » for more info¹ + // + // Links: + // 1) https://core.telegram.org/api/privacy CloseFriend bool // Whether we have hidden »¹ all active stories of this user. // @@ -299,22 +302,25 @@ type User struct { // // Use SetUsernames and GetUsernames helpers. Usernames []Username - // StoriesMaxID field of User. + // ID of the maximum read story¹. + // + // Links: + // 1) https://core.telegram.org/api/stories // // Use SetStoriesMaxID and GetStoriesMaxID helpers. StoriesMaxID int // Color field of User. // // Use SetColor and GetColor helpers. - Color int - // BackgroundEmojiID field of User. + Color PeerColor + // ProfileColor field of User. // - // Use SetBackgroundEmojiID and GetBackgroundEmojiID helpers. - BackgroundEmojiID int64 + // Use SetProfileColor and GetProfileColor helpers. + ProfileColor PeerColor } // UserTypeID is TL type id of User. -const UserTypeID = 0xeb602f25 +const UserTypeID = 0x215c4438 // construct implements constructor of UserClass. func (u User) construct() UserClass { return &u } @@ -450,10 +456,10 @@ func (u *User) Zero() bool { if !(u.StoriesMaxID == 0) { return false } - if !(u.Color == 0) { + if !(u.Color.Zero()) { return false } - if !(u.BackgroundEmojiID == 0) { + if !(u.ProfileColor.Zero()) { return false } @@ -508,8 +514,8 @@ func (u *User) FillFrom(from interface { GetEmojiStatus() (value EmojiStatusClass, ok bool) GetUsernames() (value []Username, ok bool) GetStoriesMaxID() (value int, ok bool) - GetColor() (value int, ok bool) - GetBackgroundEmojiID() (value int64, ok bool) + GetColor() (value PeerColor, ok bool) + GetProfileColor() (value PeerColor, ok bool) }) { u.Self = from.GetSelf() u.Contact = from.GetContact() @@ -594,8 +600,8 @@ func (u *User) FillFrom(from interface { u.Color = val } - if val, ok := from.GetBackgroundEmojiID(); ok { - u.BackgroundEmojiID = val + if val, ok := from.GetProfileColor(); ok { + u.ProfileColor = val } } @@ -810,12 +816,12 @@ func (u *User) TypeInfo() tdp.Type { { Name: "Color", SchemaName: "color", - Null: !u.Flags2.Has(7), + Null: !u.Flags2.Has(8), }, { - Name: "BackgroundEmojiID", - SchemaName: "background_emoji_id", - Null: !u.Flags2.Has(6), + Name: "ProfileColor", + SchemaName: "profile_color", + Null: !u.Flags2.Has(9), }, } return typ @@ -931,18 +937,18 @@ func (u *User) SetFlags() { if !(u.StoriesMaxID == 0) { u.Flags2.Set(5) } - if !(u.Color == 0) { - u.Flags2.Set(7) + if !(u.Color.Zero()) { + u.Flags2.Set(8) } - if !(u.BackgroundEmojiID == 0) { - u.Flags2.Set(6) + if !(u.ProfileColor.Zero()) { + u.Flags2.Set(9) } } // Encode implements bin.Encoder. func (u *User) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#eb602f25 as nil") + return fmt.Errorf("can't encode user#215c4438 as nil") } b.PutID(UserTypeID) return u.EncodeBare(b) @@ -951,14 +957,14 @@ func (u *User) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *User) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode user#eb602f25 as nil") + return fmt.Errorf("can't encode user#215c4438 as nil") } u.SetFlags() if err := u.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#eb602f25: field flags: %w", err) + return fmt.Errorf("unable to encode user#215c4438: field flags: %w", err) } if err := u.Flags2.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#eb602f25: field flags2: %w", err) + return fmt.Errorf("unable to encode user#215c4438: field flags2: %w", err) } b.PutLong(u.ID) if u.Flags.Has(0) { @@ -978,18 +984,18 @@ func (u *User) EncodeBare(b *bin.Buffer) error { } if u.Flags.Has(5) { if u.Photo == nil { - return fmt.Errorf("unable to encode user#eb602f25: field photo is nil") + return fmt.Errorf("unable to encode user#215c4438: field photo is nil") } if err := u.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#eb602f25: field photo: %w", err) + return fmt.Errorf("unable to encode user#215c4438: field photo: %w", err) } } if u.Flags.Has(6) { if u.Status == nil { - return fmt.Errorf("unable to encode user#eb602f25: field status is nil") + return fmt.Errorf("unable to encode user#215c4438: field status is nil") } if err := u.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#eb602f25: field status: %w", err) + return fmt.Errorf("unable to encode user#215c4438: field status: %w", err) } } if u.Flags.Has(14) { @@ -999,7 +1005,7 @@ func (u *User) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(u.RestrictionReason)) for idx, v := range u.RestrictionReason { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#eb602f25: field restriction_reason element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode user#215c4438: field restriction_reason element with index %d: %w", idx, err) } } } @@ -1011,28 +1017,32 @@ func (u *User) EncodeBare(b *bin.Buffer) error { } if u.Flags.Has(30) { if u.EmojiStatus == nil { - return fmt.Errorf("unable to encode user#eb602f25: field emoji_status is nil") + return fmt.Errorf("unable to encode user#215c4438: field emoji_status is nil") } if err := u.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#eb602f25: field emoji_status: %w", err) + return fmt.Errorf("unable to encode user#215c4438: field emoji_status: %w", err) } } if u.Flags2.Has(0) { b.PutVectorHeader(len(u.Usernames)) for idx, v := range u.Usernames { if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#eb602f25: field usernames element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode user#215c4438: field usernames element with index %d: %w", idx, err) } } } if u.Flags2.Has(5) { b.PutInt(u.StoriesMaxID) } - if u.Flags2.Has(7) { - b.PutInt(u.Color) + if u.Flags2.Has(8) { + if err := u.Color.Encode(b); err != nil { + return fmt.Errorf("unable to encode user#215c4438: field color: %w", err) + } } - if u.Flags2.Has(6) { - b.PutLong(u.BackgroundEmojiID) + if u.Flags2.Has(9) { + if err := u.ProfileColor.Encode(b); err != nil { + return fmt.Errorf("unable to encode user#215c4438: field profile_color: %w", err) + } } return nil } @@ -1040,10 +1050,10 @@ func (u *User) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (u *User) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#eb602f25 to nil") + return fmt.Errorf("can't decode user#215c4438 to nil") } if err := b.ConsumeID(UserTypeID); err != nil { - return fmt.Errorf("unable to decode user#eb602f25: %w", err) + return fmt.Errorf("unable to decode user#215c4438: %w", err) } return u.DecodeBare(b) } @@ -1051,11 +1061,11 @@ func (u *User) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *User) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode user#eb602f25 to nil") + return fmt.Errorf("can't decode user#215c4438 to nil") } { if err := u.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field flags: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field flags: %w", err) } } u.Self = u.Flags.Has(10) @@ -1078,7 +1088,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error { u.AttachMenuEnabled = u.Flags.Has(29) { if err := u.Flags2.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field flags2: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field flags2: %w", err) } } u.BotCanEdit = u.Flags2.Has(1) @@ -1088,70 +1098,70 @@ func (u *User) DecodeBare(b *bin.Buffer) error { { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field id: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field id: %w", err) } u.ID = value } if u.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field access_hash: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field access_hash: %w", err) } u.AccessHash = value } if u.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field first_name: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field first_name: %w", err) } u.FirstName = value } if u.Flags.Has(2) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field last_name: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field last_name: %w", err) } u.LastName = value } if u.Flags.Has(3) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field username: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field username: %w", err) } u.Username = value } if u.Flags.Has(4) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field phone: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field phone: %w", err) } u.Phone = value } if u.Flags.Has(5) { value, err := DecodeUserProfilePhoto(b) if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field photo: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field photo: %w", err) } u.Photo = value } if u.Flags.Has(6) { value, err := DecodeUserStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field status: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field status: %w", err) } u.Status = value } if u.Flags.Has(14) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field bot_info_version: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field bot_info_version: %w", err) } u.BotInfoVersion = value } if u.Flags.Has(18) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field restriction_reason: %w", err) } if headerLen > 0 { @@ -1160,7 +1170,7 @@ func (u *User) 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 user#eb602f25: field restriction_reason: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field restriction_reason: %w", err) } u.RestrictionReason = append(u.RestrictionReason, value) } @@ -1168,28 +1178,28 @@ func (u *User) DecodeBare(b *bin.Buffer) error { if u.Flags.Has(19) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field bot_inline_placeholder: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field bot_inline_placeholder: %w", err) } u.BotInlinePlaceholder = value } if u.Flags.Has(22) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field lang_code: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field lang_code: %w", err) } u.LangCode = value } if u.Flags.Has(30) { value, err := DecodeEmojiStatus(b) if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field emoji_status: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field emoji_status: %w", err) } u.EmojiStatus = value } if u.Flags2.Has(0) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field usernames: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field usernames: %w", err) } if headerLen > 0 { @@ -1198,7 +1208,7 @@ func (u *User) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { var value Username if err := value.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field usernames: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field usernames: %w", err) } u.Usernames = append(u.Usernames, value) } @@ -1206,23 +1216,19 @@ func (u *User) DecodeBare(b *bin.Buffer) error { if u.Flags2.Has(5) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field stories_max_id: %w", err) + return fmt.Errorf("unable to decode user#215c4438: field stories_max_id: %w", err) } u.StoriesMaxID = value } - if u.Flags2.Has(7) { - value, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field color: %w", err) + if u.Flags2.Has(8) { + if err := u.Color.Decode(b); err != nil { + return fmt.Errorf("unable to decode user#215c4438: field color: %w", err) } - u.Color = value } - if u.Flags2.Has(6) { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode user#eb602f25: field background_emoji_id: %w", err) + if u.Flags2.Has(9) { + if err := u.ProfileColor.Decode(b); err != nil { + return fmt.Errorf("unable to decode user#215c4438: field profile_color: %w", err) } - u.BackgroundEmojiID = value } return nil } @@ -1906,39 +1912,39 @@ func (u *User) GetStoriesMaxID() (value int, ok bool) { } // SetColor sets value of Color conditional field. -func (u *User) SetColor(value int) { - u.Flags2.Set(7) +func (u *User) SetColor(value PeerColor) { + u.Flags2.Set(8) u.Color = value } // GetColor returns value of Color conditional field and // boolean which is true if field was set. -func (u *User) GetColor() (value int, ok bool) { +func (u *User) GetColor() (value PeerColor, ok bool) { if u == nil { return } - if !u.Flags2.Has(7) { + if !u.Flags2.Has(8) { return value, false } return u.Color, true } -// SetBackgroundEmojiID sets value of BackgroundEmojiID conditional field. -func (u *User) SetBackgroundEmojiID(value int64) { - u.Flags2.Set(6) - u.BackgroundEmojiID = value +// SetProfileColor sets value of ProfileColor conditional field. +func (u *User) SetProfileColor(value PeerColor) { + u.Flags2.Set(9) + u.ProfileColor = value } -// GetBackgroundEmojiID returns value of BackgroundEmojiID conditional field and +// GetProfileColor returns value of ProfileColor conditional field and // boolean which is true if field was set. -func (u *User) GetBackgroundEmojiID() (value int64, ok bool) { +func (u *User) GetProfileColor() (value PeerColor, ok bool) { if u == nil { return } - if !u.Flags2.Has(6) { + if !u.Flags2.Has(9) { return value, false } - return u.BackgroundEmojiID, true + return u.ProfileColor, true } // UserClassName is schema name of UserClass. @@ -1956,7 +1962,7 @@ const UserClassName = "User" // } // switch v := g.(type) { // case *tg.UserEmpty: // userEmpty#d3bc4b7a -// case *tg.User: // user#eb602f25 +// case *tg.User: // user#215c4438 // default: panic(v) // } type UserClass interface { @@ -2031,7 +2037,7 @@ func DecodeUser(buf *bin.Buffer) (UserClass, error) { } return &v, nil case UserTypeID: - // Decoding user#eb602f25. + // Decoding user#215c4438. v := User{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UserClass: %w", err) diff --git a/tg/tl_web_page_attribute_gen.go b/tg/tl_web_page_attribute_gen.go index 208fe9f15f..1241f0326b 100644 --- a/tg/tl_web_page_attribute_gen.go +++ b/tg/tl_web_page_attribute_gen.go @@ -283,6 +283,7 @@ func (w *WebPageAttributeTheme) MapDocuments() (value DocumentClassArray, ok boo } // WebPageAttributeStory represents TL type `webPageAttributeStory#2e94c3e7`. +// Webpage preview of a Telegram story // // See https://core.telegram.org/constructor/webPageAttributeStory for reference. type WebPageAttributeStory struct { @@ -291,11 +292,18 @@ type WebPageAttributeStory struct { // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields - // Peer field of WebPageAttributeStory. + // Peer that posted the story Peer PeerClass - // ID field of WebPageAttributeStory. + // Story ID¹ + // + // Links: + // 1) https://core.telegram.org/api/stories#watching-stories ID int - // Story field of WebPageAttributeStory. + // May contain the story, if not the story should be fetched when and if needed using + // stories.getStoriesByID¹ with the above id and peer. + // + // Links: + // 1) https://core.telegram.org/method/stories.getStoriesByID // // Use SetStory and GetStory helpers. Story StoryItemClass diff --git a/tg/tl_web_page_gen.go b/tg/tl_web_page_gen.go index 4e9ff15b8d..fe1c4fef0a 100644 --- a/tg/tl_web_page_gen.go +++ b/tg/tl_web_page_gen.go @@ -36,7 +36,10 @@ var ( // // See https://core.telegram.org/constructor/webPageEmpty for reference. type WebPageEmpty struct { - // Flags field of WebPageEmpty. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // Preview ID ID int64 @@ -237,7 +240,10 @@ func (w *WebPageEmpty) GetURL() (value string, ok bool) { // // See https://core.telegram.org/constructor/webPagePending for reference. type WebPagePending struct { - // Flags field of WebPagePending. + // Flags, see TL conditional fields¹ + // + // Links: + // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields Flags bin.Fields // ID of preview ID int64