From 2f3106fe693220676fdf8249fa0cc39bcd07fcd2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 16 Mar 2023 13:43:18 +0100 Subject: [PATCH] MainUsername property on IPeerInfo --- .github/FUNDING.yml | 3 +- .github/dev.yml | 2 +- EXAMPLES.md | 3 +- README.md | 4 +- src/TL.Helpers.cs | 10 ++- src/TL.Schema.cs | 68 +++++++++++++++--- src/TL.SchemaFuncs.cs | 160 +++++++++++++++++++++--------------------- src/TL.Table.cs | 2 +- 8 files changed, 153 insertions(+), 99 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index cf80d38..1accf5e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1,2 @@ -custom: ["http://t.me/WTelegramBot?start=donate"] +github: wiz0u +custom: ["https://www.buymeacoffee.com/wizou", "http://t.me/WTelegramBot?start=donate"] diff --git a/.github/dev.yml b/.github/dev.yml index d4810da..6b18a3e 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.3.2-dev.$(Rev:r) +name: 3.3.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index ae0f20e..4bb75c8 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -374,8 +374,9 @@ var chatInvite = await client.Messages_CheckChatInvite("HASH"); // optional: get await client.Messages_ImportChatInvite("HASH"); // join the channel/group // Note: This works also with HASH invite links from public channel/group ``` -Note: `CheckChatInvite` can return [3 different types of invitation object](https://corefork.telegram.org/type/ChatInvite) +`CheckChatInvite` can return [3 different types of invitation object](https://corefork.telegram.org/type/ChatInvite) +You can also use helper methods `AnalyzeInviteLink` and `GetMessageByLink` to more easily fetch information from links. ## Add/Invite/Remove someone in a chat ```csharp diff --git a/README.md b/README.md index d60fb32..8a524db 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![API Layer](https://img.shields.io/badge/API_Layer-155-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) -[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) +[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://www.buymeacoffee.com/wizou) ## _Telegram Client API library written 100% in C# and .NET_ @@ -195,4 +195,4 @@ as well as the [API Terms of Service](https://core.telegram.org/api/terms) or yo If you read all this ReadMe, the [Frequently Asked Questions](https://wiz0u.github.io/WTelegramClient/FAQ), the [Examples codes](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and still have questions, feedback is welcome in our Telegram group [@WTelegramClient](https://t.me/WTelegramClient) -If you like this library, please [consider a donation](http://t.me/WTelegramBot?start=donate) ❤ This will help the project keep going. +If you like this library, you can [buy me a coffee](https://www.buymeacoffee.com/wizou) ❤ This will help the project keep going. diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 1acaff5..1b7b952 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -12,6 +12,7 @@ namespace TL { long ID { get; } bool IsActive { get; } + string MainUsername { get; } InputPeer ToInputPeer(); } @@ -142,6 +143,7 @@ namespace TL { public abstract long ID { get; } public abstract bool IsActive { get; } + public abstract string MainUsername { get; } public abstract InputPeer ToInputPeer(); protected abstract InputUser ToInputUser(); public static implicit operator InputPeer(UserBase user) => user?.ToInputPeer(); @@ -151,6 +153,7 @@ namespace TL { public override long ID => id; public override bool IsActive => false; + public override string MainUsername => null; public override string ToString() => null; public override InputPeer ToInputPeer() => null; protected override InputUser ToInputUser() => null; @@ -159,13 +162,13 @@ namespace TL { public override long ID => id; public override bool IsActive => (flags & Flags.deleted) == 0; - public bool IsBot => (flags & Flags.bot) != 0; - public string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; + public override string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; public override string ToString() => MainUsername is string uname ? '@' + uname : last_name == null ? first_name : $"{first_name} {last_name}"; public override InputPeer ToInputPeer() => new InputPeerUser(id, access_hash); protected override InputUser ToInputUser() => new(id, access_hash); /// An estimation of the number of days ago the user was last seen (Online=0, Recently=1, LastWeek=5, LastMonth=20, LongTimeAgo=150) public TimeSpan LastSeenAgo => status?.LastSeenAgo ?? TimeSpan.FromDays(150); + public bool IsBot => (flags & Flags.bot) != 0; } /// a null value means userStatusEmpty = last seen a long time ago, more than a month (or blocked/deleted users) @@ -183,6 +186,7 @@ namespace TL { /// Is this chat among current user active chats? public abstract bool IsActive { get; } + public virtual string MainUsername => null; public abstract ChatPhoto Photo { get; } /// returns true if you're banned of any of these rights public abstract bool IsBanned(ChatBannedRights.Flags flags = 0); @@ -216,7 +220,7 @@ namespace TL partial class Channel { public override bool IsActive => (flags & Flags.left) == 0; - public string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; + public override string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; public override ChatPhoto Photo => photo; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((banned_rights?.flags ?? 0) & flags) != 0 || ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChannel(id, access_hash); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 7e3fd02..c3c7207 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -118,13 +118,13 @@ namespace TL [TLDef(0xF392B7F4)] public class InputPhoneContact : InputContact { - /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. + /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. public long client_id; /// Phone number public string phone; - /// Contact's first name + /// Contact's first name public string first_name; - /// Contact's last name + /// Contact's last name public string last_name; } @@ -2059,6 +2059,7 @@ namespace TL [TLDef(0xC516D679)] public class MessageActionBotAllowed : MessageAction { + /// Flags, see TL conditional fields public Flags flags; /// The domain name of the website on which the user has logged in. [IfFlag(0)] public string domain; @@ -2133,6 +2134,7 @@ namespace TL [TLDef(0x3C134D7B)] public class MessageActionSetMessagesTTL : MessageAction { + /// Flags, see TL conditional fields public Flags flags; /// New Time-To-Live public int period; @@ -2192,6 +2194,7 @@ namespace TL [TLDef(0x0D999256)] public class MessageActionTopicCreate : MessageAction { + /// Flags, see TL conditional fields public Flags flags; public string title; public int icon_color; @@ -2199,6 +2202,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_icon_emoji_id = 0x1, } } @@ -2206,6 +2210,7 @@ namespace TL [TLDef(0xC0944820)] public class MessageActionTopicEdit : MessageAction { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public string title; [IfFlag(1)] public long icon_emoji_id; @@ -2214,9 +2219,13 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_title = 0x1, + /// Field has a value has_icon_emoji_id = 0x2, + /// Field has a value has_closed = 0x4, + /// Field has a value has_hidden = 0x8, } } @@ -3190,7 +3199,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class Update : IObject { } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] @@ -3682,6 +3691,7 @@ namespace TL [TLDef(0x1B49EC6D)] public class UpdateDraftMessage : Update { + /// Flags, see TL conditional fields public Flags flags; /// The peer to which the draft is associated public Peer peer; @@ -3840,6 +3850,7 @@ namespace TL [TLDef(0xEA29055D)] public class UpdateChannelReadMessagesContents : Update { + /// Flags, see TL conditional fields public Flags flags; /// Channel/supergroup ID public long channel_id; @@ -4315,6 +4326,7 @@ namespace TL [TLDef(0x5E1B3CB8)] public class UpdateMessageReactions : Update { + /// Flags, see TL conditional fields public Flags flags; /// Peer public Peer peer; @@ -4418,6 +4430,7 @@ namespace TL [TLDef(0x192EFBE3)] public class UpdateChannelPinnedTopic : Update { + /// Flags, see TL conditional fields public Flags flags; public long channel_id; public int topic_id; @@ -4431,12 +4444,14 @@ namespace TL [TLDef(0xFE198602)] public class UpdateChannelPinnedTopics : Update { + /// Flags, see TL conditional fields public Flags flags; public long channel_id; [IfFlag(0)] public int[] order; [Flags] public enum Flags : uint { + /// Field has a value has_order = 0x1, } } @@ -7907,6 +7922,7 @@ namespace TL [TLDef(0xE57B1432)] public class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public byte[] nonce; [IfFlag(1)] public string receipt; @@ -7914,7 +7930,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_nonce = 0x1, + /// Field has a value has_receipt = 0x2, } } @@ -10137,13 +10155,16 @@ namespace TL [TLDef(0x5D8D353B)] public class ChannelAdminLogEventActionPinTopic : ChannelAdminLogEventAction { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public ForumTopicBase prev_topic; [IfFlag(1)] public ForumTopicBase new_topic; [Flags] public enum Flags : uint { + /// Field has a value has_prev_topic = 0x1, + /// Field has a value has_new_topic = 0x2, } } @@ -13184,6 +13205,7 @@ namespace TL [TLDef(0xC9EE1D87)] public class Messages_SponsoredMessages : IObject, IPeerResolver { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public int posts_between; /// Sponsored messages @@ -13997,12 +14019,13 @@ namespace TL } } - /// See + /// See Derived classes: public abstract class MessageExtendedMediaBase : IObject { } /// See [TLDef(0xAD628CC8)] public class MessageExtendedMediaPreview : MessageExtendedMediaBase { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public int w; [IfFlag(0)] public int h; @@ -14011,8 +14034,11 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_w = 0x1, + /// Field has a value has_thumb = 0x2, + /// Field has a value has_video_duration = 0x4, } } @@ -14035,6 +14061,7 @@ namespace TL [TLDef(0xB4073647)] public class Username : IObject { + /// Flags, see TL conditional fields public Flags flags; public string username; @@ -14045,7 +14072,7 @@ namespace TL } } - /// See + /// See Derived classes: public abstract class ForumTopicBase : IObject { public virtual int ID { get; } @@ -14062,6 +14089,7 @@ namespace TL [TLDef(0x71701DA9)] public class ForumTopic : ForumTopicBase { + /// Flags, see TL conditional fields public Flags flags; public int id; public DateTime date; @@ -14080,10 +14108,12 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_icon_emoji_id = 0x1, my = 0x2, closed = 0x4, pinned = 0x8, + /// Field has a value has_draft = 0x10, short_ = 0x20, hidden = 0x40, @@ -14096,6 +14126,7 @@ namespace TL [TLDef(0x367617D3)] public class Messages_ForumTopics : IObject, IPeerResolver { + /// Flags, see TL conditional fields public Flags flags; public int count; public ForumTopicBase[] topics; @@ -14127,19 +14158,22 @@ namespace TL public DateTime expires; } - /// See + /// See Derived classes: public abstract class RequestPeerType : IObject { } /// See [TLDef(0x5F3B8A00)] public class RequestPeerTypeUser : RequestPeerType { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public bool bot; [IfFlag(1)] public bool premium; [Flags] public enum Flags : uint { + /// Field has a value has_bot = 0x1, + /// Field has a value has_premium = 0x2, } } @@ -14147,6 +14181,7 @@ namespace TL [TLDef(0xC9F06E1B)] public class RequestPeerTypeChat : RequestPeerType { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(3)] public bool has_username; [IfFlag(4)] public bool forum; @@ -14156,9 +14191,13 @@ namespace TL [Flags] public enum Flags : uint { creator = 0x1, + /// Field has a value has_user_admin_rights = 0x2, + /// Field has a value has_bot_admin_rights = 0x4, + /// Field has a value has_has_username = 0x8, + /// Field has a value has_forum = 0x10, bot_participant = 0x20, } @@ -14167,6 +14206,7 @@ namespace TL [TLDef(0x339BEF6C)] public class RequestPeerTypeBroadcast : RequestPeerType { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(3)] public bool has_username; [IfFlag(1)] public ChatAdminRights user_admin_rights; @@ -14175,8 +14215,11 @@ namespace TL [Flags] public enum Flags : uint { creator = 0x1, + /// Field has a value has_user_admin_rights = 0x2, + /// Field has a value has_bot_admin_rights = 0x4, + /// Field has a value has_has_username = 0x8, } } @@ -14216,7 +14259,7 @@ namespace TL public MessageEntity[] entities; } - /// Translated text, or no result See Derived classes: , + /// Translated text, or no result See Derived classes: public abstract class Messages_TranslatedText : IObject { } /// See [TLDef(0x33DB32F8)] @@ -14229,6 +14272,7 @@ namespace TL [TLDef(0xC84834CE)] public class AutoSaveSettings : IObject { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(2)] public long video_max_size; @@ -14236,6 +14280,7 @@ namespace TL { photos = 0x1, videos = 0x2, + /// Field has a value has_video_max_size = 0x4, } } @@ -14271,7 +14316,7 @@ namespace TL public JsonObject config; } - /// See + /// See Derived classes: public abstract class InputBotApp : IObject { } /// See [TLDef(0xA920BD7A)] @@ -14293,6 +14338,7 @@ namespace TL [TLDef(0x95FCD1D6)] public class BotApp : IObject { + /// Flags, see TL conditional fields public Flags flags; public long id; public long access_hash; @@ -14305,6 +14351,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_document = 0x1, } } @@ -14313,6 +14360,7 @@ namespace TL [TLDef(0xEB50ADF5)] public class Messages_BotApp : IObject { + /// Flags, see TL conditional fields public Flags flags; public BotApp app; @@ -14323,7 +14371,7 @@ namespace TL } } - /// See + /// See Derived classes: public abstract class AppWebViewResult : IObject { } /// See [TLDef(0x3C1B4F0D)] diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ac8210d..fdaa088 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -54,7 +54,7 @@ namespace TL query = query, }); - /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) + /// Invoke the specified query using the specified API layer See Possible codes: 400,403,406 (details) /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) @@ -286,7 +286,7 @@ namespace TL code = code, }); - /// See + /// See [bots: ✓] public static Task Auth_ImportWebTokenAuthorization(this Client client, int api_id, string api_hash, string web_auth_token) => client.Invoke(new Auth_ImportWebTokenAuthorization { @@ -295,7 +295,7 @@ namespace TL web_auth_token = web_auth_token, }); - /// See + /// See [bots: ✓] public static Task Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null) => client.Invoke(new Auth_RequestFirebaseSms { @@ -921,7 +921,7 @@ namespace TL { }); - /// Get info about multiple wallpapers See + /// Get info about multiple wallpapers See Possible codes: 400 (details) /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, params InputWallPaperBase[] wallpapers) => client.Invoke(new Account_GetMultiWallPapers @@ -1062,14 +1062,14 @@ namespace TL { }); - /// See + /// See [bots: ✓] public static Task Account_ReorderUsernames(this Client client, params string[] order) => client.Invoke(new Account_ReorderUsernames { order = order, }); - /// See + /// See [bots: ✓] public static Task Account_ToggleUsername(this Client client, string username, bool active) => client.Invoke(new Account_ToggleUsername { @@ -1077,7 +1077,7 @@ namespace TL active = active, }); - /// See + /// See [bots: ✓] /// a null value means emojiListNotModified public static Task Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultProfilePhotoEmojis @@ -1085,7 +1085,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] /// a null value means emojiListNotModified public static Task Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultGroupPhotoEmojis @@ -1093,13 +1093,13 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Account_GetAutoSaveSettings(this Client client) => client.Invoke(new Account_GetAutoSaveSettings { }); - /// See + /// See [bots: ✓] public static Task Account_SaveAutoSaveSettings(this Client client, AutoSaveSettings settings, InputPeer peer = null, bool users = false, bool chats = false, bool broadcasts = false) => client.Invoke(new Account_SaveAutoSaveSettings { @@ -1108,7 +1108,7 @@ namespace TL settings = settings, }); - /// See + /// See [bots: ✓] public static Task Account_DeleteAutoSaveExceptions(this Client client) => client.Invoke(new Account_DeleteAutoSaveExceptions { @@ -1339,13 +1339,13 @@ namespace TL phone = phone, }); - /// See + /// See [bots: ✓] public static Task Contacts_ExportContactToken(this Client client) => client.Invoke(new Contacts_ExportContactToken { }); - /// See + /// See [bots: ✓] public static Task Contacts_ImportContactToken(this Client client, string token) => client.Invoke(new Contacts_ImportContactToken { @@ -1360,7 +1360,7 @@ namespace TL id = id, }); - /// Returns the current user dialog list. See Possible codes: 400 (details) + /// Returns the current user dialog list. See Possible codes: 400,403 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -1380,7 +1380,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -1402,7 +1402,7 @@ namespace TL hash = hash, }); - /// Returns found messages See Possible codes: 400 (details) + /// Returns found messages See Possible codes: 400,403 (details) /// User or chat, histories with which are searched, or for global search /// Text search request /// Only return messages sent by the specified user ID @@ -1480,7 +1480,7 @@ namespace TL max_id = max_id, }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403 (details) + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403,406 (details) /// Target user or group /// Thread ID /// Type of action @@ -1493,7 +1493,7 @@ namespace TL action = action, }); - /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,420,500 (details) + /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,406,420,500 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) /// Send this message as background message @@ -1523,7 +1523,7 @@ namespace TL send_as = send_as, }); - /// Send a media See [bots: ✓] Possible codes: 400,403,420,500 (details) + /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -1670,7 +1670,7 @@ namespace TL user_id = user_id, }); - /// Creates a new chat. See Possible codes: 400,403,500 (details) + /// Creates a new chat. See Possible codes: 400,406,500 (details) /// List of user IDs to be invited /// Chat name public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title, int? ttl_period = null) @@ -1888,7 +1888,7 @@ namespace TL hash = hash, }); - /// Install a stickerset See Possible codes: 400 (details) + /// Install a stickerset See Possible codes: 406 (details) /// Stickerset to install /// Whether to archive stickerset public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) @@ -1898,7 +1898,7 @@ namespace TL archived = archived, }); - /// Uninstall a stickerset See Possible codes: 400 (details) + /// Uninstall a stickerset See Possible codes: 406 (details) /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) => client.Invoke(new Messages_UninstallStickerSet @@ -1920,7 +1920,7 @@ namespace TL start_param = start_param, }); - /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400,406 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter @@ -2019,7 +2019,7 @@ namespace TL unsave = unsave, }); - /// Query an inline bot See Possible codes: 400,-503 (details) + /// Query an inline bot See Possible codes: 400,406,-503 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested @@ -2092,7 +2092,7 @@ namespace TL id = id, }); - /// Edit message See [bots: ✓] Possible codes: 400,403 (details) + /// Edit message See [bots: ✓] Possible codes: 400,403,406 (details) /// Disable webpage preview /// Where was the message sent /// ID of the message to edit @@ -2164,7 +2164,7 @@ namespace TL cache_time = cache_time, }); - /// Get dialog info of specified peers See Possible codes: 400 (details) + /// Get dialog info of specified peers See Possible codes: 400,406 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, params InputDialogPeerBase[] peers) => client.Invoke(new Messages_GetPeerDialogs @@ -3112,7 +3112,7 @@ namespace TL limit = limit, }); - /// Dismiss or approve a chat join request related to a specific chat or channel. See [bots: ✓] Possible codes: 400 (details) + /// Dismiss or approve a chat join request related to a specific chat or channel. See [bots: ✓] Possible codes: 400,403 (details) /// Whether to dismiss or approve the chat join request » /// The chat or channel /// The user whose join request » should be dismissed or approved @@ -3136,7 +3136,7 @@ namespace TL link = link, }); - /// Enable or disable content protection on a channel or chat See + /// Enable or disable content protection on a channel or chat See Possible codes: 400 (details) /// The chat or channel /// Enable or disable content protection public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) @@ -3171,7 +3171,7 @@ namespace TL reaction = reaction, }); - /// Get message reactions » See + /// Get message reactions » See Possible codes: 400 (details) /// Peer /// Message IDs public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, params int[] id) @@ -3269,7 +3269,7 @@ namespace TL top_msg_id = top_msg_id.GetValueOrDefault(), }); - /// View and search recently sent media.
This method does not support pagination. See
+ /// View and search recently sent media.
This method does not support pagination. See
Possible codes: 400 (details)
/// Optional search query /// Message filter /// Maximum number of results to return (max 100). @@ -3393,7 +3393,7 @@ namespace TL data = data, }); - /// Transcribe voice message See + /// Transcribe voice message See Possible codes: 400,403 (details) /// Peer ID where the voice message was sent /// Voice message ID public static Task Messages_TranscribeAudio(this Client client, InputPeer peer, int msg_id) @@ -3490,20 +3490,20 @@ namespace TL id = id, }); - /// See + /// See [bots: ✓] public static Task Messages_SetDefaultHistoryTTL(this Client client, int period) => client.Invoke(new Messages_SetDefaultHistoryTTL { period = period, }); - /// See + /// See [bots: ✓] public static Task Messages_GetDefaultHistoryTTL(this Client client) => client.Invoke(new Messages_GetDefaultHistoryTTL { }); - /// See + /// See [bots: ✓] public static Task Messages_SendBotRequestedPeer(this Client client, InputPeer peer, int msg_id, int button_id, InputPeer requested_peer) => client.Invoke(new Messages_SendBotRequestedPeer { @@ -3513,7 +3513,7 @@ namespace TL requested_peer = requested_peer, }); - /// See + /// See [bots: ✓] /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiGroups @@ -3521,7 +3521,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStatusGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiStatusGroups @@ -3529,7 +3529,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiProfilePhotoGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiProfilePhotoGroups @@ -3537,7 +3537,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] /// a null value means emojiListNotModified public static Task Messages_SearchCustomEmoji(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_SearchCustomEmoji @@ -3546,7 +3546,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Messages_TogglePeerTranslations(this Client client, InputPeer peer, bool disabled = false) => client.Invoke(new Messages_TogglePeerTranslations { @@ -3554,7 +3554,7 @@ namespace TL peer = peer, }); - /// See + /// See [bots: ✓] public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) => client.Invoke(new Messages_GetBotApp { @@ -3562,7 +3562,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false) => client.Invoke(new Messages_RequestAppWebView { @@ -3595,7 +3595,7 @@ namespace TL qts = qts, }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,500 (details) + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,406,500 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter @@ -3656,7 +3656,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Photos_UploadContactProfilePhoto(this Client client, InputUserBase user_id, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool suggest = false, bool save = false) => client.Invoke(new Photos_UploadContactProfilePhoto { @@ -3834,7 +3834,7 @@ namespace TL { }); - /// Accept the new terms of service See + /// Accept the new terms of service See Possible codes: 400 (details) /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) => client.Invoke(new Help_AcceptTermsOfService @@ -3891,7 +3891,7 @@ namespace TL user_id = user_id, }); - /// Internal use See Possible codes: 400 (details) + /// Internal use See Possible codes: 400,403 (details) /// User /// Message /// Message entities for styled text @@ -3945,7 +3945,7 @@ namespace TL { }); - /// Mark channel/supergroup history as read See Possible codes: 400 (details) + /// Mark channel/supergroup history as read See Possible codes: 400,406 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) @@ -3955,7 +3955,7 @@ namespace TL max_id = max_id, }); - /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) + /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, params int[] id) @@ -3977,7 +3977,7 @@ namespace TL id = id, }); - /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) + /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, params InputMessage[] id) @@ -3987,7 +3987,7 @@ namespace TL id = id, }); - /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) + /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel /// Which participant types to fetch /// Offset @@ -4004,7 +4004,7 @@ namespace TL hash = hash, }); - /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) + /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) @@ -4014,7 +4014,7 @@ namespace TL participant = participant, }); - /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) + /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400,406 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, params InputChannelBase[] id) => client.Invoke(new Channels_GetChannels @@ -4111,7 +4111,7 @@ namespace TL channel = channel, }); - /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) + /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_LeaveChannel @@ -4119,7 +4119,7 @@ namespace TL channel = channel, }); - /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) + /// Invite users to a channel/supergroup See Possible codes: 400,403,406 (details) /// Channel/supergroup /// Users to invite public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, params InputUserBase[] users) @@ -4169,7 +4169,7 @@ namespace TL flags = (Channels_GetAdminedPublicChannels.Flags)((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)), }); - /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) + /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights @@ -4181,7 +4181,7 @@ namespace TL banned_rights = banned_rights, }); - /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) + /// Get the admin log of a channel/supergroup See Possible codes: 400,403,406 (details) /// Channel /// Search query, can be empty /// Event filter @@ -4212,7 +4212,7 @@ namespace TL stickerset = stickerset, }); - /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) + /// Mark channel/supergroup message contents as read See Possible codes: 400,406 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, params int[] id) @@ -4363,7 +4363,7 @@ namespace TL enabled = enabled, }); - /// Set whether all users should request admin approval to join the group ». See + /// Set whether all users should request admin approval to join the group ». See Possible codes: 400 (details) /// Group /// Toggle public static Task Channels_ToggleJoinRequest(this Client client, InputChannelBase channel, bool enabled) @@ -4373,7 +4373,7 @@ namespace TL enabled = enabled, }); - /// See + /// See [bots: ✓] public static Task Channels_ReorderUsernames(this Client client, InputChannelBase channel, params string[] order) => client.Invoke(new Channels_ReorderUsernames { @@ -4381,7 +4381,7 @@ namespace TL order = order, }); - /// See + /// See [bots: ✓] public static Task Channels_ToggleUsername(this Client client, InputChannelBase channel, string username, bool active) => client.Invoke(new Channels_ToggleUsername { @@ -4390,14 +4390,14 @@ namespace TL active = active, }); - /// See + /// See [bots: ✓] public static Task Channels_DeactivateAllUsernames(this Client client, InputChannelBase channel) => client.Invoke(new Channels_DeactivateAllUsernames { channel = channel, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleForum { @@ -4405,7 +4405,7 @@ namespace TL enabled = enabled, }); - /// See + /// See [bots: ✓] 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 { @@ -4418,7 +4418,7 @@ namespace TL send_as = send_as, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, DateTime offset_date = default, int offset_id = default, int offset_topic = default, int limit = int.MaxValue, string q = null) => client.Invoke(new Channels_GetForumTopics { @@ -4431,7 +4431,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Channels_GetForumTopicsByID(this Client client, InputChannelBase channel, params int[] topics) => client.Invoke(new Channels_GetForumTopicsByID { @@ -4439,7 +4439,7 @@ namespace TL topics = topics, }); - /// See + /// See [bots: ✓] public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default, bool? hidden = default) => client.Invoke(new Channels_EditForumTopic { @@ -4452,7 +4452,7 @@ namespace TL hidden = hidden.GetValueOrDefault(), }); - /// See + /// See [bots: ✓] public static Task Channels_UpdatePinnedForumTopic(this Client client, InputChannelBase channel, int topic_id, bool pinned) => client.Invoke(new Channels_UpdatePinnedForumTopic { @@ -4461,7 +4461,7 @@ namespace TL pinned = pinned, }); - /// See + /// See [bots: ✓] public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) => client.Invoke(new Channels_DeleteTopicHistory { @@ -4469,7 +4469,7 @@ namespace TL top_msg_id = top_msg_id, }); - /// See + /// See [bots: ✓] public static Task Channels_ReorderPinnedForumTopics(this Client client, InputChannelBase channel, int[] order, bool force = false) => client.Invoke(new Channels_ReorderPinnedForumTopics { @@ -4478,7 +4478,7 @@ namespace TL order = order, }); - /// See + /// See [bots: ✓] public static Task Channels_ToggleAntiSpam(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAntiSpam { @@ -4486,7 +4486,7 @@ namespace TL enabled = enabled, }); - /// See + /// See [bots: ✓] public static Task Channels_ReportAntiSpamFalsePositive(this Client client, InputChannelBase channel, int msg_id) => client.Invoke(new Channels_ReportAntiSpamFalsePositive { @@ -4494,7 +4494,7 @@ namespace TL msg_id = msg_id, }); - /// See + /// See [bots: ✓] public static Task Channels_ToggleParticipantsHidden(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleParticipantsHidden { @@ -4589,7 +4589,7 @@ namespace TL admin_rights = admin_rights, }); - /// See + /// See [bots: ✓] public static Task Bots_SetBotInfo(this Client client, string lang_code, string about = null, string description = null) => client.Invoke(new Bots_SetBotInfo { @@ -4599,7 +4599,7 @@ namespace TL description = description, }); - /// See + /// See [bots: ✓] public static Task Bots_GetBotInfo(this Client client, string lang_code) => client.Invoke(new Bots_GetBotInfo { @@ -4760,7 +4760,7 @@ namespace TL position = position, }); - /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) + /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400,406 (details) /// The stickerset /// The sticker /// a null value means messages.stickerSetNotModified @@ -4800,7 +4800,7 @@ namespace TL title = title, }); - /// See + /// See [bots: ✓] /// a null value means messages.stickerSetNotModified public static Task Stickers_ChangeSticker(this Client client, InputDocument sticker, string emoji = null, MaskCoords mask_coords = null, string keywords = null) => client.Invoke(new Stickers_ChangeSticker @@ -4812,7 +4812,7 @@ namespace TL keywords = keywords, }); - /// See + /// See [bots: ✓] /// a null value means messages.stickerSetNotModified public static Task Stickers_RenameStickerSet(this Client client, InputStickerSet stickerset, string title) => client.Invoke(new Stickers_RenameStickerSet @@ -4821,7 +4821,7 @@ namespace TL title = title, }); - /// See + /// See [bots: ✓] public static Task Stickers_DeleteStickerSet(this Client client, InputStickerSet stickerset) => client.Invoke(new Stickers_DeleteStickerSet { @@ -4987,7 +4987,7 @@ namespace TL users = users, }); - /// Terminate a group call See Possible codes: 400 (details) + /// Terminate a group call See Possible codes: 400,403 (details) /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) => client.Invoke(new Phone_DiscardGroupCall @@ -5251,7 +5251,7 @@ namespace TL folder_id = folder_id, }); - /// Get channel statistics See Possible codes: 400 (details) + /// Get channel statistics See Possible codes: 400,403 (details) /// Whether to enable dark theme for graph colors /// The channel public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) @@ -5272,7 +5272,7 @@ namespace TL x = x.GetValueOrDefault(), }); - /// Get supergroup statistics See Possible codes: 400 (details) + /// Get supergroup statistics See Possible codes: 400,403 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 57e224f..f2ee174 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 = 155; // fetched 09/03/2023 20:45:49 + public const int Version = 155; // fetched 13/03/2023 22:46:30 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415;