diff --git a/README.md b/README.md index 028de8d..ccb1edf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-149-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-150-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) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 3da5301..908cd31 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1344,6 +1344,7 @@ namespace TL { /// Can we delete this channel? can_delete_channel = 0x1, + antispam = 0x2, } /// ID of the channel @@ -2103,11 +2104,19 @@ namespace TL public long[] users; } /// The Time-To-Live of messages in this chat was changed. See - [TLDef(0xAA1AFBFD)] + [TLDef(0x3C134D7B)] public class MessageActionSetMessagesTTL : MessageAction { + public Flags flags; /// New Time-To-Live public int period; + [IfFlag(0)] public long auto_setting_from; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_auto_setting_from = 0x1, + } } /// A group call was scheduled See [TLDef(0xB3A07661)] @@ -2168,19 +2177,21 @@ namespace TL } } /// See - [TLDef(0xB18A431C)] + [TLDef(0xC0944820)] public class MessageActionTopicEdit : MessageAction { public Flags flags; [IfFlag(0)] public string title; [IfFlag(1)] public long icon_emoji_id; [IfFlag(2)] public bool closed; + [IfFlag(3)] public bool hidden; [Flags] public enum Flags : uint { has_title = 0x1, has_icon_emoji_id = 0x2, has_closed = 0x4, + has_hidden = 0x8, } } @@ -2193,7 +2204,7 @@ namespace TL public virtual int TopMessage { get; } } /// Chat See - [TLDef(0xA8EDD0F5)] + [TLDef(0xD58A08C6)] public class Dialog : DialogBase { /// Flags, see TL conditional fields @@ -2220,6 +2231,7 @@ namespace TL [IfFlag(1)] public DraftMessageBase draft; /// Peer folder ID, for more info click here [IfFlag(4)] public int folder_id; + [IfFlag(5)] public int ttl_period; [Flags] public enum Flags : uint { @@ -2233,6 +2245,8 @@ namespace TL unread_mark = 0x8, /// Field has a value has_folder_id = 0x10, + /// Field has a value + has_ttl_period = 0x20, } /// The chat @@ -7754,6 +7768,8 @@ namespace TL FlashCall = 0x226CCEFB, ///The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user. MissedCall = 0xD61AD6EE, + ///See + FragmentSms = 0x06ED998C, } /// Type of the verification code that was sent See Derived classes: , , , , , , @@ -7831,6 +7847,12 @@ namespace TL google_signin_allowed = 0x2, } } + /// See + [TLDef(0xD9565C39)] + public class Auth_SentCodeTypeFragmentSms : Auth_SentCodeTypeSms + { + public string url; + } /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] @@ -10049,6 +10071,12 @@ namespace TL has_new_topic = 0x2, } } + /// See + [TLDef(0x64F36DFC)] + public class ChannelAdminLogEventActionToggleAntiSpam : ChannelAdminLogEventAction + { + public bool new_value; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -13954,6 +13982,7 @@ namespace TL pinned = 0x8, has_draft = 0x10, short_ = 0x20, + hidden = 0x40, } public override int ID => id; @@ -13978,4 +14007,19 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + + /// See + [TLDef(0x43B46B20)] + public class DefaultHistoryTTL : IObject + { + public int period; + } + + /// See + [TLDef(0x41BF109B)] + public class ExportedContactToken : IObject + { + public string url; + public DateTime expires; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 93ac53c..66f7c00 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -286,6 +286,15 @@ namespace TL code = code, }); + /// See + public static Task Auth_ImportWebTokenAuthorization(this Client client, int api_id, string api_hash, string web_auth_token) + => client.Invoke(new Auth_ImportWebTokenAuthorization + { + api_id = api_id, + api_hash = api_hash, + web_auth_token = web_auth_token, + }); + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. @@ -1282,6 +1291,19 @@ namespace TL phone = phone, }); + /// See + public static Task Contacts_ExportContactToken(this Client client) + => client.Invoke(new Contacts_ExportContactToken + { + }); + + /// See + public static Task Contacts_ImportContactToken(this Client client, string token) + => client.Invoke(new Contacts_ImportContactToken + { + token = token, + }); + /// 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
Returns the list of messages by their IDs. See
[bots: ✓]
/// Message ID list public static Task Messages_GetMessages(this Client client, params InputMessage[] id) @@ -1603,11 +1625,13 @@ namespace TL /// Creates a new chat. See Possible codes: 400,403,500 (details) /// List of user IDs to be invited /// Chat name - public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) + public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title, int? ttl_period = null) => client.Invoke(new Messages_CreateChat { + flags = (Messages_CreateChat.Flags)(ttl_period != null ? 0x1 : 0), users = users, title = title, + ttl_period = ttl_period.GetValueOrDefault(), }); /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) @@ -3419,6 +3443,19 @@ namespace TL id = id, }); + /// See + public static Task Messages_SetDefaultHistoryTTL(this Client client, int period) + => client.Invoke(new Messages_SetDefaultHistoryTTL + { + period = period, + }); + + /// See + public static Task Messages_GetDefaultHistoryTTL(this Client client) + => client.Invoke(new Messages_GetDefaultHistoryTTL + { + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3867,14 +3904,15 @@ namespace TL /// Channel description /// Geogroup location /// Geogroup address - public static Task Channels_CreateChannel(this Client client, string title, string about, bool broadcast = false, bool megagroup = false, bool for_import = false, InputGeoPoint geo_point = null, string address = null) + public static Task Channels_CreateChannel(this Client client, string title, string about, bool broadcast = false, bool megagroup = false, bool for_import = false, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null) => client.Invoke(new Channels_CreateChannel { - flags = (Channels_CreateChannel.Flags)((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0)), + flags = (Channels_CreateChannel.Flags)((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0) | (ttl_period != null ? 0x10 : 0)), title = title, about = about, geo_point = geo_point, address = address, + ttl_period = ttl_period.GetValueOrDefault(), }); /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) @@ -4268,15 +4306,16 @@ namespace TL }); /// 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) + 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 { - flags = (Channels_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0)), + flags = (Channels_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0) | (hidden != default ? 0x8 : 0)), channel = channel, topic_id = topic_id, title = title, icon_emoji_id = icon_emoji_id.GetValueOrDefault(), closed = closed.GetValueOrDefault(), + hidden = hidden.GetValueOrDefault(), }); /// See @@ -4305,6 +4344,22 @@ namespace TL order = order, }); + /// See + public static Task Channels_ToggleAntiSpam(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleAntiSpam + { + channel = channel, + enabled = enabled, + }); + + /// See + public static Task Channels_ReportAntiSpamFalsePositive(this Client client, InputChannelBase channel, int msg_id) + => client.Invoke(new Channels_ReportAntiSpamFalsePositive + { + channel = channel, + msg_id = msg_id, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5274,6 +5329,14 @@ namespace TL.Methods public string code; } + [TLDef(0x2DB873A9)] + public class Auth_ImportWebTokenAuthorization : IMethod + { + public int api_id; + public string api_hash; + public string web_auth_token; + } + [TLDef(0xEC86017A)] public class Account_RegisterDevice : IMethod { @@ -6049,6 +6112,15 @@ namespace TL.Methods public string phone; } + [TLDef(0xF8654027)] + public class Contacts_ExportContactToken : IMethod { } + + [TLDef(0x13005788)] + public class Contacts_ImportContactToken : IMethod + { + public string token; + } + [TLDef(0x63C66506)] public class Messages_GetMessages : IMethod { @@ -6324,11 +6396,18 @@ namespace TL.Methods } } - [TLDef(0x09CB126E)] + [TLDef(0x0034A818)] public class Messages_CreateChat : IMethod { + public Flags flags; public InputUserBase[] users; public string title; + [IfFlag(0)] public int ttl_period; + + [Flags] public enum Flags : uint + { + has_ttl_period = 0x1, + } } [TLDef(0x26CF8950)] @@ -7862,6 +7941,15 @@ namespace TL.Methods public int[] id; } + [TLDef(0x9EB51445)] + public class Messages_SetDefaultHistoryTTL : IMethod + { + public int period; + } + + [TLDef(0x658B7188)] + public class Messages_GetDefaultHistoryTTL : IMethod { } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -8172,7 +8260,7 @@ namespace TL.Methods public InputChannelBase channel; } - [TLDef(0x3D5FB10F)] + [TLDef(0x91006707)] public class Channels_CreateChannel : IMethod { public Flags flags; @@ -8180,6 +8268,7 @@ namespace TL.Methods public string about; [IfFlag(2)] public InputGeoPoint geo_point; [IfFlag(2)] public string address; + [IfFlag(4)] public int ttl_period; [Flags] public enum Flags : uint { @@ -8187,6 +8276,7 @@ namespace TL.Methods megagroup = 0x2, has_geo_point = 0x4, for_import = 0x8, + has_ttl_period = 0x10, } } @@ -8505,7 +8595,7 @@ namespace TL.Methods public int[] topics; } - [TLDef(0x6C883E2D)] + [TLDef(0xF4DFA185)] public class Channels_EditForumTopic : IMethod { public Flags flags; @@ -8514,12 +8604,14 @@ namespace TL.Methods [IfFlag(0)] public string title; [IfFlag(1)] public long icon_emoji_id; [IfFlag(2)] public bool closed; + [IfFlag(3)] public bool hidden; [Flags] public enum Flags : uint { has_title = 0x1, has_icon_emoji_id = 0x2, has_closed = 0x4, + has_hidden = 0x8, } } @@ -8551,6 +8643,20 @@ namespace TL.Methods } } + [TLDef(0x68F3E4EB)] + public class Channels_ToggleAntiSpam : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0xA850A693)] + public class Channels_ReportAntiSpamFalsePositive : IMethod + { + public InputChannelBase channel; + public int msg_id; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index d991db7..f1f9db4 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 = 149; // fetched 23/11/2022 13:15:45 + public const int Version = 150; // fetched 07/12/2022 12:23:35 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -184,7 +184,7 @@ namespace TL [0x98E0D697] = typeof(MessageActionGeoProximityReached), [0x7A0D7F42] = typeof(MessageActionGroupCall), [0x502F92F7] = typeof(MessageActionInviteToGroupCall), - [0xAA1AFBFD] = typeof(MessageActionSetMessagesTTL), + [0x3C134D7B] = typeof(MessageActionSetMessagesTTL), [0xB3A07661] = typeof(MessageActionGroupCallScheduled), [0xAA786345] = typeof(MessageActionSetChatTheme), [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), @@ -192,8 +192,8 @@ namespace TL [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), [0xABA0F5C6] = typeof(MessageActionGiftPremium), [0x0D999256] = typeof(MessageActionTopicCreate), - [0xB18A431C] = typeof(MessageActionTopicEdit), - [0xA8EDD0F5] = typeof(Dialog), + [0xC0944820] = typeof(MessageActionTopicEdit), + [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), [0xFB197A65] = typeof(Photo), @@ -598,6 +598,7 @@ namespace TL [0x82006484] = typeof(Auth_SentCodeTypeMissedCall), [0x5A159841] = typeof(Auth_SentCodeTypeEmailCode), [0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired), + [0xD9565C39] = typeof(Auth_SentCodeTypeFragmentSms), [0x36585EA4] = typeof(Messages_BotCallbackAnswer), [0x26B5DDE6] = typeof(Messages_MessageEditData), [0x890C3D89] = typeof(InputBotInlineMessageID), @@ -763,6 +764,7 @@ namespace TL [0xF06FE208] = typeof(ChannelAdminLogEventActionEditTopic), [0xAE168909] = typeof(ChannelAdminLogEventActionDeleteTopic), [0x5D8D353B] = typeof(ChannelAdminLogEventActionPinTopic), + [0x64F36DFC] = typeof(ChannelAdminLogEventActionToggleAntiSpam), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -1047,6 +1049,8 @@ namespace TL [0x023F109B] = typeof(ForumTopicDeleted), [0x71701DA9] = typeof(ForumTopic), [0x367617D3] = typeof(Messages_ForumTopics), + [0x43B46B20] = typeof(DefaultHistoryTTL), + [0x41BF109B] = typeof(ExportedContactToken), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 3b1b4a8..5718f70 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,7 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 149 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 150 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2022 MIT https://github.com/wiz0u/WTelegramClient