Compare commits

...

4 commits

Author SHA1 Message Date
Wizou 59425a910a api doc
Some checks failed
Dev build / build (push) Has been cancelled
2026-03-02 18:28:15 +01:00
Wizou bd311a3a4f TLDef.inheritBefore => inheritAt 2026-03-02 16:25:35 +01:00
Wizou 42fed13205 Making method Invoke virtual for library add-ons. 2026-02-27 16:40:53 +01:00
Wizou 3d4be8ee9a Update to Telegram API layer 222: gift crafting, keyboard buttons style, getFutureCreatorAfterLeave and more... 2026-02-06 20:27:00 +01:00
10 changed files with 574 additions and 178 deletions

View file

@ -1,4 +1,4 @@
[![API Layer](https://img.shields.io/badge/API_Layer-221-blueviolet)](https://corefork.telegram.org/methods)
[![API Layer](https://img.shields.io/badge/API_Layer-222-blueviolet)](https://corefork.telegram.org/methods)
[![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](https://www.nuget.org/packages/WTelegramClient/)
[![NuGet prerelease](https://img.shields.io/nuget/vpre/WTelegramClient?color=C09030&label=dev+nuget)](https://www.nuget.org/packages/WTelegramClient/absoluteLatest)
[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://buymeacoffee.com/wizou)

View file

@ -112,11 +112,12 @@ public class MTProtoGenerator : IIncrementalGenerator
.AppendLine("\t\t{")
.AppendLine($"\t\t\twriter.Write(0x{id:X8});");
var members = symbol.GetMembers().ToList();
int inheritIndex = 0;
for (var parent = symbol.BaseType; parent != object_; parent = parent.BaseType)
{
var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false;
if (inheritBefore) members.InsertRange(0, parent.GetMembers());
else members.AddRange(parent.GetMembers());
var inheritAt = (int?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritAt").Value.Value ?? -1;
if (inheritAt >= 0) members.InsertRange(inheritIndex += inheritAt, parent.GetMembers());
else { inheritIndex = members.Count; members.AddRange(parent.GetMembers()); }
tldef = parent.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute);
}
foreach (var member in members.OfType<IFieldSymbol>())

View file

@ -1584,7 +1584,7 @@ namespace WTelegram
/// <typeparam name="T">Expected type of the returned object</typeparam>
/// <param name="query">TL method structure</param>
/// <returns>Wait for the reply and return the resulting object, or throws an RpcException if an error was replied</returns>
public async Task<T> Invoke<T>(IMethod<T> query)
public virtual async Task<T> Invoke<T>(IMethod<T> query)
{
if (_dcSession.withoutUpdates && query is not IMethod<Pong> and not IMethod<FutureSalts>)
query = new TL.Methods.InvokeWithoutUpdates<T> { query = query };

View file

@ -25,17 +25,17 @@ namespace TL
public Int128 server_nonce;
public Int256 new_nonce;
}
[TLDef(0xA9F55F95, inheritBefore = true)] //p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data
[TLDef(0xA9F55F95, inheritAt = 0)] //p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data
public sealed partial class PQInnerDataDc : PQInnerData
{
public int dc;
}
[TLDef(0x3C6A84D4, inheritBefore = true)] //p_q_inner_data_temp#3c6a84d4 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data
[TLDef(0x3C6A84D4, inheritAt = 0)] //p_q_inner_data_temp#3c6a84d4 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data
public sealed partial class PQInnerDataTemp : PQInnerData
{
public int expires_in;
}
[TLDef(0x56FDDF88, inheritBefore = true)] //p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data
[TLDef(0x56FDDF88, inheritAt = 0)] //p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data
public sealed partial class PQInnerDataTempDc : PQInnerData
{
public int dc;
@ -57,12 +57,12 @@ namespace TL
public Int128 nonce;
public Int128 server_nonce;
}
[TLDef(0x79CB045D, inheritBefore = true)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params
[TLDef(0x79CB045D, inheritAt = 0)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params
public sealed partial class ServerDHParamsFail : ServerDHParams
{
public Int128 new_nonce_hash;
}
[TLDef(0xD0E8075C, inheritBefore = true)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params
[TLDef(0xD0E8075C, inheritAt = 0)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params
public sealed partial class ServerDHParamsOk : ServerDHParams
{
public byte[] encrypted_answer;
@ -93,17 +93,17 @@ namespace TL
public Int128 nonce;
public Int128 server_nonce;
}
[TLDef(0x3BCBF734, inheritBefore = true)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer
[TLDef(0x3BCBF734, inheritAt = 0)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer
public sealed partial class DhGenOk : SetClientDHParamsAnswer
{
public Int128 new_nonce_hash1;
}
[TLDef(0x46DC1FB9, inheritBefore = true)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer
[TLDef(0x46DC1FB9, inheritAt = 0)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer
public sealed partial class DhGenRetry : SetClientDHParamsAnswer
{
public Int128 new_nonce_hash2;
}
[TLDef(0xA69DAE02, inheritBefore = true)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer
[TLDef(0xA69DAE02, inheritAt = 0)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer
public sealed partial class DhGenFail : SetClientDHParamsAnswer
{
public Int128 new_nonce_hash3;
@ -130,7 +130,7 @@ namespace TL
public int bad_msg_seqno;
public int error_code;
}
[TLDef(0xEDAB447B, inheritBefore = true)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification
[TLDef(0xEDAB447B, inheritAt = 0)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification
public sealed partial class BadServerSalt : BadMsgNotification
{
public long new_server_salt;
@ -267,7 +267,7 @@ namespace TL
public int ipv4;
public int port;
}
[TLDef(0x37982646, inheritBefore = true)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort
[TLDef(0x37982646, inheritAt = 0)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort
public sealed partial class IpPortSecret : IpPort
{
public byte[] secret;

File diff suppressed because one or more lines are too long

View file

@ -387,7 +387,7 @@ namespace TL
mnc = mnc,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/auth.checkPaidAuth"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/auth.checkPaidAuth"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/auth.checkPaidAuth#possible-errors">details</a>)</para></summary>
public static Task<Auth_SentCodeBase> Auth_CheckPaidAuth(this Client client, string phone_number, string phone_code_hash, long form_id)
=> client.Invoke(new Auth_CheckPaidAuth
{
@ -396,7 +396,7 @@ namespace TL
form_id = form_id,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/auth.initPasskeyLogin"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/auth.initPasskeyLogin"/></para> <para>Possible <see cref="RpcException"/> codes: 400,500 (<a href="https://corefork.telegram.org/method/auth.initPasskeyLogin#possible-errors">details</a>)</para></summary>
public static Task<Auth_PasskeyLoginOptions> Auth_InitPasskeyLogin(this Client client, int api_id, string api_hash)
=> client.Invoke(new Auth_InitPasskeyLogin
{
@ -404,7 +404,7 @@ namespace TL
api_hash = api_hash,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/auth.finishPasskeyLogin"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/auth.finishPasskeyLogin"/></para> <para>Possible <see cref="RpcException"/> codes: 400,500 (<a href="https://corefork.telegram.org/method/auth.finishPasskeyLogin#possible-errors">details</a>)</para></summary>
public static Task<Auth_AuthorizationBase> Auth_FinishPasskeyLogin(this Client client, InputPasskeyCredential credential, int? from_dc_id = null, long? from_auth_key_id = null)
=> client.Invoke(new Auth_FinishPasskeyLogin
{
@ -1528,13 +1528,13 @@ namespace TL
hash = hash,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/account.initPasskeyRegistration"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/account.initPasskeyRegistration"/></para> <para>Possible <see cref="RpcException"/> codes: 403 (<a href="https://corefork.telegram.org/method/account.initPasskeyRegistration#possible-errors">details</a>)</para></summary>
public static Task<Account_PasskeyRegistrationOptions> Account_InitPasskeyRegistration(this Client client)
=> client.Invoke(new Account_InitPasskeyRegistration
{
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/account.registerPasskey"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/account.registerPasskey"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/account.registerPasskey#possible-errors">details</a>)</para></summary>
public static Task<Passkey> Account_RegisterPasskey(this Client client, InputPasskeyCredential credential)
=> client.Invoke(new Account_RegisterPasskey
{
@ -1588,7 +1588,7 @@ namespace TL
id = id,
});
/// <summary>Get songs <a href="https://corefork.telegram.org/api/profile#music">pinned to the user's profile, see here »</a> for more info. <para>See <a href="https://corefork.telegram.org/method/users.getSavedMusic"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/users.getSavedMusic#possible-errors">details</a>)</para></summary>
/// <summary>Get songs <a href="https://corefork.telegram.org/api/profile#music">pinned to the user's profile, see here »</a> for more info. <para>See <a href="https://corefork.telegram.org/method/users.getSavedMusic"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/users.getSavedMusic#possible-errors">details</a>)</para></summary>
/// <param name="id">The ID of the user.</param>
/// <param name="offset">Offset for pagination.</param>
/// <param name="limit">Maximum number of results to return, <a href="https://corefork.telegram.org/api/offsets">see pagination</a></param>
@ -1612,7 +1612,7 @@ namespace TL
documents = documents,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/users.suggestBirthday"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/users.suggestBirthday"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/users.suggestBirthday#possible-errors">details</a>)</para></summary>
public static Task<UpdatesBase> Users_SuggestBirthday(this Client client, InputUserBase id, Birthday birthday)
=> client.Invoke(new Users_SuggestBirthday
{
@ -1879,7 +1879,7 @@ namespace TL
q = q,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/contacts.updateContactNote"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/contacts.updateContactNote"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/contacts.updateContactNote#possible-errors">details</a>)</para></summary>
public static Task<bool> Contacts_UpdateContactNote(this Client client, InputUserBase id, TextWithEntities note)
=> client.Invoke(new Contacts_UpdateContactNote
{
@ -1915,7 +1915,7 @@ namespace TL
hash = hash,
});
/// <summary>Returns the conversation history with one interlocutor / within a chat <para>See <a href="https://corefork.telegram.org/method/messages.getHistory"/></para> <para>Possible <see cref="RpcException"/> codes: 400,406 (<a href="https://corefork.telegram.org/method/messages.getHistory#possible-errors">details</a>)</para></summary>
/// <summary>Returns the conversation history with one interlocutor / within a chat <para>See <a href="https://corefork.telegram.org/method/messages.getHistory"/></para> <para>Possible <see cref="RpcException"/> codes: 400,406,500 (<a href="https://corefork.telegram.org/method/messages.getHistory#possible-errors">details</a>)</para></summary>
/// <param name="peer">Target peer</param>
/// <param name="offset_id">Only return messages starting from the specified message ID</param>
/// <param name="offset_date">Only return messages sent before the specified date</param>
@ -2243,7 +2243,7 @@ namespace TL
user_id = user_id,
});
/// <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>
/// <summary>Creates a new chat. <para>See <a href="https://corefork.telegram.org/method/messages.createChat"/></para> <para>Possible <see cref="RpcException"/> codes: 400,406,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>
/// <param name="ttl_period">Time-to-live of all messages that will be sent in the chat: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use <see cref="Messages_SetDefaultHistoryTTL">Messages_SetDefaultHistoryTTL</see> to edit this value later.</param>
@ -2290,7 +2290,7 @@ namespace TL
key_fingerprint = key_fingerprint,
});
/// <summary>Cancels a request for creation and/or delete info on secret chat. <para>See <a href="https://corefork.telegram.org/method/messages.discardEncryption"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.discardEncryption#possible-errors">details</a>)</para></summary>
/// <summary>Cancels a request for creation and/or delete info on secret chat. <para>See <a href="https://corefork.telegram.org/method/messages.discardEncryption"/></para> <para>Possible <see cref="RpcException"/> codes: 400,500 (<a href="https://corefork.telegram.org/method/messages.discardEncryption#possible-errors">details</a>)</para></summary>
/// <param name="delete_history">Whether to delete the entire chat history for the other user as well</param>
/// <param name="chat_id">Secret chat ID</param>
public static Task<bool> Messages_DiscardEncryption(this Client client, int chat_id, bool delete_history = false)
@ -3085,7 +3085,7 @@ namespace TL
hash = hash,
});
/// <summary>Send an <a href="https://corefork.telegram.org/api/files#albums-grouped-media">album or grouped media</a> <para>See <a href="https://corefork.telegram.org/method/messages.sendMultiMedia"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400,403,420,500 (<a href="https://corefork.telegram.org/method/messages.sendMultiMedia#possible-errors">details</a>)</para></summary>
/// <summary>Send an <a href="https://corefork.telegram.org/api/files#albums-grouped-media">album or grouped media</a> <para>See <a href="https://corefork.telegram.org/method/messages.sendMultiMedia"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400,403,406,420,500 (<a href="https://corefork.telegram.org/method/messages.sendMultiMedia#possible-errors">details</a>)</para></summary>
/// <param name="silent">Whether to send the album silently (no notification triggered)</param>
/// <param name="background">Send in background?</param>
/// <param name="clear_draft">Whether to clear <a href="https://corefork.telegram.org/api/drafts">drafts</a></param>
@ -3308,10 +3308,10 @@ namespace TL
/// <param name="button_id">ID of the login button</param>
/// <param name="url">URL used for <a href="https://corefork.telegram.org/api/url-authorization#link-url-authorization">link URL authorization, click here for more info »</a></param>
/// <returns>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/urlAuthResultDefault">urlAuthResultDefault</a></returns>
public static Task<UrlAuthResult> Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, bool write_allowed = false)
public static Task<UrlAuthResult> Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, bool write_allowed = false, bool share_phone_number = false)
=> client.Invoke(new Messages_AcceptUrlAuth
{
flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0)),
flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0) | (share_phone_number ? 0x8 : 0)),
peer = peer,
msg_id = msg_id ?? default,
button_id = button_id ?? default,
@ -4863,7 +4863,7 @@ namespace TL
{
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.summarizeText"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/messages.summarizeText"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.summarizeText#possible-errors">details</a>)</para></summary>
public static Task<TextWithEntities> Messages_SummarizeText(this Client client, InputPeer peer, int id, string to_lang = null)
=> client.Invoke(new Messages_SummarizeText
{
@ -5367,7 +5367,7 @@ namespace TL
channel = channel,
});
/// <summary>Create a <a href="https://corefork.telegram.org/api/channel">supergroup/channel</a>. <para>See <a href="https://corefork.telegram.org/method/channels.createChannel"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403,500 (<a href="https://corefork.telegram.org/method/channels.createChannel#possible-errors">details</a>)</para></summary>
/// <summary>Create a <a href="https://corefork.telegram.org/api/channel">supergroup/channel</a>. <para>See <a href="https://corefork.telegram.org/method/channels.createChannel"/></para> <para>Possible <see cref="RpcException"/> codes: 400,406,500 (<a href="https://corefork.telegram.org/method/channels.createChannel#possible-errors">details</a>)</para></summary>
/// <param name="broadcast">Whether to create a <a href="https://corefork.telegram.org/api/channel">channel</a></param>
/// <param name="megagroup">Whether to create a <a href="https://corefork.telegram.org/api/channel">supergroup</a></param>
/// <param name="for_import">Whether the supergroup is being created to import messages from a foreign chat service using <see cref="Messages_InitHistoryImport">Messages_InitHistoryImport</see></param>
@ -5842,7 +5842,7 @@ namespace TL
restricted = restricted,
});
/// <summary>Globally search for posts from public <a href="https://corefork.telegram.org/api/channel">channels »</a> (<em>including</em> those we aren't a member of) containing either a specific hashtag, <em>or</em> a full text query. <para>See <a href="https://corefork.telegram.org/method/channels.searchPosts"/></para> <para>Possible <see cref="RpcException"/> codes: 420 (<a href="https://corefork.telegram.org/method/channels.searchPosts#possible-errors">details</a>)</para></summary>
/// <summary>Globally search for posts from public <a href="https://corefork.telegram.org/api/channel">channels »</a> (<em>including</em> those we aren't a member of) containing either a specific hashtag, <em>or</em> a full text query. <para>See <a href="https://corefork.telegram.org/method/channels.searchPosts"/></para> <para>Possible <see cref="RpcException"/> codes: 403,420 (<a href="https://corefork.telegram.org/method/channels.searchPosts#possible-errors">details</a>)</para></summary>
/// <param name="hashtag">The hashtag to search, without the <c>#</c> character.</param>
/// <param name="query">The full text query: each user has a limited amount of free full text search slots, after which payment is required, see <a href="https://corefork.telegram.org/api/search#posts-tab">here »</a> for more info on the full flow.</param>
/// <param name="offset_rate">Initially 0, then set to the <see cref="Messages_MessagesSlice"><c>next_rate</c> parameter of messages.messagesSlice</see>, or if that is absent, the <c>date</c> of the last returned message.</param>
@ -5914,6 +5914,13 @@ namespace TL
tab = tab,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/channels.getFutureCreatorAfterLeave"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/channels.getFutureCreatorAfterLeave#possible-errors">details</a>)</para></summary>
public static Task<UserBase> Channels_GetFutureCreatorAfterLeave(this Client client, InputChannelBase channel)
=> client.Invoke(new Channels_GetFutureCreatorAfterLeave
{
channel = channel,
});
/// <summary>Sends a custom request; for bots only <para>See <a href="https://corefork.telegram.org/method/bots.sendCustomRequest"/> [bots: ✓ users: ✗]</para> <para>Possible <see cref="RpcException"/> codes: 400 (<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>
@ -6667,7 +6674,7 @@ namespace TL
slug = slug,
});
/// <summary>Fetch the full list of <a href="https://corefork.telegram.org/api/gifts">gifts</a> owned by a peer. <para>See <a href="https://corefork.telegram.org/method/payments.getSavedStarGifts"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/payments.getSavedStarGifts#possible-errors">details</a>)</para></summary>
/// <summary>Fetch the full list of <a href="https://corefork.telegram.org/api/gifts">gifts</a> owned by a peer. <para>See <a href="https://corefork.telegram.org/method/payments.getSavedStarGifts"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/payments.getSavedStarGifts#possible-errors">details</a>)</para></summary>
/// <param name="exclude_unsaved">Exclude gifts not pinned on the profile.</param>
/// <param name="exclude_saved">Exclude gifts pinned on the profile.</param>
/// <param name="exclude_unlimited">Exclude gifts that do not have the <see cref="StarGift"/>.<c>limited</c> flag set.</param>
@ -6743,10 +6750,10 @@ namespace TL
/// <param name="attributes">Optionally filter gifts with the specified attributes. If no attributes of a specific type are specified, all attributes of that type are allowed.</param>
/// <param name="offset">Offset for pagination. If not equal to an empty string, <see cref="Payments_ResaleStarGifts"/>.<c>counters</c> will not be set to avoid returning the counters every time a new page is fetched.</param>
/// <param name="limit">Maximum number of results to return, <a href="https://corefork.telegram.org/api/offsets">see pagination</a></param>
public static Task<Payments_ResaleStarGifts> Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false)
public static Task<Payments_ResaleStarGifts> Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false, bool for_craft = false)
=> client.Invoke(new Payments_GetResaleStarGifts
{
flags = (Payments_GetResaleStarGifts.Flags)((attributes_hash != null ? 0x1 : 0) | (attributes != null ? 0x8 : 0) | (sort_by_price ? 0x2 : 0) | (sort_by_num ? 0x4 : 0)),
flags = (Payments_GetResaleStarGifts.Flags)((attributes_hash != null ? 0x1 : 0) | (attributes != null ? 0x8 : 0) | (sort_by_price ? 0x2 : 0) | (sort_by_num ? 0x4 : 0) | (for_craft ? 0x10 : 0)),
attributes_hash = attributes_hash ?? default,
gift_id = gift_id,
attributes = attributes,
@ -6842,7 +6849,7 @@ namespace TL
gift_id = gift_id,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.getStarGiftAuctionState"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.getStarGiftAuctionState"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/payments.getStarGiftAuctionState#possible-errors">details</a>)</para></summary>
public static Task<Payments_StarGiftAuctionState> Payments_GetStarGiftAuctionState(this Client client, InputStarGiftAuctionBase auction, int version)
=> client.Invoke(new Payments_GetStarGiftAuctionState
{
@ -6850,7 +6857,7 @@ namespace TL
version = version,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.getStarGiftAuctionAcquiredGifts"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.getStarGiftAuctionAcquiredGifts"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/payments.getStarGiftAuctionAcquiredGifts#possible-errors">details</a>)</para></summary>
public static Task<Payments_StarGiftAuctionAcquiredGifts> Payments_GetStarGiftAuctionAcquiredGifts(this Client client, long gift_id)
=> client.Invoke(new Payments_GetStarGiftAuctionAcquiredGifts
{
@ -6865,7 +6872,7 @@ namespace TL
hash = hash,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.resolveStarGiftOffer"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.resolveStarGiftOffer"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/payments.resolveStarGiftOffer#possible-errors">details</a>)</para></summary>
public static Task<UpdatesBase> Payments_ResolveStarGiftOffer(this Client client, int offer_msg_id, bool decline = false)
=> client.Invoke(new Payments_ResolveStarGiftOffer
{
@ -6873,7 +6880,8 @@ namespace TL
offer_msg_id = offer_msg_id,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.sendStarGiftOffer"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.sendStarGiftOffer"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/payments.sendStarGiftOffer#possible-errors">details</a>)</para></summary>
/// <param name="random_id"> <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
public static Task<UpdatesBase> Payments_SendStarGiftOffer(this Client client, InputPeer peer, string slug, StarsAmountBase price, int duration, long random_id, long? allow_paid_stars = null)
=> client.Invoke(new Payments_SendStarGiftOffer
{
@ -6886,13 +6894,30 @@ namespace TL
allow_paid_stars = allow_paid_stars ?? default,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.getStarGiftUpgradeAttributes"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.getStarGiftUpgradeAttributes"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/payments.getStarGiftUpgradeAttributes#possible-errors">details</a>)</para></summary>
public static Task<Payments_StarGiftUpgradeAttributes> Payments_GetStarGiftUpgradeAttributes(this Client client, long gift_id)
=> client.Invoke(new Payments_GetStarGiftUpgradeAttributes
{
gift_id = gift_id,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.getCraftStarGifts"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/payments.getCraftStarGifts#possible-errors">details</a>)</para></summary>
/// <param name="limit">Maximum number of results to return, <a href="https://corefork.telegram.org/api/offsets">see pagination</a></param>
public static Task<Payments_SavedStarGifts> Payments_GetCraftStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue)
=> client.Invoke(new Payments_GetCraftStarGifts
{
gift_id = gift_id,
offset = offset,
limit = limit,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/payments.craftStarGift"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/payments.craftStarGift#possible-errors">details</a>)</para></summary>
public static Task<UpdatesBase> Payments_CraftStarGift(this Client client, params InputSavedStarGift[] stargift)
=> client.Invoke(new Payments_CraftStarGift
{
stargift = stargift,
});
/// <summary>Create a stickerset. <para>See <a href="https://corefork.telegram.org/method/stickers.createStickerSet"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/stickers.createStickerSet#possible-errors">details</a>)</para></summary>
/// <param name="masks">Whether this is a mask stickerset</param>
/// <param name="emojis">Whether this is a <a href="https://corefork.telegram.org/api/custom-emoji">custom emoji</a> stickerset.</param>
@ -7029,7 +7054,7 @@ namespace TL
{
});
/// <summary>Start a telegram phone call <para>See <a href="https://corefork.telegram.org/method/phone.requestCall"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403 (<a href="https://corefork.telegram.org/method/phone.requestCall#possible-errors">details</a>)</para></summary>
/// <summary>Start a telegram phone call <para>See <a href="https://corefork.telegram.org/method/phone.requestCall"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403,500 (<a href="https://corefork.telegram.org/method/phone.requestCall#possible-errors">details</a>)</para></summary>
/// <param name="video">Whether to start a video call</param>
/// <param name="user_id">Destination of the phone call</param>
/// <param name="random_id">Random ID to avoid resending the same object</param>
@ -7145,7 +7170,7 @@ namespace TL
schedule_date = schedule_date ?? default,
});
/// <summary>Join a group call <para>See <a href="https://corefork.telegram.org/method/phone.joinGroupCall"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403 (<a href="https://corefork.telegram.org/method/phone.joinGroupCall#possible-errors">details</a>)</para></summary>
/// <summary>Join a group call <para>See <a href="https://corefork.telegram.org/method/phone.joinGroupCall"/></para> <para>Possible <see cref="RpcException"/> codes: 400,403,500 (<a href="https://corefork.telegram.org/method/phone.joinGroupCall#possible-errors">details</a>)</para></summary>
/// <param name="muted">If set, the user will be muted by default upon joining.</param>
/// <param name="video_stopped">If set, the user's video will be disabled by default upon joining.</param>
/// <param name="call">The group call</param>
@ -7462,7 +7487,8 @@ namespace TL
limit = limit,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.sendGroupCallMessage"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.sendGroupCallMessage"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/phone.sendGroupCallMessage#possible-errors">details</a>)</para></summary>
/// <param name="random_id"> <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
public static Task<UpdatesBase> Phone_SendGroupCallMessage(this Client client, InputGroupCallBase call, long random_id, TextWithEntities message, long? allow_paid_stars = null, InputPeer send_as = null)
=> client.Invoke(new Phone_SendGroupCallMessage
{
@ -7474,7 +7500,7 @@ namespace TL
send_as = send_as,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.sendGroupCallEncryptedMessage"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.sendGroupCallEncryptedMessage"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/phone.sendGroupCallEncryptedMessage#possible-errors">details</a>)</para></summary>
public static Task<bool> Phone_SendGroupCallEncryptedMessage(this Client client, InputGroupCallBase call, byte[] encrypted_message)
=> client.Invoke(new Phone_SendGroupCallEncryptedMessage
{
@ -7482,7 +7508,7 @@ namespace TL
encrypted_message = encrypted_message,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.deleteGroupCallMessages"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.deleteGroupCallMessages"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/phone.deleteGroupCallMessages#possible-errors">details</a>)</para></summary>
public static Task<UpdatesBase> Phone_DeleteGroupCallMessages(this Client client, InputGroupCallBase call, int[] messages, bool report_spam = false)
=> client.Invoke(new Phone_DeleteGroupCallMessages
{
@ -7491,7 +7517,7 @@ namespace TL
messages = messages,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.deleteGroupCallParticipantMessages"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.deleteGroupCallParticipantMessages"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/phone.deleteGroupCallParticipantMessages#possible-errors">details</a>)</para></summary>
public static Task<UpdatesBase> Phone_DeleteGroupCallParticipantMessages(this Client client, InputGroupCallBase call, InputPeer participant, bool report_spam = false)
=> client.Invoke(new Phone_DeleteGroupCallParticipantMessages
{
@ -7500,14 +7526,14 @@ namespace TL
participant = participant,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.getGroupCallStars"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.getGroupCallStars"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/phone.getGroupCallStars#possible-errors">details</a>)</para></summary>
public static Task<Phone_GroupCallStars> Phone_GetGroupCallStars(this Client client, InputGroupCallBase call)
=> client.Invoke(new Phone_GetGroupCallStars
{
call = call,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.saveDefaultSendAs"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/phone.saveDefaultSendAs"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/phone.saveDefaultSendAs#possible-errors">details</a>)</para></summary>
public static Task<bool> Phone_SaveDefaultSendAs(this Client client, InputGroupCallBase call, InputPeer send_as)
=> client.Invoke(new Phone_SaveDefaultSendAs
{
@ -8157,7 +8183,9 @@ namespace TL
limit = limit,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/stories.startLive"/></para></summary>
/// <summary><para>See <a href="https://corefork.telegram.org/method/stories.startLive"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/stories.startLive#possible-errors">details</a>)</para></summary>
/// <param name="entities"><a href="https://corefork.telegram.org/api/entities">Message entities for styled text</a></param>
/// <param name="random_id"> <para>You can use <see cref="WTelegram.Helpers.RandomLong"/></para></param>
public static Task<UpdatesBase> Stories_StartLive(this Client client, InputPeer peer, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, bool? messages_enabled = default, long? send_paid_messages_stars = null, bool pinned = false, bool noforwards = false, bool rtmp_stream = false)
=> client.Invoke(new Stories_StartLive
{
@ -11060,6 +11088,7 @@ namespace TL.Methods
write_allowed = 0x1,
has_peer = 0x2,
has_url = 0x4,
share_phone_number = 0x8,
}
}
@ -13190,6 +13219,12 @@ namespace TL.Methods
public ProfileTab tab;
}
[TLDef(0xA00918AF)]
public sealed partial class Channels_GetFutureCreatorAfterLeave : IMethod<UserBase>
{
public InputChannelBase channel;
}
[TLDef(0xAA2769ED)]
public sealed partial class Bots_SendCustomRequest : IMethod<DataJSON>
{
@ -13911,6 +13946,7 @@ namespace TL.Methods
sort_by_price = 0x2,
sort_by_num = 0x4,
has_attributes = 0x8,
for_craft = 0x10,
}
}
@ -14036,6 +14072,20 @@ namespace TL.Methods
public long gift_id;
}
[TLDef(0xFD05DD00)]
public sealed partial class Payments_GetCraftStarGifts : IMethod<Payments_SavedStarGifts>
{
public long gift_id;
public string offset;
public int limit;
}
[TLDef(0xB0F9684F)]
public sealed partial class Payments_CraftStarGift : IMethod<UpdatesBase>
{
public InputSavedStarGift[] stargift;
}
[TLDef(0x9021AB67)]
public sealed partial class Stickers_CreateStickerSet : IMethod<Messages_StickerSet>
{

View file

@ -571,7 +571,7 @@ namespace TL
}
/// <summary>Message entity representing a <a href="https://corefork.telegram.org/api/mentions">user mention</a>: for <em>creating</em> a mention use <see cref="InputMessageEntityMentionName"/>. <para>See <a href="https://corefork.telegram.org/constructor/messageEntityMentionName"/></para></summary>
[TLDef(0x352DCA58, inheritBefore = true)]
[TLDef(0x352DCA58, inheritAt = 0)]
public sealed partial class MessageEntityMentionName : MessageEntity
{
/// <summary>Identifier of the user that was mentioned</summary>

View file

@ -6,7 +6,7 @@ namespace TL
{
public static partial class Layer
{
public const int Version = 221; // fetched 01/03/2026 17:38:29
public const int Version = 222; // fetched 02/06/2026 19:18:24
internal const int SecretChats = 144;
internal const int MTProto2 = 73;
internal const uint VectorCtor = 0x1CB5C415;
@ -221,7 +221,7 @@ namespace TL
[0x45D5B021] = typeof(MessageActionGiftStars),
[0xB00C47A2] = typeof(MessageActionPrizeStars),
[0xEA2C31D3] = typeof(MessageActionStarGift),
[0x95728543] = typeof(MessageActionStarGiftUnique),
[0xE6C31522] = typeof(MessageActionStarGiftUnique),
[0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded),
[0x84B88578] = typeof(MessageActionPaidMessagesPrice),
[0x2FFE2F7A] = typeof(MessageActionConferenceCall),
@ -234,6 +234,8 @@ namespace TL
[0x2C8F2A25] = typeof(MessageActionSuggestBirthday),
[0x774278D4] = typeof(MessageActionStarGiftPurchaseOffer),
[0x73ADA76B] = typeof(MessageActionStarGiftPurchaseOfferDeclined),
[0xB07ED085] = typeof(MessageActionNewCreatorPending),
[0xE188503B] = typeof(MessageActionChangeCreator),
[0xD58A08C6] = typeof(Dialog),
[0x71BD134C] = typeof(DialogFolder),
[0x2331B22D] = typeof(PhotoEmpty),
@ -450,6 +452,7 @@ namespace TL
[0x48E246C2] = typeof(UpdateStarGiftAuctionState),
[0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState),
[0xFB9C547A] = typeof(UpdateEmojiGameInfo),
[0xAC072444] = typeof(UpdateStarGiftCraftFail),
[0xA56C2A3E] = typeof(Updates_State),
[0x5D75A138] = typeof(Updates_DifferenceEmpty),
[0x00F49CA0] = typeof(Updates_Difference),
@ -594,24 +597,24 @@ namespace TL
[0xD3F924EB] = null,//Messages_StickerSetNotModified
[0xC27AC8C7] = typeof(BotCommand),
[0x4D8A0299] = typeof(BotInfo),
[0xA2FA4880] = typeof(KeyboardButton),
[0x258AFF05] = typeof(KeyboardButtonUrl),
[0x35BBDB6B] = typeof(KeyboardButtonCallback),
[0xB16A6C29] = typeof(KeyboardButtonRequestPhone),
[0xFC796B3F] = typeof(KeyboardButtonRequestGeoLocation),
[0x93B9FBB5] = typeof(KeyboardButtonSwitchInline),
[0x50F41CCF] = typeof(KeyboardButtonGame),
[0xAFD93FBB] = typeof(KeyboardButtonBuy),
[0x10B78D29] = typeof(KeyboardButtonUrlAuth),
[0xD02E7FD4] = typeof(InputKeyboardButtonUrlAuth),
[0xBBC7515D] = typeof(KeyboardButtonRequestPoll),
[0xE988037B] = typeof(InputKeyboardButtonUserProfile),
[0x308660C1] = typeof(KeyboardButtonUserProfile),
[0x13767230] = typeof(KeyboardButtonWebView),
[0xA0C0505C] = typeof(KeyboardButtonSimpleWebView),
[0x53D7BFD8] = typeof(KeyboardButtonRequestPeer),
[0xC9662D05] = typeof(InputKeyboardButtonRequestPeer),
[0x75D2698E] = typeof(KeyboardButtonCopy),
[0x7D170CFF] = typeof(KeyboardButton),
[0xD80C25EC] = typeof(KeyboardButtonUrl),
[0xE62BC960] = typeof(KeyboardButtonCallback),
[0x417EFD8F] = typeof(KeyboardButtonRequestPhone),
[0xAA40F94D] = typeof(KeyboardButtonRequestGeoLocation),
[0x991399FC] = typeof(KeyboardButtonSwitchInline),
[0x89C590F9] = typeof(KeyboardButtonGame),
[0x3FA53905] = typeof(KeyboardButtonBuy),
[0xF51006F9] = typeof(KeyboardButtonUrlAuth),
[0x68013E72] = typeof(InputKeyboardButtonUrlAuth),
[0x7A11D782] = typeof(KeyboardButtonRequestPoll),
[0x7D5E07C7] = typeof(InputKeyboardButtonUserProfile),
[0xC0FD5D09] = typeof(KeyboardButtonUserProfile),
[0xE846B1A0] = typeof(KeyboardButtonWebView),
[0xE15C4370] = typeof(KeyboardButtonSimpleWebView),
[0x5B0F15F5] = typeof(KeyboardButtonRequestPeer),
[0x02B78156] = typeof(InputKeyboardButtonRequestPeer),
[0xBCC4AF10] = typeof(KeyboardButtonCopy),
[0x77608B83] = typeof(KeyboardButtonRow),
[0xA03E5B85] = typeof(ReplyKeyboardHide),
[0x86B40B08] = typeof(ReplyKeyboardForceReply),
@ -999,8 +1002,8 @@ namespace TL
[0xFBD2C296] = typeof(InputFolderPeer),
[0xE9BAA668] = typeof(FolderPeer),
[0xE844EBFF] = typeof(Messages_SearchCounter),
[0x92D33A0E] = typeof(UrlAuthResultRequest),
[0x8F8C0E4E] = typeof(UrlAuthResultAccepted),
[0x32FABF1A] = typeof(UrlAuthResultRequest),
[0x623A8FA0] = typeof(UrlAuthResultAccepted),
[0xA9D6DB1F] = null,//UrlAuthResultDefault
[0xBFB5AD8B] = null,//ChannelLocationEmpty
[0x209B82DB] = typeof(ChannelLocation),
@ -1389,7 +1392,7 @@ namespace TL
[0x94CE852A] = typeof(StarsGiveawayOption),
[0x54236209] = typeof(StarsGiveawayWinnersOption),
[0x313A9547] = typeof(StarGift),
[0x569D64C9] = typeof(StarGiftUnique),
[0x85F0A9CD] = typeof(StarGiftUnique),
[0xA388A368] = null,//Payments_StarGiftsNotModified
[0x2ED82995] = typeof(Payments_StarGifts),
[0x7903E3D9] = typeof(MessageReportOption),
@ -1409,16 +1412,16 @@ namespace TL
[0x82C9E290] = typeof(Messages_FoundStickers),
[0xB0CD6617] = typeof(BotVerifierSettings),
[0xF93CD45C] = typeof(BotVerification),
[0x39D99013] = typeof(StarGiftAttributeModel),
[0x13ACFF19] = typeof(StarGiftAttributePattern),
[0xD93D859C] = typeof(StarGiftAttributeBackdrop),
[0x565251E2] = typeof(StarGiftAttributeModel),
[0x4E7085EA] = typeof(StarGiftAttributePattern),
[0x9F2504E4] = typeof(StarGiftAttributeBackdrop),
[0xE0BFF26C] = typeof(StarGiftAttributeOriginalDetails),
[0x3DE1DFED] = typeof(Payments_StarGiftUpgradePreview),
[0x62D706B8] = typeof(Users_Users),
[0x315A4974] = typeof(Users_UsersSlice),
[0x416C56E8] = typeof(Payments_UniqueStarGift),
[0x8C9A88AC] = typeof(Messages_WebPagePreview),
[0xEAD6805E] = typeof(SavedStarGift),
[0x41DF43FC] = typeof(SavedStarGift),
[0x95F389B1] = typeof(Payments_SavedStarGifts),
[0x69279795] = typeof(InputSavedStarGiftUser),
[0xF101AA7F] = typeof(InputSavedStarGiftChat),
@ -1498,6 +1501,12 @@ namespace TL
[0xDA2AD647] = typeof(Messages_EmojiGameOutcome),
[0x59E65335] = typeof(Messages_EmojiGameUnavailable),
[0x44E56023] = typeof(Messages_EmojiGameDiceInfo),
[0x36437737] = typeof(StarGiftAttributeRarity),
[0xDBCE6389] = typeof(StarGiftAttributeRarityUncommon),
[0xF08D516B] = typeof(StarGiftAttributeRarityRare),
[0x78FBF3A8] = typeof(StarGiftAttributeRarityEpic),
[0xCEF7E7A8] = typeof(StarGiftAttributeRarityLegendary),
[0x4FDD3430] = typeof(KeyboardButtonStyle),
// from TL.Secret:
[0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument),
[0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote),

View file

@ -24,7 +24,7 @@ namespace TL
public sealed class TLDefAttribute(uint ctorNb) : Attribute
{
public readonly uint CtorNb = ctorNb;
public bool inheritBefore;
public int inheritAt = -1;
}
[AttributeUsage(AttributeTargets.Field)]
@ -68,8 +68,7 @@ namespace TL
var tlDef = type.GetCustomAttribute<TLDefAttribute>();
var ctorNb = tlDef.CtorNb;
writer.Write(ctorNb);
IEnumerable<FieldInfo> fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public);
if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g);
var fields = GetTLFields(type, tlDef);
ulong flags = 0;
IfFlagAttribute ifFlag;
foreach (var field in fields)
@ -98,8 +97,7 @@ namespace TL
if (type == null) return null; // nullable ctor (class meaning is associated with null)
var tlDef = type.GetCustomAttribute<TLDefAttribute>();
var obj = Activator.CreateInstance(type, true);
IEnumerable<FieldInfo> fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public);
if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g);
var fields = GetTLFields(type, tlDef);
ulong flags = 0;
IfFlagAttribute ifFlag;
foreach (var field in fields)
@ -115,6 +113,16 @@ namespace TL
#endif
}
#if !MTPG
static IEnumerable<FieldInfo> GetTLFields(Type type, TLDefAttribute tlDef)
{
if (!(tlDef?.inheritAt >= 0)) return type.GetFields(BindingFlags.Instance | BindingFlags.Public);
var fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
if (type.IsAbstract || type.BaseType == typeof(IObject)) return fields;
var subfields = GetTLFields(type.BaseType, type.BaseType.GetCustomAttribute<TLDefAttribute>());
return fields.Take(tlDef.inheritAt).Concat(subfields).Concat(fields.Skip(tlDef.inheritAt));
}
#else
public static IMethod<X> ReadTLMethod<X>(this BinaryReader reader)
{
uint ctorNb = reader.ReadUInt32();
@ -125,6 +133,7 @@ namespace TL
method = new BoolMethod { query = method };
return (IMethod<X>)method;
}
#endif
internal static void WriteTLValue(this BinaryWriter writer, object value, Type valueType)
{
@ -490,6 +499,10 @@ namespace TL
public sealed class BoolMethod : IMethod<object>
{
public IObject query;
#if MTPG
public void WriteTL(BinaryWriter writer) => query.WriteTL(writer);
#else
public void WriteTL(BinaryWriter writer) => writer.WriteTLObject(query);
#endif
}
}

View file

@ -13,8 +13,8 @@
<PackageId>WTelegramClient</PackageId>
<Authors>Wizou</Authors>
<VersionPrefix>0.0.0</VersionPrefix>
<VersionSuffix>layer.221</VersionSuffix>
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 221
<VersionSuffix>layer.222</VersionSuffix>
<Description>Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 222
Release Notes:
$(ReleaseNotes)</Description>