From fd42d3e6df61cdea1cb920b048bb92b813f02ba4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 1 Nov 2022 19:26:40 +0100 Subject: [PATCH] Upgrade to layer 148: Topics, Usernames, Sticker keywords... + support for flags2 has_fields --- Examples/Program_ListenUpdates.cs | 2 +- README.md | 2 +- src/TL.Schema.cs | 275 ++++++++++++++++++++- src/TL.SchemaFuncs.cs | 385 ++++++++++++++++++++++++++---- src/TL.Table.cs | 39 ++- src/TL.cs | 16 +- 6 files changed, 648 insertions(+), 71 deletions(-) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index fd25eb6..920dfd1 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -50,7 +50,7 @@ namespace WTelegramClientTest case UpdateChannelUserTyping ucut2: Console.WriteLine($"{Peer(ucut2.from_id)} is {ucut2.action} in {Chat(ucut2.channel_id)}"); break; case UpdateChatParticipants { participants: ChatParticipants cp }: Console.WriteLine($"{cp.participants.Length} participants in {Chat(cp.chat_id)}"); break; case UpdateUserStatus uus: Console.WriteLine($"{User(uus.user_id)} is now {uus.status.GetType().Name[10..]}"); break; - case UpdateUserName uun: Console.WriteLine($"{User(uun.user_id)} has changed profile name: @{uun.username} {uun.first_name} {uun.last_name}"); break; + case UpdateUserName uun: Console.WriteLine($"{User(uun.user_id)} has changed profile name: {uun.first_name} {uun.last_name}"); break; case UpdateUserPhoto uup: Console.WriteLine($"{User(uup.user_id)} has changed profile photo"); break; default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above cases } diff --git a/README.md b/README.md index 439e09d..16da3f6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient)](https://www.nuget.org/packages/WTelegramClient/) [![Build Status](https://img.shields.io/azure-devops/build/wiz0u/WTelegramClient/7)](https://dev.azure.com/wiz0u/WTelegramClient/_build?definitionId=7) -[![API Layer](https://img.shields.io/badge/API_Layer-146-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-148-blueviolet)](https://corefork.telegram.org/methods) [![dev nuget](https://img.shields.io/badge/dynamic/json?color=ffc040&label=dev%20nuget&query=%24.versions%5B0%5D&url=https%3A%2F%2Fpkgs.dev.azure.com%2Fwiz0u%2F81bd92b7-0bb9-4701-b426-09090b27e037%2F_packaging%2F46ce0497-7803-4bd4-8c6c-030583e7c371%2Fnuget%2Fv3%2Fflat2%2Fwtelegramclient%2Findex.json)](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index a827e48..b785fb9 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -698,11 +698,12 @@ namespace TL public long id; } /// Indicates info about a certain user See - [TLDef(0x5D99ADEE)] + [TLDef(0x8F97C628)] public partial class User : UserBase { /// Flags, see TL conditional fields public Flags flags; + public Flags2 flags2; /// ID of the user public long id; /// Access hash of the user @@ -729,6 +730,7 @@ namespace TL [IfFlag(22)] public string lang_code; /// Emoji status [IfFlag(30)] public EmojiStatus emoji_status; + [IfFlag(32)] public Username[] usernames; [Flags] public enum Flags : uint { @@ -789,6 +791,12 @@ namespace TL /// Field has a value has_emoji_status = 0x40000000, } + + [Flags] public enum Flags2 : uint + { + /// Field has a value + has_usernames = 0x1, + } } /// User profile photo. See @@ -926,11 +934,12 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x8261AC61)] + [TLDef(0x83259464)] public partial class Channel : ChatBase { /// Flags, see TL conditional fields public Flags flags; + public Flags2 flags2; /// ID of the channel public long id; /// Access hash @@ -953,6 +962,7 @@ namespace TL [IfFlag(18)] public ChatBannedRights default_banned_rights; /// Participant count [IfFlag(17)] public int participants_count; + [IfFlag(32)] public Username[] usernames; [Flags] public enum Flags : uint { @@ -1006,6 +1016,13 @@ namespace TL join_to_send = 0x10000000, /// Whether a user's join request will have to be approved by administrators, toggle using channels.toggleJoinToSend join_request = 0x20000000, + forum = 0x40000000, + } + + [Flags] public enum Flags2 : uint + { + /// Field has a value + has_usernames = 0x1, } /// ID of the channel @@ -2136,6 +2153,36 @@ namespace TL /// Duration of the gifted Telegram Premium subscription public int months; } + /// See + [TLDef(0x0D999256)] + public class MessageActionTopicCreate : MessageAction + { + public Flags flags; + public string title; + public int icon_color; + [IfFlag(0)] public long icon_emoji_id; + + [Flags] public enum Flags : uint + { + has_icon_emoji_id = 0x1, + } + } + /// See + [TLDef(0xB18A431C)] + public class MessageActionTopicEdit : MessageAction + { + public Flags flags; + [IfFlag(0)] public string title; + [IfFlag(1)] public long icon_emoji_id; + [IfFlag(2)] public bool closed; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_icon_emoji_id = 0x2, + has_closed = 0x4, + } + } /// Chat info. See Derived classes: , public abstract class DialogBase : IObject @@ -2468,6 +2515,13 @@ namespace TL /// All channels See [TLDef(0xB1DB7C7E)] public class InputNotifyBroadcasts : InputNotifyPeerBase { } + /// See + [TLDef(0x5C467992)] + public class InputNotifyForumTopic : InputNotifyPeerBase + { + public InputPeer peer; + public int top_msg_id; + } /// Notification settings. See [TLDef(0xDF1F002B)] @@ -3132,7 +3186,7 @@ namespace TL public UserStatus status; } /// Changes the user's first name, last name and username. See - [TLDef(0xC3F202E0)] + [TLDef(0xA7848924)] public class UpdateUserName : Update { /// User identifier @@ -3141,8 +3195,7 @@ namespace TL public string first_name; /// New last name. Corresponds to the new value of real_last_name field of the . public string last_name; - /// New username. - public string username; + public Username[] usernames; } /// Change of contact's profile photo. See [TLDef(0xF227868C)] @@ -3575,13 +3628,21 @@ namespace TL public int max_id; } /// Notifies a change of a message draft. See - [TLDef(0xEE2BB969)] + [TLDef(0x1B49EC6D)] public class UpdateDraftMessage : Update { + public Flags flags; /// The peer to which the draft is associated public Peer peer; + [IfFlag(0)] public int top_msg_id; /// The draft public DraftMessageBase draft; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_msg_id = 0x1, + } } /// Some featured stickers were marked as read See [TLDef(0x571D2742)] @@ -3725,11 +3786,21 @@ namespace TL [TLDef(0xE511996D)] public class UpdateFavedStickers : Update { } /// The specified channel/supergroup messages were read See - [TLDef(0x44BDD535, inheritBefore = true)] - public class UpdateChannelReadMessagesContents : UpdateChannel + [TLDef(0xEA29055D)] + public class UpdateChannelReadMessagesContents : Update { + public Flags flags; + /// Channel/supergroup ID + public long channel_id; + [IfFlag(0)] public int top_msg_id; /// IDs of messages that were read public int[] messages; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_msg_id = 0x1, + } } /// All contacts were deleted See [TLDef(0x7084A7BE)] @@ -4190,15 +4261,23 @@ namespace TL public int qts; } /// New message reactions » are available See - [TLDef(0x154798C3)] + [TLDef(0x5E1B3CB8)] public class UpdateMessageReactions : Update { + public Flags flags; /// Peer public Peer peer; /// Message ID public int msg_id; + [IfFlag(0)] public int top_msg_id; /// Reactions public MessageReactions reactions; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_msg_id = 0x1, + } } /// The list of installed attachment menu entries » has changed, use messages.getAttachMenuBots to fetch the updated list. See [TLDef(0x17B7A20B)] @@ -4286,6 +4365,19 @@ namespace TL public int msg_id; public MessageExtendedMediaBase extended_media; } + /// See + [TLDef(0xF694B0AE)] + public class UpdateChannelPinnedTopic : Update + { + public Flags flags; + public long channel_id; + [IfFlag(0)] public int topic_id; + + [Flags] public enum Flags : uint + { + has_topic_id = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -5260,6 +5352,13 @@ namespace TL /// Channel notification settings See [TLDef(0xD612E8EF)] public class NotifyBroadcasts : NotifyPeerBase { } + /// See + [TLDef(0x226E6308)] + public class NotifyForumTopic : NotifyPeerBase + { + public Peer peer; + public int top_msg_id; + } /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , public abstract partial class SendMessageAction : IObject { } @@ -6111,6 +6210,9 @@ namespace TL /// Default custom emoji status stickerset See [TLDef(0x29D0F5EE)] public class InputStickerSetEmojiDefaultStatuses : InputStickerSet { } + /// See + [TLDef(0x44C1F8E9)] + public class InputStickerSetEmojiDefaultTopicIcons : InputStickerSet { } /// Represents a stickerset (stickerpack) See [TLDef(0x2DD14EDC)] @@ -6166,13 +6268,14 @@ namespace TL /// Stickerset and stickers inside it See /// a value means messages.stickerSetNotModified - [TLDef(0xB60A24A6)] + [TLDef(0x6E153F16)] public class Messages_StickerSet : IObject { /// The stickerset public StickerSet set; /// Emoji info for stickers public StickerPack[] packs; + public StickerKeyword[] keywords; /// Stickers in stickerset public DocumentBase[] documents; } @@ -8002,13 +8105,14 @@ namespace TL public override StickerSet Set => set; } /// Stickerset preview with all stickers of the stickerset included.
Currently used only for custom emoji stickersets, to avoid a further call to messages.getStickerSet. See
- [TLDef(0x1AED5EE5)] + [TLDef(0x40D13C0E)] public class StickerSetFullCovered : StickerSetCoveredBase { /// Stickerset public StickerSet set; /// Emoji information about every sticker in the stickerset public StickerPack[] packs; + public StickerKeyword[] keywords; /// Stickers public DocumentBase[] documents; @@ -9803,6 +9907,52 @@ namespace TL /// New allowed reaction emojis public ChatReactions new_value; } + /// See + [TLDef(0xF04FB3A9)] + public class ChannelAdminLogEventActionChangeUsernames : ChannelAdminLogEventAction + { + public string[] prev_value; + public string[] new_value; + } + /// See + [TLDef(0x02CC6383)] + public class ChannelAdminLogEventActionToggleForum : ChannelAdminLogEventAction + { + public bool new_value; + } + /// See + [TLDef(0x58707D28)] + public class ChannelAdminLogEventActionCreateTopic : ChannelAdminLogEventAction + { + public ForumTopicBase topic; + } + /// See + [TLDef(0xF06FE208)] + public class ChannelAdminLogEventActionEditTopic : ChannelAdminLogEventAction + { + public ForumTopicBase prev_topic; + public ForumTopicBase new_topic; + } + /// See + [TLDef(0xAE168909)] + public class ChannelAdminLogEventActionDeleteTopic : ChannelAdminLogEventAction + { + public ForumTopicBase topic; + } + /// See + [TLDef(0x5D8D353B)] + public class ChannelAdminLogEventActionPinTopic : ChannelAdminLogEventAction + { + public Flags flags; + [IfFlag(0)] public ForumTopicBase prev_topic; + [IfFlag(1)] public ForumTopicBase new_topic; + + [Flags] public enum Flags : uint + { + has_prev_topic = 0x1, + has_new_topic = 0x2, + } + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -9875,6 +10025,7 @@ namespace TL invites = 0x8000, /// A message was posted in a channel send = 0x10000, + forums = 0x20000, } } @@ -11045,6 +11196,7 @@ namespace TL manage_call = 0x800, /// Set this flag if none of the other flags are set, but you still want the user to be an admin: if this or any of the other flags are set, the admin can get the chat admin log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode. other = 0x1000, + manage_topics = 0x2000, } } @@ -11083,6 +11235,7 @@ namespace TL invite_users = 0x8000, /// If set, does not allow any user to pin messages in a supergroup/chat pin_messages = 0x20000, + manage_topics = 0x40000, } } @@ -12211,6 +12364,7 @@ namespace TL /// Field has a value has_reply_to_top_id = 0x2, reply_to_scheduled = 0x4, + forum_topic = 0x8, } } @@ -12786,19 +12940,29 @@ namespace TL has_chat_invite = 0x10, /// Whether the message needs to be labeled as "recommended" instead of "sponsored" recommended = 0x20, + show_peer_photo = 0x40, } } /// A set of sponsored messages associated to a channel See - [TLDef(0x65A4C7D5)] + /// a value means messages.sponsoredMessagesEmpty + [TLDef(0xC9EE1D87)] public class Messages_SponsoredMessages : IObject, IPeerResolver { + public Flags flags; + [IfFlag(0)] public int posts_between; /// Sponsored messages public SponsoredMessage[] messages; /// Chats mentioned in the sponsored messages public Dictionary chats; /// Users mentioned in the sponsored messages public Dictionary users; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_posts_between = 0x1, + } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } @@ -13630,4 +13794,91 @@ namespace TL { public MessageMedia media; } + + /// See + [TLDef(0xFCFEB29C)] + public class StickerKeyword : IObject + { + public long document_id; + public string[] keyword; + } + + /// See + [TLDef(0xB4073647)] + public class Username : IObject + { + public Flags flags; + public string username; + + [Flags] public enum Flags : uint + { + editable = 0x1, + active = 0x2, + } + } + + /// See + public abstract class ForumTopicBase : IObject + { + public virtual int ID { get; } + } + /// See + [TLDef(0x023F109B)] + public class ForumTopicDeleted : ForumTopicBase + { + public int id; + + public override int ID => id; + } + /// See + [TLDef(0x71701DA9)] + public class ForumTopic : ForumTopicBase + { + public Flags flags; + public int id; + public DateTime date; + public string title; + public int icon_color; + [IfFlag(0)] public long icon_emoji_id; + public int top_message; + public int read_inbox_max_id; + public int read_outbox_max_id; + public int unread_count; + public int unread_mentions_count; + public int unread_reactions_count; + public Peer from_id; + public PeerNotifySettings notify_settings; + [IfFlag(4)] public DraftMessageBase draft; + + [Flags] public enum Flags : uint + { + has_icon_emoji_id = 0x1, + my = 0x2, + closed = 0x4, + pinned = 0x8, + has_draft = 0x10, + } + + public override int ID => id; + } + + /// See + [TLDef(0x367617D3)] + public class Messages_ForumTopics : IObject, IPeerResolver + { + public Flags flags; + public int count; + public ForumTopicBase[] topics; + public MessageBase[] messages; + public Dictionary chats; + public Dictionary users; + public int pts; + + [Flags] public enum Flags : uint + { + order_by_create_date = 0x1, + } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 43f7f50..081d365 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -869,13 +869,11 @@ namespace TL /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme - /// Deprecated: should always be 0 - public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) + public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme) => client.Invoke(new Account_GetTheme { format = format, theme = theme, - document_id = document_id, }); /// Get installed themes See @@ -1044,6 +1042,21 @@ namespace TL { }); + /// See + public static Task Account_ReorderUsernames(this Client client, params string[] order) + => client.Invoke(new Account_ReorderUsernames + { + order = order, + }); + + /// See + public static Task Account_ToggleUsername(this Client client, string username, bool active) + => client.Invoke(new Account_ToggleUsername + { + username = username, + active = active, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1425,12 +1438,13 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), message = message, random_id = random_id, reply_markup = reply_markup, @@ -1454,12 +1468,13 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), media = media, message = message, random_id = random_id, @@ -1482,14 +1497,15 @@ namespace TL /// Destination peer /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_ForwardMessages.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), from_peer = from_peer, id = id, random_id = random_id, to_peer = to_peer, + top_msg_id = top_msg_id.GetValueOrDefault(), schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, }); @@ -1979,12 +1995,13 @@ namespace TL /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false, int? reply_to_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendInlineBotResult { - flags = (Messages_SendInlineBotResult.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendInlineBotResult.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), random_id = random_id, query_id = query_id, id = id, @@ -2088,11 +2105,12 @@ namespace TL /// Destination of the message that should be sent /// The draft /// Message entities for styled text - public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, bool no_webpage = false, int? reply_to_msg_id = null, MessageEntity[] entities = null) + public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, bool no_webpage = false, int? reply_to_msg_id = null, int? top_msg_id = null, MessageEntity[] entities = null) => client.Invoke(new Messages_SaveDraft { - flags = (Messages_SaveDraft.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)), + flags = (Messages_SaveDraft.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x4 : 0) | (entities != null ? 0x8 : 0)), reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), peer = peer, message = message, entities = entities, @@ -2369,10 +2387,12 @@ namespace TL /// Maximum number of results to return, see pagination /// Maximum message ID to return, see pagination /// Minimum message ID to return, see pagination - public static Task Messages_GetUnreadMentions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default) + public static Task Messages_GetUnreadMentions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, int? top_msg_id = null) => client.Invoke(new Messages_GetUnreadMentions { + flags = (Messages_GetUnreadMentions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), offset_id = offset_id, add_offset = add_offset, limit = limit, @@ -2382,10 +2402,12 @@ namespace TL /// Mark mentions as read See Possible codes: 400 (details) /// Dialog - public static Task Messages_ReadMentions(this Client client, InputPeer peer) + public static Task Messages_ReadMentions(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_ReadMentions { + flags = (Messages_ReadMentions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), }); /// Get live location history of a certain user See @@ -2411,12 +2433,13 @@ namespace TL /// The medias to send: note that they must be separately uploaded using messages.uploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), multi_media = multi_media, schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, @@ -2575,10 +2598,12 @@ namespace TL /// Get the number of results that would be found by a messages.search call with the same parameters See Possible codes: 400 (details) /// Peer where to search /// Search filters - public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, params MessagesFilter[] filters) + public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null) => client.Invoke(new Messages_GetSearchCounters { + flags = (Messages_GetSearchCounters.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), filters = filters, }); @@ -2783,10 +2808,12 @@ namespace TL /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details) /// Chat where to unpin - public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) + public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_UnpinAllMessages { + flags = (Messages_UnpinAllMessages.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), }); /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
@@ -3149,10 +3176,12 @@ namespace TL /// Maximum number of results to return, see pagination /// Only return reactions for messages up until this message ID /// Only return reactions for messages starting from this message ID - public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default) + public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, int? top_msg_id = null) => client.Invoke(new Messages_GetUnreadReactions { + flags = (Messages_GetUnreadReactions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), offset_id = offset_id, add_offset = add_offset, limit = limit, @@ -3162,10 +3191,12 @@ namespace TL /// Mark message reactions » as read See Possible codes: 400 (details) /// Peer - public static Task Messages_ReadReactions(this Client client, InputPeer peer) + public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_ReadReactions { + flags = (Messages_ReadReactions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), }); /// View and search recently sent media.
This method does not support pagination. See
@@ -3218,10 +3249,10 @@ namespace TL /// Short name of the application; 0-64 English letters, digits, and underscores /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. - public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, InputPeer send_as = null) + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null) => client.Invoke(new Messages_RequestWebView { - flags = (Messages_RequestWebView.Flags)((from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (url != null ? 0x2 : 0) | (start_param != null ? 0x8 : 0) | (theme_params != null ? 0x4 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_RequestWebView.Flags)((from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (url != null ? 0x2 : 0) | (start_param != null ? 0x8 : 0) | (theme_params != null ? 0x4 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, bot = bot, url = url, @@ -3229,6 +3260,7 @@ namespace TL theme_params = theme_params, platform = platform, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), send_as = send_as, }); @@ -3239,14 +3271,15 @@ namespace TL /// Web app interaction ID obtained from messages.requestWebView /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID. /// Open the web app as the specified peer - public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null, InputPeer send_as = null) + public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null) => client.Invoke(new Messages_ProlongWebView { - flags = (Messages_ProlongWebView.Flags)((silent ? 0x20 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_ProlongWebView.Flags)((silent ? 0x20 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, bot = bot, query_id = query_id, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), send_as = send_as, }); @@ -4123,6 +4156,7 @@ namespace TL /// Get a list of sponsored messages See Possible codes: 400 (details) /// Peer + /// a null value means messages.sponsoredMessagesEmpty public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetSponsoredMessages { @@ -4167,6 +4201,101 @@ namespace TL enabled = enabled, }); + /// See + public static Task Channels_ReorderUsernames(this Client client, InputChannelBase channel, params string[] order) + => client.Invoke(new Channels_ReorderUsernames + { + channel = channel, + order = order, + }); + + /// See + public static Task Channels_ToggleUsername(this Client client, InputChannelBase channel, string username, bool active) + => client.Invoke(new Channels_ToggleUsername + { + channel = channel, + username = username, + active = active, + }); + + /// See + public static Task Channels_DeactivateAllUsernames(this Client client, InputChannelBase channel) + => client.Invoke(new Channels_DeactivateAllUsernames + { + channel = channel, + }); + + /// See + public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleForum + { + channel = channel, + enabled = enabled, + }); + + /// See + public static Task Channels_CreateForumTopic(this Client client, InputChannelBase channel, string title, long random_id, int? icon_color = null, long? icon_emoji_id = null, InputPeer send_as = null) + => client.Invoke(new Channels_CreateForumTopic + { + flags = (Channels_CreateForumTopic.Flags)((icon_color != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x8 : 0) | (send_as != null ? 0x4 : 0)), + channel = channel, + title = title, + icon_color = icon_color.GetValueOrDefault(), + icon_emoji_id = icon_emoji_id.GetValueOrDefault(), + random_id = random_id, + send_as = send_as, + }); + + /// See + public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, int offset_topic, DateTime offset_date = default, int offset_id = default, int limit = int.MaxValue, string q = null) + => client.Invoke(new Channels_GetForumTopics + { + flags = (Channels_GetForumTopics.Flags)(q != null ? 0x1 : 0), + channel = channel, + q = q, + offset_date = offset_date, + offset_id = offset_id, + offset_topic = offset_topic, + limit = limit, + }); + + /// See + public static Task Channels_GetForumTopicsByID(this Client client, InputChannelBase channel, params int[] topics) + => client.Invoke(new Channels_GetForumTopicsByID + { + channel = channel, + topics = topics, + }); + + /// See + public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default) + => client.Invoke(new Channels_EditForumTopic + { + flags = (Channels_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0)), + channel = channel, + topic_id = topic_id, + title = title, + icon_emoji_id = icon_emoji_id.GetValueOrDefault(), + closed = closed.GetValueOrDefault(), + }); + + /// See + public static Task Channels_UpdatePinnedForumTopic(this Client client, InputChannelBase channel, int topic_id, bool pinned) + => client.Invoke(new Channels_UpdatePinnedForumTopic + { + channel = channel, + topic_id = topic_id, + pinned = pinned, + }); + + /// See + public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) + => client.Invoke(new Channels_DeleteTopicHistory + { + channel = channel, + top_msg_id = top_msg_id, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5592,12 +5721,11 @@ namespace TL.Methods } } - [TLDef(0x8D9D742B)] + [TLDef(0x3A5869EC)] public class Account_GetTheme : IMethod { public string format; public InputThemeBase theme; - public long document_id; } [TLDef(0x7206E458)] @@ -5720,6 +5848,19 @@ namespace TL.Methods [TLDef(0x18201AAE)] public class Account_ClearRecentEmojiStatuses : IMethod { } + [TLDef(0xEF500EAB)] + public class Account_ReorderUsernames : IMethod + { + public string[] order; + } + + [TLDef(0x58D6B376)] + public class Account_ToggleUsername : IMethod + { + public string username; + public bool active; + } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { @@ -6018,12 +6159,13 @@ namespace TL.Methods } } - [TLDef(0x0D9D75A4)] + [TLDef(0x1CC20387)] public class Messages_SendMessage : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; public string message; public long random_id; [IfFlag(2)] public ReplyMarkup reply_markup; @@ -6040,6 +6182,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, clear_draft = 0x80, + has_top_msg_id = 0x200, has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, @@ -6047,12 +6190,13 @@ namespace TL.Methods } } - [TLDef(0xE25FF8E0)] + [TLDef(0x7547C966)] public class Messages_SendMedia : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; public InputMedia media; public string message; public long random_id; @@ -6069,6 +6213,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, clear_draft = 0x80, + has_top_msg_id = 0x200, has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, @@ -6076,7 +6221,7 @@ namespace TL.Methods } } - [TLDef(0xCC30290B)] + [TLDef(0xC661BBC4)] public class Messages_ForwardMessages : IMethod { public Flags flags; @@ -6084,6 +6229,7 @@ namespace TL.Methods public int[] id; public long[] random_id; public InputPeer to_peer; + [IfFlag(9)] public int top_msg_id; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; @@ -6092,6 +6238,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, with_my_score = 0x100, + has_top_msg_id = 0x200, has_schedule_date = 0x400, drop_author = 0x800, drop_media_captions = 0x1000, @@ -6476,12 +6623,13 @@ namespace TL.Methods } } - [TLDef(0x7AA11297)] + [TLDef(0xD3FBDCCB)] public class Messages_SendInlineBotResult : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; public long random_id; public long query_id; public string id; @@ -6494,6 +6642,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, clear_draft = 0x80, + has_top_msg_id = 0x200, has_schedule_date = 0x400, hide_via = 0x800, has_send_as = 0x2000, @@ -6590,11 +6739,12 @@ namespace TL.Methods public InputDialogPeerBase[] peers; } - [TLDef(0xBC39E14B)] + [TLDef(0xB4331E3F)] public class Messages_SaveDraft : IMethod { public Flags flags; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(2)] public int top_msg_id; public InputPeer peer; public string message; [IfFlag(3)] public MessageEntity[] entities; @@ -6603,6 +6753,7 @@ namespace TL.Methods { has_reply_to_msg_id = 0x1, no_webpage = 0x2, + has_top_msg_id = 0x4, has_entities = 0x8, } } @@ -6839,21 +6990,35 @@ namespace TL.Methods public bool unfave; } - [TLDef(0x46578472)] + [TLDef(0xF107E790)] public class Messages_GetUnreadMentions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; public int offset_id; public int add_offset; public int limit; public int max_id; public int min_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } - [TLDef(0x0F0189D3)] + [TLDef(0x36E5BF4D)] public class Messages_ReadMentions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } [TLDef(0x702A40E0)] @@ -6864,12 +7029,13 @@ namespace TL.Methods public long hash; } - [TLDef(0xF803138F)] + [TLDef(0xB6F11A1C)] public class Messages_SendMultiMedia : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; public InputSingleMedia[] multi_media; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; @@ -6880,6 +7046,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, clear_draft = 0x80, + has_top_msg_id = 0x200, has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, @@ -7003,11 +7170,18 @@ namespace TL.Methods public string lang_code; } - [TLDef(0x732EEF00)] + [TLDef(0x00AE7CC1)] public class Messages_GetSearchCounters : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; public MessagesFilter[] filters; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } [TLDef(0x198FB446)] @@ -7170,10 +7344,17 @@ namespace TL.Methods public int read_max_id; } - [TLDef(0xF025BC8B)] + [TLDef(0xEE22B9A8)] public class Messages_UnpinAllMessages : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } [TLDef(0x5BD0EE50)] @@ -7470,21 +7651,35 @@ namespace TL.Methods } } - [TLDef(0xE85BAE1A)] + [TLDef(0x3223495B)] public class Messages_GetUnreadReactions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; public int offset_id; public int add_offset; public int limit; public int max_id; public int min_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } - [TLDef(0x82E251D7)] + [TLDef(0x54AA7F8E)] public class Messages_ReadReactions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } [TLDef(0x107E31A0)] @@ -7514,7 +7709,7 @@ namespace TL.Methods public bool enabled; } - [TLDef(0xFC87A53C)] + [TLDef(0x178B480B)] public class Messages_RequestWebView : IMethod { public Flags flags; @@ -7525,6 +7720,7 @@ namespace TL.Methods [IfFlag(2)] public DataJSON theme_params; public string platform; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint @@ -7535,11 +7731,12 @@ namespace TL.Methods has_start_param = 0x8, from_bot_menu = 0x10, silent = 0x20, + has_top_msg_id = 0x200, has_send_as = 0x2000, } } - [TLDef(0xEA5FBCCE)] + [TLDef(0x7FF34309)] public class Messages_ProlongWebView : IMethod { public Flags flags; @@ -7547,12 +7744,14 @@ namespace TL.Methods public InputUserBase bot; public long query_id; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint { has_reply_to_msg_id = 0x1, silent = 0x20, + has_top_msg_id = 0x200, has_send_as = 0x2000, } } @@ -8226,6 +8425,110 @@ namespace TL.Methods public bool enabled; } + [TLDef(0xB45CED1D)] + public class Channels_ReorderUsernames : IMethod + { + public InputChannelBase channel; + public string[] order; + } + + [TLDef(0x50F24105)] + public class Channels_ToggleUsername : IMethod + { + public InputChannelBase channel; + public string username; + public bool active; + } + + [TLDef(0x0A245DD3)] + public class Channels_DeactivateAllUsernames : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0xA4298B29)] + public class Channels_ToggleForum : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0xF40C0224)] + public class Channels_CreateForumTopic : IMethod + { + public Flags flags; + public InputChannelBase channel; + public string title; + [IfFlag(0)] public int icon_color; + [IfFlag(3)] public long icon_emoji_id; + public long random_id; + [IfFlag(2)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + has_icon_color = 0x1, + has_send_as = 0x4, + has_icon_emoji_id = 0x8, + } + } + + [TLDef(0x0DE560D1)] + public class Channels_GetForumTopics : IMethod + { + public Flags flags; + public InputChannelBase channel; + [IfFlag(0)] public string q; + public DateTime offset_date; + public int offset_id; + public int offset_topic; + public int limit; + + [Flags] public enum Flags : uint + { + has_q = 0x1, + } + } + + [TLDef(0xB0831EB9)] + public class Channels_GetForumTopicsByID : IMethod + { + public InputChannelBase channel; + public int[] topics; + } + + [TLDef(0x6C883E2D)] + public class Channels_EditForumTopic : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int topic_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public long icon_emoji_id; + [IfFlag(2)] public bool closed; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_icon_emoji_id = 0x2, + has_closed = 0x4, + } + } + + [TLDef(0x6C2D9026)] + public class Channels_UpdatePinnedForumTopic : IMethod + { + public InputChannelBase channel; + public int topic_id; + public bool pinned; + } + + [TLDef(0x34435F2D)] + public class Channels_DeleteTopicHistory : IMethod + { + public InputChannelBase channel; + public int top_msg_id; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 3682f20..77a69be 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -6,7 +6,7 @@ namespace TL { public static class Layer { - public const int Version = 146; // fetched 14/09/2022 16:18:39 + public const int Version = 148; // fetched 01/11/2022 17:33:23 internal const int SecretChats = 101; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -119,7 +119,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0x5D99ADEE] = typeof(User), + [0x8F97C628] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -131,7 +131,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x8261AC61] = typeof(Channel), + [0x83259464] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0xC9D31138] = typeof(ChatFull), [0xF2355507] = typeof(ChannelFull), @@ -191,6 +191,8 @@ namespace TL [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), [0xABA0F5C6] = typeof(MessageActionGiftPremium), + [0x0D999256] = typeof(MessageActionTopicCreate), + [0xB18A431C] = typeof(MessageActionTopicEdit), [0xA8EDD0F5] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -211,6 +213,7 @@ namespace TL [0x193B4417] = typeof(InputNotifyUsers), [0x4A95E84E] = typeof(InputNotifyChats), [0xB1DB7C7E] = typeof(InputNotifyBroadcasts), + [0x5C467992] = typeof(InputNotifyForumTopic), [0xDF1F002B] = typeof(InputPeerNotifySettings), [0xA83B0426] = typeof(PeerNotifySettings), [0xA518110D] = typeof(PeerSettings), @@ -260,7 +263,7 @@ namespace TL [0x83487AF0] = typeof(UpdateChatUserTyping), [0x07761198] = typeof(UpdateChatParticipants), [0xE5BDF8DE] = typeof(UpdateUserStatus), - [0xC3F202E0] = typeof(UpdateUserName), + [0xA7848924] = typeof(UpdateUserName), [0xF227868C] = typeof(UpdateUserPhoto), [0x12BCBD9A] = typeof(UpdateNewEncryptedMessage), [0x1710F156] = typeof(UpdateEncryptedChatTyping), @@ -295,7 +298,7 @@ namespace TL [0xE40370A3] = typeof(UpdateEditMessage), [0x691E9052] = typeof(UpdateInlineBotCallbackQuery), [0xB75F99A9] = typeof(UpdateReadChannelOutbox), - [0xEE2BB969] = typeof(UpdateDraftMessage), + [0x1B49EC6D] = typeof(UpdateDraftMessage), [0x571D2742] = typeof(UpdateReadFeaturedStickers), [0x9A422C20] = typeof(UpdateRecentStickers), [0xA229DD06] = typeof(UpdateConfig), @@ -311,7 +314,7 @@ namespace TL [0x46560264] = typeof(UpdateLangPackTooLong), [0x56022F4D] = typeof(UpdateLangPack), [0xE511996D] = typeof(UpdateFavedStickers), - [0x44BDD535] = typeof(UpdateChannelReadMessagesContents), + [0xEA29055D] = typeof(UpdateChannelReadMessagesContents), [0x7084A7BE] = typeof(UpdateContactsReset), [0xB23FC698] = typeof(UpdateChannelAvailableMessages), [0xE16459C3] = typeof(UpdateDialogUnreadMark), @@ -348,7 +351,7 @@ namespace TL [0x4D712F2E] = typeof(UpdateBotCommands), [0x7063C3DB] = typeof(UpdatePendingJoinRequests), [0x11DFA986] = typeof(UpdateBotChatInviteRequester), - [0x154798C3] = typeof(UpdateMessageReactions), + [0x5E1B3CB8] = typeof(UpdateMessageReactions), [0x17B7A20B] = typeof(UpdateAttachMenuBots), [0x1592B79D] = typeof(UpdateWebViewResultSent), [0x14B85813] = typeof(UpdateBotMenuButton), @@ -360,6 +363,7 @@ namespace TL [0x6F7863F4] = typeof(UpdateRecentReactions), [0x86FCCF85] = typeof(UpdateMoveStickerSetToTop), [0x5A73A98C] = typeof(UpdateMessageExtendedMedia), + [0xF694B0AE] = typeof(UpdateChannelPinnedTopic), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -410,6 +414,7 @@ namespace TL [0xB4C83B4C] = typeof(NotifyUsers), [0xC007CEC3] = typeof(NotifyChats), [0xD612E8EF] = typeof(NotifyBroadcasts), + [0x226E6308] = typeof(NotifyForumTopic), [0x16BF744E] = typeof(SendMessageTypingAction), [0xFD5EC8F5] = typeof(SendMessageCancelAction), [0xA187D66F] = typeof(SendMessageRecordVideoAction), @@ -486,8 +491,9 @@ namespace TL [0xC88B3B02] = typeof(InputStickerSetPremiumGifts), [0x04C4D4CE] = typeof(InputStickerSetEmojiGenericAnimations), [0x29D0F5EE] = typeof(InputStickerSetEmojiDefaultStatuses), + [0x44C1F8E9] = typeof(InputStickerSetEmojiDefaultTopicIcons), [0x2DD14EDC] = typeof(StickerSet), - [0xB60A24A6] = typeof(Messages_StickerSet), + [0x6E153F16] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), [0x8F300B57] = typeof(BotInfo), @@ -613,7 +619,7 @@ namespace TL [0x35E410A8] = typeof(Messages_StickerSetInstallResultArchive), [0x6410A5D2] = typeof(StickerSetCovered), [0x3407E51B] = typeof(StickerSetMultiCovered), - [0x1AED5EE5] = typeof(StickerSetFullCovered), + [0x40D13C0E] = typeof(StickerSetFullCovered), [0xAED6DBB2] = typeof(MaskCoords), [0x4A992157] = typeof(InputStickeredMediaPhoto), [0x0438865B] = typeof(InputStickeredMediaDocument), @@ -750,6 +756,12 @@ namespace TL [0xCB2AC766] = typeof(ChannelAdminLogEventActionToggleNoForwards), [0x278F2868] = typeof(ChannelAdminLogEventActionSendMessage), [0xBE4E0EF8] = typeof(ChannelAdminLogEventActionChangeAvailableReactions), + [0xF04FB3A9] = typeof(ChannelAdminLogEventActionChangeUsernames), + [0x02CC6383] = typeof(ChannelAdminLogEventActionToggleForum), + [0x58707D28] = typeof(ChannelAdminLogEventActionCreateTopic), + [0xF06FE208] = typeof(ChannelAdminLogEventActionEditTopic), + [0xAE168909] = typeof(ChannelAdminLogEventActionDeleteTopic), + [0x5D8D353B] = typeof(ChannelAdminLogEventActionPinTopic), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -953,7 +965,8 @@ namespace TL [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), [0x3A836DF8] = typeof(SponsoredMessage), - [0x65A4C7D5] = typeof(Messages_SponsoredMessages), + [0xC9EE1D87] = typeof(Messages_SponsoredMessages), + [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), [0x147EE23C] = typeof(Messages_SearchResultsCalendar), [0x7F648B67] = typeof(SearchResultPosition), @@ -1028,6 +1041,11 @@ namespace TL [0xB81C7034] = typeof(SendAsPeer), [0xAD628CC8] = typeof(MessageExtendedMediaPreview), [0xEE479C64] = typeof(MessageExtendedMedia), + [0xFCFEB29C] = typeof(StickerKeyword), + [0xB4073647] = typeof(Username), + [0x023F109B] = typeof(ForumTopicDeleted), + [0x71701DA9] = typeof(ForumTopic), + [0x367617D3] = typeof(Messages_ForumTopics), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), @@ -1130,6 +1148,7 @@ namespace TL [typeof(DialogFilter)] = 0x363293AE, //dialogFilterDefault [typeof(Help_CountriesList)] = 0x93CC1F32, //help.countriesListNotModified [typeof(BotCommandScope)] = 0x2F6CB2AB, //botCommandScopeDefault + [typeof(Messages_SponsoredMessages)] = 0x1839490F, //messages.sponsoredMessagesEmpty [typeof(Messages_AvailableReactions)] = 0x9F071957, //messages.availableReactionsNotModified [typeof(AttachMenuBots)] = 0xF1D88A5C, //attachMenuBotsNotModified [typeof(BotMenuButtonBase)] = 0x7533A588, //botMenuButtonDefault diff --git a/src/TL.cs b/src/TL.cs index 6daf747..c7b1767 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -59,14 +59,16 @@ namespace TL writer.Write(ctorNb); IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); - uint flags = 0; + ulong flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) { - if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; + if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1UL << ifFlag.Bit)) == 0) continue; object value = field.GetValue(obj); writer.WriteTLValue(value, field.FieldType); - if (field.FieldType.IsEnum && field.Name == "flags") flags = (uint)value; + if (field.FieldType.IsEnum) + if (field.Name == "flags") flags = (uint)value; + else if (field.Name == "flags2") flags |= (ulong)(uint)value << 32; } } @@ -83,14 +85,16 @@ namespace TL var obj = Activator.CreateInstance(type, true); IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); - uint flags = 0; + ulong flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) { - if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; + if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1UL << ifFlag.Bit)) == 0) continue; object value = reader.ReadTLValue(field.FieldType); field.SetValue(obj, value); - if (field.FieldType.IsEnum && field.Name == "flags") flags = (uint)value; + if (field.FieldType.IsEnum) + if (field.Name == "flags") flags = (uint)value; + else if (field.Name == "flags2") flags |= (ulong)(uint)value << 32; if (reader.Client?.CollectAccessHash == true) reader.Client.CollectField(field, obj, value); } return (IObject)obj;