Upgrade to layer 150: Anti-Spam, web/contact tokens, chat TTL, hide topics, Fragment login

This commit is contained in:
Wizou 2022-12-07 13:36:49 +01:00
parent 231bf632e2
commit eb2577beed
5 changed files with 171 additions and 17 deletions

View file

@ -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)

View file

@ -1344,6 +1344,7 @@ namespace TL
{
/// <summary>Can we delete this channel?</summary>
can_delete_channel = 0x1,
antispam = 0x2,
}
/// <summary>ID of the channel</summary>
@ -2103,11 +2104,19 @@ namespace TL
public long[] users;
}
/// <summary>The Time-To-Live of messages in this chat was changed. <para>See <a href="https://corefork.telegram.org/constructor/messageActionSetMessagesTTL"/></para></summary>
[TLDef(0xAA1AFBFD)]
[TLDef(0x3C134D7B)]
public class MessageActionSetMessagesTTL : MessageAction
{
public Flags flags;
/// <summary>New Time-To-Live</summary>
public int period;
[IfFlag(0)] public long auto_setting_from;
[Flags] public enum Flags : uint
{
/// <summary>Field <see cref="auto_setting_from"/> has a value</summary>
has_auto_setting_from = 0x1,
}
}
/// <summary>A group call was scheduled <para>See <a href="https://corefork.telegram.org/constructor/messageActionGroupCallScheduled"/></para></summary>
[TLDef(0xB3A07661)]
@ -2168,19 +2177,21 @@ namespace TL
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/messageActionTopicEdit"/></para></summary>
[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; }
}
/// <summary>Chat <para>See <a href="https://corefork.telegram.org/constructor/dialog"/></para></summary>
[TLDef(0xA8EDD0F5)]
[TLDef(0xD58A08C6)]
public class Dialog : DialogBase
{
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></summary>
@ -2220,6 +2231,7 @@ namespace TL
[IfFlag(1)] public DraftMessageBase draft;
/// <summary><a href="https://corefork.telegram.org/api/folders#peer-folders">Peer folder ID, for more info click here</a></summary>
[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,
/// <summary>Field <see cref="folder_id"/> has a value</summary>
has_folder_id = 0x10,
/// <summary>Field <see cref="ttl_period"/> has a value</summary>
has_ttl_period = 0x20,
}
/// <summary>The chat</summary>
@ -7754,6 +7768,8 @@ namespace TL
FlashCall = 0x226CCEFB,
///<summary>The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user.</summary>
MissedCall = 0xD61AD6EE,
///<summary>See <a href="https://corefork.telegram.org/constructor/auth.codeTypeFragmentSms"/></summary>
FragmentSms = 0x06ED998C,
}
/// <summary>Type of the verification code that was sent <para>See <a href="https://corefork.telegram.org/type/auth.SentCodeType"/></para> <para>Derived classes: <see cref="Auth_SentCodeTypeApp"/>, <see cref="Auth_SentCodeTypeSms"/>, <see cref="Auth_SentCodeTypeCall"/>, <see cref="Auth_SentCodeTypeFlashCall"/>, <see cref="Auth_SentCodeTypeMissedCall"/>, <see cref="Auth_SentCodeTypeEmailCode"/>, <see cref="Auth_SentCodeTypeSetUpEmailRequired"/></para></summary>
@ -7831,6 +7847,12 @@ namespace TL
google_signin_allowed = 0x2,
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/auth.sentCodeTypeFragmentSms"/></para></summary>
[TLDef(0xD9565C39)]
public class Auth_SentCodeTypeFragmentSms : Auth_SentCodeTypeSms
{
public string url;
}
/// <summary>Callback answer sent by the bot in response to a button press <para>See <a href="https://corefork.telegram.org/constructor/messages.botCallbackAnswer"/></para></summary>
[TLDef(0x36585EA4)]
@ -10049,6 +10071,12 @@ namespace TL
has_new_topic = 0x2,
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/channelAdminLogEventActionToggleAntiSpam"/></para></summary>
[TLDef(0x64F36DFC)]
public class ChannelAdminLogEventActionToggleAntiSpam : ChannelAdminLogEventAction
{
public bool new_value;
}
/// <summary>Admin log event <para>See <a href="https://corefork.telegram.org/constructor/channelAdminLogEvent"/></para></summary>
[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
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/defaultHistoryTTL"/></para></summary>
[TLDef(0x43B46B20)]
public class DefaultHistoryTTL : IObject
{
public int period;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/exportedContactToken"/></para></summary>
[TLDef(0x41BF109B)]
public class ExportedContactToken : IObject
{
public string url;
public DateTime expires;
}
}

View file

@ -286,6 +286,15 @@ namespace TL
code = code,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/auth.importWebTokenAuthorization"/></para></summary>
public static Task<Auth_AuthorizationBase> 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,
});
/// <summary>Register device to receive <a href="https://corefork.telegram.org/api/push-updates">PUSH notifications</a> <para>See <a href="https://corefork.telegram.org/method/account.registerDevice"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/account.registerDevice#possible-errors">details</a>)</para></summary>
/// <param name="no_muted">Avoid receiving (silent and invisible background) notifications. Useful to save battery.</param>
/// <param name="token_type">Device token type, see <a href="https://corefork.telegram.org/api/push-updates#subscribing-to-notifications">PUSH updates</a> for the possible values.</param>
@ -1282,6 +1291,19 @@ namespace TL
phone = phone,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/contacts.exportContactToken"/></para></summary>
public static Task<ExportedContactToken> Contacts_ExportContactToken(this Client client)
=> client.Invoke(new Contacts_ExportContactToken
{
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/contacts.importContactToken"/></para></summary>
public static Task<UserBase> Contacts_ImportContactToken(this Client client, string token)
=> client.Invoke(new Contacts_ImportContactToken
{
token = token,
});
/// <summary><para>⚠ <b>This method is only for basic Chat</b>. See <see href="https://wiz0u.github.io/WTelegramClient/README#terminology">Terminology</see> to understand what this means<br/>Search for a similar method name starting with <c>Channels_</c> if you're dealing with a <see cref="Channel"/></para> Returns the list of messages by their IDs. <para>See <a href="https://corefork.telegram.org/method/messages.getMessages"/> [bots: ✓]</para></summary>
/// <param name="id">Message ID list</param>
public static Task<Messages_MessagesBase> Messages_GetMessages(this Client client, params InputMessage[] id)
@ -1603,11 +1625,13 @@ namespace TL
/// <summary>Creates a new chat. <para>See <a href="https://corefork.telegram.org/method/messages.createChat"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403,500 (<a href="https://corefork.telegram.org/method/messages.createChat#possible-errors">details</a>)</para></summary>
/// <param name="users">List of user IDs to be invited</param>
/// <param name="title">Chat name</param>
public static Task<UpdatesBase> Messages_CreateChat(this Client client, InputUserBase[] users, string title)
public static Task<UpdatesBase> 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(),
});
/// <summary>Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. <para>See <a href="https://corefork.telegram.org/method/messages.getDhConfig"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.getDhConfig#possible-errors">details</a>)</para></summary>
@ -3419,6 +3443,19 @@ namespace TL
id = id,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.setDefaultHistoryTTL"/></para></summary>
public static Task<bool> Messages_SetDefaultHistoryTTL(this Client client, int period)
=> client.Invoke(new Messages_SetDefaultHistoryTTL
{
period = period,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.getDefaultHistoryTTL"/></para></summary>
public static Task<DefaultHistoryTTL> Messages_GetDefaultHistoryTTL(this Client client)
=> client.Invoke(new Messages_GetDefaultHistoryTTL
{
});
/// <summary>Returns a current state of updates. <para>See <a href="https://corefork.telegram.org/method/updates.getState"/> [bots: ✓]</para></summary>
public static Task<Updates_State> Updates_GetState(this Client client)
=> client.Invoke(new Updates_GetState
@ -3867,14 +3904,15 @@ namespace TL
/// <param name="about">Channel description</param>
/// <param name="geo_point">Geogroup location</param>
/// <param name="address">Geogroup address</param>
public static Task<UpdatesBase> 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<UpdatesBase> 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(),
});
/// <summary>Modify the admin rights of a user in a <a href="https://corefork.telegram.org/api/channel">supergroup/channel</a>. <para>See <a href="https://corefork.telegram.org/method/channels.editAdmin"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400,403,406 (<a href="https://corefork.telegram.org/method/channels.editAdmin#possible-errors">details</a>)</para></summary>
@ -4268,15 +4306,16 @@ namespace TL
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/channels.editForumTopic"/></para></summary>
public static Task<UpdatesBase> Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default)
public static Task<UpdatesBase> 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(),
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/channels.updatePinnedForumTopic"/></para></summary>
@ -4305,6 +4344,22 @@ namespace TL
order = order,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/channels.toggleAntiSpam"/></para></summary>
public static Task<UpdatesBase> Channels_ToggleAntiSpam(this Client client, InputChannelBase channel, bool enabled)
=> client.Invoke(new Channels_ToggleAntiSpam
{
channel = channel,
enabled = enabled,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/channels.reportAntiSpamFalsePositive"/></para></summary>
public static Task<bool> Channels_ReportAntiSpamFalsePositive(this Client client, InputChannelBase channel, int msg_id)
=> client.Invoke(new Channels_ReportAntiSpamFalsePositive
{
channel = channel,
msg_id = msg_id,
});
/// <summary>Sends a custom request; for bots only <para>See <a href="https://corefork.telegram.org/method/bots.sendCustomRequest"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400,403 (<a href="https://corefork.telegram.org/method/bots.sendCustomRequest#possible-errors">details</a>)</para></summary>
/// <param name="custom_method">The method name</param>
/// <param name="params_">JSON-serialized method parameters</param>
@ -5274,6 +5329,14 @@ namespace TL.Methods
public string code;
}
[TLDef(0x2DB873A9)]
public class Auth_ImportWebTokenAuthorization : IMethod<Auth_AuthorizationBase>
{
public int api_id;
public string api_hash;
public string web_auth_token;
}
[TLDef(0xEC86017A)]
public class Account_RegisterDevice : IMethod<bool>
{
@ -6049,6 +6112,15 @@ namespace TL.Methods
public string phone;
}
[TLDef(0xF8654027)]
public class Contacts_ExportContactToken : IMethod<ExportedContactToken> { }
[TLDef(0x13005788)]
public class Contacts_ImportContactToken : IMethod<UserBase>
{
public string token;
}
[TLDef(0x63C66506)]
public class Messages_GetMessages : IMethod<Messages_MessagesBase>
{
@ -6324,11 +6396,18 @@ namespace TL.Methods
}
}
[TLDef(0x09CB126E)]
[TLDef(0x0034A818)]
public class Messages_CreateChat : IMethod<UpdatesBase>
{
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<bool>
{
public int period;
}
[TLDef(0x658B7188)]
public class Messages_GetDefaultHistoryTTL : IMethod<DefaultHistoryTTL> { }
[TLDef(0xEDD4882A)]
public class Updates_GetState : IMethod<Updates_State> { }
@ -8172,7 +8260,7 @@ namespace TL.Methods
public InputChannelBase channel;
}
[TLDef(0x3D5FB10F)]
[TLDef(0x91006707)]
public class Channels_CreateChannel : IMethod<UpdatesBase>
{
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<UpdatesBase>
{
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<UpdatesBase>
{
public InputChannelBase channel;
public bool enabled;
}
[TLDef(0xA850A693)]
public class Channels_ReportAntiSpamFalsePositive : IMethod<bool>
{
public InputChannelBase channel;
public int msg_id;
}
[TLDef(0xAA2769ED)]
public class Bots_SendCustomRequest : IMethod<DataJSON>
{

View file

@ -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),

View file

@ -13,7 +13,7 @@
<PackageId>WTelegramClient</PackageId>
<Version>0.0.0</Version>
<Authors>Wizou</Authors>
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 149&#10;&#10;Release Notes:&#10;$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</Description>
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 150&#10;&#10;Release Notes:&#10;$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</Description>
<Copyright>Copyright © Olivier Marcoux 2021-2022</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/wiz0u/WTelegramClient</PackageProjectUrl>