diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index 2f1a727d74..ce545b79ae 100644 --- a/_schema/tdesktop.tl +++ b/_schema/tdesktop.tl @@ -1,8 +1,8 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl -// Layer: 189 -// SHA256: 274a71c5b60947275de376cce5cecb0a907181439ae6d53c54f4a0331c66be75 +// Layer: 192 +// SHA256: 8de881afe6424446c01b781ba56351db3ae6853674140329dcea4bcf17bded31 boolFalse#bc799737 = Bool; @@ -190,7 +190,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#94345242 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck = Message; +message#94345242 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck = Message; messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message; @@ -292,7 +292,7 @@ messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; -messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long = MessageAction; +messageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction; messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; @@ -304,7 +304,7 @@ messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAc messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; +messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction; messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; @@ -396,7 +396,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; +userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -606,7 +606,7 @@ updatePeerLocated#b4afcfb0 peers:Vector = Update; updateNewScheduledMessage#39a51dfb message:Message = Update; -updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector = Update; +updateDeleteScheduledMessages#f2a71983 flags:# peer:Peer messages:Vector sent_messages:flags.0?Vector = Update; updateTheme#8216fba3 theme:Theme = Update; @@ -2248,7 +2248,7 @@ inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgra inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose; inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; @@ -2670,9 +2670,11 @@ starsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer; starsTransactionPeerAds#60682812 = StarsTransactionPeer; +starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; + starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#a9ee4c2 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift = StarsTransaction; +starsTransaction#35d4f276 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int = StarsTransaction; payments.starsStatus#bbfa316c flags:# balance:long subscriptions:flags.1?Vector subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; @@ -2710,7 +2712,7 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; -starGift#aea174ee flags:# limited:flags.0?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long = StarGift; +starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift; payments.starGiftsNotModified#a388a368 = payments.StarGifts; @@ -3099,11 +3101,11 @@ messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; -messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; -messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; -messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; +messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; @@ -3259,7 +3261,7 @@ messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = m messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; -messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; @@ -3515,6 +3517,14 @@ messages.togglePaidReactionPrivacy#849ad397 peer:InputPeer msg_id:int private:Bo messages.getPaidReactionPrivacy#472455aa = Updates; +messages.viewSponsoredMessage#673ad8f1 peer:InputPeer random_id:bytes = Bool; + +messages.clickSponsoredMessage#f093465 flags:# media:flags.0?true fullscreen:flags.1?true peer:InputPeer random_id:bytes = Bool; + +messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:bytes = channels.SponsoredMessageReportResult; + +messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages; + updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -3667,10 +3677,6 @@ channels.getInactiveChannels#11e831ee = messages.InactiveChats; channels.convertToGigagroup#b290c69 channel:InputChannel = Updates; -channels.viewSponsoredMessage#beaedb94 channel:InputChannel random_id:bytes = Bool; - -channels.getSponsoredMessages#ec210fbf channel:InputChannel = messages.SponsoredMessages; - channels.getSendAs#dc770ee peer:InputPeer = channels.SendAsPeers; channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory; @@ -3707,8 +3713,6 @@ channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = channels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = Updates; -channels.clickSponsoredMessage#1445d75 flags:# media:flags.0?true fullscreen:flags.1?true channel:InputChannel random_id:bytes = Bool; - channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; @@ -3721,8 +3725,6 @@ channels.setBoostsToUnblockRestrictions#ad399cee channel:InputChannel boosts:int channels.setEmojiStickers#3cd930b7 channel:InputChannel stickerset:InputStickerSet = Bool; -channels.reportSponsoredMessage#af8ff6b9 channel:InputChannel random_id:bytes option:bytes = channels.SponsoredMessageReportResult; - channels.restrictSponsoredMessages#9ae91519 channel:InputChannel restricted:Bool = Updates; channels.searchPosts#d19f987b hashtag:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; @@ -3951,11 +3953,11 @@ stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = s stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; -stats.getBroadcastRevenueStats#75dfb671 flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastRevenueStats; +stats.getBroadcastRevenueStats#f788ee19 flags:# dark:flags.0?true peer:InputPeer = stats.BroadcastRevenueStats; -stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 channel:InputChannel password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl; +stats.getBroadcastRevenueWithdrawalUrl#9df4faad peer:InputPeer password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl; -stats.getBroadcastRevenueTransactions#69280f channel:InputChannel offset:int limit:int = stats.BroadcastRevenueTransactions; +stats.getBroadcastRevenueTransactions#70990b6d peer:InputPeer offset:int limit:int = stats.BroadcastRevenueTransactions; chatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector = chatlists.ExportedChatlistInvite; @@ -4029,7 +4031,7 @@ stories.getStoryReactionsList#b9b2881f flags:# forwards_first:flags.2?true peer: stories.togglePinnedToTop#b297e9b peer:InputPeer id:Vector = Bool; -stories.searchPosts#6cea116a flags:# hashtag:flags.0?string area:flags.1?MediaArea offset:string limit:int = stories.FoundStories; +stories.searchPosts#d1810907 flags:# hashtag:flags.0?string area:flags.1?MediaArea peer:flags.2?InputPeer offset:string limit:int = stories.FoundStories; premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList; @@ -4057,4 +4059,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 189 +// LAYER 192 diff --git a/_schema/tdlib.tl b/_schema/tdlib.tl index 3ebe173c66..7136d694c2 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: 189 -// SHA256: eff9073ed808ffbcfe0d8fd73c3fb125d65e897792d8e53327c5e4af2a4c07d7 +// Layer: 192 +// SHA256: a0ae469f520d1c291bf11b28ea23563f9308645cc158467e78e161106b17cfb1 int#a8509bda ? = Int; @@ -226,7 +226,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#94345242 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck = Message; +message#94345242 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck = Message; messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message; @@ -328,7 +328,7 @@ messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; -messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long = MessageAction; +messageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction; messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; @@ -340,7 +340,7 @@ messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAc messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; +messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction; messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; @@ -432,7 +432,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; +userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -642,7 +642,7 @@ updatePeerLocated#b4afcfb0 peers:Vector = Update; updateNewScheduledMessage#39a51dfb message:Message = Update; -updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector = Update; +updateDeleteScheduledMessages#f2a71983 flags:# peer:Peer messages:Vector sent_messages:flags.0?Vector = Update; updateTheme#8216fba3 theme:Theme = Update; @@ -2284,7 +2284,7 @@ inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgra inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose; inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; @@ -2706,9 +2706,11 @@ starsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer; starsTransactionPeerAds#60682812 = StarsTransactionPeer; +starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; + starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#a9ee4c2 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift = StarsTransaction; +starsTransaction#35d4f276 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int = StarsTransaction; payments.starsStatus#bbfa316c flags:# balance:long subscriptions:flags.1?Vector subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; @@ -2746,7 +2748,7 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; -starGift#aea174ee flags:# limited:flags.0?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long = StarGift; +starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift; payments.starGiftsNotModified#a388a368 = payments.StarGifts; @@ -3135,11 +3137,11 @@ messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; -messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; -messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; -messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; +messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; @@ -3295,7 +3297,7 @@ messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = m messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; -messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; @@ -3551,6 +3553,14 @@ messages.togglePaidReactionPrivacy#849ad397 peer:InputPeer msg_id:int private:Bo messages.getPaidReactionPrivacy#472455aa = Updates; +messages.viewSponsoredMessage#673ad8f1 peer:InputPeer random_id:bytes = Bool; + +messages.clickSponsoredMessage#f093465 flags:# media:flags.0?true fullscreen:flags.1?true peer:InputPeer random_id:bytes = Bool; + +messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:bytes = channels.SponsoredMessageReportResult; + +messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages; + updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -3703,10 +3713,6 @@ channels.getInactiveChannels#11e831ee = messages.InactiveChats; channels.convertToGigagroup#b290c69 channel:InputChannel = Updates; -channels.viewSponsoredMessage#beaedb94 channel:InputChannel random_id:bytes = Bool; - -channels.getSponsoredMessages#ec210fbf channel:InputChannel = messages.SponsoredMessages; - channels.getSendAs#dc770ee peer:InputPeer = channels.SendAsPeers; channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory; @@ -3743,8 +3749,6 @@ channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = channels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = Updates; -channels.clickSponsoredMessage#1445d75 flags:# media:flags.0?true fullscreen:flags.1?true channel:InputChannel random_id:bytes = Bool; - channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; @@ -3757,8 +3761,6 @@ channels.setBoostsToUnblockRestrictions#ad399cee channel:InputChannel boosts:int channels.setEmojiStickers#3cd930b7 channel:InputChannel stickerset:InputStickerSet = Bool; -channels.reportSponsoredMessage#af8ff6b9 channel:InputChannel random_id:bytes option:bytes = channels.SponsoredMessageReportResult; - channels.restrictSponsoredMessages#9ae91519 channel:InputChannel restricted:Bool = Updates; channels.searchPosts#d19f987b hashtag:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; @@ -3987,11 +3989,11 @@ stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = s stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; -stats.getBroadcastRevenueStats#75dfb671 flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastRevenueStats; +stats.getBroadcastRevenueStats#f788ee19 flags:# dark:flags.0?true peer:InputPeer = stats.BroadcastRevenueStats; -stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 channel:InputChannel password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl; +stats.getBroadcastRevenueWithdrawalUrl#9df4faad peer:InputPeer password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl; -stats.getBroadcastRevenueTransactions#69280f channel:InputChannel offset:int limit:int = stats.BroadcastRevenueTransactions; +stats.getBroadcastRevenueTransactions#70990b6d peer:InputPeer offset:int limit:int = stats.BroadcastRevenueTransactions; chatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector = chatlists.ExportedChatlistInvite; @@ -4065,7 +4067,7 @@ stories.getStoryReactionsList#b9b2881f flags:# forwards_first:flags.2?true peer: stories.togglePinnedToTop#b297e9b peer:InputPeer id:Vector = Bool; -stories.searchPosts#6cea116a flags:# hashtag:flags.0?string area:flags.1?MediaArea offset:string limit:int = stories.FoundStories; +stories.searchPosts#d1810907 flags:# hashtag:flags.0?string area:flags.1?MediaArea peer:flags.2?InputPeer offset:string limit:int = stories.FoundStories; premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList; @@ -4093,4 +4095,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 189 +// LAYER 192 diff --git a/_schema/telegram.tl b/_schema/telegram.tl index 97265ef4c9..7cc3353e14 100644 --- a/_schema/telegram.tl +++ b/_schema/telegram.tl @@ -2,8 +2,8 @@ // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl // Merge: _schema/legacy.tl -// Layer: 189 -// SHA256: 274a71c5b60947275de376cce5cecb0a907181439ae6d53c54f4a0331c66be75 +// Layer: 192 +// SHA256: 8de881afe6424446c01b781ba56351db3ae6853674140329dcea4bcf17bded31 boolFalse#bc799737 = Bool; @@ -191,7 +191,7 @@ chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:f messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#94345242 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck = Message; +message#94345242 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck = Message; messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message; @@ -293,7 +293,7 @@ messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; -messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long = MessageAction; +messageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction; messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; @@ -305,7 +305,7 @@ messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAc messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; +messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction; messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; @@ -397,7 +397,7 @@ inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; +userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -607,7 +607,7 @@ updatePeerLocated#b4afcfb0 peers:Vector = Update; updateNewScheduledMessage#39a51dfb message:Message = Update; -updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector = Update; +updateDeleteScheduledMessages#f2a71983 flags:# peer:Peer messages:Vector sent_messages:flags.0?Vector = Update; updateTheme#8216fba3 theme:Theme = Update; @@ -2249,7 +2249,7 @@ inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgra inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose; inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; @@ -2671,9 +2671,11 @@ starsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer; starsTransactionPeerAds#60682812 = StarsTransactionPeer; +starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; + starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#a9ee4c2 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift = StarsTransaction; +starsTransaction#35d4f276 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int = StarsTransaction; payments.starsStatus#bbfa316c flags:# balance:long subscriptions:flags.1?Vector subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; @@ -2711,7 +2713,7 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; -starGift#aea174ee flags:# limited:flags.0?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long = StarGift; +starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift; payments.starGiftsNotModified#a388a368 = payments.StarGifts; @@ -3100,11 +3102,11 @@ messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; -messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; -messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; -messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; +messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; @@ -3260,7 +3262,7 @@ messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = m messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; -messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; @@ -3516,6 +3518,14 @@ messages.togglePaidReactionPrivacy#849ad397 peer:InputPeer msg_id:int private:Bo messages.getPaidReactionPrivacy#472455aa = Updates; +messages.viewSponsoredMessage#673ad8f1 peer:InputPeer random_id:bytes = Bool; + +messages.clickSponsoredMessage#f093465 flags:# media:flags.0?true fullscreen:flags.1?true peer:InputPeer random_id:bytes = Bool; + +messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:bytes = channels.SponsoredMessageReportResult; + +messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages; + updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -3668,10 +3678,6 @@ channels.getInactiveChannels#11e831ee = messages.InactiveChats; channels.convertToGigagroup#b290c69 channel:InputChannel = Updates; -channels.viewSponsoredMessage#beaedb94 channel:InputChannel random_id:bytes = Bool; - -channels.getSponsoredMessages#ec210fbf channel:InputChannel = messages.SponsoredMessages; - channels.getSendAs#dc770ee peer:InputPeer = channels.SendAsPeers; channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory; @@ -3708,8 +3714,6 @@ channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = channels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = Updates; -channels.clickSponsoredMessage#1445d75 flags:# media:flags.0?true fullscreen:flags.1?true channel:InputChannel random_id:bytes = Bool; - channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; @@ -3722,8 +3726,6 @@ channels.setBoostsToUnblockRestrictions#ad399cee channel:InputChannel boosts:int channels.setEmojiStickers#3cd930b7 channel:InputChannel stickerset:InputStickerSet = Bool; -channels.reportSponsoredMessage#af8ff6b9 channel:InputChannel random_id:bytes option:bytes = channels.SponsoredMessageReportResult; - channels.restrictSponsoredMessages#9ae91519 channel:InputChannel restricted:Bool = Updates; channels.searchPosts#d19f987b hashtag:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; @@ -3952,11 +3954,11 @@ stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = s stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; -stats.getBroadcastRevenueStats#75dfb671 flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastRevenueStats; +stats.getBroadcastRevenueStats#f788ee19 flags:# dark:flags.0?true peer:InputPeer = stats.BroadcastRevenueStats; -stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 channel:InputChannel password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl; +stats.getBroadcastRevenueWithdrawalUrl#9df4faad peer:InputPeer password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl; -stats.getBroadcastRevenueTransactions#69280f channel:InputChannel offset:int limit:int = stats.BroadcastRevenueTransactions; +stats.getBroadcastRevenueTransactions#70990b6d peer:InputPeer offset:int limit:int = stats.BroadcastRevenueTransactions; chatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector = chatlists.ExportedChatlistInvite; @@ -4030,7 +4032,7 @@ stories.getStoryReactionsList#b9b2881f flags:# forwards_first:flags.2?true peer: stories.togglePinnedToTop#b297e9b peer:InputPeer id:Vector = Bool; -stories.searchPosts#6cea116a flags:# hashtag:flags.0?string area:flags.1?MediaArea offset:string limit:int = stories.FoundStories; +stories.searchPosts#d1810907 flags:# hashtag:flags.0?string area:flags.1?MediaArea peer:flags.2?InputPeer offset:string limit:int = stories.FoundStories; premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList; @@ -4090,4 +4092,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 189 +// LAYER 192 diff --git a/tg/tl_channels_click_sponsored_message_gen.go b/tg/tl_channels_click_sponsored_message_gen.go deleted file mode 100644 index b5cd28419a..0000000000 --- a/tg/tl_channels_click_sponsored_message_gen.go +++ /dev/null @@ -1,305 +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{} -) - -// ChannelsClickSponsoredMessageRequest represents TL type `channels.clickSponsoredMessage#1445d75`. -// Informs the server that the user has either: -// -// See https://core.telegram.org/method/channels.clickSponsoredMessage for reference. -type ChannelsClickSponsoredMessageRequest struct { - // Flags field of ChannelsClickSponsoredMessageRequest. - Flags bin.Fields - // Media field of ChannelsClickSponsoredMessageRequest. - Media bool - // Fullscreen field of ChannelsClickSponsoredMessageRequest. - Fullscreen bool - // Channel where the sponsored message was posted - Channel InputChannelClass - // Message ID - RandomID []byte -} - -// ChannelsClickSponsoredMessageRequestTypeID is TL type id of ChannelsClickSponsoredMessageRequest. -const ChannelsClickSponsoredMessageRequestTypeID = 0x1445d75 - -// Ensuring interfaces in compile-time for ChannelsClickSponsoredMessageRequest. -var ( - _ bin.Encoder = &ChannelsClickSponsoredMessageRequest{} - _ bin.Decoder = &ChannelsClickSponsoredMessageRequest{} - _ bin.BareEncoder = &ChannelsClickSponsoredMessageRequest{} - _ bin.BareDecoder = &ChannelsClickSponsoredMessageRequest{} -) - -func (c *ChannelsClickSponsoredMessageRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Flags.Zero()) { - return false - } - if !(c.Media == false) { - return false - } - if !(c.Fullscreen == false) { - return false - } - if !(c.Channel == nil) { - return false - } - if !(c.RandomID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChannelsClickSponsoredMessageRequest) String() string { - if c == nil { - return "ChannelsClickSponsoredMessageRequest(nil)" - } - type Alias ChannelsClickSponsoredMessageRequest - return fmt.Sprintf("ChannelsClickSponsoredMessageRequest%+v", Alias(*c)) -} - -// FillFrom fills ChannelsClickSponsoredMessageRequest from given interface. -func (c *ChannelsClickSponsoredMessageRequest) FillFrom(from interface { - GetMedia() (value bool) - GetFullscreen() (value bool) - GetChannel() (value InputChannelClass) - GetRandomID() (value []byte) -}) { - c.Media = from.GetMedia() - c.Fullscreen = from.GetFullscreen() - c.Channel = from.GetChannel() - c.RandomID = from.GetRandomID() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChannelsClickSponsoredMessageRequest) TypeID() uint32 { - return ChannelsClickSponsoredMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChannelsClickSponsoredMessageRequest) TypeName() string { - return "channels.clickSponsoredMessage" -} - -// TypeInfo returns info about TL type. -func (c *ChannelsClickSponsoredMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "channels.clickSponsoredMessage", - ID: ChannelsClickSponsoredMessageRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Media", - SchemaName: "media", - Null: !c.Flags.Has(0), - }, - { - Name: "Fullscreen", - SchemaName: "fullscreen", - Null: !c.Flags.Has(1), - }, - { - Name: "Channel", - SchemaName: "channel", - }, - { - Name: "RandomID", - SchemaName: "random_id", - }, - } - return typ -} - -// SetFlags sets flags for non-zero fields. -func (c *ChannelsClickSponsoredMessageRequest) SetFlags() { - if !(c.Media == false) { - c.Flags.Set(0) - } - if !(c.Fullscreen == false) { - c.Flags.Set(1) - } -} - -// Encode implements bin.Encoder. -func (c *ChannelsClickSponsoredMessageRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode channels.clickSponsoredMessage#1445d75 as nil") - } - b.PutID(ChannelsClickSponsoredMessageRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChannelsClickSponsoredMessageRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode channels.clickSponsoredMessage#1445d75 as nil") - } - c.SetFlags() - if err := c.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.clickSponsoredMessage#1445d75: field flags: %w", err) - } - if c.Channel == nil { - return fmt.Errorf("unable to encode channels.clickSponsoredMessage#1445d75: field channel is nil") - } - if err := c.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.clickSponsoredMessage#1445d75: field channel: %w", err) - } - b.PutBytes(c.RandomID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChannelsClickSponsoredMessageRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode channels.clickSponsoredMessage#1445d75 to nil") - } - if err := b.ConsumeID(ChannelsClickSponsoredMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.clickSponsoredMessage#1445d75: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChannelsClickSponsoredMessageRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode channels.clickSponsoredMessage#1445d75 to nil") - } - { - if err := c.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode channels.clickSponsoredMessage#1445d75: field flags: %w", err) - } - } - c.Media = c.Flags.Has(0) - c.Fullscreen = c.Flags.Has(1) - { - value, err := DecodeInputChannel(b) - if err != nil { - return fmt.Errorf("unable to decode channels.clickSponsoredMessage#1445d75: field channel: %w", err) - } - c.Channel = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode channels.clickSponsoredMessage#1445d75: field random_id: %w", err) - } - c.RandomID = value - } - return nil -} - -// SetMedia sets value of Media conditional field. -func (c *ChannelsClickSponsoredMessageRequest) SetMedia(value bool) { - if value { - c.Flags.Set(0) - c.Media = true - } else { - c.Flags.Unset(0) - c.Media = false - } -} - -// GetMedia returns value of Media conditional field. -func (c *ChannelsClickSponsoredMessageRequest) GetMedia() (value bool) { - if c == nil { - return - } - return c.Flags.Has(0) -} - -// SetFullscreen sets value of Fullscreen conditional field. -func (c *ChannelsClickSponsoredMessageRequest) SetFullscreen(value bool) { - if value { - c.Flags.Set(1) - c.Fullscreen = true - } else { - c.Flags.Unset(1) - c.Fullscreen = false - } -} - -// GetFullscreen returns value of Fullscreen conditional field. -func (c *ChannelsClickSponsoredMessageRequest) GetFullscreen() (value bool) { - if c == nil { - return - } - return c.Flags.Has(1) -} - -// GetChannel returns value of Channel field. -func (c *ChannelsClickSponsoredMessageRequest) GetChannel() (value InputChannelClass) { - if c == nil { - return - } - return c.Channel -} - -// GetRandomID returns value of RandomID field. -func (c *ChannelsClickSponsoredMessageRequest) GetRandomID() (value []byte) { - if c == nil { - return - } - return c.RandomID -} - -// GetChannelAsNotEmpty returns mapped value of Channel field. -func (c *ChannelsClickSponsoredMessageRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { - return c.Channel.AsNotEmpty() -} - -// ChannelsClickSponsoredMessage invokes method channels.clickSponsoredMessage#1445d75 returning error if any. -// Informs the server that the user has either: -// -// Possible errors: -// -// 400 CHANNEL_INVALID: The provided channel is invalid. -// -// See https://core.telegram.org/method/channels.clickSponsoredMessage for reference. -func (c *Client) ChannelsClickSponsoredMessage(ctx context.Context, request *ChannelsClickSponsoredMessageRequest) (bool, error) { - var result BoolBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return false, err - } - _, ok := result.Bool.(*BoolTrue) - return ok, nil -} diff --git a/tg/tl_channels_get_sponsored_messages_gen.go b/tg/tl_channels_get_sponsored_messages_gen.go deleted file mode 100644 index b6c9deebc8..0000000000 --- a/tg/tl_channels_get_sponsored_messages_gen.go +++ /dev/null @@ -1,194 +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{} -) - -// ChannelsGetSponsoredMessagesRequest represents TL type `channels.getSponsoredMessages#ec210fbf`. -// Get a list of sponsored messages -// -// See https://core.telegram.org/method/channels.getSponsoredMessages for reference. -type ChannelsGetSponsoredMessagesRequest struct { - // Peer - Channel InputChannelClass -} - -// ChannelsGetSponsoredMessagesRequestTypeID is TL type id of ChannelsGetSponsoredMessagesRequest. -const ChannelsGetSponsoredMessagesRequestTypeID = 0xec210fbf - -// Ensuring interfaces in compile-time for ChannelsGetSponsoredMessagesRequest. -var ( - _ bin.Encoder = &ChannelsGetSponsoredMessagesRequest{} - _ bin.Decoder = &ChannelsGetSponsoredMessagesRequest{} - _ bin.BareEncoder = &ChannelsGetSponsoredMessagesRequest{} - _ bin.BareDecoder = &ChannelsGetSponsoredMessagesRequest{} -) - -func (g *ChannelsGetSponsoredMessagesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Channel == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *ChannelsGetSponsoredMessagesRequest) String() string { - if g == nil { - return "ChannelsGetSponsoredMessagesRequest(nil)" - } - type Alias ChannelsGetSponsoredMessagesRequest - return fmt.Sprintf("ChannelsGetSponsoredMessagesRequest%+v", Alias(*g)) -} - -// FillFrom fills ChannelsGetSponsoredMessagesRequest from given interface. -func (g *ChannelsGetSponsoredMessagesRequest) 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 (*ChannelsGetSponsoredMessagesRequest) TypeID() uint32 { - return ChannelsGetSponsoredMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChannelsGetSponsoredMessagesRequest) TypeName() string { - return "channels.getSponsoredMessages" -} - -// TypeInfo returns info about TL type. -func (g *ChannelsGetSponsoredMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "channels.getSponsoredMessages", - ID: ChannelsGetSponsoredMessagesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Channel", - SchemaName: "channel", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *ChannelsGetSponsoredMessagesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode channels.getSponsoredMessages#ec210fbf as nil") - } - b.PutID(ChannelsGetSponsoredMessagesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *ChannelsGetSponsoredMessagesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode channels.getSponsoredMessages#ec210fbf as nil") - } - if g.Channel == nil { - return fmt.Errorf("unable to encode channels.getSponsoredMessages#ec210fbf: field channel is nil") - } - if err := g.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.getSponsoredMessages#ec210fbf: field channel: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *ChannelsGetSponsoredMessagesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode channels.getSponsoredMessages#ec210fbf to nil") - } - if err := b.ConsumeID(ChannelsGetSponsoredMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.getSponsoredMessages#ec210fbf: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *ChannelsGetSponsoredMessagesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode channels.getSponsoredMessages#ec210fbf to nil") - } - { - value, err := DecodeInputChannel(b) - if err != nil { - return fmt.Errorf("unable to decode channels.getSponsoredMessages#ec210fbf: field channel: %w", err) - } - g.Channel = value - } - return nil -} - -// GetChannel returns value of Channel field. -func (g *ChannelsGetSponsoredMessagesRequest) GetChannel() (value InputChannelClass) { - if g == nil { - return - } - return g.Channel -} - -// GetChannelAsNotEmpty returns mapped value of Channel field. -func (g *ChannelsGetSponsoredMessagesRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { - return g.Channel.AsNotEmpty() -} - -// ChannelsGetSponsoredMessages invokes method channels.getSponsoredMessages#ec210fbf returning error if any. -// Get a list of sponsored messages -// -// 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. -// -// See https://core.telegram.org/method/channels.getSponsoredMessages for reference. -func (c *Client) ChannelsGetSponsoredMessages(ctx context.Context, channel InputChannelClass) (MessagesSponsoredMessagesClass, error) { - var result MessagesSponsoredMessagesBox - - request := &ChannelsGetSponsoredMessagesRequest{ - Channel: channel, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.SponsoredMessages, nil -} diff --git a/tg/tl_channels_report_sponsored_message_gen.go b/tg/tl_channels_report_sponsored_message_gen.go deleted file mode 100644 index 1c96373861..0000000000 --- a/tg/tl_channels_report_sponsored_message_gen.go +++ /dev/null @@ -1,257 +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{} -) - -// ChannelsReportSponsoredMessageRequest represents TL type `channels.reportSponsoredMessage#af8ff6b9`. -// Report a sponsored message »¹, see here »² for more info on the full flow. -// -// Links: -// 1. https://core.telegram.org/api/sponsored-messages -// 2. https://core.telegram.org/api/sponsored-messages#reporting-sponsored-messages -// -// See https://core.telegram.org/method/channels.reportSponsoredMessage for reference. -type ChannelsReportSponsoredMessageRequest struct { - // The channel where the sponsored message can be seen. - Channel InputChannelClass - // ID of the sponsored message. - RandomID []byte - // Chosen report option, initially an empty string, see here »¹ for more info on the - // full flow. - // - // Links: - // 1) https://core.telegram.org/api/sponsored-messages#reporting-sponsored-messages - Option []byte -} - -// ChannelsReportSponsoredMessageRequestTypeID is TL type id of ChannelsReportSponsoredMessageRequest. -const ChannelsReportSponsoredMessageRequestTypeID = 0xaf8ff6b9 - -// Ensuring interfaces in compile-time for ChannelsReportSponsoredMessageRequest. -var ( - _ bin.Encoder = &ChannelsReportSponsoredMessageRequest{} - _ bin.Decoder = &ChannelsReportSponsoredMessageRequest{} - _ bin.BareEncoder = &ChannelsReportSponsoredMessageRequest{} - _ bin.BareDecoder = &ChannelsReportSponsoredMessageRequest{} -) - -func (r *ChannelsReportSponsoredMessageRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Channel == nil) { - return false - } - if !(r.RandomID == nil) { - return false - } - if !(r.Option == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ChannelsReportSponsoredMessageRequest) String() string { - if r == nil { - return "ChannelsReportSponsoredMessageRequest(nil)" - } - type Alias ChannelsReportSponsoredMessageRequest - return fmt.Sprintf("ChannelsReportSponsoredMessageRequest%+v", Alias(*r)) -} - -// FillFrom fills ChannelsReportSponsoredMessageRequest from given interface. -func (r *ChannelsReportSponsoredMessageRequest) FillFrom(from interface { - GetChannel() (value InputChannelClass) - GetRandomID() (value []byte) - GetOption() (value []byte) -}) { - r.Channel = from.GetChannel() - r.RandomID = from.GetRandomID() - r.Option = from.GetOption() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChannelsReportSponsoredMessageRequest) TypeID() uint32 { - return ChannelsReportSponsoredMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChannelsReportSponsoredMessageRequest) TypeName() string { - return "channels.reportSponsoredMessage" -} - -// TypeInfo returns info about TL type. -func (r *ChannelsReportSponsoredMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "channels.reportSponsoredMessage", - ID: ChannelsReportSponsoredMessageRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Channel", - SchemaName: "channel", - }, - { - Name: "RandomID", - SchemaName: "random_id", - }, - { - Name: "Option", - SchemaName: "option", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ChannelsReportSponsoredMessageRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode channels.reportSponsoredMessage#af8ff6b9 as nil") - } - b.PutID(ChannelsReportSponsoredMessageRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ChannelsReportSponsoredMessageRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode channels.reportSponsoredMessage#af8ff6b9 as nil") - } - if r.Channel == nil { - return fmt.Errorf("unable to encode channels.reportSponsoredMessage#af8ff6b9: field channel is nil") - } - if err := r.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.reportSponsoredMessage#af8ff6b9: field channel: %w", err) - } - b.PutBytes(r.RandomID) - b.PutBytes(r.Option) - return nil -} - -// Decode implements bin.Decoder. -func (r *ChannelsReportSponsoredMessageRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode channels.reportSponsoredMessage#af8ff6b9 to nil") - } - if err := b.ConsumeID(ChannelsReportSponsoredMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.reportSponsoredMessage#af8ff6b9: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ChannelsReportSponsoredMessageRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode channels.reportSponsoredMessage#af8ff6b9 to nil") - } - { - value, err := DecodeInputChannel(b) - if err != nil { - return fmt.Errorf("unable to decode channels.reportSponsoredMessage#af8ff6b9: field channel: %w", err) - } - r.Channel = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode channels.reportSponsoredMessage#af8ff6b9: field random_id: %w", err) - } - r.RandomID = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode channels.reportSponsoredMessage#af8ff6b9: field option: %w", err) - } - r.Option = value - } - return nil -} - -// GetChannel returns value of Channel field. -func (r *ChannelsReportSponsoredMessageRequest) GetChannel() (value InputChannelClass) { - if r == nil { - return - } - return r.Channel -} - -// GetRandomID returns value of RandomID field. -func (r *ChannelsReportSponsoredMessageRequest) GetRandomID() (value []byte) { - if r == nil { - return - } - return r.RandomID -} - -// GetOption returns value of Option field. -func (r *ChannelsReportSponsoredMessageRequest) GetOption() (value []byte) { - if r == nil { - return - } - return r.Option -} - -// GetChannelAsNotEmpty returns mapped value of Channel field. -func (r *ChannelsReportSponsoredMessageRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { - return r.Channel.AsNotEmpty() -} - -// ChannelsReportSponsoredMessage invokes method channels.reportSponsoredMessage#af8ff6b9 returning error if any. -// Report a sponsored message »¹, see here »² for more info on the full flow. -// -// Links: -// 1. https://core.telegram.org/api/sponsored-messages -// 2. https://core.telegram.org/api/sponsored-messages#reporting-sponsored-messages -// -// Possible errors: -// -// 400 AD_EXPIRED: The ad has expired (too old or not found). -// 400 CHANNEL_INVALID: The provided channel is invalid. -// 400 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action. -// -// See https://core.telegram.org/method/channels.reportSponsoredMessage for reference. -func (c *Client) ChannelsReportSponsoredMessage(ctx context.Context, request *ChannelsReportSponsoredMessageRequest) (ChannelsSponsoredMessageReportResultClass, error) { - var result ChannelsSponsoredMessageReportResultBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.SponsoredMessageReportResult, nil -} diff --git a/tg/tl_channels_view_sponsored_message_gen.go b/tg/tl_channels_view_sponsored_message_gen.go deleted file mode 100644 index 0531998dc5..0000000000 --- a/tg/tl_channels_view_sponsored_message_gen.go +++ /dev/null @@ -1,218 +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{} -) - -// ChannelsViewSponsoredMessageRequest represents TL type `channels.viewSponsoredMessage#beaedb94`. -// Mark a specific sponsored message as read -// -// See https://core.telegram.org/method/channels.viewSponsoredMessage for reference. -type ChannelsViewSponsoredMessageRequest struct { - // Peer - Channel InputChannelClass - // Message ID - RandomID []byte -} - -// ChannelsViewSponsoredMessageRequestTypeID is TL type id of ChannelsViewSponsoredMessageRequest. -const ChannelsViewSponsoredMessageRequestTypeID = 0xbeaedb94 - -// Ensuring interfaces in compile-time for ChannelsViewSponsoredMessageRequest. -var ( - _ bin.Encoder = &ChannelsViewSponsoredMessageRequest{} - _ bin.Decoder = &ChannelsViewSponsoredMessageRequest{} - _ bin.BareEncoder = &ChannelsViewSponsoredMessageRequest{} - _ bin.BareDecoder = &ChannelsViewSponsoredMessageRequest{} -) - -func (v *ChannelsViewSponsoredMessageRequest) Zero() bool { - if v == nil { - return true - } - if !(v.Channel == nil) { - return false - } - if !(v.RandomID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *ChannelsViewSponsoredMessageRequest) String() string { - if v == nil { - return "ChannelsViewSponsoredMessageRequest(nil)" - } - type Alias ChannelsViewSponsoredMessageRequest - return fmt.Sprintf("ChannelsViewSponsoredMessageRequest%+v", Alias(*v)) -} - -// FillFrom fills ChannelsViewSponsoredMessageRequest from given interface. -func (v *ChannelsViewSponsoredMessageRequest) FillFrom(from interface { - GetChannel() (value InputChannelClass) - GetRandomID() (value []byte) -}) { - v.Channel = from.GetChannel() - v.RandomID = from.GetRandomID() -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChannelsViewSponsoredMessageRequest) TypeID() uint32 { - return ChannelsViewSponsoredMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChannelsViewSponsoredMessageRequest) TypeName() string { - return "channels.viewSponsoredMessage" -} - -// TypeInfo returns info about TL type. -func (v *ChannelsViewSponsoredMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "channels.viewSponsoredMessage", - ID: ChannelsViewSponsoredMessageRequestTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Channel", - SchemaName: "channel", - }, - { - Name: "RandomID", - SchemaName: "random_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *ChannelsViewSponsoredMessageRequest) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode channels.viewSponsoredMessage#beaedb94 as nil") - } - b.PutID(ChannelsViewSponsoredMessageRequestTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *ChannelsViewSponsoredMessageRequest) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode channels.viewSponsoredMessage#beaedb94 as nil") - } - if v.Channel == nil { - return fmt.Errorf("unable to encode channels.viewSponsoredMessage#beaedb94: field channel is nil") - } - if err := v.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode channels.viewSponsoredMessage#beaedb94: field channel: %w", err) - } - b.PutBytes(v.RandomID) - return nil -} - -// Decode implements bin.Decoder. -func (v *ChannelsViewSponsoredMessageRequest) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode channels.viewSponsoredMessage#beaedb94 to nil") - } - if err := b.ConsumeID(ChannelsViewSponsoredMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode channels.viewSponsoredMessage#beaedb94: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *ChannelsViewSponsoredMessageRequest) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode channels.viewSponsoredMessage#beaedb94 to nil") - } - { - value, err := DecodeInputChannel(b) - if err != nil { - return fmt.Errorf("unable to decode channels.viewSponsoredMessage#beaedb94: field channel: %w", err) - } - v.Channel = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode channels.viewSponsoredMessage#beaedb94: field random_id: %w", err) - } - v.RandomID = value - } - return nil -} - -// GetChannel returns value of Channel field. -func (v *ChannelsViewSponsoredMessageRequest) GetChannel() (value InputChannelClass) { - if v == nil { - return - } - return v.Channel -} - -// GetRandomID returns value of RandomID field. -func (v *ChannelsViewSponsoredMessageRequest) GetRandomID() (value []byte) { - if v == nil { - return - } - return v.RandomID -} - -// GetChannelAsNotEmpty returns mapped value of Channel field. -func (v *ChannelsViewSponsoredMessageRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { - return v.Channel.AsNotEmpty() -} - -// ChannelsViewSponsoredMessage invokes method channels.viewSponsoredMessage#beaedb94 returning error if any. -// Mark a specific sponsored message as read -// -// Possible errors: -// -// 400 CHANNEL_INVALID: The provided channel is invalid. -// 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup. -// -// See https://core.telegram.org/method/channels.viewSponsoredMessage for reference. -func (c *Client) ChannelsViewSponsoredMessage(ctx context.Context, request *ChannelsViewSponsoredMessageRequest) (bool, error) { - var result BoolBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return false, err - } - _, ok := result.Bool.(*BoolTrue) - return ok, nil -} diff --git a/tg/tl_errors_gen.go b/tg/tl_errors_gen.go index a3b97233b7..7fa395e316 100644 --- a/tg/tl_errors_gen.go +++ b/tg/tl_errors_gen.go @@ -43,7 +43,6 @@ const ( ErrAdminRankEmojiNotAllowed = "ADMIN_RANK_EMOJI_NOT_ALLOWED" ErrAdminRankInvalid = "ADMIN_RANK_INVALID" ErrAdminRightsEmpty = "ADMIN_RIGHTS_EMPTY" - ErrAdExpired = "AD_EXPIRED" ErrAlbumPhotosTooMany = "ALBUM_PHOTOS_TOO_MANY" ErrAnonymousReactionsDisabled = "ANONYMOUS_REACTIONS_DISABLED" ErrAPIIDInvalid = "API_ID_INVALID" @@ -657,11 +656,6 @@ func IsAdminRightsEmpty(err error) bool { return tgerr.Is(err, ErrAdminRightsEmpty) } -// IsAdExpired reports whether err is AD_EXPIRED. -func IsAdExpired(err error) bool { - return tgerr.Is(err, ErrAdExpired) -} - // IsAlbumPhotosTooMany reports whether err is ALBUM_PHOTOS_TOO_MANY. func IsAlbumPhotosTooMany(err error) bool { return tgerr.Is(err, ErrAlbumPhotosTooMany) diff --git a/tg/tl_input_store_payment_purpose_gen.go b/tg/tl_input_store_payment_purpose_gen.go index 3237790472..9166b087a2 100644 --- a/tg/tl_input_store_payment_purpose_gen.go +++ b/tg/tl_input_store_payment_purpose_gen.go @@ -434,7 +434,7 @@ func (i *InputStorePaymentGiftPremium) GetAmount() (value int64) { return i.Amount } -// InputStorePaymentPremiumGiftCode represents TL type `inputStorePaymentPremiumGiftCode#a3805f3f`. +// InputStorePaymentPremiumGiftCode represents TL type `inputStorePaymentPremiumGiftCode#fb790393`. // Used to gift Telegram Premium¹ subscriptions only to some specific subscribers of a // channel/supergroup or to some of our contacts, see here »² for more info on // giveaways and gifts. @@ -480,10 +480,14 @@ type InputStorePaymentPremiumGiftCode struct { // Links: // 1) https://core.telegram.org/bots/payments/currencies.json Amount int64 + // Message field of InputStorePaymentPremiumGiftCode. + // + // Use SetMessage and GetMessage helpers. + Message TextWithEntities } // InputStorePaymentPremiumGiftCodeTypeID is TL type id of InputStorePaymentPremiumGiftCode. -const InputStorePaymentPremiumGiftCodeTypeID = 0xa3805f3f +const InputStorePaymentPremiumGiftCodeTypeID = 0xfb790393 // construct implements constructor of InputStorePaymentPurposeClass. func (i InputStorePaymentPremiumGiftCode) construct() InputStorePaymentPurposeClass { return &i } @@ -517,6 +521,9 @@ func (i *InputStorePaymentPremiumGiftCode) Zero() bool { if !(i.Amount == 0) { return false } + if !(i.Message.Zero()) { + return false + } return true } @@ -536,6 +543,7 @@ func (i *InputStorePaymentPremiumGiftCode) FillFrom(from interface { GetBoostPeer() (value InputPeerClass, ok bool) GetCurrency() (value string) GetAmount() (value int64) + GetMessage() (value TextWithEntities, ok bool) }) { i.Users = from.GetUsers() if val, ok := from.GetBoostPeer(); ok { @@ -544,6 +552,10 @@ func (i *InputStorePaymentPremiumGiftCode) FillFrom(from interface { i.Currency = from.GetCurrency() i.Amount = from.GetAmount() + if val, ok := from.GetMessage(); ok { + i.Message = val + } + } // TypeID returns type id in TL schema. @@ -586,6 +598,11 @@ func (i *InputStorePaymentPremiumGiftCode) TypeInfo() tdp.Type { Name: "Amount", SchemaName: "amount", }, + { + Name: "Message", + SchemaName: "message", + Null: !i.Flags.Has(1), + }, } return typ } @@ -595,12 +612,15 @@ func (i *InputStorePaymentPremiumGiftCode) SetFlags() { if !(i.BoostPeer == nil) { i.Flags.Set(0) } + if !(i.Message.Zero()) { + i.Flags.Set(1) + } } // Encode implements bin.Encoder. func (i *InputStorePaymentPremiumGiftCode) Encode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStorePaymentPremiumGiftCode#a3805f3f as nil") + return fmt.Errorf("can't encode inputStorePaymentPremiumGiftCode#fb790393 as nil") } b.PutID(InputStorePaymentPremiumGiftCodeTypeID) return i.EncodeBare(b) @@ -609,41 +629,46 @@ func (i *InputStorePaymentPremiumGiftCode) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (i *InputStorePaymentPremiumGiftCode) EncodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't encode inputStorePaymentPremiumGiftCode#a3805f3f as nil") + return fmt.Errorf("can't encode inputStorePaymentPremiumGiftCode#fb790393 as nil") } i.SetFlags() if err := i.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field flags: %w", err) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field flags: %w", err) } b.PutVectorHeader(len(i.Users)) for idx, v := range i.Users { if v == nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field users element with index %d is nil", idx) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field users element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field users element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field users element with index %d: %w", idx, err) } } if i.Flags.Has(0) { if i.BoostPeer == nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field boost_peer is nil") + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field boost_peer is nil") } if err := i.BoostPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#a3805f3f: field boost_peer: %w", err) + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field boost_peer: %w", err) } } b.PutString(i.Currency) b.PutLong(i.Amount) + if i.Flags.Has(1) { + if err := i.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode inputStorePaymentPremiumGiftCode#fb790393: field message: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (i *InputStorePaymentPremiumGiftCode) Decode(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStorePaymentPremiumGiftCode#a3805f3f to nil") + return fmt.Errorf("can't decode inputStorePaymentPremiumGiftCode#fb790393 to nil") } if err := b.ConsumeID(InputStorePaymentPremiumGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: %w", err) } return i.DecodeBare(b) } @@ -651,17 +676,17 @@ func (i *InputStorePaymentPremiumGiftCode) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (i *InputStorePaymentPremiumGiftCode) DecodeBare(b *bin.Buffer) error { if i == nil { - return fmt.Errorf("can't decode inputStorePaymentPremiumGiftCode#a3805f3f to nil") + return fmt.Errorf("can't decode inputStorePaymentPremiumGiftCode#fb790393 to nil") } { if err := i.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field flags: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field flags: %w", err) } } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field users: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field users: %w", err) } if headerLen > 0 { @@ -670,7 +695,7 @@ func (i *InputStorePaymentPremiumGiftCode) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeInputUser(b) if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field users: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field users: %w", err) } i.Users = append(i.Users, value) } @@ -678,24 +703,29 @@ func (i *InputStorePaymentPremiumGiftCode) DecodeBare(b *bin.Buffer) error { if i.Flags.Has(0) { value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field boost_peer: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field boost_peer: %w", err) } i.BoostPeer = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field currency: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field currency: %w", err) } i.Currency = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#a3805f3f: field amount: %w", err) + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field amount: %w", err) } i.Amount = value } + if i.Flags.Has(1) { + if err := i.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode inputStorePaymentPremiumGiftCode#fb790393: field message: %w", err) + } + } return nil } @@ -741,6 +771,24 @@ func (i *InputStorePaymentPremiumGiftCode) GetAmount() (value int64) { return i.Amount } +// SetMessage sets value of Message conditional field. +func (i *InputStorePaymentPremiumGiftCode) SetMessage(value TextWithEntities) { + i.Flags.Set(1) + i.Message = value +} + +// GetMessage returns value of Message conditional field and +// boolean which is true if field was set. +func (i *InputStorePaymentPremiumGiftCode) GetMessage() (value TextWithEntities, ok bool) { + if i == nil { + return + } + if !i.Flags.Has(1) { + return value, false + } + return i.Message, true +} + // MapUsers returns field Users wrapped in InputUserClassArray helper. func (i *InputStorePaymentPremiumGiftCode) MapUsers() (value InputUserClassArray) { return InputUserClassArray(i.Users) @@ -2324,7 +2372,7 @@ const InputStorePaymentPurposeClassName = "InputStorePaymentPurpose" // switch v := g.(type) { // case *tg.InputStorePaymentPremiumSubscription: // inputStorePaymentPremiumSubscription#a6751e66 // case *tg.InputStorePaymentGiftPremium: // inputStorePaymentGiftPremium#616f7fe8 -// case *tg.InputStorePaymentPremiumGiftCode: // inputStorePaymentPremiumGiftCode#a3805f3f +// case *tg.InputStorePaymentPremiumGiftCode: // inputStorePaymentPremiumGiftCode#fb790393 // case *tg.InputStorePaymentPremiumGiveaway: // inputStorePaymentPremiumGiveaway#160544ca // case *tg.InputStorePaymentStarsTopup: // inputStorePaymentStarsTopup#dddd0f56 // case *tg.InputStorePaymentStarsGift: // inputStorePaymentStarsGift#1d741ef7 @@ -2372,7 +2420,7 @@ func DecodeInputStorePaymentPurpose(buf *bin.Buffer) (InputStorePaymentPurposeCl } return &v, nil case InputStorePaymentPremiumGiftCodeTypeID: - // Decoding inputStorePaymentPremiumGiftCode#a3805f3f. + // Decoding inputStorePaymentPremiumGiftCode#fb790393. v := InputStorePaymentPremiumGiftCode{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode InputStorePaymentPurposeClass: %w", err) diff --git a/tg/tl_message_action_gen.go b/tg/tl_message_action_gen.go index 8717d41053..91ba31610a 100644 --- a/tg/tl_message_action_gen.go +++ b/tg/tl_message_action_gen.go @@ -5430,7 +5430,7 @@ func (m *MessageActionWebViewDataSent) GetText() (value string) { return m.Text } -// MessageActionGiftPremium represents TL type `messageActionGiftPremium#c83d6aec`. +// MessageActionGiftPremium represents TL type `messageActionGiftPremium#6c6274fa`. // Info about a gifted Telegram Premium subscription // // See https://core.telegram.org/constructor/messageActionGiftPremium for reference. @@ -5464,10 +5464,14 @@ type MessageActionGiftPremium struct { // // Use SetCryptoAmount and GetCryptoAmount helpers. CryptoAmount int64 + // Message field of MessageActionGiftPremium. + // + // Use SetMessage and GetMessage helpers. + Message TextWithEntities } // MessageActionGiftPremiumTypeID is TL type id of MessageActionGiftPremium. -const MessageActionGiftPremiumTypeID = 0xc83d6aec +const MessageActionGiftPremiumTypeID = 0x6c6274fa // construct implements constructor of MessageActionClass. func (m MessageActionGiftPremium) construct() MessageActionClass { return &m } @@ -5504,6 +5508,9 @@ func (m *MessageActionGiftPremium) Zero() bool { if !(m.CryptoAmount == 0) { return false } + if !(m.Message.Zero()) { + return false + } return true } @@ -5524,6 +5531,7 @@ func (m *MessageActionGiftPremium) FillFrom(from interface { GetMonths() (value int) GetCryptoCurrency() (value string, ok bool) GetCryptoAmount() (value int64, ok bool) + GetMessage() (value TextWithEntities, ok bool) }) { m.Currency = from.GetCurrency() m.Amount = from.GetAmount() @@ -5536,6 +5544,10 @@ func (m *MessageActionGiftPremium) FillFrom(from interface { m.CryptoAmount = val } + if val, ok := from.GetMessage(); ok { + m.Message = val + } + } // TypeID returns type id in TL schema. @@ -5583,6 +5595,11 @@ func (m *MessageActionGiftPremium) TypeInfo() tdp.Type { SchemaName: "crypto_amount", Null: !m.Flags.Has(0), }, + { + Name: "Message", + SchemaName: "message", + Null: !m.Flags.Has(1), + }, } return typ } @@ -5595,12 +5612,15 @@ func (m *MessageActionGiftPremium) SetFlags() { if !(m.CryptoAmount == 0) { m.Flags.Set(0) } + if !(m.Message.Zero()) { + m.Flags.Set(1) + } } // Encode implements bin.Encoder. func (m *MessageActionGiftPremium) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftPremium#c83d6aec as nil") + return fmt.Errorf("can't encode messageActionGiftPremium#6c6274fa as nil") } b.PutID(MessageActionGiftPremiumTypeID) return m.EncodeBare(b) @@ -5609,11 +5629,11 @@ func (m *MessageActionGiftPremium) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionGiftPremium) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftPremium#c83d6aec as nil") + return fmt.Errorf("can't encode messageActionGiftPremium#6c6274fa as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionGiftPremium#c83d6aec: field flags: %w", err) + return fmt.Errorf("unable to encode messageActionGiftPremium#6c6274fa: field flags: %w", err) } b.PutString(m.Currency) b.PutLong(m.Amount) @@ -5624,16 +5644,21 @@ func (m *MessageActionGiftPremium) EncodeBare(b *bin.Buffer) error { if m.Flags.Has(0) { b.PutLong(m.CryptoAmount) } + if m.Flags.Has(1) { + if err := m.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionGiftPremium#6c6274fa: field message: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (m *MessageActionGiftPremium) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftPremium#c83d6aec to nil") + return fmt.Errorf("can't decode messageActionGiftPremium#6c6274fa to nil") } if err := b.ConsumeID(MessageActionGiftPremiumTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: %w", err) } return m.DecodeBare(b) } @@ -5641,48 +5666,53 @@ func (m *MessageActionGiftPremium) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionGiftPremium) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftPremium#c83d6aec to nil") + return fmt.Errorf("can't decode messageActionGiftPremium#6c6274fa to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field flags: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field flags: %w", err) } } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field currency: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field currency: %w", err) } m.Currency = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field amount: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field amount: %w", err) } m.Amount = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field months: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field months: %w", err) } m.Months = value } if m.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field crypto_currency: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field crypto_currency: %w", err) } m.CryptoCurrency = value } if m.Flags.Has(0) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field crypto_amount: %w", err) + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field crypto_amount: %w", err) } m.CryptoAmount = value } + if m.Flags.Has(1) { + if err := m.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionGiftPremium#6c6274fa: field message: %w", err) + } + } return nil } @@ -5746,6 +5776,24 @@ func (m *MessageActionGiftPremium) GetCryptoAmount() (value int64, ok bool) { return m.CryptoAmount, true } +// SetMessage sets value of Message conditional field. +func (m *MessageActionGiftPremium) SetMessage(value TextWithEntities) { + m.Flags.Set(1) + m.Message = value +} + +// GetMessage returns value of Message conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftPremium) GetMessage() (value TextWithEntities, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(1) { + return value, false + } + return m.Message, true +} + // MessageActionTopicCreate represents TL type `messageActionTopicCreate#d999256`. // A forum topic¹ was created. // @@ -6895,7 +6943,7 @@ func (m *MessageActionSetChatWallPaper) GetWallpaper() (value WallPaperClass) { return m.Wallpaper } -// MessageActionGiftCode represents TL type `messageActionGiftCode#678c2e09`. +// MessageActionGiftCode represents TL type `messageActionGiftCode#56d03994`. // Contains a Telegram Premium giftcode link¹. // // Links: @@ -6965,10 +7013,14 @@ type MessageActionGiftCode struct { // // Use SetCryptoAmount and GetCryptoAmount helpers. CryptoAmount int64 + // Message field of MessageActionGiftCode. + // + // Use SetMessage and GetMessage helpers. + Message TextWithEntities } // MessageActionGiftCodeTypeID is TL type id of MessageActionGiftCode. -const MessageActionGiftCodeTypeID = 0x678c2e09 +const MessageActionGiftCodeTypeID = 0x56d03994 // construct implements constructor of MessageActionClass. func (m MessageActionGiftCode) construct() MessageActionClass { return &m } @@ -7017,6 +7069,9 @@ func (m *MessageActionGiftCode) Zero() bool { if !(m.CryptoAmount == 0) { return false } + if !(m.Message.Zero()) { + return false + } return true } @@ -7041,6 +7096,7 @@ func (m *MessageActionGiftCode) FillFrom(from interface { GetAmount() (value int64, ok bool) GetCryptoCurrency() (value string, ok bool) GetCryptoAmount() (value int64, ok bool) + GetMessage() (value TextWithEntities, ok bool) }) { m.ViaGiveaway = from.GetViaGiveaway() m.Unclaimed = from.GetUnclaimed() @@ -7066,6 +7122,10 @@ func (m *MessageActionGiftCode) FillFrom(from interface { m.CryptoAmount = val } + if val, ok := from.GetMessage(); ok { + m.Message = val + } + } // TypeID returns type id in TL schema. @@ -7134,6 +7194,11 @@ func (m *MessageActionGiftCode) TypeInfo() tdp.Type { SchemaName: "crypto_amount", Null: !m.Flags.Has(3), }, + { + Name: "Message", + SchemaName: "message", + Null: !m.Flags.Has(4), + }, } return typ } @@ -7161,12 +7226,15 @@ func (m *MessageActionGiftCode) SetFlags() { if !(m.CryptoAmount == 0) { m.Flags.Set(3) } + if !(m.Message.Zero()) { + m.Flags.Set(4) + } } // Encode implements bin.Encoder. func (m *MessageActionGiftCode) Encode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftCode#678c2e09 as nil") + return fmt.Errorf("can't encode messageActionGiftCode#56d03994 as nil") } b.PutID(MessageActionGiftCodeTypeID) return m.EncodeBare(b) @@ -7175,18 +7243,18 @@ func (m *MessageActionGiftCode) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (m *MessageActionGiftCode) EncodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't encode messageActionGiftCode#678c2e09 as nil") + return fmt.Errorf("can't encode messageActionGiftCode#56d03994 as nil") } m.SetFlags() if err := m.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionGiftCode#678c2e09: field flags: %w", err) + return fmt.Errorf("unable to encode messageActionGiftCode#56d03994: field flags: %w", err) } if m.Flags.Has(1) { if m.BoostPeer == nil { - return fmt.Errorf("unable to encode messageActionGiftCode#678c2e09: field boost_peer is nil") + return fmt.Errorf("unable to encode messageActionGiftCode#56d03994: field boost_peer is nil") } if err := m.BoostPeer.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageActionGiftCode#678c2e09: field boost_peer: %w", err) + return fmt.Errorf("unable to encode messageActionGiftCode#56d03994: field boost_peer: %w", err) } } b.PutInt(m.Months) @@ -7203,16 +7271,21 @@ func (m *MessageActionGiftCode) EncodeBare(b *bin.Buffer) error { if m.Flags.Has(3) { b.PutLong(m.CryptoAmount) } + if m.Flags.Has(4) { + if err := m.Message.Encode(b); err != nil { + return fmt.Errorf("unable to encode messageActionGiftCode#56d03994: field message: %w", err) + } + } return nil } // Decode implements bin.Decoder. func (m *MessageActionGiftCode) Decode(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftCode#678c2e09 to nil") + return fmt.Errorf("can't decode messageActionGiftCode#56d03994 to nil") } if err := b.ConsumeID(MessageActionGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: %w", err) } return m.DecodeBare(b) } @@ -7220,11 +7293,11 @@ func (m *MessageActionGiftCode) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (m *MessageActionGiftCode) DecodeBare(b *bin.Buffer) error { if m == nil { - return fmt.Errorf("can't decode messageActionGiftCode#678c2e09 to nil") + return fmt.Errorf("can't decode messageActionGiftCode#56d03994 to nil") } { if err := m.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field flags: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field flags: %w", err) } } m.ViaGiveaway = m.Flags.Has(0) @@ -7232,52 +7305,57 @@ func (m *MessageActionGiftCode) DecodeBare(b *bin.Buffer) error { if m.Flags.Has(1) { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field boost_peer: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field boost_peer: %w", err) } m.BoostPeer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field months: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field months: %w", err) } m.Months = value } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field slug: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field slug: %w", err) } m.Slug = value } if m.Flags.Has(2) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field currency: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field currency: %w", err) } m.Currency = value } if m.Flags.Has(2) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field amount: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field amount: %w", err) } m.Amount = value } if m.Flags.Has(3) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field crypto_currency: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field crypto_currency: %w", err) } m.CryptoCurrency = value } if m.Flags.Has(3) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode messageActionGiftCode#678c2e09: field crypto_amount: %w", err) + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field crypto_amount: %w", err) } m.CryptoAmount = value } + if m.Flags.Has(4) { + if err := m.Message.Decode(b); err != nil { + return fmt.Errorf("unable to decode messageActionGiftCode#56d03994: field message: %w", err) + } + } return nil } @@ -7425,6 +7503,24 @@ func (m *MessageActionGiftCode) GetCryptoAmount() (value int64, ok bool) { return m.CryptoAmount, true } +// SetMessage sets value of Message conditional field. +func (m *MessageActionGiftCode) SetMessage(value TextWithEntities) { + m.Flags.Set(4) + m.Message = value +} + +// GetMessage returns value of Message conditional field and +// boolean which is true if field was set. +func (m *MessageActionGiftCode) GetMessage() (value TextWithEntities, ok bool) { + if m == nil { + return + } + if !m.Flags.Has(4) { + return value, false + } + return m.Message, true +} + // MessageActionGiveawayLaunch represents TL type `messageActionGiveawayLaunch#a80f51e4`. // A giveaway¹ was started. // @@ -9468,13 +9564,13 @@ const MessageActionClassName = "MessageAction" // case *tg.MessageActionChatJoinedByRequest: // messageActionChatJoinedByRequest#ebbca3cb // case *tg.MessageActionWebViewDataSentMe: // messageActionWebViewDataSentMe#47dd8079 // case *tg.MessageActionWebViewDataSent: // messageActionWebViewDataSent#b4c38cb5 -// case *tg.MessageActionGiftPremium: // messageActionGiftPremium#c83d6aec +// case *tg.MessageActionGiftPremium: // messageActionGiftPremium#6c6274fa // case *tg.MessageActionTopicCreate: // messageActionTopicCreate#d999256 // case *tg.MessageActionTopicEdit: // messageActionTopicEdit#c0944820 // case *tg.MessageActionSuggestProfilePhoto: // messageActionSuggestProfilePhoto#57de635e // case *tg.MessageActionRequestedPeer: // messageActionRequestedPeer#31518e9b // case *tg.MessageActionSetChatWallPaper: // messageActionSetChatWallPaper#5060a3f4 -// case *tg.MessageActionGiftCode: // messageActionGiftCode#678c2e09 +// case *tg.MessageActionGiftCode: // messageActionGiftCode#56d03994 // case *tg.MessageActionGiveawayLaunch: // messageActionGiveawayLaunch#a80f51e4 // case *tg.MessageActionGiveawayResults: // messageActionGiveawayResults#87e2f155 // case *tg.MessageActionBoostApply: // messageActionBoostApply#cc02aa6d @@ -9736,7 +9832,7 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionGiftPremiumTypeID: - // Decoding messageActionGiftPremium#c83d6aec. + // Decoding messageActionGiftPremium#6c6274fa. v := MessageActionGiftPremium{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) @@ -9778,7 +9874,7 @@ func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) { } return &v, nil case MessageActionGiftCodeTypeID: - // Decoding messageActionGiftCode#678c2e09. + // Decoding messageActionGiftCode#56d03994. v := MessageActionGiftCode{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err) diff --git a/tg/tl_message_gen.go b/tg/tl_message_gen.go index a89e6f0cac..ef431f7b07 100644 --- a/tg/tl_message_gen.go +++ b/tg/tl_message_gen.go @@ -296,6 +296,8 @@ type Message struct { // If set, the message was sent because of a scheduled action by the message sender, for // example, as away, or a greeting service message. Offline bool + // VideoProcessingPending field of Message. + VideoProcessingPending bool // ID of the message ID int // ID of the sender of the message @@ -499,6 +501,9 @@ func (m *Message) Zero() bool { if !(m.Offline == false) { return false } + if !(m.VideoProcessingPending == false) { + return false + } if !(m.ID == 0) { return false } @@ -604,6 +609,7 @@ func (m *Message) FillFrom(from interface { GetNoforwards() (value bool) GetInvertMedia() (value bool) GetOffline() (value bool) + GetVideoProcessingPending() (value bool) GetID() (value int) GetFromID() (value PeerClass, ok bool) GetFromBoostsApplied() (value int, ok bool) @@ -643,6 +649,7 @@ func (m *Message) FillFrom(from interface { m.Noforwards = from.GetNoforwards() m.InvertMedia = from.GetInvertMedia() m.Offline = from.GetOffline() + m.VideoProcessingPending = from.GetVideoProcessingPending() m.ID = from.GetID() if val, ok := from.GetFromID(); ok { m.FromID = val @@ -820,6 +827,11 @@ func (m *Message) TypeInfo() tdp.Type { SchemaName: "offline", Null: !m.Flags2.Has(1), }, + { + Name: "VideoProcessingPending", + SchemaName: "video_processing_pending", + Null: !m.Flags2.Has(4), + }, { Name: "ID", SchemaName: "id", @@ -988,6 +1000,9 @@ func (m *Message) SetFlags() { if !(m.Offline == false) { m.Flags2.Set(1) } + if !(m.VideoProcessingPending == false) { + m.Flags2.Set(4) + } if !(m.FromID == nil) { m.Flags.Set(8) } @@ -1239,6 +1254,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error { } } m.Offline = m.Flags2.Has(1) + m.VideoProcessingPending = m.Flags2.Has(4) { value, err := b.Int() if err != nil { @@ -1664,6 +1680,25 @@ func (m *Message) GetOffline() (value bool) { return m.Flags2.Has(1) } +// SetVideoProcessingPending sets value of VideoProcessingPending conditional field. +func (m *Message) SetVideoProcessingPending(value bool) { + if value { + m.Flags2.Set(4) + m.VideoProcessingPending = true + } else { + m.Flags2.Unset(4) + m.VideoProcessingPending = false + } +} + +// GetVideoProcessingPending returns value of VideoProcessingPending conditional field. +func (m *Message) GetVideoProcessingPending() (value bool) { + if m == nil { + return + } + return m.Flags2.Has(4) +} + // GetID returns value of ID field. func (m *Message) GetID() (value int) { if m == nil { diff --git a/tg/tl_messages_click_sponsored_message_gen.go b/tg/tl_messages_click_sponsored_message_gen.go new file mode 100644 index 0000000000..bcda2a8312 --- /dev/null +++ b/tg/tl_messages_click_sponsored_message_gen.go @@ -0,0 +1,294 @@ +// 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{} +) + +// MessagesClickSponsoredMessageRequest represents TL type `messages.clickSponsoredMessage#f093465`. +// +// See https://core.telegram.org/method/messages.clickSponsoredMessage for reference. +type MessagesClickSponsoredMessageRequest struct { + // Flags field of MessagesClickSponsoredMessageRequest. + Flags bin.Fields + // Media field of MessagesClickSponsoredMessageRequest. + Media bool + // Fullscreen field of MessagesClickSponsoredMessageRequest. + Fullscreen bool + // Peer field of MessagesClickSponsoredMessageRequest. + Peer InputPeerClass + // RandomID field of MessagesClickSponsoredMessageRequest. + RandomID []byte +} + +// MessagesClickSponsoredMessageRequestTypeID is TL type id of MessagesClickSponsoredMessageRequest. +const MessagesClickSponsoredMessageRequestTypeID = 0xf093465 + +// Ensuring interfaces in compile-time for MessagesClickSponsoredMessageRequest. +var ( + _ bin.Encoder = &MessagesClickSponsoredMessageRequest{} + _ bin.Decoder = &MessagesClickSponsoredMessageRequest{} + _ bin.BareEncoder = &MessagesClickSponsoredMessageRequest{} + _ bin.BareDecoder = &MessagesClickSponsoredMessageRequest{} +) + +func (c *MessagesClickSponsoredMessageRequest) Zero() bool { + if c == nil { + return true + } + if !(c.Flags.Zero()) { + return false + } + if !(c.Media == false) { + return false + } + if !(c.Fullscreen == false) { + return false + } + if !(c.Peer == nil) { + return false + } + if !(c.RandomID == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (c *MessagesClickSponsoredMessageRequest) String() string { + if c == nil { + return "MessagesClickSponsoredMessageRequest(nil)" + } + type Alias MessagesClickSponsoredMessageRequest + return fmt.Sprintf("MessagesClickSponsoredMessageRequest%+v", Alias(*c)) +} + +// FillFrom fills MessagesClickSponsoredMessageRequest from given interface. +func (c *MessagesClickSponsoredMessageRequest) FillFrom(from interface { + GetMedia() (value bool) + GetFullscreen() (value bool) + GetPeer() (value InputPeerClass) + GetRandomID() (value []byte) +}) { + c.Media = from.GetMedia() + c.Fullscreen = from.GetFullscreen() + c.Peer = from.GetPeer() + c.RandomID = from.GetRandomID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesClickSponsoredMessageRequest) TypeID() uint32 { + return MessagesClickSponsoredMessageRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesClickSponsoredMessageRequest) TypeName() string { + return "messages.clickSponsoredMessage" +} + +// TypeInfo returns info about TL type. +func (c *MessagesClickSponsoredMessageRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.clickSponsoredMessage", + ID: MessagesClickSponsoredMessageRequestTypeID, + } + if c == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Media", + SchemaName: "media", + Null: !c.Flags.Has(0), + }, + { + Name: "Fullscreen", + SchemaName: "fullscreen", + Null: !c.Flags.Has(1), + }, + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "RandomID", + SchemaName: "random_id", + }, + } + return typ +} + +// SetFlags sets flags for non-zero fields. +func (c *MessagesClickSponsoredMessageRequest) SetFlags() { + if !(c.Media == false) { + c.Flags.Set(0) + } + if !(c.Fullscreen == false) { + c.Flags.Set(1) + } +} + +// Encode implements bin.Encoder. +func (c *MessagesClickSponsoredMessageRequest) Encode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode messages.clickSponsoredMessage#f093465 as nil") + } + b.PutID(MessagesClickSponsoredMessageRequestTypeID) + return c.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (c *MessagesClickSponsoredMessageRequest) EncodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't encode messages.clickSponsoredMessage#f093465 as nil") + } + c.SetFlags() + if err := c.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.clickSponsoredMessage#f093465: field flags: %w", err) + } + if c.Peer == nil { + return fmt.Errorf("unable to encode messages.clickSponsoredMessage#f093465: field peer is nil") + } + if err := c.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.clickSponsoredMessage#f093465: field peer: %w", err) + } + b.PutBytes(c.RandomID) + return nil +} + +// Decode implements bin.Decoder. +func (c *MessagesClickSponsoredMessageRequest) Decode(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode messages.clickSponsoredMessage#f093465 to nil") + } + if err := b.ConsumeID(MessagesClickSponsoredMessageRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.clickSponsoredMessage#f093465: %w", err) + } + return c.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (c *MessagesClickSponsoredMessageRequest) DecodeBare(b *bin.Buffer) error { + if c == nil { + return fmt.Errorf("can't decode messages.clickSponsoredMessage#f093465 to nil") + } + { + if err := c.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode messages.clickSponsoredMessage#f093465: field flags: %w", err) + } + } + c.Media = c.Flags.Has(0) + c.Fullscreen = c.Flags.Has(1) + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.clickSponsoredMessage#f093465: field peer: %w", err) + } + c.Peer = value + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode messages.clickSponsoredMessage#f093465: field random_id: %w", err) + } + c.RandomID = value + } + return nil +} + +// SetMedia sets value of Media conditional field. +func (c *MessagesClickSponsoredMessageRequest) SetMedia(value bool) { + if value { + c.Flags.Set(0) + c.Media = true + } else { + c.Flags.Unset(0) + c.Media = false + } +} + +// GetMedia returns value of Media conditional field. +func (c *MessagesClickSponsoredMessageRequest) GetMedia() (value bool) { + if c == nil { + return + } + return c.Flags.Has(0) +} + +// SetFullscreen sets value of Fullscreen conditional field. +func (c *MessagesClickSponsoredMessageRequest) SetFullscreen(value bool) { + if value { + c.Flags.Set(1) + c.Fullscreen = true + } else { + c.Flags.Unset(1) + c.Fullscreen = false + } +} + +// GetFullscreen returns value of Fullscreen conditional field. +func (c *MessagesClickSponsoredMessageRequest) GetFullscreen() (value bool) { + if c == nil { + return + } + return c.Flags.Has(1) +} + +// GetPeer returns value of Peer field. +func (c *MessagesClickSponsoredMessageRequest) GetPeer() (value InputPeerClass) { + if c == nil { + return + } + return c.Peer +} + +// GetRandomID returns value of RandomID field. +func (c *MessagesClickSponsoredMessageRequest) GetRandomID() (value []byte) { + if c == nil { + return + } + return c.RandomID +} + +// MessagesClickSponsoredMessage invokes method messages.clickSponsoredMessage#f093465 returning error if any. +// +// See https://core.telegram.org/method/messages.clickSponsoredMessage for reference. +func (c *Client) MessagesClickSponsoredMessage(ctx context.Context, request *MessagesClickSponsoredMessageRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_channels_click_sponsored_message_slices_gen.go b/tg/tl_messages_click_sponsored_message_slices_gen.go similarity index 100% rename from tg/tl_channels_click_sponsored_message_slices_gen.go rename to tg/tl_messages_click_sponsored_message_slices_gen.go diff --git a/tg/tl_messages_forward_messages_gen.go b/tg/tl_messages_forward_messages_gen.go index f5da4fcd4a..7ae0bf0a79 100644 --- a/tg/tl_messages_forward_messages_gen.go +++ b/tg/tl_messages_forward_messages_gen.go @@ -58,6 +58,8 @@ type MessagesForwardMessagesRequest struct { // Links: // 1) https://telegram.org/blog/protected-content-delete-by-date-and-more Noforwards bool + // AllowPaidFloodskip field of MessagesForwardMessagesRequest. + AllowPaidFloodskip bool // Source of messages FromPeer InputPeerClass // IDs of messages @@ -126,6 +128,9 @@ func (f *MessagesForwardMessagesRequest) Zero() bool { if !(f.Noforwards == false) { return false } + if !(f.AllowPaidFloodskip == false) { + return false + } if !(f.FromPeer == nil) { return false } @@ -171,6 +176,7 @@ func (f *MessagesForwardMessagesRequest) FillFrom(from interface { GetDropAuthor() (value bool) GetDropMediaCaptions() (value bool) GetNoforwards() (value bool) + GetAllowPaidFloodskip() (value bool) GetFromPeer() (value InputPeerClass) GetID() (value []int) GetRandomID() (value []int64) @@ -186,6 +192,7 @@ func (f *MessagesForwardMessagesRequest) FillFrom(from interface { f.DropAuthor = from.GetDropAuthor() f.DropMediaCaptions = from.GetDropMediaCaptions() f.Noforwards = from.GetNoforwards() + f.AllowPaidFloodskip = from.GetAllowPaidFloodskip() f.FromPeer = from.GetFromPeer() f.ID = from.GetID() f.RandomID = from.GetRandomID() @@ -261,6 +268,11 @@ func (f *MessagesForwardMessagesRequest) TypeInfo() tdp.Type { SchemaName: "noforwards", Null: !f.Flags.Has(14), }, + { + Name: "AllowPaidFloodskip", + SchemaName: "allow_paid_floodskip", + Null: !f.Flags.Has(19), + }, { Name: "FromPeer", SchemaName: "from_peer", @@ -321,6 +333,9 @@ func (f *MessagesForwardMessagesRequest) SetFlags() { if !(f.Noforwards == false) { f.Flags.Set(14) } + if !(f.AllowPaidFloodskip == false) { + f.Flags.Set(19) + } if !(f.TopMsgID == 0) { f.Flags.Set(9) } @@ -425,6 +440,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { f.DropAuthor = f.Flags.Has(11) f.DropMediaCaptions = f.Flags.Has(12) f.Noforwards = f.Flags.Has(14) + f.AllowPaidFloodskip = f.Flags.Has(19) { value, err := DecodeInputPeer(b) if err != nil { @@ -618,6 +634,25 @@ func (f *MessagesForwardMessagesRequest) GetNoforwards() (value bool) { return f.Flags.Has(14) } +// SetAllowPaidFloodskip sets value of AllowPaidFloodskip conditional field. +func (f *MessagesForwardMessagesRequest) SetAllowPaidFloodskip(value bool) { + if value { + f.Flags.Set(19) + f.AllowPaidFloodskip = true + } else { + f.Flags.Unset(19) + f.AllowPaidFloodskip = false + } +} + +// GetAllowPaidFloodskip returns value of AllowPaidFloodskip conditional field. +func (f *MessagesForwardMessagesRequest) GetAllowPaidFloodskip() (value bool) { + if f == nil { + return + } + return f.Flags.Has(19) +} + // GetFromPeer returns value of FromPeer field. func (f *MessagesForwardMessagesRequest) GetFromPeer() (value InputPeerClass) { if f == nil { diff --git a/tg/tl_messages_get_sponsored_messages_gen.go b/tg/tl_messages_get_sponsored_messages_gen.go new file mode 100644 index 0000000000..07def0d475 --- /dev/null +++ b/tg/tl_messages_get_sponsored_messages_gen.go @@ -0,0 +1,181 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "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{} +) + +// MessagesGetSponsoredMessagesRequest represents TL type `messages.getSponsoredMessages#9bd2f439`. +// +// See https://core.telegram.org/method/messages.getSponsoredMessages for reference. +type MessagesGetSponsoredMessagesRequest struct { + // Peer field of MessagesGetSponsoredMessagesRequest. + Peer InputPeerClass +} + +// MessagesGetSponsoredMessagesRequestTypeID is TL type id of MessagesGetSponsoredMessagesRequest. +const MessagesGetSponsoredMessagesRequestTypeID = 0x9bd2f439 + +// Ensuring interfaces in compile-time for MessagesGetSponsoredMessagesRequest. +var ( + _ bin.Encoder = &MessagesGetSponsoredMessagesRequest{} + _ bin.Decoder = &MessagesGetSponsoredMessagesRequest{} + _ bin.BareEncoder = &MessagesGetSponsoredMessagesRequest{} + _ bin.BareDecoder = &MessagesGetSponsoredMessagesRequest{} +) + +func (g *MessagesGetSponsoredMessagesRequest) Zero() bool { + if g == nil { + return true + } + if !(g.Peer == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (g *MessagesGetSponsoredMessagesRequest) String() string { + if g == nil { + return "MessagesGetSponsoredMessagesRequest(nil)" + } + type Alias MessagesGetSponsoredMessagesRequest + return fmt.Sprintf("MessagesGetSponsoredMessagesRequest%+v", Alias(*g)) +} + +// FillFrom fills MessagesGetSponsoredMessagesRequest from given interface. +func (g *MessagesGetSponsoredMessagesRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) +}) { + g.Peer = from.GetPeer() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesGetSponsoredMessagesRequest) TypeID() uint32 { + return MessagesGetSponsoredMessagesRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesGetSponsoredMessagesRequest) TypeName() string { + return "messages.getSponsoredMessages" +} + +// TypeInfo returns info about TL type. +func (g *MessagesGetSponsoredMessagesRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.getSponsoredMessages", + ID: MessagesGetSponsoredMessagesRequestTypeID, + } + if g == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (g *MessagesGetSponsoredMessagesRequest) Encode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getSponsoredMessages#9bd2f439 as nil") + } + b.PutID(MessagesGetSponsoredMessagesRequestTypeID) + return g.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (g *MessagesGetSponsoredMessagesRequest) EncodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't encode messages.getSponsoredMessages#9bd2f439 as nil") + } + if g.Peer == nil { + return fmt.Errorf("unable to encode messages.getSponsoredMessages#9bd2f439: field peer is nil") + } + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.getSponsoredMessages#9bd2f439: field peer: %w", err) + } + return nil +} + +// Decode implements bin.Decoder. +func (g *MessagesGetSponsoredMessagesRequest) Decode(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getSponsoredMessages#9bd2f439 to nil") + } + if err := b.ConsumeID(MessagesGetSponsoredMessagesRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.getSponsoredMessages#9bd2f439: %w", err) + } + return g.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (g *MessagesGetSponsoredMessagesRequest) DecodeBare(b *bin.Buffer) error { + if g == nil { + return fmt.Errorf("can't decode messages.getSponsoredMessages#9bd2f439 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.getSponsoredMessages#9bd2f439: field peer: %w", err) + } + g.Peer = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (g *MessagesGetSponsoredMessagesRequest) GetPeer() (value InputPeerClass) { + if g == nil { + return + } + return g.Peer +} + +// MessagesGetSponsoredMessages invokes method messages.getSponsoredMessages#9bd2f439 returning error if any. +// +// See https://core.telegram.org/method/messages.getSponsoredMessages for reference. +func (c *Client) MessagesGetSponsoredMessages(ctx context.Context, peer InputPeerClass) (MessagesSponsoredMessagesClass, error) { + var result MessagesSponsoredMessagesBox + + request := &MessagesGetSponsoredMessagesRequest{ + Peer: peer, + } + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.SponsoredMessages, nil +} diff --git a/tg/tl_channels_get_sponsored_messages_slices_gen.go b/tg/tl_messages_get_sponsored_messages_slices_gen.go similarity index 100% rename from tg/tl_channels_get_sponsored_messages_slices_gen.go rename to tg/tl_messages_get_sponsored_messages_slices_gen.go diff --git a/tg/tl_messages_report_sponsored_message_gen.go b/tg/tl_messages_report_sponsored_message_gen.go new file mode 100644 index 0000000000..19c66ba359 --- /dev/null +++ b/tg/tl_messages_report_sponsored_message_gen.go @@ -0,0 +1,232 @@ +// 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{} +) + +// MessagesReportSponsoredMessageRequest represents TL type `messages.reportSponsoredMessage#1af3dbb8`. +// +// See https://core.telegram.org/method/messages.reportSponsoredMessage for reference. +type MessagesReportSponsoredMessageRequest struct { + // Peer field of MessagesReportSponsoredMessageRequest. + Peer InputPeerClass + // RandomID field of MessagesReportSponsoredMessageRequest. + RandomID []byte + // Option field of MessagesReportSponsoredMessageRequest. + Option []byte +} + +// MessagesReportSponsoredMessageRequestTypeID is TL type id of MessagesReportSponsoredMessageRequest. +const MessagesReportSponsoredMessageRequestTypeID = 0x1af3dbb8 + +// Ensuring interfaces in compile-time for MessagesReportSponsoredMessageRequest. +var ( + _ bin.Encoder = &MessagesReportSponsoredMessageRequest{} + _ bin.Decoder = &MessagesReportSponsoredMessageRequest{} + _ bin.BareEncoder = &MessagesReportSponsoredMessageRequest{} + _ bin.BareDecoder = &MessagesReportSponsoredMessageRequest{} +) + +func (r *MessagesReportSponsoredMessageRequest) Zero() bool { + if r == nil { + return true + } + if !(r.Peer == nil) { + return false + } + if !(r.RandomID == nil) { + return false + } + if !(r.Option == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (r *MessagesReportSponsoredMessageRequest) String() string { + if r == nil { + return "MessagesReportSponsoredMessageRequest(nil)" + } + type Alias MessagesReportSponsoredMessageRequest + return fmt.Sprintf("MessagesReportSponsoredMessageRequest%+v", Alias(*r)) +} + +// FillFrom fills MessagesReportSponsoredMessageRequest from given interface. +func (r *MessagesReportSponsoredMessageRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetRandomID() (value []byte) + GetOption() (value []byte) +}) { + r.Peer = from.GetPeer() + r.RandomID = from.GetRandomID() + r.Option = from.GetOption() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesReportSponsoredMessageRequest) TypeID() uint32 { + return MessagesReportSponsoredMessageRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesReportSponsoredMessageRequest) TypeName() string { + return "messages.reportSponsoredMessage" +} + +// TypeInfo returns info about TL type. +func (r *MessagesReportSponsoredMessageRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.reportSponsoredMessage", + ID: MessagesReportSponsoredMessageRequestTypeID, + } + if r == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "RandomID", + SchemaName: "random_id", + }, + { + Name: "Option", + SchemaName: "option", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (r *MessagesReportSponsoredMessageRequest) Encode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode messages.reportSponsoredMessage#1af3dbb8 as nil") + } + b.PutID(MessagesReportSponsoredMessageRequestTypeID) + return r.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (r *MessagesReportSponsoredMessageRequest) EncodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't encode messages.reportSponsoredMessage#1af3dbb8 as nil") + } + if r.Peer == nil { + return fmt.Errorf("unable to encode messages.reportSponsoredMessage#1af3dbb8: field peer is nil") + } + if err := r.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.reportSponsoredMessage#1af3dbb8: field peer: %w", err) + } + b.PutBytes(r.RandomID) + b.PutBytes(r.Option) + return nil +} + +// Decode implements bin.Decoder. +func (r *MessagesReportSponsoredMessageRequest) Decode(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode messages.reportSponsoredMessage#1af3dbb8 to nil") + } + if err := b.ConsumeID(MessagesReportSponsoredMessageRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.reportSponsoredMessage#1af3dbb8: %w", err) + } + return r.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (r *MessagesReportSponsoredMessageRequest) DecodeBare(b *bin.Buffer) error { + if r == nil { + return fmt.Errorf("can't decode messages.reportSponsoredMessage#1af3dbb8 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.reportSponsoredMessage#1af3dbb8: field peer: %w", err) + } + r.Peer = value + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode messages.reportSponsoredMessage#1af3dbb8: field random_id: %w", err) + } + r.RandomID = value + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode messages.reportSponsoredMessage#1af3dbb8: field option: %w", err) + } + r.Option = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (r *MessagesReportSponsoredMessageRequest) GetPeer() (value InputPeerClass) { + if r == nil { + return + } + return r.Peer +} + +// GetRandomID returns value of RandomID field. +func (r *MessagesReportSponsoredMessageRequest) GetRandomID() (value []byte) { + if r == nil { + return + } + return r.RandomID +} + +// GetOption returns value of Option field. +func (r *MessagesReportSponsoredMessageRequest) GetOption() (value []byte) { + if r == nil { + return + } + return r.Option +} + +// MessagesReportSponsoredMessage invokes method messages.reportSponsoredMessage#1af3dbb8 returning error if any. +// +// See https://core.telegram.org/method/messages.reportSponsoredMessage for reference. +func (c *Client) MessagesReportSponsoredMessage(ctx context.Context, request *MessagesReportSponsoredMessageRequest) (ChannelsSponsoredMessageReportResultClass, error) { + var result ChannelsSponsoredMessageReportResultBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return nil, err + } + return result.SponsoredMessageReportResult, nil +} diff --git a/tg/tl_channels_report_sponsored_message_slices_gen.go b/tg/tl_messages_report_sponsored_message_slices_gen.go similarity index 100% rename from tg/tl_channels_report_sponsored_message_slices_gen.go rename to tg/tl_messages_report_sponsored_message_slices_gen.go diff --git a/tg/tl_messages_send_media_gen.go b/tg/tl_messages_send_media_gen.go index 84cb532ce0..f878424c54 100644 --- a/tg/tl_messages_send_media_gen.go +++ b/tg/tl_messages_send_media_gen.go @@ -61,6 +61,8 @@ type MessagesSendMediaRequest struct { // If set, any eventual webpage preview will be shown on top of the message instead of at // the bottom. InvertMedia bool + // AllowPaidFloodskip field of MessagesSendMediaRequest. + AllowPaidFloodskip bool // Destination Peer InputPeerClass // If set, indicates that the message should be sent in reply to the specified message or @@ -148,6 +150,9 @@ func (s *MessagesSendMediaRequest) Zero() bool { if !(s.InvertMedia == false) { return false } + if !(s.AllowPaidFloodskip == false) { + return false + } if !(s.Peer == nil) { return false } @@ -202,6 +207,7 @@ func (s *MessagesSendMediaRequest) FillFrom(from interface { GetNoforwards() (value bool) GetUpdateStickersetsOrder() (value bool) GetInvertMedia() (value bool) + GetAllowPaidFloodskip() (value bool) GetPeer() (value InputPeerClass) GetReplyTo() (value InputReplyToClass, ok bool) GetMedia() (value InputMediaClass) @@ -220,6 +226,7 @@ func (s *MessagesSendMediaRequest) FillFrom(from interface { s.Noforwards = from.GetNoforwards() s.UpdateStickersetsOrder = from.GetUpdateStickersetsOrder() s.InvertMedia = from.GetInvertMedia() + s.AllowPaidFloodskip = from.GetAllowPaidFloodskip() s.Peer = from.GetPeer() if val, ok := from.GetReplyTo(); ok { s.ReplyTo = val @@ -307,6 +314,11 @@ func (s *MessagesSendMediaRequest) TypeInfo() tdp.Type { SchemaName: "invert_media", Null: !s.Flags.Has(16), }, + { + Name: "AllowPaidFloodskip", + SchemaName: "allow_paid_floodskip", + Null: !s.Flags.Has(19), + }, { Name: "Peer", SchemaName: "peer", @@ -382,6 +394,9 @@ func (s *MessagesSendMediaRequest) SetFlags() { if !(s.InvertMedia == false) { s.Flags.Set(16) } + if !(s.AllowPaidFloodskip == false) { + s.Flags.Set(19) + } if !(s.ReplyTo == nil) { s.Flags.Set(0) } @@ -516,6 +531,7 @@ func (s *MessagesSendMediaRequest) DecodeBare(b *bin.Buffer) error { s.Noforwards = s.Flags.Has(14) s.UpdateStickersetsOrder = s.Flags.Has(15) s.InvertMedia = s.Flags.Has(16) + s.AllowPaidFloodskip = s.Flags.Has(19) { value, err := DecodeInputPeer(b) if err != nil { @@ -720,6 +736,25 @@ func (s *MessagesSendMediaRequest) GetInvertMedia() (value bool) { return s.Flags.Has(16) } +// SetAllowPaidFloodskip sets value of AllowPaidFloodskip conditional field. +func (s *MessagesSendMediaRequest) SetAllowPaidFloodskip(value bool) { + if value { + s.Flags.Set(19) + s.AllowPaidFloodskip = true + } else { + s.Flags.Unset(19) + s.AllowPaidFloodskip = false + } +} + +// GetAllowPaidFloodskip returns value of AllowPaidFloodskip conditional field. +func (s *MessagesSendMediaRequest) GetAllowPaidFloodskip() (value bool) { + if s == nil { + return + } + return s.Flags.Has(19) +} + // GetPeer returns value of Peer field. func (s *MessagesSendMediaRequest) GetPeer() (value InputPeerClass) { if s == nil { diff --git a/tg/tl_messages_send_message_gen.go b/tg/tl_messages_send_message_gen.go index e2c00d1743..a26bbbf99f 100644 --- a/tg/tl_messages_send_message_gen.go +++ b/tg/tl_messages_send_message_gen.go @@ -63,6 +63,8 @@ type MessagesSendMessageRequest struct { // If set, any eventual webpage preview will be shown on top of the message instead of at // the bottom. InvertMedia bool + // AllowPaidFloodskip field of MessagesSendMessageRequest. + AllowPaidFloodskip bool // The destination where the message will be sent Peer InputPeerClass // If set, indicates that the message should be sent in reply to the specified message or @@ -151,6 +153,9 @@ func (s *MessagesSendMessageRequest) Zero() bool { if !(s.InvertMedia == false) { return false } + if !(s.AllowPaidFloodskip == false) { + return false + } if !(s.Peer == nil) { return false } @@ -203,6 +208,7 @@ func (s *MessagesSendMessageRequest) FillFrom(from interface { GetNoforwards() (value bool) GetUpdateStickersetsOrder() (value bool) GetInvertMedia() (value bool) + GetAllowPaidFloodskip() (value bool) GetPeer() (value InputPeerClass) GetReplyTo() (value InputReplyToClass, ok bool) GetMessage() (value string) @@ -221,6 +227,7 @@ func (s *MessagesSendMessageRequest) FillFrom(from interface { s.Noforwards = from.GetNoforwards() s.UpdateStickersetsOrder = from.GetUpdateStickersetsOrder() s.InvertMedia = from.GetInvertMedia() + s.AllowPaidFloodskip = from.GetAllowPaidFloodskip() s.Peer = from.GetPeer() if val, ok := from.GetReplyTo(); ok { s.ReplyTo = val @@ -312,6 +319,11 @@ func (s *MessagesSendMessageRequest) TypeInfo() tdp.Type { SchemaName: "invert_media", Null: !s.Flags.Has(16), }, + { + Name: "AllowPaidFloodskip", + SchemaName: "allow_paid_floodskip", + Null: !s.Flags.Has(19), + }, { Name: "Peer", SchemaName: "peer", @@ -386,6 +398,9 @@ func (s *MessagesSendMessageRequest) SetFlags() { if !(s.InvertMedia == false) { s.Flags.Set(16) } + if !(s.AllowPaidFloodskip == false) { + s.Flags.Set(19) + } if !(s.ReplyTo == nil) { s.Flags.Set(0) } @@ -515,6 +530,7 @@ func (s *MessagesSendMessageRequest) DecodeBare(b *bin.Buffer) error { s.Noforwards = s.Flags.Has(14) s.UpdateStickersetsOrder = s.Flags.Has(15) s.InvertMedia = s.Flags.Has(16) + s.AllowPaidFloodskip = s.Flags.Has(19) { value, err := DecodeInputPeer(b) if err != nil { @@ -731,6 +747,25 @@ func (s *MessagesSendMessageRequest) GetInvertMedia() (value bool) { return s.Flags.Has(16) } +// SetAllowPaidFloodskip sets value of AllowPaidFloodskip conditional field. +func (s *MessagesSendMessageRequest) SetAllowPaidFloodskip(value bool) { + if value { + s.Flags.Set(19) + s.AllowPaidFloodskip = true + } else { + s.Flags.Unset(19) + s.AllowPaidFloodskip = false + } +} + +// GetAllowPaidFloodskip returns value of AllowPaidFloodskip conditional field. +func (s *MessagesSendMessageRequest) GetAllowPaidFloodskip() (value bool) { + if s == nil { + return + } + return s.Flags.Has(19) +} + // GetPeer returns value of Peer field. func (s *MessagesSendMessageRequest) GetPeer() (value InputPeerClass) { if s == nil { diff --git a/tg/tl_messages_send_multi_media_gen.go b/tg/tl_messages_send_multi_media_gen.go index e1adb338d7..52e29002d2 100644 --- a/tg/tl_messages_send_multi_media_gen.go +++ b/tg/tl_messages_send_multi_media_gen.go @@ -67,6 +67,8 @@ type MessagesSendMultiMediaRequest struct { // If set, any eventual webpage preview will be shown on top of the message instead of at // the bottom. InvertMedia bool + // AllowPaidFloodskip field of MessagesSendMultiMediaRequest. + AllowPaidFloodskip bool // The destination chat Peer InputPeerClass // If set, indicates that the message should be sent in reply to the specified message or @@ -140,6 +142,9 @@ func (s *MessagesSendMultiMediaRequest) Zero() bool { if !(s.InvertMedia == false) { return false } + if !(s.AllowPaidFloodskip == false) { + return false + } if !(s.Peer == nil) { return false } @@ -182,6 +187,7 @@ func (s *MessagesSendMultiMediaRequest) FillFrom(from interface { GetNoforwards() (value bool) GetUpdateStickersetsOrder() (value bool) GetInvertMedia() (value bool) + GetAllowPaidFloodskip() (value bool) GetPeer() (value InputPeerClass) GetReplyTo() (value InputReplyToClass, ok bool) GetMultiMedia() (value []InputSingleMedia) @@ -196,6 +202,7 @@ func (s *MessagesSendMultiMediaRequest) FillFrom(from interface { s.Noforwards = from.GetNoforwards() s.UpdateStickersetsOrder = from.GetUpdateStickersetsOrder() s.InvertMedia = from.GetInvertMedia() + s.AllowPaidFloodskip = from.GetAllowPaidFloodskip() s.Peer = from.GetPeer() if val, ok := from.GetReplyTo(); ok { s.ReplyTo = val @@ -273,6 +280,11 @@ func (s *MessagesSendMultiMediaRequest) TypeInfo() tdp.Type { SchemaName: "invert_media", Null: !s.Flags.Has(16), }, + { + Name: "AllowPaidFloodskip", + SchemaName: "allow_paid_floodskip", + Null: !s.Flags.Has(19), + }, { Name: "Peer", SchemaName: "peer", @@ -330,6 +342,9 @@ func (s *MessagesSendMultiMediaRequest) SetFlags() { if !(s.InvertMedia == false) { s.Flags.Set(16) } + if !(s.AllowPaidFloodskip == false) { + s.Flags.Set(19) + } if !(s.ReplyTo == nil) { s.Flags.Set(0) } @@ -437,6 +452,7 @@ func (s *MessagesSendMultiMediaRequest) DecodeBare(b *bin.Buffer) error { s.Noforwards = s.Flags.Has(14) s.UpdateStickersetsOrder = s.Flags.Has(15) s.InvertMedia = s.Flags.Has(16) + s.AllowPaidFloodskip = s.Flags.Has(19) { value, err := DecodeInputPeer(b) if err != nil { @@ -613,6 +629,25 @@ func (s *MessagesSendMultiMediaRequest) GetInvertMedia() (value bool) { return s.Flags.Has(16) } +// SetAllowPaidFloodskip sets value of AllowPaidFloodskip conditional field. +func (s *MessagesSendMultiMediaRequest) SetAllowPaidFloodskip(value bool) { + if value { + s.Flags.Set(19) + s.AllowPaidFloodskip = true + } else { + s.Flags.Unset(19) + s.AllowPaidFloodskip = false + } +} + +// GetAllowPaidFloodskip returns value of AllowPaidFloodskip conditional field. +func (s *MessagesSendMultiMediaRequest) GetAllowPaidFloodskip() (value bool) { + if s == nil { + return + } + return s.Flags.Has(19) +} + // GetPeer returns value of Peer field. func (s *MessagesSendMultiMediaRequest) GetPeer() (value InputPeerClass) { if s == nil { diff --git a/tg/tl_messages_view_sponsored_message_gen.go b/tg/tl_messages_view_sponsored_message_gen.go new file mode 100644 index 0000000000..e906da44d7 --- /dev/null +++ b/tg/tl_messages_view_sponsored_message_gen.go @@ -0,0 +1,206 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesViewSponsoredMessageRequest represents TL type `messages.viewSponsoredMessage#673ad8f1`. +// +// See https://core.telegram.org/method/messages.viewSponsoredMessage for reference. +type MessagesViewSponsoredMessageRequest struct { + // Peer field of MessagesViewSponsoredMessageRequest. + Peer InputPeerClass + // RandomID field of MessagesViewSponsoredMessageRequest. + RandomID []byte +} + +// MessagesViewSponsoredMessageRequestTypeID is TL type id of MessagesViewSponsoredMessageRequest. +const MessagesViewSponsoredMessageRequestTypeID = 0x673ad8f1 + +// Ensuring interfaces in compile-time for MessagesViewSponsoredMessageRequest. +var ( + _ bin.Encoder = &MessagesViewSponsoredMessageRequest{} + _ bin.Decoder = &MessagesViewSponsoredMessageRequest{} + _ bin.BareEncoder = &MessagesViewSponsoredMessageRequest{} + _ bin.BareDecoder = &MessagesViewSponsoredMessageRequest{} +) + +func (v *MessagesViewSponsoredMessageRequest) Zero() bool { + if v == nil { + return true + } + if !(v.Peer == nil) { + return false + } + if !(v.RandomID == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (v *MessagesViewSponsoredMessageRequest) String() string { + if v == nil { + return "MessagesViewSponsoredMessageRequest(nil)" + } + type Alias MessagesViewSponsoredMessageRequest + return fmt.Sprintf("MessagesViewSponsoredMessageRequest%+v", Alias(*v)) +} + +// FillFrom fills MessagesViewSponsoredMessageRequest from given interface. +func (v *MessagesViewSponsoredMessageRequest) FillFrom(from interface { + GetPeer() (value InputPeerClass) + GetRandomID() (value []byte) +}) { + v.Peer = from.GetPeer() + v.RandomID = from.GetRandomID() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesViewSponsoredMessageRequest) TypeID() uint32 { + return MessagesViewSponsoredMessageRequestTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesViewSponsoredMessageRequest) TypeName() string { + return "messages.viewSponsoredMessage" +} + +// TypeInfo returns info about TL type. +func (v *MessagesViewSponsoredMessageRequest) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.viewSponsoredMessage", + ID: MessagesViewSponsoredMessageRequestTypeID, + } + if v == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Peer", + SchemaName: "peer", + }, + { + Name: "RandomID", + SchemaName: "random_id", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (v *MessagesViewSponsoredMessageRequest) Encode(b *bin.Buffer) error { + if v == nil { + return fmt.Errorf("can't encode messages.viewSponsoredMessage#673ad8f1 as nil") + } + b.PutID(MessagesViewSponsoredMessageRequestTypeID) + return v.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (v *MessagesViewSponsoredMessageRequest) EncodeBare(b *bin.Buffer) error { + if v == nil { + return fmt.Errorf("can't encode messages.viewSponsoredMessage#673ad8f1 as nil") + } + if v.Peer == nil { + return fmt.Errorf("unable to encode messages.viewSponsoredMessage#673ad8f1: field peer is nil") + } + if err := v.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.viewSponsoredMessage#673ad8f1: field peer: %w", err) + } + b.PutBytes(v.RandomID) + return nil +} + +// Decode implements bin.Decoder. +func (v *MessagesViewSponsoredMessageRequest) Decode(b *bin.Buffer) error { + if v == nil { + return fmt.Errorf("can't decode messages.viewSponsoredMessage#673ad8f1 to nil") + } + if err := b.ConsumeID(MessagesViewSponsoredMessageRequestTypeID); err != nil { + return fmt.Errorf("unable to decode messages.viewSponsoredMessage#673ad8f1: %w", err) + } + return v.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (v *MessagesViewSponsoredMessageRequest) DecodeBare(b *bin.Buffer) error { + if v == nil { + return fmt.Errorf("can't decode messages.viewSponsoredMessage#673ad8f1 to nil") + } + { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode messages.viewSponsoredMessage#673ad8f1: field peer: %w", err) + } + v.Peer = value + } + { + value, err := b.Bytes() + if err != nil { + return fmt.Errorf("unable to decode messages.viewSponsoredMessage#673ad8f1: field random_id: %w", err) + } + v.RandomID = value + } + return nil +} + +// GetPeer returns value of Peer field. +func (v *MessagesViewSponsoredMessageRequest) GetPeer() (value InputPeerClass) { + if v == nil { + return + } + return v.Peer +} + +// GetRandomID returns value of RandomID field. +func (v *MessagesViewSponsoredMessageRequest) GetRandomID() (value []byte) { + if v == nil { + return + } + return v.RandomID +} + +// MessagesViewSponsoredMessage invokes method messages.viewSponsoredMessage#673ad8f1 returning error if any. +// +// See https://core.telegram.org/method/messages.viewSponsoredMessage for reference. +func (c *Client) MessagesViewSponsoredMessage(ctx context.Context, request *MessagesViewSponsoredMessageRequest) (bool, error) { + var result BoolBox + + if err := c.rpc.Invoke(ctx, request, &result); err != nil { + return false, err + } + _, ok := result.Bool.(*BoolTrue) + return ok, nil +} diff --git a/tg/tl_channels_view_sponsored_message_slices_gen.go b/tg/tl_messages_view_sponsored_message_slices_gen.go similarity index 100% rename from tg/tl_channels_view_sponsored_message_slices_gen.go rename to tg/tl_messages_view_sponsored_message_slices_gen.go diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index df45f511ef..bcf2f93b84 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 189 +const Layer = 192 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -181,13 +181,13 @@ func TypesMap() map[uint32]string { MessageActionChatJoinedByRequestTypeID: "messageActionChatJoinedByRequest#ebbca3cb", MessageActionWebViewDataSentMeTypeID: "messageActionWebViewDataSentMe#47dd8079", MessageActionWebViewDataSentTypeID: "messageActionWebViewDataSent#b4c38cb5", - MessageActionGiftPremiumTypeID: "messageActionGiftPremium#c83d6aec", + MessageActionGiftPremiumTypeID: "messageActionGiftPremium#6c6274fa", MessageActionTopicCreateTypeID: "messageActionTopicCreate#d999256", MessageActionTopicEditTypeID: "messageActionTopicEdit#c0944820", MessageActionSuggestProfilePhotoTypeID: "messageActionSuggestProfilePhoto#57de635e", MessageActionRequestedPeerTypeID: "messageActionRequestedPeer#31518e9b", MessageActionSetChatWallPaperTypeID: "messageActionSetChatWallPaper#5060a3f4", - MessageActionGiftCodeTypeID: "messageActionGiftCode#678c2e09", + MessageActionGiftCodeTypeID: "messageActionGiftCode#56d03994", MessageActionGiveawayLaunchTypeID: "messageActionGiveawayLaunch#a80f51e4", MessageActionGiveawayResultsTypeID: "messageActionGiveawayResults#87e2f155", MessageActionBoostApplyTypeID: "messageActionBoostApply#cc02aa6d", @@ -338,7 +338,7 @@ func TypesMap() map[uint32]string { UpdatePeerSettingsTypeID: "updatePeerSettings#6a7e7366", UpdatePeerLocatedTypeID: "updatePeerLocated#b4afcfb0", UpdateNewScheduledMessageTypeID: "updateNewScheduledMessage#39a51dfb", - UpdateDeleteScheduledMessagesTypeID: "updateDeleteScheduledMessages#90866cee", + UpdateDeleteScheduledMessagesTypeID: "updateDeleteScheduledMessages#f2a71983", UpdateThemeTypeID: "updateTheme#8216fba3", UpdateGeoLiveViewedTypeID: "updateGeoLiveViewed#871fb939", UpdateLoginTokenTypeID: "updateLoginToken#564fe691", @@ -1159,7 +1159,7 @@ func TypesMap() map[uint32]string { HelpPremiumPromoTypeID: "help.premiumPromo#5334759c", InputStorePaymentPremiumSubscriptionTypeID: "inputStorePaymentPremiumSubscription#a6751e66", InputStorePaymentGiftPremiumTypeID: "inputStorePaymentGiftPremium#616f7fe8", - InputStorePaymentPremiumGiftCodeTypeID: "inputStorePaymentPremiumGiftCode#a3805f3f", + InputStorePaymentPremiumGiftCodeTypeID: "inputStorePaymentPremiumGiftCode#fb790393", InputStorePaymentPremiumGiveawayTypeID: "inputStorePaymentPremiumGiveaway#160544ca", InputStorePaymentStarsTopupTypeID: "inputStorePaymentStarsTopup#dddd0f56", InputStorePaymentStarsGiftTypeID: "inputStorePaymentStarsGift#1d741ef7", @@ -1370,8 +1370,9 @@ func TypesMap() map[uint32]string { StarsTransactionPeerFragmentTypeID: "starsTransactionPeerFragment#e92fd902", StarsTransactionPeerTypeID: "starsTransactionPeer#d80da15d", StarsTransactionPeerAdsTypeID: "starsTransactionPeerAds#60682812", + StarsTransactionPeerAPITypeID: "starsTransactionPeerAPI#f9677aad", StarsTopupOptionTypeID: "starsTopupOption#bd915c0", - StarsTransactionTypeID: "starsTransaction#a9ee4c2", + StarsTransactionTypeID: "starsTransaction#35d4f276", PaymentsStarsStatusTypeID: "payments.starsStatus#bbfa316c", FoundStoryTypeID: "foundStory#e87acbc0", StoriesFoundStoriesTypeID: "stories.foundStories#e2de7737", @@ -1390,7 +1391,7 @@ func TypesMap() map[uint32]string { MessageReactorTypeID: "messageReactor#4ba3a95a", StarsGiveawayOptionTypeID: "starsGiveawayOption#94ce852a", StarsGiveawayWinnersOptionTypeID: "starsGiveawayWinnersOption#54236209", - StarGiftTypeID: "starGift#aea174ee", + StarGiftTypeID: "starGift#49c577cd", PaymentsStarGiftsNotModifiedTypeID: "payments.starGiftsNotModified#a388a368", PaymentsStarGiftsTypeID: "payments.starGifts#901689ea", UserStarGiftTypeID: "userStarGift#eea49a6e", @@ -1791,6 +1792,10 @@ func TypesMap() map[uint32]string { MessagesSendPaidReactionRequestTypeID: "messages.sendPaidReaction#9dd6a67b", MessagesTogglePaidReactionPrivacyRequestTypeID: "messages.togglePaidReactionPrivacy#849ad397", MessagesGetPaidReactionPrivacyRequestTypeID: "messages.getPaidReactionPrivacy#472455aa", + MessagesViewSponsoredMessageRequestTypeID: "messages.viewSponsoredMessage#673ad8f1", + MessagesClickSponsoredMessageRequestTypeID: "messages.clickSponsoredMessage#f093465", + MessagesReportSponsoredMessageRequestTypeID: "messages.reportSponsoredMessage#1af3dbb8", + MessagesGetSponsoredMessagesRequestTypeID: "messages.getSponsoredMessages#9bd2f439", UpdatesGetStateRequestTypeID: "updates.getState#edd4882a", UpdatesGetDifferenceRequestTypeID: "updates.getDifference#19c2f763", UpdatesGetChannelDifferenceRequestTypeID: "updates.getChannelDifference#3173d78", @@ -1867,8 +1872,6 @@ func TypesMap() map[uint32]string { ChannelsToggleSlowModeRequestTypeID: "channels.toggleSlowMode#edd49ef0", ChannelsGetInactiveChannelsRequestTypeID: "channels.getInactiveChannels#11e831ee", ChannelsConvertToGigagroupRequestTypeID: "channels.convertToGigagroup#b290c69", - ChannelsViewSponsoredMessageRequestTypeID: "channels.viewSponsoredMessage#beaedb94", - ChannelsGetSponsoredMessagesRequestTypeID: "channels.getSponsoredMessages#ec210fbf", ChannelsGetSendAsRequestTypeID: "channels.getSendAs#dc770ee", ChannelsDeleteParticipantHistoryRequestTypeID: "channels.deleteParticipantHistory#367544db", ChannelsToggleJoinToSendRequestTypeID: "channels.toggleJoinToSend#e4cb9580", @@ -1887,14 +1890,12 @@ func TypesMap() map[uint32]string { ChannelsToggleAntiSpamRequestTypeID: "channels.toggleAntiSpam#68f3e4eb", ChannelsReportAntiSpamFalsePositiveRequestTypeID: "channels.reportAntiSpamFalsePositive#a850a693", ChannelsToggleParticipantsHiddenRequestTypeID: "channels.toggleParticipantsHidden#6a6e7854", - ChannelsClickSponsoredMessageRequestTypeID: "channels.clickSponsoredMessage#1445d75", ChannelsUpdateColorRequestTypeID: "channels.updateColor#d8aa3671", ChannelsToggleViewForumAsMessagesRequestTypeID: "channels.toggleViewForumAsMessages#9738bb15", ChannelsGetChannelRecommendationsRequestTypeID: "channels.getChannelRecommendations#25a71742", ChannelsUpdateEmojiStatusRequestTypeID: "channels.updateEmojiStatus#f0d3e6a8", ChannelsSetBoostsToUnblockRestrictionsRequestTypeID: "channels.setBoostsToUnblockRestrictions#ad399cee", ChannelsSetEmojiStickersRequestTypeID: "channels.setEmojiStickers#3cd930b7", - ChannelsReportSponsoredMessageRequestTypeID: "channels.reportSponsoredMessage#af8ff6b9", ChannelsRestrictSponsoredMessagesRequestTypeID: "channels.restrictSponsoredMessages#9ae91519", ChannelsSearchPostsRequestTypeID: "channels.searchPosts#d19f987b", BotsSendCustomRequestRequestTypeID: "bots.sendCustomRequest#aa2769ed", @@ -2009,9 +2010,9 @@ func TypesMap() map[uint32]string { StatsGetMessageStatsRequestTypeID: "stats.getMessageStats#b6e0a3f5", StatsGetStoryStatsRequestTypeID: "stats.getStoryStats#374fef40", StatsGetStoryPublicForwardsRequestTypeID: "stats.getStoryPublicForwards#a6437ef6", - StatsGetBroadcastRevenueStatsRequestTypeID: "stats.getBroadcastRevenueStats#75dfb671", - StatsGetBroadcastRevenueWithdrawalURLRequestTypeID: "stats.getBroadcastRevenueWithdrawalUrl#2a65ef73", - StatsGetBroadcastRevenueTransactionsRequestTypeID: "stats.getBroadcastRevenueTransactions#69280f", + StatsGetBroadcastRevenueStatsRequestTypeID: "stats.getBroadcastRevenueStats#f788ee19", + StatsGetBroadcastRevenueWithdrawalURLRequestTypeID: "stats.getBroadcastRevenueWithdrawalUrl#9df4faad", + StatsGetBroadcastRevenueTransactionsRequestTypeID: "stats.getBroadcastRevenueTransactions#70990b6d", ChatlistsExportChatlistInviteRequestTypeID: "chatlists.exportChatlistInvite#8472478e", ChatlistsDeleteExportedInviteRequestTypeID: "chatlists.deleteExportedInvite#719c5c5e", ChatlistsEditExportedInviteRequestTypeID: "chatlists.editExportedInvite#653db63d", @@ -2048,7 +2049,7 @@ func TypesMap() map[uint32]string { StoriesTogglePeerStoriesHiddenRequestTypeID: "stories.togglePeerStoriesHidden#bd0415c4", StoriesGetStoryReactionsListRequestTypeID: "stories.getStoryReactionsList#b9b2881f", StoriesTogglePinnedToTopRequestTypeID: "stories.togglePinnedToTop#b297e9b", - StoriesSearchPostsRequestTypeID: "stories.searchPosts#6cea116a", + StoriesSearchPostsRequestTypeID: "stories.searchPosts#d1810907", PremiumGetBoostsListRequestTypeID: "premium.getBoostsList#60f67660", PremiumGetMyBoostsRequestTypeID: "premium.getMyBoosts#be77b4a", PremiumApplyBoostRequestTypeID: "premium.applyBoost#6b7da746", @@ -3414,6 +3415,7 @@ func NamesMap() map[string]uint32 { "starsTransactionPeerFragment": StarsTransactionPeerFragmentTypeID, "starsTransactionPeer": StarsTransactionPeerTypeID, "starsTransactionPeerAds": StarsTransactionPeerAdsTypeID, + "starsTransactionPeerAPI": StarsTransactionPeerAPITypeID, "starsTopupOption": StarsTopupOptionTypeID, "starsTransaction": StarsTransactionTypeID, "payments.starsStatus": PaymentsStarsStatusTypeID, @@ -3835,6 +3837,10 @@ func NamesMap() map[string]uint32 { "messages.sendPaidReaction": MessagesSendPaidReactionRequestTypeID, "messages.togglePaidReactionPrivacy": MessagesTogglePaidReactionPrivacyRequestTypeID, "messages.getPaidReactionPrivacy": MessagesGetPaidReactionPrivacyRequestTypeID, + "messages.viewSponsoredMessage": MessagesViewSponsoredMessageRequestTypeID, + "messages.clickSponsoredMessage": MessagesClickSponsoredMessageRequestTypeID, + "messages.reportSponsoredMessage": MessagesReportSponsoredMessageRequestTypeID, + "messages.getSponsoredMessages": MessagesGetSponsoredMessagesRequestTypeID, "updates.getState": UpdatesGetStateRequestTypeID, "updates.getDifference": UpdatesGetDifferenceRequestTypeID, "updates.getChannelDifference": UpdatesGetChannelDifferenceRequestTypeID, @@ -3911,8 +3917,6 @@ func NamesMap() map[string]uint32 { "channels.toggleSlowMode": ChannelsToggleSlowModeRequestTypeID, "channels.getInactiveChannels": ChannelsGetInactiveChannelsRequestTypeID, "channels.convertToGigagroup": ChannelsConvertToGigagroupRequestTypeID, - "channels.viewSponsoredMessage": ChannelsViewSponsoredMessageRequestTypeID, - "channels.getSponsoredMessages": ChannelsGetSponsoredMessagesRequestTypeID, "channels.getSendAs": ChannelsGetSendAsRequestTypeID, "channels.deleteParticipantHistory": ChannelsDeleteParticipantHistoryRequestTypeID, "channels.toggleJoinToSend": ChannelsToggleJoinToSendRequestTypeID, @@ -3931,14 +3935,12 @@ func NamesMap() map[string]uint32 { "channels.toggleAntiSpam": ChannelsToggleAntiSpamRequestTypeID, "channels.reportAntiSpamFalsePositive": ChannelsReportAntiSpamFalsePositiveRequestTypeID, "channels.toggleParticipantsHidden": ChannelsToggleParticipantsHiddenRequestTypeID, - "channels.clickSponsoredMessage": ChannelsClickSponsoredMessageRequestTypeID, "channels.updateColor": ChannelsUpdateColorRequestTypeID, "channels.toggleViewForumAsMessages": ChannelsToggleViewForumAsMessagesRequestTypeID, "channels.getChannelRecommendations": ChannelsGetChannelRecommendationsRequestTypeID, "channels.updateEmojiStatus": ChannelsUpdateEmojiStatusRequestTypeID, "channels.setBoostsToUnblockRestrictions": ChannelsSetBoostsToUnblockRestrictionsRequestTypeID, "channels.setEmojiStickers": ChannelsSetEmojiStickersRequestTypeID, - "channels.reportSponsoredMessage": ChannelsReportSponsoredMessageRequestTypeID, "channels.restrictSponsoredMessages": ChannelsRestrictSponsoredMessagesRequestTypeID, "channels.searchPosts": ChannelsSearchPostsRequestTypeID, "bots.sendCustomRequest": BotsSendCustomRequestRequestTypeID, @@ -5458,6 +5460,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StarsTransactionPeerFragmentTypeID: func() bin.Object { return &StarsTransactionPeerFragment{} }, StarsTransactionPeerTypeID: func() bin.Object { return &StarsTransactionPeer{} }, StarsTransactionPeerAdsTypeID: func() bin.Object { return &StarsTransactionPeerAds{} }, + StarsTransactionPeerAPITypeID: func() bin.Object { return &StarsTransactionPeerAPI{} }, StarsTopupOptionTypeID: func() bin.Object { return &StarsTopupOption{} }, StarsTransactionTypeID: func() bin.Object { return &StarsTransaction{} }, PaymentsStarsStatusTypeID: func() bin.Object { return &PaymentsStarsStatus{} }, @@ -5879,6 +5882,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object { MessagesSendPaidReactionRequestTypeID: func() bin.Object { return &MessagesSendPaidReactionRequest{} }, MessagesTogglePaidReactionPrivacyRequestTypeID: func() bin.Object { return &MessagesTogglePaidReactionPrivacyRequest{} }, MessagesGetPaidReactionPrivacyRequestTypeID: func() bin.Object { return &MessagesGetPaidReactionPrivacyRequest{} }, + MessagesViewSponsoredMessageRequestTypeID: func() bin.Object { return &MessagesViewSponsoredMessageRequest{} }, + MessagesClickSponsoredMessageRequestTypeID: func() bin.Object { return &MessagesClickSponsoredMessageRequest{} }, + MessagesReportSponsoredMessageRequestTypeID: func() bin.Object { return &MessagesReportSponsoredMessageRequest{} }, + MessagesGetSponsoredMessagesRequestTypeID: func() bin.Object { return &MessagesGetSponsoredMessagesRequest{} }, UpdatesGetStateRequestTypeID: func() bin.Object { return &UpdatesGetStateRequest{} }, UpdatesGetDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetDifferenceRequest{} }, UpdatesGetChannelDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} }, @@ -5955,8 +5962,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelsToggleSlowModeRequestTypeID: func() bin.Object { return &ChannelsToggleSlowModeRequest{} }, ChannelsGetInactiveChannelsRequestTypeID: func() bin.Object { return &ChannelsGetInactiveChannelsRequest{} }, ChannelsConvertToGigagroupRequestTypeID: func() bin.Object { return &ChannelsConvertToGigagroupRequest{} }, - ChannelsViewSponsoredMessageRequestTypeID: func() bin.Object { return &ChannelsViewSponsoredMessageRequest{} }, - ChannelsGetSponsoredMessagesRequestTypeID: func() bin.Object { return &ChannelsGetSponsoredMessagesRequest{} }, ChannelsGetSendAsRequestTypeID: func() bin.Object { return &ChannelsGetSendAsRequest{} }, ChannelsDeleteParticipantHistoryRequestTypeID: func() bin.Object { return &ChannelsDeleteParticipantHistoryRequest{} }, ChannelsToggleJoinToSendRequestTypeID: func() bin.Object { return &ChannelsToggleJoinToSendRequest{} }, @@ -5975,14 +5980,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object { ChannelsToggleAntiSpamRequestTypeID: func() bin.Object { return &ChannelsToggleAntiSpamRequest{} }, ChannelsReportAntiSpamFalsePositiveRequestTypeID: func() bin.Object { return &ChannelsReportAntiSpamFalsePositiveRequest{} }, 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{} }, ChannelsUpdateEmojiStatusRequestTypeID: func() bin.Object { return &ChannelsUpdateEmojiStatusRequest{} }, ChannelsSetBoostsToUnblockRestrictionsRequestTypeID: func() bin.Object { return &ChannelsSetBoostsToUnblockRestrictionsRequest{} }, ChannelsSetEmojiStickersRequestTypeID: func() bin.Object { return &ChannelsSetEmojiStickersRequest{} }, - ChannelsReportSponsoredMessageRequestTypeID: func() bin.Object { return &ChannelsReportSponsoredMessageRequest{} }, ChannelsRestrictSponsoredMessagesRequestTypeID: func() bin.Object { return &ChannelsRestrictSponsoredMessagesRequest{} }, ChannelsSearchPostsRequestTypeID: func() bin.Object { return &ChannelsSearchPostsRequest{} }, BotsSendCustomRequestRequestTypeID: func() bin.Object { return &BotsSendCustomRequestRequest{} }, @@ -7367,6 +7370,7 @@ func ClassConstructorsMap() map[string][]uint32 { StarsTransactionPeerFragmentTypeID, StarsTransactionPeerTypeID, StarsTransactionPeerAdsTypeID, + StarsTransactionPeerAPITypeID, }, StatsGraphClassName: { StatsGraphAsyncTypeID, diff --git a/tg/tl_server_gen.go b/tg/tl_server_gen.go index fe020917da..d509e75777 100644 --- a/tg/tl_server_gen.go +++ b/tg/tl_server_gen.go @@ -7043,6 +7043,82 @@ func (s *ServerDispatcher) OnMessagesGetPaidReactionPrivacy(f func(ctx context.C s.handlers[MessagesGetPaidReactionPrivacyRequestTypeID] = handler } +func (s *ServerDispatcher) OnMessagesViewSponsoredMessage(f func(ctx context.Context, request *MessagesViewSponsoredMessageRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesViewSponsoredMessageRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesViewSponsoredMessageRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesClickSponsoredMessage(f func(ctx context.Context, request *MessagesClickSponsoredMessageRequest) (bool, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesClickSponsoredMessageRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + if response { + return &BoolBox{Bool: &BoolTrue{}}, nil + } + + return &BoolBox{Bool: &BoolFalse{}}, nil + } + + s.handlers[MessagesClickSponsoredMessageRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesReportSponsoredMessage(f func(ctx context.Context, request *MessagesReportSponsoredMessageRequest) (ChannelsSponsoredMessageReportResultClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesReportSponsoredMessageRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, &request) + if err != nil { + return nil, err + } + return &ChannelsSponsoredMessageReportResultBox{SponsoredMessageReportResult: response}, nil + } + + s.handlers[MessagesReportSponsoredMessageRequestTypeID] = handler +} + +func (s *ServerDispatcher) OnMessagesGetSponsoredMessages(f func(ctx context.Context, peer InputPeerClass) (MessagesSponsoredMessagesClass, error)) { + handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { + var request MessagesGetSponsoredMessagesRequest + if err := request.Decode(b); err != nil { + return nil, err + } + + response, err := f(ctx, request.Peer) + if err != nil { + return nil, err + } + return &MessagesSponsoredMessagesBox{SponsoredMessages: response}, nil + } + + s.handlers[MessagesGetSponsoredMessagesRequestTypeID] = 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 @@ -8395,44 +8471,6 @@ func (s *ServerDispatcher) OnChannelsConvertToGigagroup(f func(ctx context.Conte s.handlers[ChannelsConvertToGigagroupRequestTypeID] = handler } -func (s *ServerDispatcher) OnChannelsViewSponsoredMessage(f func(ctx context.Context, request *ChannelsViewSponsoredMessageRequest) (bool, error)) { - handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { - var request ChannelsViewSponsoredMessageRequest - if err := request.Decode(b); err != nil { - return nil, err - } - - response, err := f(ctx, &request) - if err != nil { - return nil, err - } - if response { - return &BoolBox{Bool: &BoolTrue{}}, nil - } - - return &BoolBox{Bool: &BoolFalse{}}, nil - } - - s.handlers[ChannelsViewSponsoredMessageRequestTypeID] = handler -} - -func (s *ServerDispatcher) OnChannelsGetSponsoredMessages(f func(ctx context.Context, channel InputChannelClass) (MessagesSponsoredMessagesClass, error)) { - handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { - var request ChannelsGetSponsoredMessagesRequest - if err := request.Decode(b); err != nil { - return nil, err - } - - response, err := f(ctx, request.Channel) - if err != nil { - return nil, err - } - return &MessagesSponsoredMessagesBox{SponsoredMessages: response}, nil - } - - s.handlers[ChannelsGetSponsoredMessagesRequestTypeID] = handler -} - func (s *ServerDispatcher) OnChannelsGetSendAs(f func(ctx context.Context, peer InputPeerClass) (*ChannelsSendAsPeers, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request ChannelsGetSendAsRequest @@ -8755,27 +8793,6 @@ func (s *ServerDispatcher) OnChannelsToggleParticipantsHidden(f func(ctx context s.handlers[ChannelsToggleParticipantsHiddenRequestTypeID] = handler } -func (s *ServerDispatcher) OnChannelsClickSponsoredMessage(f func(ctx context.Context, request *ChannelsClickSponsoredMessageRequest) (bool, error)) { - handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { - var request ChannelsClickSponsoredMessageRequest - if err := request.Decode(b); err != nil { - return nil, err - } - - response, err := f(ctx, &request) - if err != nil { - return nil, err - } - if response { - return &BoolBox{Bool: &BoolTrue{}}, nil - } - - return &BoolBox{Bool: &BoolFalse{}}, nil - } - - s.handlers[ChannelsClickSponsoredMessageRequestTypeID] = handler -} - func (s *ServerDispatcher) OnChannelsUpdateColor(f func(ctx context.Context, request *ChannelsUpdateColorRequest) (UpdatesClass, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request ChannelsUpdateColorRequest @@ -8882,23 +8899,6 @@ func (s *ServerDispatcher) OnChannelsSetEmojiStickers(f func(ctx context.Context s.handlers[ChannelsSetEmojiStickersRequestTypeID] = handler } -func (s *ServerDispatcher) OnChannelsReportSponsoredMessage(f func(ctx context.Context, request *ChannelsReportSponsoredMessageRequest) (ChannelsSponsoredMessageReportResultClass, error)) { - handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { - var request ChannelsReportSponsoredMessageRequest - if err := request.Decode(b); err != nil { - return nil, err - } - - response, err := f(ctx, &request) - if err != nil { - return nil, err - } - return &ChannelsSponsoredMessageReportResultBox{SponsoredMessageReportResult: response}, nil - } - - s.handlers[ChannelsReportSponsoredMessageRequestTypeID] = handler -} - func (s *ServerDispatcher) OnChannelsRestrictSponsoredMessages(f func(ctx context.Context, request *ChannelsRestrictSponsoredMessagesRequest) (UpdatesClass, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request ChannelsRestrictSponsoredMessagesRequest diff --git a/tg/tl_star_gift_gen.go b/tg/tl_star_gift_gen.go index 09f03c8783..db06266ce0 100644 --- a/tg/tl_star_gift_gen.go +++ b/tg/tl_star_gift_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StarGift represents TL type `starGift#aea174ee`. +// StarGift represents TL type `starGift#49c577cd`. // // See https://core.telegram.org/constructor/starGift for reference. type StarGift struct { @@ -39,6 +39,8 @@ type StarGift struct { Flags bin.Fields // Limited field of StarGift. Limited bool + // SoldOut field of StarGift. + SoldOut bool // ID field of StarGift. ID int64 // Sticker field of StarGift. @@ -55,10 +57,18 @@ type StarGift struct { AvailabilityTotal int // ConvertStars field of StarGift. ConvertStars int64 + // FirstSaleDate field of StarGift. + // + // Use SetFirstSaleDate and GetFirstSaleDate helpers. + FirstSaleDate int + // LastSaleDate field of StarGift. + // + // Use SetLastSaleDate and GetLastSaleDate helpers. + LastSaleDate int } // StarGiftTypeID is TL type id of StarGift. -const StarGiftTypeID = 0xaea174ee +const StarGiftTypeID = 0x49c577cd // Ensuring interfaces in compile-time for StarGift. var ( @@ -78,6 +88,9 @@ func (s *StarGift) Zero() bool { if !(s.Limited == false) { return false } + if !(s.SoldOut == false) { + return false + } if !(s.ID == 0) { return false } @@ -96,6 +109,12 @@ func (s *StarGift) Zero() bool { if !(s.ConvertStars == 0) { return false } + if !(s.FirstSaleDate == 0) { + return false + } + if !(s.LastSaleDate == 0) { + return false + } return true } @@ -112,14 +131,18 @@ func (s *StarGift) String() string { // FillFrom fills StarGift from given interface. func (s *StarGift) FillFrom(from interface { GetLimited() (value bool) + GetSoldOut() (value bool) GetID() (value int64) GetSticker() (value DocumentClass) GetStars() (value int64) GetAvailabilityRemains() (value int, ok bool) GetAvailabilityTotal() (value int, ok bool) GetConvertStars() (value int64) + GetFirstSaleDate() (value int, ok bool) + GetLastSaleDate() (value int, ok bool) }) { s.Limited = from.GetLimited() + s.SoldOut = from.GetSoldOut() s.ID = from.GetID() s.Sticker = from.GetSticker() s.Stars = from.GetStars() @@ -132,6 +155,14 @@ func (s *StarGift) FillFrom(from interface { } s.ConvertStars = from.GetConvertStars() + if val, ok := from.GetFirstSaleDate(); ok { + s.FirstSaleDate = val + } + + if val, ok := from.GetLastSaleDate(); ok { + s.LastSaleDate = val + } + } // TypeID returns type id in TL schema. @@ -162,6 +193,11 @@ func (s *StarGift) TypeInfo() tdp.Type { SchemaName: "limited", Null: !s.Flags.Has(0), }, + { + Name: "SoldOut", + SchemaName: "sold_out", + Null: !s.Flags.Has(1), + }, { Name: "ID", SchemaName: "id", @@ -188,6 +224,16 @@ func (s *StarGift) TypeInfo() tdp.Type { Name: "ConvertStars", SchemaName: "convert_stars", }, + { + Name: "FirstSaleDate", + SchemaName: "first_sale_date", + Null: !s.Flags.Has(1), + }, + { + Name: "LastSaleDate", + SchemaName: "last_sale_date", + Null: !s.Flags.Has(1), + }, } return typ } @@ -197,18 +243,27 @@ func (s *StarGift) SetFlags() { if !(s.Limited == false) { s.Flags.Set(0) } + if !(s.SoldOut == false) { + s.Flags.Set(1) + } if !(s.AvailabilityRemains == 0) { s.Flags.Set(0) } if !(s.AvailabilityTotal == 0) { s.Flags.Set(0) } + if !(s.FirstSaleDate == 0) { + s.Flags.Set(1) + } + if !(s.LastSaleDate == 0) { + s.Flags.Set(1) + } } // Encode implements bin.Encoder. func (s *StarGift) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGift#aea174ee as nil") + return fmt.Errorf("can't encode starGift#49c577cd as nil") } b.PutID(StarGiftTypeID) return s.EncodeBare(b) @@ -217,18 +272,18 @@ func (s *StarGift) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarGift) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starGift#aea174ee as nil") + return fmt.Errorf("can't encode starGift#49c577cd as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGift#aea174ee: field flags: %w", err) + return fmt.Errorf("unable to encode starGift#49c577cd: field flags: %w", err) } b.PutLong(s.ID) if s.Sticker == nil { - return fmt.Errorf("unable to encode starGift#aea174ee: field sticker is nil") + return fmt.Errorf("unable to encode starGift#49c577cd: field sticker is nil") } if err := s.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode starGift#aea174ee: field sticker: %w", err) + return fmt.Errorf("unable to encode starGift#49c577cd: field sticker: %w", err) } b.PutLong(s.Stars) if s.Flags.Has(0) { @@ -238,16 +293,22 @@ func (s *StarGift) EncodeBare(b *bin.Buffer) error { b.PutInt(s.AvailabilityTotal) } b.PutLong(s.ConvertStars) + if s.Flags.Has(1) { + b.PutInt(s.FirstSaleDate) + } + if s.Flags.Has(1) { + b.PutInt(s.LastSaleDate) + } return nil } // Decode implements bin.Decoder. func (s *StarGift) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGift#aea174ee to nil") + return fmt.Errorf("can't decode starGift#49c577cd to nil") } if err := b.ConsumeID(StarGiftTypeID); err != nil { - return fmt.Errorf("unable to decode starGift#aea174ee: %w", err) + return fmt.Errorf("unable to decode starGift#49c577cd: %w", err) } return s.DecodeBare(b) } @@ -255,56 +316,71 @@ func (s *StarGift) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarGift) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starGift#aea174ee to nil") + return fmt.Errorf("can't decode starGift#49c577cd to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode starGift#aea174ee: field flags: %w", err) + return fmt.Errorf("unable to decode starGift#49c577cd: field flags: %w", err) } } s.Limited = s.Flags.Has(0) + s.SoldOut = s.Flags.Has(1) { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGift#aea174ee: field id: %w", err) + return fmt.Errorf("unable to decode starGift#49c577cd: field id: %w", err) } s.ID = value } { value, err := DecodeDocument(b) if err != nil { - return fmt.Errorf("unable to decode starGift#aea174ee: field sticker: %w", err) + return fmt.Errorf("unable to decode starGift#49c577cd: field sticker: %w", err) } s.Sticker = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGift#aea174ee: field stars: %w", err) + return fmt.Errorf("unable to decode starGift#49c577cd: field stars: %w", err) } s.Stars = value } if s.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#aea174ee: field availability_remains: %w", err) + return fmt.Errorf("unable to decode starGift#49c577cd: field availability_remains: %w", err) } s.AvailabilityRemains = value } if s.Flags.Has(0) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starGift#aea174ee: field availability_total: %w", err) + return fmt.Errorf("unable to decode starGift#49c577cd: field availability_total: %w", err) } s.AvailabilityTotal = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starGift#aea174ee: field convert_stars: %w", err) + return fmt.Errorf("unable to decode starGift#49c577cd: field convert_stars: %w", err) } s.ConvertStars = value } + if s.Flags.Has(1) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGift#49c577cd: field first_sale_date: %w", err) + } + s.FirstSaleDate = value + } + if s.Flags.Has(1) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starGift#49c577cd: field last_sale_date: %w", err) + } + s.LastSaleDate = value + } return nil } @@ -327,6 +403,25 @@ func (s *StarGift) GetLimited() (value bool) { return s.Flags.Has(0) } +// SetSoldOut sets value of SoldOut conditional field. +func (s *StarGift) SetSoldOut(value bool) { + if value { + s.Flags.Set(1) + s.SoldOut = true + } else { + s.Flags.Unset(1) + s.SoldOut = false + } +} + +// GetSoldOut returns value of SoldOut conditional field. +func (s *StarGift) GetSoldOut() (value bool) { + if s == nil { + return + } + return s.Flags.Has(1) +} + // GetID returns value of ID field. func (s *StarGift) GetID() (value int64) { if s == nil { @@ -395,6 +490,42 @@ func (s *StarGift) GetConvertStars() (value int64) { return s.ConvertStars } +// SetFirstSaleDate sets value of FirstSaleDate conditional field. +func (s *StarGift) SetFirstSaleDate(value int) { + s.Flags.Set(1) + s.FirstSaleDate = value +} + +// GetFirstSaleDate returns value of FirstSaleDate conditional field and +// boolean which is true if field was set. +func (s *StarGift) GetFirstSaleDate() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(1) { + return value, false + } + return s.FirstSaleDate, true +} + +// SetLastSaleDate sets value of LastSaleDate conditional field. +func (s *StarGift) SetLastSaleDate(value int) { + s.Flags.Set(1) + s.LastSaleDate = value +} + +// GetLastSaleDate returns value of LastSaleDate conditional field and +// boolean which is true if field was set. +func (s *StarGift) GetLastSaleDate() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(1) { + return value, false + } + return s.LastSaleDate, true +} + // GetStickerAsNotEmpty returns mapped value of Sticker field. func (s *StarGift) GetStickerAsNotEmpty() (*Document, bool) { return s.Sticker.AsNotEmpty() diff --git a/tg/tl_stars_transaction_gen.go b/tg/tl_stars_transaction_gen.go index b5bf80bd99..38c1b76562 100644 --- a/tg/tl_stars_transaction_gen.go +++ b/tg/tl_stars_transaction_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StarsTransaction represents TL type `starsTransaction#a9ee4c2`. +// StarsTransaction represents TL type `starsTransaction#35d4f276`. // Represents a Telegram Stars transaction »¹. // // Links: @@ -122,10 +122,14 @@ type StarsTransaction struct { // // Use SetStargift and GetStargift helpers. Stargift StarGift + // FloodskipNumber field of StarsTransaction. + // + // Use SetFloodskipNumber and GetFloodskipNumber helpers. + FloodskipNumber int } // StarsTransactionTypeID is TL type id of StarsTransaction. -const StarsTransactionTypeID = 0xa9ee4c2 +const StarsTransactionTypeID = 0x35d4f276 // Ensuring interfaces in compile-time for StarsTransaction. var ( @@ -202,6 +206,9 @@ func (s *StarsTransaction) Zero() bool { if !(s.Stargift.Zero()) { return false } + if !(s.FloodskipNumber == 0) { + return false + } return true } @@ -237,6 +244,7 @@ func (s *StarsTransaction) FillFrom(from interface { GetSubscriptionPeriod() (value int, ok bool) GetGiveawayPostID() (value int, ok bool) GetStargift() (value StarGift, ok bool) + GetFloodskipNumber() (value int, ok bool) }) { s.Refund = from.GetRefund() s.Pending = from.GetPending() @@ -291,6 +299,10 @@ func (s *StarsTransaction) FillFrom(from interface { s.Stargift = val } + if val, ok := from.GetFloodskipNumber(); ok { + s.FloodskipNumber = val + } + } // TypeID returns type id in TL schema. @@ -412,6 +424,11 @@ func (s *StarsTransaction) TypeInfo() tdp.Type { SchemaName: "stargift", Null: !s.Flags.Has(14), }, + { + Name: "FloodskipNumber", + SchemaName: "floodskip_number", + Null: !s.Flags.Has(15), + }, } return typ } @@ -466,12 +483,15 @@ func (s *StarsTransaction) SetFlags() { if !(s.Stargift.Zero()) { s.Flags.Set(14) } + if !(s.FloodskipNumber == 0) { + s.Flags.Set(15) + } } // Encode implements bin.Encoder. func (s *StarsTransaction) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starsTransaction#a9ee4c2 as nil") + return fmt.Errorf("can't encode starsTransaction#35d4f276 as nil") } b.PutID(StarsTransactionTypeID) return s.EncodeBare(b) @@ -480,20 +500,20 @@ func (s *StarsTransaction) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StarsTransaction) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode starsTransaction#a9ee4c2 as nil") + return fmt.Errorf("can't encode starsTransaction#35d4f276 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsTransaction#a9ee4c2: field flags: %w", err) + return fmt.Errorf("unable to encode starsTransaction#35d4f276: field flags: %w", err) } b.PutString(s.ID) b.PutLong(s.Stars) b.PutInt(s.Date) if s.Peer == nil { - return fmt.Errorf("unable to encode starsTransaction#a9ee4c2: field peer is nil") + return fmt.Errorf("unable to encode starsTransaction#35d4f276: field peer is nil") } if err := s.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsTransaction#a9ee4c2: field peer: %w", err) + return fmt.Errorf("unable to encode starsTransaction#35d4f276: field peer: %w", err) } if s.Flags.Has(0) { b.PutString(s.Title) @@ -503,10 +523,10 @@ func (s *StarsTransaction) EncodeBare(b *bin.Buffer) error { } if s.Flags.Has(2) { if s.Photo == nil { - return fmt.Errorf("unable to encode starsTransaction#a9ee4c2: field photo is nil") + return fmt.Errorf("unable to encode starsTransaction#35d4f276: field photo is nil") } if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsTransaction#a9ee4c2: field photo: %w", err) + return fmt.Errorf("unable to encode starsTransaction#35d4f276: field photo: %w", err) } } if s.Flags.Has(5) { @@ -525,10 +545,10 @@ func (s *StarsTransaction) EncodeBare(b *bin.Buffer) error { b.PutVectorHeader(len(s.ExtendedMedia)) for idx, v := range s.ExtendedMedia { if v == nil { - return fmt.Errorf("unable to encode starsTransaction#a9ee4c2: field extended_media element with index %d is nil", idx) + return fmt.Errorf("unable to encode starsTransaction#35d4f276: field extended_media element with index %d is nil", idx) } if err := v.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsTransaction#a9ee4c2: field extended_media element with index %d: %w", idx, err) + return fmt.Errorf("unable to encode starsTransaction#35d4f276: field extended_media element with index %d: %w", idx, err) } } } @@ -540,19 +560,22 @@ func (s *StarsTransaction) EncodeBare(b *bin.Buffer) error { } if s.Flags.Has(14) { if err := s.Stargift.Encode(b); err != nil { - return fmt.Errorf("unable to encode starsTransaction#a9ee4c2: field stargift: %w", err) + return fmt.Errorf("unable to encode starsTransaction#35d4f276: field stargift: %w", err) } } + if s.Flags.Has(15) { + b.PutInt(s.FloodskipNumber) + } return nil } // Decode implements bin.Decoder. func (s *StarsTransaction) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starsTransaction#a9ee4c2 to nil") + return fmt.Errorf("can't decode starsTransaction#35d4f276 to nil") } if err := b.ConsumeID(StarsTransactionTypeID); err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: %w", err) } return s.DecodeBare(b) } @@ -560,11 +583,11 @@ func (s *StarsTransaction) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StarsTransaction) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode starsTransaction#a9ee4c2 to nil") + return fmt.Errorf("can't decode starsTransaction#35d4f276 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field flags: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field flags: %w", err) } } s.Refund = s.Flags.Has(3) @@ -575,84 +598,84 @@ func (s *StarsTransaction) DecodeBare(b *bin.Buffer) error { { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field id: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field id: %w", err) } s.ID = value } { value, err := b.Long() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field stars: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field stars: %w", err) } s.Stars = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field date: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field date: %w", err) } s.Date = value } { value, err := DecodeStarsTransactionPeer(b) if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field peer: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field peer: %w", err) } s.Peer = value } if s.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field title: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field title: %w", err) } s.Title = value } if s.Flags.Has(1) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field description: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field description: %w", err) } s.Description = value } if s.Flags.Has(2) { value, err := DecodeWebDocument(b) if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field photo: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field photo: %w", err) } s.Photo = value } if s.Flags.Has(5) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field transaction_date: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field transaction_date: %w", err) } s.TransactionDate = value } if s.Flags.Has(5) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field transaction_url: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field transaction_url: %w", err) } s.TransactionURL = value } if s.Flags.Has(7) { value, err := b.Bytes() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field bot_payload: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field bot_payload: %w", err) } s.BotPayload = value } if s.Flags.Has(8) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field msg_id: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field msg_id: %w", err) } s.MsgID = value } if s.Flags.Has(9) { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field extended_media: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field extended_media: %w", err) } if headerLen > 0 { @@ -661,7 +684,7 @@ func (s *StarsTransaction) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := DecodeMessageMedia(b) if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field extended_media: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field extended_media: %w", err) } s.ExtendedMedia = append(s.ExtendedMedia, value) } @@ -669,22 +692,29 @@ func (s *StarsTransaction) DecodeBare(b *bin.Buffer) error { if s.Flags.Has(12) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field subscription_period: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field subscription_period: %w", err) } s.SubscriptionPeriod = value } if s.Flags.Has(13) { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field giveaway_post_id: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field giveaway_post_id: %w", err) } s.GiveawayPostID = value } if s.Flags.Has(14) { if err := s.Stargift.Decode(b); err != nil { - return fmt.Errorf("unable to decode starsTransaction#a9ee4c2: field stargift: %w", err) + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field stargift: %w", err) } } + if s.Flags.Has(15) { + value, err := b.Int() + if err != nil { + return fmt.Errorf("unable to decode starsTransaction#35d4f276: field floodskip_number: %w", err) + } + s.FloodskipNumber = value + } return nil } @@ -1013,6 +1043,24 @@ func (s *StarsTransaction) GetStargift() (value StarGift, ok bool) { return s.Stargift, true } +// SetFloodskipNumber sets value of FloodskipNumber conditional field. +func (s *StarsTransaction) SetFloodskipNumber(value int) { + s.Flags.Set(15) + s.FloodskipNumber = value +} + +// GetFloodskipNumber returns value of FloodskipNumber conditional field and +// boolean which is true if field was set. +func (s *StarsTransaction) GetFloodskipNumber() (value int, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(15) { + return value, false + } + return s.FloodskipNumber, true +} + // MapExtendedMedia returns field ExtendedMedia wrapped in MessageMediaClassArray helper. func (s *StarsTransaction) MapExtendedMedia() (value MessageMediaClassArray, ok bool) { if !s.Flags.Has(9) { diff --git a/tg/tl_stars_transaction_peer_gen.go b/tg/tl_stars_transaction_peer_gen.go index 980b083022..3d0e29263f 100644 --- a/tg/tl_stars_transaction_peer_gen.go +++ b/tg/tl_stars_transaction_peer_gen.go @@ -816,6 +816,107 @@ func (s *StarsTransactionPeerAds) DecodeBare(b *bin.Buffer) error { return nil } +// StarsTransactionPeerAPI represents TL type `starsTransactionPeerAPI#f9677aad`. +// +// See https://core.telegram.org/constructor/starsTransactionPeerAPI for reference. +type StarsTransactionPeerAPI struct { +} + +// StarsTransactionPeerAPITypeID is TL type id of StarsTransactionPeerAPI. +const StarsTransactionPeerAPITypeID = 0xf9677aad + +// construct implements constructor of StarsTransactionPeerClass. +func (s StarsTransactionPeerAPI) construct() StarsTransactionPeerClass { return &s } + +// Ensuring interfaces in compile-time for StarsTransactionPeerAPI. +var ( + _ bin.Encoder = &StarsTransactionPeerAPI{} + _ bin.Decoder = &StarsTransactionPeerAPI{} + _ bin.BareEncoder = &StarsTransactionPeerAPI{} + _ bin.BareDecoder = &StarsTransactionPeerAPI{} + + _ StarsTransactionPeerClass = &StarsTransactionPeerAPI{} +) + +func (s *StarsTransactionPeerAPI) Zero() bool { + if s == nil { + return true + } + + return true +} + +// String implements fmt.Stringer. +func (s *StarsTransactionPeerAPI) String() string { + if s == nil { + return "StarsTransactionPeerAPI(nil)" + } + type Alias StarsTransactionPeerAPI + return fmt.Sprintf("StarsTransactionPeerAPI%+v", Alias(*s)) +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*StarsTransactionPeerAPI) TypeID() uint32 { + return StarsTransactionPeerAPITypeID +} + +// TypeName returns name of type in TL schema. +func (*StarsTransactionPeerAPI) TypeName() string { + return "starsTransactionPeerAPI" +} + +// TypeInfo returns info about TL type. +func (s *StarsTransactionPeerAPI) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "starsTransactionPeerAPI", + ID: StarsTransactionPeerAPITypeID, + } + if s == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{} + return typ +} + +// Encode implements bin.Encoder. +func (s *StarsTransactionPeerAPI) Encode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsTransactionPeerAPI#f9677aad as nil") + } + b.PutID(StarsTransactionPeerAPITypeID) + return s.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (s *StarsTransactionPeerAPI) EncodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't encode starsTransactionPeerAPI#f9677aad as nil") + } + return nil +} + +// Decode implements bin.Decoder. +func (s *StarsTransactionPeerAPI) Decode(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsTransactionPeerAPI#f9677aad to nil") + } + if err := b.ConsumeID(StarsTransactionPeerAPITypeID); err != nil { + return fmt.Errorf("unable to decode starsTransactionPeerAPI#f9677aad: %w", err) + } + return s.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (s *StarsTransactionPeerAPI) DecodeBare(b *bin.Buffer) error { + if s == nil { + return fmt.Errorf("can't decode starsTransactionPeerAPI#f9677aad to nil") + } + return nil +} + // StarsTransactionPeerClassName is schema name of StarsTransactionPeerClass. const StarsTransactionPeerClassName = "StarsTransactionPeer" @@ -837,6 +938,7 @@ const StarsTransactionPeerClassName = "StarsTransactionPeer" // case *tg.StarsTransactionPeerFragment: // starsTransactionPeerFragment#e92fd902 // case *tg.StarsTransactionPeer: // starsTransactionPeer#d80da15d // case *tg.StarsTransactionPeerAds: // starsTransactionPeerAds#60682812 +// case *tg.StarsTransactionPeerAPI: // starsTransactionPeerAPI#f9677aad // default: panic(v) // } type StarsTransactionPeerClass interface { @@ -914,6 +1016,13 @@ func DecodeStarsTransactionPeer(buf *bin.Buffer) (StarsTransactionPeerClass, err return nil, fmt.Errorf("unable to decode StarsTransactionPeerClass: %w", err) } return &v, nil + case StarsTransactionPeerAPITypeID: + // Decoding starsTransactionPeerAPI#f9677aad. + v := StarsTransactionPeerAPI{} + if err := v.Decode(buf); err != nil { + return nil, fmt.Errorf("unable to decode StarsTransactionPeerClass: %w", err) + } + return &v, nil default: return nil, fmt.Errorf("unable to decode StarsTransactionPeerClass: %w", bin.NewUnexpectedID(id)) } diff --git a/tg/tl_stats_get_broadcast_revenue_stats_gen.go b/tg/tl_stats_get_broadcast_revenue_stats_gen.go index 9b1c52c9a3..ca98a1586a 100644 --- a/tg/tl_stats_get_broadcast_revenue_stats_gen.go +++ b/tg/tl_stats_get_broadcast_revenue_stats_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StatsGetBroadcastRevenueStatsRequest represents TL type `stats.getBroadcastRevenueStats#75dfb671`. +// StatsGetBroadcastRevenueStatsRequest represents TL type `stats.getBroadcastRevenueStats#f788ee19`. // Get channel ad revenue statistics »¹. // // Links: @@ -46,12 +46,12 @@ type StatsGetBroadcastRevenueStatsRequest struct { Flags bin.Fields // Whether to enable dark theme for graph colors Dark bool - // The channel - Channel InputChannelClass + // Peer field of StatsGetBroadcastRevenueStatsRequest. + Peer InputPeerClass } // StatsGetBroadcastRevenueStatsRequestTypeID is TL type id of StatsGetBroadcastRevenueStatsRequest. -const StatsGetBroadcastRevenueStatsRequestTypeID = 0x75dfb671 +const StatsGetBroadcastRevenueStatsRequestTypeID = 0xf788ee19 // Ensuring interfaces in compile-time for StatsGetBroadcastRevenueStatsRequest. var ( @@ -71,7 +71,7 @@ func (g *StatsGetBroadcastRevenueStatsRequest) Zero() bool { if !(g.Dark == false) { return false } - if !(g.Channel == nil) { + if !(g.Peer == nil) { return false } @@ -90,10 +90,10 @@ func (g *StatsGetBroadcastRevenueStatsRequest) String() string { // FillFrom fills StatsGetBroadcastRevenueStatsRequest from given interface. func (g *StatsGetBroadcastRevenueStatsRequest) FillFrom(from interface { GetDark() (value bool) - GetChannel() (value InputChannelClass) + GetPeer() (value InputPeerClass) }) { g.Dark = from.GetDark() - g.Channel = from.GetChannel() + g.Peer = from.GetPeer() } // TypeID returns type id in TL schema. @@ -125,8 +125,8 @@ func (g *StatsGetBroadcastRevenueStatsRequest) TypeInfo() tdp.Type { Null: !g.Flags.Has(0), }, { - Name: "Channel", - SchemaName: "channel", + Name: "Peer", + SchemaName: "peer", }, } return typ @@ -142,7 +142,7 @@ func (g *StatsGetBroadcastRevenueStatsRequest) SetFlags() { // Encode implements bin.Encoder. func (g *StatsGetBroadcastRevenueStatsRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode stats.getBroadcastRevenueStats#75dfb671 as nil") + return fmt.Errorf("can't encode stats.getBroadcastRevenueStats#f788ee19 as nil") } b.PutID(StatsGetBroadcastRevenueStatsRequestTypeID) return g.EncodeBare(b) @@ -151,17 +151,17 @@ func (g *StatsGetBroadcastRevenueStatsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *StatsGetBroadcastRevenueStatsRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode stats.getBroadcastRevenueStats#75dfb671 as nil") + return fmt.Errorf("can't encode stats.getBroadcastRevenueStats#f788ee19 as nil") } g.SetFlags() if err := g.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode stats.getBroadcastRevenueStats#75dfb671: field flags: %w", err) + return fmt.Errorf("unable to encode stats.getBroadcastRevenueStats#f788ee19: field flags: %w", err) } - if g.Channel == nil { - return fmt.Errorf("unable to encode stats.getBroadcastRevenueStats#75dfb671: field channel is nil") + if g.Peer == nil { + return fmt.Errorf("unable to encode stats.getBroadcastRevenueStats#f788ee19: field peer is nil") } - if err := g.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode stats.getBroadcastRevenueStats#75dfb671: field channel: %w", err) + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.getBroadcastRevenueStats#f788ee19: field peer: %w", err) } return nil } @@ -169,10 +169,10 @@ func (g *StatsGetBroadcastRevenueStatsRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (g *StatsGetBroadcastRevenueStatsRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode stats.getBroadcastRevenueStats#75dfb671 to nil") + return fmt.Errorf("can't decode stats.getBroadcastRevenueStats#f788ee19 to nil") } if err := b.ConsumeID(StatsGetBroadcastRevenueStatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueStats#75dfb671: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueStats#f788ee19: %w", err) } return g.DecodeBare(b) } @@ -180,20 +180,20 @@ func (g *StatsGetBroadcastRevenueStatsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *StatsGetBroadcastRevenueStatsRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode stats.getBroadcastRevenueStats#75dfb671 to nil") + return fmt.Errorf("can't decode stats.getBroadcastRevenueStats#f788ee19 to nil") } { if err := g.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueStats#75dfb671: field flags: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueStats#f788ee19: field flags: %w", err) } } g.Dark = g.Flags.Has(0) { - value, err := DecodeInputChannel(b) + value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueStats#75dfb671: field channel: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueStats#f788ee19: field peer: %w", err) } - g.Channel = value + g.Peer = value } return nil } @@ -217,20 +217,15 @@ func (g *StatsGetBroadcastRevenueStatsRequest) GetDark() (value bool) { return g.Flags.Has(0) } -// GetChannel returns value of Channel field. -func (g *StatsGetBroadcastRevenueStatsRequest) GetChannel() (value InputChannelClass) { +// GetPeer returns value of Peer field. +func (g *StatsGetBroadcastRevenueStatsRequest) GetPeer() (value InputPeerClass) { if g == nil { return } - return g.Channel + return g.Peer } -// GetChannelAsNotEmpty returns mapped value of Channel field. -func (g *StatsGetBroadcastRevenueStatsRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { - return g.Channel.AsNotEmpty() -} - -// StatsGetBroadcastRevenueStats invokes method stats.getBroadcastRevenueStats#75dfb671 returning error if any. +// StatsGetBroadcastRevenueStats invokes method stats.getBroadcastRevenueStats#f788ee19 returning error if any. // Get channel ad revenue statistics »¹. // // Links: diff --git a/tg/tl_stats_get_broadcast_revenue_transactions_gen.go b/tg/tl_stats_get_broadcast_revenue_transactions_gen.go index 5a58ac3c6b..165b8ca9e9 100644 --- a/tg/tl_stats_get_broadcast_revenue_transactions_gen.go +++ b/tg/tl_stats_get_broadcast_revenue_transactions_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StatsGetBroadcastRevenueTransactionsRequest represents TL type `stats.getBroadcastRevenueTransactions#69280f`. +// StatsGetBroadcastRevenueTransactionsRequest represents TL type `stats.getBroadcastRevenueTransactions#70990b6d`. // Fetch channel ad revenue transaction history »¹. // // Links: @@ -39,8 +39,8 @@ var ( // // See https://core.telegram.org/method/stats.getBroadcastRevenueTransactions for reference. type StatsGetBroadcastRevenueTransactionsRequest struct { - // The channel - Channel InputChannelClass + // Peer field of StatsGetBroadcastRevenueTransactionsRequest. + Peer InputPeerClass // Offset for pagination¹ // // Links: @@ -54,7 +54,7 @@ type StatsGetBroadcastRevenueTransactionsRequest struct { } // StatsGetBroadcastRevenueTransactionsRequestTypeID is TL type id of StatsGetBroadcastRevenueTransactionsRequest. -const StatsGetBroadcastRevenueTransactionsRequestTypeID = 0x69280f +const StatsGetBroadcastRevenueTransactionsRequestTypeID = 0x70990b6d // Ensuring interfaces in compile-time for StatsGetBroadcastRevenueTransactionsRequest. var ( @@ -68,7 +68,7 @@ func (g *StatsGetBroadcastRevenueTransactionsRequest) Zero() bool { if g == nil { return true } - if !(g.Channel == nil) { + if !(g.Peer == nil) { return false } if !(g.Offset == 0) { @@ -92,11 +92,11 @@ func (g *StatsGetBroadcastRevenueTransactionsRequest) String() string { // FillFrom fills StatsGetBroadcastRevenueTransactionsRequest from given interface. func (g *StatsGetBroadcastRevenueTransactionsRequest) FillFrom(from interface { - GetChannel() (value InputChannelClass) + GetPeer() (value InputPeerClass) GetOffset() (value int) GetLimit() (value int) }) { - g.Channel = from.GetChannel() + g.Peer = from.GetPeer() g.Offset = from.GetOffset() g.Limit = from.GetLimit() } @@ -125,8 +125,8 @@ func (g *StatsGetBroadcastRevenueTransactionsRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "Channel", - SchemaName: "channel", + Name: "Peer", + SchemaName: "peer", }, { Name: "Offset", @@ -143,7 +143,7 @@ func (g *StatsGetBroadcastRevenueTransactionsRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *StatsGetBroadcastRevenueTransactionsRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode stats.getBroadcastRevenueTransactions#69280f as nil") + return fmt.Errorf("can't encode stats.getBroadcastRevenueTransactions#70990b6d as nil") } b.PutID(StatsGetBroadcastRevenueTransactionsRequestTypeID) return g.EncodeBare(b) @@ -152,13 +152,13 @@ func (g *StatsGetBroadcastRevenueTransactionsRequest) Encode(b *bin.Buffer) erro // EncodeBare implements bin.BareEncoder. func (g *StatsGetBroadcastRevenueTransactionsRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode stats.getBroadcastRevenueTransactions#69280f as nil") + return fmt.Errorf("can't encode stats.getBroadcastRevenueTransactions#70990b6d as nil") } - if g.Channel == nil { - return fmt.Errorf("unable to encode stats.getBroadcastRevenueTransactions#69280f: field channel is nil") + if g.Peer == nil { + return fmt.Errorf("unable to encode stats.getBroadcastRevenueTransactions#70990b6d: field peer is nil") } - if err := g.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode stats.getBroadcastRevenueTransactions#69280f: field channel: %w", err) + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.getBroadcastRevenueTransactions#70990b6d: field peer: %w", err) } b.PutInt(g.Offset) b.PutInt(g.Limit) @@ -168,10 +168,10 @@ func (g *StatsGetBroadcastRevenueTransactionsRequest) EncodeBare(b *bin.Buffer) // Decode implements bin.Decoder. func (g *StatsGetBroadcastRevenueTransactionsRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode stats.getBroadcastRevenueTransactions#69280f to nil") + return fmt.Errorf("can't decode stats.getBroadcastRevenueTransactions#70990b6d to nil") } if err := b.ConsumeID(StatsGetBroadcastRevenueTransactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueTransactions#69280f: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueTransactions#70990b6d: %w", err) } return g.DecodeBare(b) } @@ -179,38 +179,38 @@ func (g *StatsGetBroadcastRevenueTransactionsRequest) Decode(b *bin.Buffer) erro // DecodeBare implements bin.BareDecoder. func (g *StatsGetBroadcastRevenueTransactionsRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode stats.getBroadcastRevenueTransactions#69280f to nil") + return fmt.Errorf("can't decode stats.getBroadcastRevenueTransactions#70990b6d to nil") } { - value, err := DecodeInputChannel(b) + value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueTransactions#69280f: field channel: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueTransactions#70990b6d: field peer: %w", err) } - g.Channel = value + g.Peer = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueTransactions#69280f: field offset: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueTransactions#70990b6d: field offset: %w", err) } g.Offset = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueTransactions#69280f: field limit: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueTransactions#70990b6d: field limit: %w", err) } g.Limit = value } return nil } -// GetChannel returns value of Channel field. -func (g *StatsGetBroadcastRevenueTransactionsRequest) GetChannel() (value InputChannelClass) { +// GetPeer returns value of Peer field. +func (g *StatsGetBroadcastRevenueTransactionsRequest) GetPeer() (value InputPeerClass) { if g == nil { return } - return g.Channel + return g.Peer } // GetOffset returns value of Offset field. @@ -229,12 +229,7 @@ func (g *StatsGetBroadcastRevenueTransactionsRequest) GetLimit() (value int) { return g.Limit } -// GetChannelAsNotEmpty returns mapped value of Channel field. -func (g *StatsGetBroadcastRevenueTransactionsRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { - return g.Channel.AsNotEmpty() -} - -// StatsGetBroadcastRevenueTransactions invokes method stats.getBroadcastRevenueTransactions#69280f returning error if any. +// StatsGetBroadcastRevenueTransactions invokes method stats.getBroadcastRevenueTransactions#70990b6d returning error if any. // Fetch channel ad revenue transaction history »¹. // // Links: diff --git a/tg/tl_stats_get_broadcast_revenue_withdrawal_url_gen.go b/tg/tl_stats_get_broadcast_revenue_withdrawal_url_gen.go index 33247c117c..9c6684cf24 100644 --- a/tg/tl_stats_get_broadcast_revenue_withdrawal_url_gen.go +++ b/tg/tl_stats_get_broadcast_revenue_withdrawal_url_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StatsGetBroadcastRevenueWithdrawalURLRequest represents TL type `stats.getBroadcastRevenueWithdrawalUrl#2a65ef73`. +// StatsGetBroadcastRevenueWithdrawalURLRequest represents TL type `stats.getBroadcastRevenueWithdrawalUrl#9df4faad`. // Withdraw funds from a channel's ad revenue balance »¹. // // Links: @@ -39,8 +39,8 @@ var ( // // See https://core.telegram.org/method/stats.getBroadcastRevenueWithdrawalUrl for reference. type StatsGetBroadcastRevenueWithdrawalURLRequest struct { - // The channel - Channel InputChannelClass + // Peer field of StatsGetBroadcastRevenueWithdrawalURLRequest. + Peer InputPeerClass // 2FA password, see here »¹ for more info. // // Links: @@ -49,7 +49,7 @@ type StatsGetBroadcastRevenueWithdrawalURLRequest struct { } // StatsGetBroadcastRevenueWithdrawalURLRequestTypeID is TL type id of StatsGetBroadcastRevenueWithdrawalURLRequest. -const StatsGetBroadcastRevenueWithdrawalURLRequestTypeID = 0x2a65ef73 +const StatsGetBroadcastRevenueWithdrawalURLRequestTypeID = 0x9df4faad // Ensuring interfaces in compile-time for StatsGetBroadcastRevenueWithdrawalURLRequest. var ( @@ -63,7 +63,7 @@ func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) Zero() bool { if g == nil { return true } - if !(g.Channel == nil) { + if !(g.Peer == nil) { return false } if !(g.Password == nil) { @@ -84,10 +84,10 @@ func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) String() string { // FillFrom fills StatsGetBroadcastRevenueWithdrawalURLRequest from given interface. func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) FillFrom(from interface { - GetChannel() (value InputChannelClass) + GetPeer() (value InputPeerClass) GetPassword() (value InputCheckPasswordSRPClass) }) { - g.Channel = from.GetChannel() + g.Peer = from.GetPeer() g.Password = from.GetPassword() } @@ -115,8 +115,8 @@ func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) TypeInfo() tdp.Type { } typ.Fields = []tdp.Field{ { - Name: "Channel", - SchemaName: "channel", + Name: "Peer", + SchemaName: "peer", }, { Name: "Password", @@ -129,7 +129,7 @@ func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 as nil") + return fmt.Errorf("can't encode stats.getBroadcastRevenueWithdrawalUrl#9df4faad as nil") } b.PutID(StatsGetBroadcastRevenueWithdrawalURLRequestTypeID) return g.EncodeBare(b) @@ -138,19 +138,19 @@ func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) Encode(b *bin.Buffer) err // EncodeBare implements bin.BareEncoder. func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 as nil") + return fmt.Errorf("can't encode stats.getBroadcastRevenueWithdrawalUrl#9df4faad as nil") } - if g.Channel == nil { - return fmt.Errorf("unable to encode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73: field channel is nil") + if g.Peer == nil { + return fmt.Errorf("unable to encode stats.getBroadcastRevenueWithdrawalUrl#9df4faad: field peer is nil") } - if err := g.Channel.Encode(b); err != nil { - return fmt.Errorf("unable to encode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73: field channel: %w", err) + if err := g.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode stats.getBroadcastRevenueWithdrawalUrl#9df4faad: field peer: %w", err) } if g.Password == nil { - return fmt.Errorf("unable to encode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73: field password is nil") + return fmt.Errorf("unable to encode stats.getBroadcastRevenueWithdrawalUrl#9df4faad: field password is nil") } if err := g.Password.Encode(b); err != nil { - return fmt.Errorf("unable to encode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73: field password: %w", err) + return fmt.Errorf("unable to encode stats.getBroadcastRevenueWithdrawalUrl#9df4faad: field password: %w", err) } return nil } @@ -158,10 +158,10 @@ func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) EncodeBare(b *bin.Buffer) // Decode implements bin.Decoder. func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 to nil") + return fmt.Errorf("can't decode stats.getBroadcastRevenueWithdrawalUrl#9df4faad to nil") } if err := b.ConsumeID(StatsGetBroadcastRevenueWithdrawalURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueWithdrawalUrl#9df4faad: %w", err) } return g.DecodeBare(b) } @@ -169,31 +169,31 @@ func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) Decode(b *bin.Buffer) err // DecodeBare implements bin.BareDecoder. func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 to nil") + return fmt.Errorf("can't decode stats.getBroadcastRevenueWithdrawalUrl#9df4faad to nil") } { - value, err := DecodeInputChannel(b) + value, err := DecodeInputPeer(b) if err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73: field channel: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueWithdrawalUrl#9df4faad: field peer: %w", err) } - g.Channel = value + g.Peer = value } { value, err := DecodeInputCheckPasswordSRP(b) if err != nil { - return fmt.Errorf("unable to decode stats.getBroadcastRevenueWithdrawalUrl#2a65ef73: field password: %w", err) + return fmt.Errorf("unable to decode stats.getBroadcastRevenueWithdrawalUrl#9df4faad: field password: %w", err) } g.Password = value } return nil } -// GetChannel returns value of Channel field. -func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) GetChannel() (value InputChannelClass) { +// GetPeer returns value of Peer field. +func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) GetPeer() (value InputPeerClass) { if g == nil { return } - return g.Channel + return g.Peer } // GetPassword returns value of Password field. @@ -204,17 +204,12 @@ func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) GetPassword() (value Inpu return g.Password } -// GetChannelAsNotEmpty returns mapped value of Channel field. -func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) { - return g.Channel.AsNotEmpty() -} - // GetPasswordAsNotEmpty returns mapped value of Password field. func (g *StatsGetBroadcastRevenueWithdrawalURLRequest) GetPasswordAsNotEmpty() (*InputCheckPasswordSRP, bool) { return g.Password.AsNotEmpty() } -// StatsGetBroadcastRevenueWithdrawalURL invokes method stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 returning error if any. +// StatsGetBroadcastRevenueWithdrawalURL invokes method stats.getBroadcastRevenueWithdrawalUrl#9df4faad returning error if any. // Withdraw funds from a channel's ad revenue balance »¹. // // Links: diff --git a/tg/tl_stories_search_posts_gen.go b/tg/tl_stories_search_posts_gen.go index acc83b2dec..5d1abbf2cd 100644 --- a/tg/tl_stories_search_posts_gen.go +++ b/tg/tl_stories_search_posts_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StoriesSearchPostsRequest represents TL type `stories.searchPosts#6cea116a`. +// StoriesSearchPostsRequest represents TL type `stories.searchPosts#d1810907`. // Globally search for stories¹ using a hashtag or a location media area², see here // »³ for more info on the full flow. // Either hashtag or area must be set when invoking the method. @@ -62,6 +62,10 @@ type StoriesSearchPostsRequest struct { // // Use SetArea and GetArea helpers. Area MediaAreaClass + // Peer field of StoriesSearchPostsRequest. + // + // Use SetPeer and GetPeer helpers. + Peer InputPeerClass // Offset for pagination¹: initially an empty string, then the next_offset from the // previously returned stories.foundStories². // @@ -77,7 +81,7 @@ type StoriesSearchPostsRequest struct { } // StoriesSearchPostsRequestTypeID is TL type id of StoriesSearchPostsRequest. -const StoriesSearchPostsRequestTypeID = 0x6cea116a +const StoriesSearchPostsRequestTypeID = 0xd1810907 // Ensuring interfaces in compile-time for StoriesSearchPostsRequest. var ( @@ -100,6 +104,9 @@ func (s *StoriesSearchPostsRequest) Zero() bool { if !(s.Area == nil) { return false } + if !(s.Peer == nil) { + return false + } if !(s.Offset == "") { return false } @@ -123,6 +130,7 @@ func (s *StoriesSearchPostsRequest) String() string { func (s *StoriesSearchPostsRequest) FillFrom(from interface { GetHashtag() (value string, ok bool) GetArea() (value MediaAreaClass, ok bool) + GetPeer() (value InputPeerClass, ok bool) GetOffset() (value string) GetLimit() (value int) }) { @@ -134,6 +142,10 @@ func (s *StoriesSearchPostsRequest) FillFrom(from interface { s.Area = val } + if val, ok := from.GetPeer(); ok { + s.Peer = val + } + s.Offset = from.GetOffset() s.Limit = from.GetLimit() } @@ -171,6 +183,11 @@ func (s *StoriesSearchPostsRequest) TypeInfo() tdp.Type { SchemaName: "area", Null: !s.Flags.Has(1), }, + { + Name: "Peer", + SchemaName: "peer", + Null: !s.Flags.Has(2), + }, { Name: "Offset", SchemaName: "offset", @@ -191,12 +208,15 @@ func (s *StoriesSearchPostsRequest) SetFlags() { if !(s.Area == nil) { s.Flags.Set(1) } + if !(s.Peer == nil) { + s.Flags.Set(2) + } } // Encode implements bin.Encoder. func (s *StoriesSearchPostsRequest) Encode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stories.searchPosts#6cea116a as nil") + return fmt.Errorf("can't encode stories.searchPosts#d1810907 as nil") } b.PutID(StoriesSearchPostsRequestTypeID) return s.EncodeBare(b) @@ -205,21 +225,29 @@ func (s *StoriesSearchPostsRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (s *StoriesSearchPostsRequest) EncodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't encode stories.searchPosts#6cea116a as nil") + return fmt.Errorf("can't encode stories.searchPosts#d1810907 as nil") } s.SetFlags() if err := s.Flags.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.searchPosts#6cea116a: field flags: %w", err) + return fmt.Errorf("unable to encode stories.searchPosts#d1810907: field flags: %w", err) } if s.Flags.Has(0) { b.PutString(s.Hashtag) } if s.Flags.Has(1) { if s.Area == nil { - return fmt.Errorf("unable to encode stories.searchPosts#6cea116a: field area is nil") + return fmt.Errorf("unable to encode stories.searchPosts#d1810907: field area is nil") } if err := s.Area.Encode(b); err != nil { - return fmt.Errorf("unable to encode stories.searchPosts#6cea116a: field area: %w", err) + return fmt.Errorf("unable to encode stories.searchPosts#d1810907: field area: %w", err) + } + } + if s.Flags.Has(2) { + if s.Peer == nil { + return fmt.Errorf("unable to encode stories.searchPosts#d1810907: field peer is nil") + } + if err := s.Peer.Encode(b); err != nil { + return fmt.Errorf("unable to encode stories.searchPosts#d1810907: field peer: %w", err) } } b.PutString(s.Offset) @@ -230,10 +258,10 @@ func (s *StoriesSearchPostsRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (s *StoriesSearchPostsRequest) Decode(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stories.searchPosts#6cea116a to nil") + return fmt.Errorf("can't decode stories.searchPosts#d1810907 to nil") } if err := b.ConsumeID(StoriesSearchPostsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: %w", err) + return fmt.Errorf("unable to decode stories.searchPosts#d1810907: %w", err) } return s.DecodeBare(b) } @@ -241,38 +269,45 @@ func (s *StoriesSearchPostsRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (s *StoriesSearchPostsRequest) DecodeBare(b *bin.Buffer) error { if s == nil { - return fmt.Errorf("can't decode stories.searchPosts#6cea116a to nil") + return fmt.Errorf("can't decode stories.searchPosts#d1810907 to nil") } { if err := s.Flags.Decode(b); err != nil { - return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field flags: %w", err) + return fmt.Errorf("unable to decode stories.searchPosts#d1810907: field flags: %w", err) } } if s.Flags.Has(0) { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field hashtag: %w", err) + return fmt.Errorf("unable to decode stories.searchPosts#d1810907: field hashtag: %w", err) } s.Hashtag = value } if s.Flags.Has(1) { value, err := DecodeMediaArea(b) if err != nil { - return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field area: %w", err) + return fmt.Errorf("unable to decode stories.searchPosts#d1810907: field area: %w", err) } s.Area = value } + if s.Flags.Has(2) { + value, err := DecodeInputPeer(b) + if err != nil { + return fmt.Errorf("unable to decode stories.searchPosts#d1810907: field peer: %w", err) + } + s.Peer = value + } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field offset: %w", err) + return fmt.Errorf("unable to decode stories.searchPosts#d1810907: field offset: %w", err) } s.Offset = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode stories.searchPosts#6cea116a: field limit: %w", err) + return fmt.Errorf("unable to decode stories.searchPosts#d1810907: field limit: %w", err) } s.Limit = value } @@ -315,6 +350,24 @@ func (s *StoriesSearchPostsRequest) GetArea() (value MediaAreaClass, ok bool) { return s.Area, true } +// SetPeer sets value of Peer conditional field. +func (s *StoriesSearchPostsRequest) SetPeer(value InputPeerClass) { + s.Flags.Set(2) + s.Peer = value +} + +// GetPeer returns value of Peer conditional field and +// boolean which is true if field was set. +func (s *StoriesSearchPostsRequest) GetPeer() (value InputPeerClass, ok bool) { + if s == nil { + return + } + if !s.Flags.Has(2) { + return value, false + } + return s.Peer, true +} + // GetOffset returns value of Offset field. func (s *StoriesSearchPostsRequest) GetOffset() (value string) { if s == nil { @@ -331,7 +384,7 @@ func (s *StoriesSearchPostsRequest) GetLimit() (value int) { return s.Limit } -// StoriesSearchPosts invokes method stories.searchPosts#6cea116a returning error if any. +// StoriesSearchPosts invokes method stories.searchPosts#d1810907 returning error if any. // Globally search for stories¹ using a hashtag or a location media area², see here // »³ for more info on the full flow. // Either hashtag or area must be set when invoking the method. diff --git a/tg/tl_update_gen.go b/tg/tl_update_gen.go index 10e638ba0a..61a3015adf 100644 --- a/tg/tl_update_gen.go +++ b/tg/tl_update_gen.go @@ -13842,7 +13842,7 @@ func (u *UpdateNewScheduledMessage) GetMessage() (value MessageClass) { return u.Message } -// UpdateDeleteScheduledMessages represents TL type `updateDeleteScheduledMessages#90866cee`. +// UpdateDeleteScheduledMessages represents TL type `updateDeleteScheduledMessages#f2a71983`. // Some scheduled messages¹ were deleted from the schedule queue of a chat // // Links: @@ -13850,14 +13850,20 @@ func (u *UpdateNewScheduledMessage) GetMessage() (value MessageClass) { // // See https://core.telegram.org/constructor/updateDeleteScheduledMessages for reference. type UpdateDeleteScheduledMessages struct { + // Flags field of UpdateDeleteScheduledMessages. + Flags bin.Fields // Peer Peer PeerClass // Deleted scheduled messages Messages []int + // SentMessages field of UpdateDeleteScheduledMessages. + // + // Use SetSentMessages and GetSentMessages helpers. + SentMessages []int } // UpdateDeleteScheduledMessagesTypeID is TL type id of UpdateDeleteScheduledMessages. -const UpdateDeleteScheduledMessagesTypeID = 0x90866cee +const UpdateDeleteScheduledMessagesTypeID = 0xf2a71983 // construct implements constructor of UpdateClass. func (u UpdateDeleteScheduledMessages) construct() UpdateClass { return &u } @@ -13876,12 +13882,18 @@ func (u *UpdateDeleteScheduledMessages) Zero() bool { if u == nil { return true } + if !(u.Flags.Zero()) { + return false + } if !(u.Peer == nil) { return false } if !(u.Messages == nil) { return false } + if !(u.SentMessages == nil) { + return false + } return true } @@ -13899,9 +13911,14 @@ func (u *UpdateDeleteScheduledMessages) String() string { func (u *UpdateDeleteScheduledMessages) FillFrom(from interface { GetPeer() (value PeerClass) GetMessages() (value []int) + GetSentMessages() (value []int, ok bool) }) { u.Peer = from.GetPeer() u.Messages = from.GetMessages() + if val, ok := from.GetSentMessages(); ok { + u.SentMessages = val + } + } // TypeID returns type id in TL schema. @@ -13935,14 +13952,26 @@ func (u *UpdateDeleteScheduledMessages) TypeInfo() tdp.Type { Name: "Messages", SchemaName: "messages", }, + { + Name: "SentMessages", + SchemaName: "sent_messages", + Null: !u.Flags.Has(0), + }, } return typ } +// SetFlags sets flags for non-zero fields. +func (u *UpdateDeleteScheduledMessages) SetFlags() { + if !(u.SentMessages == nil) { + u.Flags.Set(0) + } +} + // Encode implements bin.Encoder. func (u *UpdateDeleteScheduledMessages) Encode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateDeleteScheduledMessages#90866cee as nil") + return fmt.Errorf("can't encode updateDeleteScheduledMessages#f2a71983 as nil") } b.PutID(UpdateDeleteScheduledMessagesTypeID) return u.EncodeBare(b) @@ -13951,28 +13980,38 @@ func (u *UpdateDeleteScheduledMessages) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (u *UpdateDeleteScheduledMessages) EncodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't encode updateDeleteScheduledMessages#90866cee as nil") + return fmt.Errorf("can't encode updateDeleteScheduledMessages#f2a71983 as nil") + } + u.SetFlags() + if err := u.Flags.Encode(b); err != nil { + return fmt.Errorf("unable to encode updateDeleteScheduledMessages#f2a71983: field flags: %w", err) } if u.Peer == nil { - return fmt.Errorf("unable to encode updateDeleteScheduledMessages#90866cee: field peer is nil") + return fmt.Errorf("unable to encode updateDeleteScheduledMessages#f2a71983: field peer is nil") } if err := u.Peer.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateDeleteScheduledMessages#90866cee: field peer: %w", err) + return fmt.Errorf("unable to encode updateDeleteScheduledMessages#f2a71983: field peer: %w", err) } b.PutVectorHeader(len(u.Messages)) for _, v := range u.Messages { b.PutInt(v) } + if u.Flags.Has(0) { + b.PutVectorHeader(len(u.SentMessages)) + for _, v := range u.SentMessages { + b.PutInt(v) + } + } return nil } // Decode implements bin.Decoder. func (u *UpdateDeleteScheduledMessages) Decode(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateDeleteScheduledMessages#90866cee to nil") + return fmt.Errorf("can't decode updateDeleteScheduledMessages#f2a71983 to nil") } if err := b.ConsumeID(UpdateDeleteScheduledMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode updateDeleteScheduledMessages#90866cee: %w", err) + return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: %w", err) } return u.DecodeBare(b) } @@ -13980,19 +14019,24 @@ func (u *UpdateDeleteScheduledMessages) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (u *UpdateDeleteScheduledMessages) DecodeBare(b *bin.Buffer) error { if u == nil { - return fmt.Errorf("can't decode updateDeleteScheduledMessages#90866cee to nil") + return fmt.Errorf("can't decode updateDeleteScheduledMessages#f2a71983 to nil") + } + { + if err := u.Flags.Decode(b); err != nil { + return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field flags: %w", err) + } } { value, err := DecodePeer(b) if err != nil { - return fmt.Errorf("unable to decode updateDeleteScheduledMessages#90866cee: field peer: %w", err) + return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field peer: %w", err) } u.Peer = value } { headerLen, err := b.VectorHeader() if err != nil { - return fmt.Errorf("unable to decode updateDeleteScheduledMessages#90866cee: field messages: %w", err) + return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field messages: %w", err) } if headerLen > 0 { @@ -14001,11 +14045,28 @@ func (u *UpdateDeleteScheduledMessages) DecodeBare(b *bin.Buffer) error { for idx := 0; idx < headerLen; idx++ { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode updateDeleteScheduledMessages#90866cee: field messages: %w", err) + return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field messages: %w", err) } u.Messages = append(u.Messages, value) } } + if u.Flags.Has(0) { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field sent_messages: %w", err) + } + + if headerLen > 0 { + u.SentMessages = 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 updateDeleteScheduledMessages#f2a71983: field sent_messages: %w", err) + } + u.SentMessages = append(u.SentMessages, value) + } + } return nil } @@ -14025,6 +14086,24 @@ func (u *UpdateDeleteScheduledMessages) GetMessages() (value []int) { return u.Messages } +// SetSentMessages sets value of SentMessages conditional field. +func (u *UpdateDeleteScheduledMessages) SetSentMessages(value []int) { + u.Flags.Set(0) + u.SentMessages = value +} + +// GetSentMessages returns value of SentMessages conditional field and +// boolean which is true if field was set. +func (u *UpdateDeleteScheduledMessages) GetSentMessages() (value []int, ok bool) { + if u == nil { + return + } + if !u.Flags.Has(0) { + return value, false + } + return u.SentMessages, true +} + // UpdateTheme represents TL type `updateTheme#8216fba3`. // A cloud theme was updated // @@ -28549,7 +28628,7 @@ const UpdateClassName = "Update" // case *tg.UpdatePeerSettings: // updatePeerSettings#6a7e7366 // case *tg.UpdatePeerLocated: // updatePeerLocated#b4afcfb0 // case *tg.UpdateNewScheduledMessage: // updateNewScheduledMessage#39a51dfb -// case *tg.UpdateDeleteScheduledMessages: // updateDeleteScheduledMessages#90866cee +// case *tg.UpdateDeleteScheduledMessages: // updateDeleteScheduledMessages#f2a71983 // case *tg.UpdateTheme: // updateTheme#8216fba3 // case *tg.UpdateGeoLiveViewed: // updateGeoLiveViewed#871fb939 // case *tg.UpdateLoginToken: // updateLoginToken#564fe691 @@ -29127,7 +29206,7 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { } return &v, nil case UpdateDeleteScheduledMessagesTypeID: - // Decoding updateDeleteScheduledMessages#90866cee. + // Decoding updateDeleteScheduledMessages#f2a71983. v := UpdateDeleteScheduledMessages{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) diff --git a/tg/tl_user_full_gen.go b/tg/tl_user_full_gen.go index c90014fef7..edf5527528 100644 --- a/tg/tl_user_full_gen.go +++ b/tg/tl_user_full_gen.go @@ -119,6 +119,8 @@ type UserFull struct { // Links: // 1) https://core.telegram.org/api/business#re-enable-ads SponsoredEnabled bool + // CanViewRevenue field of UserFull. + CanViewRevenue bool // User ID ID int64 // Bio of the user @@ -339,6 +341,9 @@ func (u *UserFull) Zero() bool { if !(u.SponsoredEnabled == false) { return false } + if !(u.CanViewRevenue == false) { + return false + } if !(u.ID == 0) { return false } @@ -452,6 +457,7 @@ func (u *UserFull) FillFrom(from interface { GetContactRequirePremium() (value bool) GetReadDatesPrivate() (value bool) GetSponsoredEnabled() (value bool) + GetCanViewRevenue() (value bool) GetID() (value int64) GetAbout() (value string, ok bool) GetSettings() (value PeerSettings) @@ -495,6 +501,7 @@ func (u *UserFull) FillFrom(from interface { u.ContactRequirePremium = from.GetContactRequirePremium() u.ReadDatesPrivate = from.GetReadDatesPrivate() u.SponsoredEnabled = from.GetSponsoredEnabled() + u.CanViewRevenue = from.GetCanViewRevenue() u.ID = from.GetID() if val, ok := from.GetAbout(); ok { u.About = val @@ -690,6 +697,11 @@ func (u *UserFull) TypeInfo() tdp.Type { SchemaName: "sponsored_enabled", Null: !u.Flags2.Has(7), }, + { + Name: "CanViewRevenue", + SchemaName: "can_view_revenue", + Null: !u.Flags2.Has(9), + }, { Name: "ID", SchemaName: "id", @@ -874,6 +886,9 @@ func (u *UserFull) SetFlags() { if !(u.SponsoredEnabled == false) { u.Flags2.Set(7) } + if !(u.CanViewRevenue == false) { + u.Flags2.Set(9) + } if !(u.About == "") { u.Flags.Set(1) } @@ -1137,6 +1152,7 @@ func (u *UserFull) DecodeBare(b *bin.Buffer) error { } } u.SponsoredEnabled = u.Flags2.Has(7) + u.CanViewRevenue = u.Flags2.Has(9) { value, err := b.Long() if err != nil { @@ -1588,6 +1604,25 @@ func (u *UserFull) GetSponsoredEnabled() (value bool) { return u.Flags2.Has(7) } +// SetCanViewRevenue sets value of CanViewRevenue conditional field. +func (u *UserFull) SetCanViewRevenue(value bool) { + if value { + u.Flags2.Set(9) + u.CanViewRevenue = true + } else { + u.Flags2.Unset(9) + u.CanViewRevenue = false + } +} + +// GetCanViewRevenue returns value of CanViewRevenue conditional field. +func (u *UserFull) GetCanViewRevenue() (value bool) { + if u == nil { + return + } + return u.Flags2.Has(9) +} + // GetID returns value of ID field. func (u *UserFull) GetID() (value int64) { if u == nil {