more 'params' arguments

This commit is contained in:
Wizou 2022-09-14 18:22:52 +02:00
parent b1649839d9
commit 11a9ca8631
5 changed files with 75 additions and 61 deletions

View file

@ -26,10 +26,12 @@ static async Task Main(string[] _)
Console.WriteLine($"We are logged-in as {my.username ?? my.first_name + " " + my.last_name} (id {my.id})");
}
```
When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's [API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers.
When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's
[API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers.
Those api hash/id represent your application and one can be used for handling many user accounts.
Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code** that will be sent to this user (for example through SMS or another Telegram client app the user is connected to).
Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code**
that will be sent to this user (for example through SMS, Email, or another Telegram client app the user is connected to).
If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up
*(register their account by accepting the Terms of Service)* and provide their **first_name** and **last_name**.
@ -42,9 +44,11 @@ All those API methods require `using TL;` namespace and are called with an under
# Saved session
If you run this program again, you will notice that only **api_hash** is requested, the other prompts are gone and you are automatically logged-on and ready to go.
This is because WTelegramClient saves (typically in the encrypted file **bin\WTelegram.session**) its state and the authentication keys that were negotiated with Telegram so that you needn't sign-in again every time.
This is because WTelegramClient saves (typically in the encrypted file **bin\WTelegram.session**) its state
and the authentication keys that were negotiated with Telegram so that you needn't sign-in again every time.
That file path is configurable (session_pathname), and under various circumstances (changing user or server address) you may want to change it or simply delete the existing session file in order to restart the authentification process.
That file path is configurable (session_pathname), and under various circumstances (changing user or server address)
you may want to change it or simply delete the existing session file in order to restart the authentification process.
# Non-interactive configuration
Your next step will probably be to provide a configuration to the client so that the required elements are not prompted through the Console but answered by your program.
@ -83,13 +87,17 @@ Its `int` argument is the log severity, compatible with the [LogLevel enum](http
# Example of API call
> The Telegram API makes extensive usage of base and derived classes, so be ready to use the various syntaxes C# offer to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` )
> The Telegram API makes extensive usage of base and derived classes, so be ready to use the various C# syntaxes
to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` )
All the Telegram API classes/methods are fully documented through Intellisense: Place your mouse over a class/method name, or start typing the call arguments to see a tooltip displaying their description, the list of derived classes and a web link to the official API page.
All the Telegram API classes/methods are fully documented through Intellisense: Place your mouse over a class/method name,
or start typing the call arguments to see a tooltip displaying their description, the list of derived classes and a web link to the official API page.
The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace, and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`.
The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace,
and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`.
Below is an example of calling the [messages.getAllChats](https://corefork.telegram.org/method/messages.getAllChats) API function, enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message:
Below is an example of calling the [messages.getAllChats](https://corefork.telegram.org/method/messages.getAllChats) API function,
enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message:
```csharp
using TL;
...
@ -115,14 +123,17 @@ Console.WriteLine($"Sending a message in chat {chatId}: {target.Title}");
await client.SendMessageAsync(target, "Hello, World");
```
➡️ You can find lots of useful code snippets in [EXAMPLES.md](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md) and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples).
➡️ You can find lots of useful code snippets in [EXAMPLES.md](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md)
and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples).
<a name="terminology"></a>
# Terminology in Telegram Client API
In the API, Telegram uses some terms/classnames that can be confusing as they differ from the terms shown to end-users:
- `Channel` : A (large or public) chat group *(sometimes called [supergroup](https://corefork.telegram.org/api/channel#supergroups))* or a [broadcast channel](https://corefork.telegram.org/api/channel#channels) (the `broadcast` flag differentiate those)
- `Chat` : A private [basic chat group](https://corefork.telegram.org/api/channel#basic-groups) with less than 200 members (it may be migrated to a supergroup `Channel` with a new ID when it gets bigger or public, in which case the old `Chat` will still exist but be `deactivated`)
- `Channel` : A (large or public) chat group *(sometimes called [supergroup](https://corefork.telegram.org/api/channel#supergroups))*
or a [broadcast channel](https://corefork.telegram.org/api/channel#channels) (the `broadcast` flag differentiate those)
- `Chat` : A private [basic chat group](https://corefork.telegram.org/api/channel#basic-groups) with less than 200 members
(it may be migrated to a supergroup `Channel` with a new ID when it gets bigger or public, in which case the old `Chat` will still exist but be `deactivated`)
**⚠️ Most chat groups you see are really of type `Channel`, not `Chat`!**
- chats : In plural or general meaning, it means either `Chat` or `Channel`
- `Peer` : Either a `Chat`, a `Channel` or a `User`
@ -133,13 +144,15 @@ See [FAQ #4](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access-
# Other things to know
The Client class also offers an `OnUpdate` event that is triggered when Telegram servers sends Updates (like new messages or status), independently of your API requests. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs)
The Client class also offers an `OnUpdate` event that is triggered when Telegram servers sends Updates (like new messages or status), independently of your API requests.
See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs)
An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem.
The other configuration items that you can override include: **session_pathname, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id**
Optional API parameters have a default value of `null` when unset. Passing `null` for a required string/array is the same as *empty* (0-length). Required API parameters/fields can sometimes be set to 0 or `null` when unused (check API documentation or experiment).
Optional API parameters have a default value of `null` when unset. Passing `null` for a required string/array is the same as *empty* (0-length).
Required API parameters/fields can sometimes be set to 0 or `null` when unused (check API documentation or experiment).
I've added several useful converters, implicit cast or helper properties to various API objects so that they are more easy to manipulate.
@ -157,7 +170,8 @@ This library can be used for any Telegram scenarios including:
It has been tested in a Console app, [in a WinForms app](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#gui),
[in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#logging), and in Xamarin/Android.
Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) as well as the [API Terms of Service](https://core.telegram.org/api/terms) or you might get banned from Telegram servers.
Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos)
as well as the [API Terms of Service](https://core.telegram.org/api/terms) or you might get banned from Telegram servers.
Developers feedback is welcome in the Telegram support group [@WTelegramClient](https://t.me/WTelegramClient)
You can also check our [📖 Frequently Asked Questions](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md) for more help and troubleshooting guide.

View file

@ -870,7 +870,7 @@ namespace WTelegram
{
try
{
var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this calls also reenable incoming Updates
var users = await this.Users_GetUsers(InputUser.Self); // this calls also reenable incoming Updates
var self = users[0] as User;
if (self.id == long.Parse(botToken.Split(':')[0]))
{
@ -905,7 +905,7 @@ namespace WTelegram
{
try
{
var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this call also reenable incoming Updates
var users = await this.Users_GetUsers(InputUser.Self); // this call also reenable incoming Updates
var self = users[0] as User;
// check user_id or phone_number match currently logged-in user
if ((long.TryParse(_config("user_id"), out long id) && (id == -1 || self.id == id)) ||

View file

@ -370,7 +370,7 @@ namespace TL
public string provider;
/// <summary>JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.</summary>
public DataJSON provider_data;
/// <summary>Unique <a href="https://corefork.telegram.org/api/links#not-invoice">bot deep links start parameter</a>. If present, forwarded copies of the sent message will have a URL button with a <a href="https://corefork.telegram.org/api/links#bot-links">deep link</a> to the bot (instead of a Pay button), with the value used as the start parameter. If absent, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice.</summary>
/// <summary>Unique <a href="https://corefork.telegram.org/api/links#bot-links">bot deep links start parameter</a>. If present, forwarded copies of the sent message will have a URL button with a <a href="https://corefork.telegram.org/api/links#bot-links">deep link</a> to the bot (instead of a Pay button), with the value used as the start parameter. If absent, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice.</summary>
[IfFlag(1)] public string start_param;
[Flags] public enum Flags : uint
@ -794,7 +794,7 @@ namespace TL
{
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></summary>
public Flags flags;
/// <summary>Identifier of the respective photo<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-2">Layer 2</a></summary>
/// <summary>Identifier of the respective photo</summary>
public long photo_id;
/// <summary><a href="https://corefork.telegram.org/api/files#stripped-thumbnails">Stripped thumbnail</a></summary>
[IfFlag(1)] public byte[] stripped_thumb;
@ -2604,7 +2604,7 @@ namespace TL
default_ = 0x2,
/// <summary>Field <see cref="settings"/> has a value</summary>
has_settings = 0x4,
/// <summary>Whether this is a <a href="https://corefork.telegram.org/api/wallpapers#pattern-wallpaper">pattern wallpaper »</a></summary>
/// <summary>Whether this is a <a href="https://corefork.telegram.org/api/wallpapers#pattern-wallpapers">pattern wallpaper »</a></summary>
pattern = 0x8,
/// <summary>Whether this wallpaper should be used in dark mode.</summary>
dark = 0x10,
@ -2796,7 +2796,7 @@ namespace TL
public ImportedContact[] imported;
/// <summary>Popular contacts</summary>
public PopularContact[] popular_invites;
/// <summary>List of contact ids that could not be imported due to system limitation and will need to be imported at a later date.<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-13">Layer 13</a></summary>
/// <summary>List of contact ids that could not be imported due to system limitation and will need to be imported at a later date.</summary>
public long[] retry_contacts;
/// <summary>List of users</summary>
public Dictionary<long, User> users;
@ -3106,7 +3106,7 @@ namespace TL
{
/// <summary>User id</summary>
public long user_id;
/// <summary>Action type<br/>Param added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>Action type</summary>
public SendMessageAction action;
}
/// <summary>The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing <para>See <a href="https://corefork.telegram.org/constructor/updateChatUserTyping"/></para></summary>
@ -3115,7 +3115,7 @@ namespace TL
{
/// <summary>Peer that started typing (can be the chat itself, in case of anonymous admins).</summary>
public Peer from_id;
/// <summary>Type of action<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>Type of action</summary>
public SendMessageAction action;
}
/// <summary>Composition of chat participants changed. <para>See <a href="https://corefork.telegram.org/constructor/updateChatParticipants"/></para></summary>
@ -3144,7 +3144,7 @@ namespace TL
public string first_name;
/// <summary>New last name. Corresponds to the new value of <strong>real_last_name</strong> field of the <see cref="UserFull"/>.</summary>
public string last_name;
/// <summary>New username.<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-18">Layer 18</a>.</summary>
/// <summary>New username.</summary>
public string username;
}
/// <summary>Change of contact's profile photo. <para>See <a href="https://corefork.telegram.org/constructor/updateUserPhoto"/></para></summary>
@ -4150,7 +4150,7 @@ namespace TL
presentation = 0x1,
}
}
/// <summary>The <a href="https://corefork.telegram.org/bots/api#june-25-2021">command set</a> of a certain bot in a certain chat has changed. <para>See <a href="https://corefork.telegram.org/constructor/updateBotCommands"/></para></summary>
/// <summary>The <a href="https://corefork.telegram.org/api/bots/commands">command set</a> of a certain bot in a certain chat has changed. <para>See <a href="https://corefork.telegram.org/constructor/updateBotCommands"/></para></summary>
[TLDef(0x4D712F2E)]
public class UpdateBotCommands : Update
{
@ -13148,7 +13148,7 @@ namespace TL
{
/// <summary>Whether this bot attachment menu entry should be shown in the attachment menu (toggle using <a href="https://corefork.telegram.org/method/messages.toggleBotInAttachMenu">messages.toggleBotInAttachMenu</a>)</summary>
inactive = 0x1,
/// <summary>True, if the bot supports the <a href="https://corefork.telegram.org/api/bots/webapps#settings_button_pressed">"settings_button_pressed" event »</a></summary>
/// <summary>True, if the bot supports the <a href="https://corefork.telegram.org/api/bots/webapps#settings-button-pressed">"settings_button_pressed" event »</a></summary>
has_settings = 0x2,
}
}
@ -13317,7 +13317,7 @@ namespace TL
[TLDef(0xAED0CBD9)]
public class Payments_ExportedInvoice : IObject
{
/// <summary>Exported <a href="https://corefork.telegram.org/api/links#invoice-link">invoice deep link</a></summary>
/// <summary>Exported <a href="https://corefork.telegram.org/api/links#invoice-links">invoice deep link</a></summary>
public string url;
}

View file

@ -307,7 +307,7 @@ namespace TL
/// <param name="token_type">Device token type.<br/><strong>Possible values</strong>:<br/><c>1</c> - APNS (device token for apple push)<br/><c>2</c> - FCM (firebase token for google firebase)<br/><c>3</c> - MPNS (channel URI for microsoft push)<br/><c>4</c> - Simple push (endpoint for firefox's simple push API)<br/><c>5</c> - Ubuntu phone (token for ubuntu push)<br/><c>6</c> - Blackberry (token for blackberry push)<br/><c>7</c> - Unused<br/><c>8</c> - WNS (windows push)<br/><c>9</c> - APNS VoIP (token for apple push VoIP)<br/><c>10</c> - Web push (web push, see below)<br/><c>11</c> - MPNS VoIP (token for microsoft push VoIP)<br/><c>12</c> - Tizen (token for tizen push)<br/><br/>For <c>10</c> web push, the token must be a JSON-encoded object containing the keys described in <a href="https://corefork.telegram.org/api/push-updates">PUSH updates</a></param>
/// <param name="token">Device token</param>
/// <param name="other_uids">List of user identifiers of other users currently using the client</param>
public static Task<bool> Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids)
public static Task<bool> Account_UnregisterDevice(this Client client, int token_type, string token, params long[] other_uids)
=> client.Invoke(new Account_UnregisterDevice
{
token_type = token_type,
@ -935,7 +935,7 @@ namespace TL
message = message,
});
/// <summary>Initiate a 2FA password reset: can only be used if the user is already logged-in, <a href="https://corefork.telegram.org/api/srp#password-reset">see here for more info »</a> <para>See <a href="https://corefork.telegram.org/method/account.resetPassword"/></para></summary>
/// <summary>Initiate a 2FA password reset: can only be used if the user is already logged-in, <a href="https://corefork.telegram.org/api/srp#password-reset">see here for more info »</a> <para>See <a href="https://corefork.telegram.org/method/account.resetPassword"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/account.resetPassword#possible-errors">details</a>)</para></summary>
public static Task<Account_ResetPasswordResult> Account_ResetPassword(this Client client)
=> client.Invoke(new Account_ResetPassword
{
@ -1104,7 +1104,7 @@ namespace TL
/// <summary>Delete contacts by phone number <para>See <a href="https://corefork.telegram.org/method/contacts.deleteByPhones"/></para></summary>
/// <param name="phones">Phone numbers</param>
public static Task<bool> Contacts_DeleteByPhones(this Client client, string[] phones)
public static Task<bool> Contacts_DeleteByPhones(this Client client, params string[] phones)
=> client.Invoke(new Contacts_DeleteByPhones
{
phones = phones,
@ -1393,7 +1393,7 @@ namespace TL
/// <summary>Sends a current user typing event (see <see cref="SendMessageAction"/> for all event types) to a conversation partner or group. <para>See <a href="https://corefork.telegram.org/method/messages.setTyping"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400,403 (<a href="https://corefork.telegram.org/method/messages.setTyping#possible-errors">details</a>)</para></summary>
/// <param name="peer">Target user or group</param>
/// <param name="top_msg_id"><a href="https://corefork.telegram.org/api/threads">Thread ID</a></param>
/// <param name="action">Type of action<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</param>
/// <param name="action">Type of action</param>
public static Task<bool> Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null)
=> client.Invoke(new Messages_SetTyping
{
@ -1517,7 +1517,7 @@ namespace TL
/// <summary><para>⚠ <b>This method is only for basic Chat</b>. See <see href="https://github.com/wiz0u/WTelegramClient/blob/master/README.md#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 chat basic info on their IDs. <para>See <a href="https://corefork.telegram.org/method/messages.getChats"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.getChats#possible-errors">details</a>)</para></summary>
/// <param name="id">List of chat IDs</param>
public static Task<Messages_Chats> Messages_GetChats(this Client client, long[] id)
public static Task<Messages_Chats> Messages_GetChats(this Client client, params long[] id)
=> client.Invoke(new Messages_GetChats
{
id = id,
@ -1709,7 +1709,7 @@ namespace TL
/// <summary><para>⚠ <b>This method is only for basic Chat</b>. See <see href="https://github.com/wiz0u/WTelegramClient/blob/master/README.md#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> Notifies the sender about the recipient having listened a voice message or watched a video. <para>See <a href="https://corefork.telegram.org/method/messages.readMessageContents"/></para></summary>
/// <param name="id">Message ID list</param>
public static Task<Messages_AffectedMessages> Messages_ReadMessageContents(this Client client, int[] id)
public static Task<Messages_AffectedMessages> Messages_ReadMessageContents(this Client client, params int[] id)
=> client.Invoke(new Messages_ReadMessageContents
{
id = id,
@ -2105,7 +2105,7 @@ namespace TL
/// <summary>Mark new featured stickers as read <para>See <a href="https://corefork.telegram.org/method/messages.readFeaturedStickers"/></para></summary>
/// <param name="id">IDs of stickersets to mark as read</param>
public static Task<bool> Messages_ReadFeaturedStickers(this Client client, long[] id)
public static Task<bool> Messages_ReadFeaturedStickers(this Client client, params long[] id)
=> client.Invoke(new Messages_ReadFeaturedStickers
{
id = id,
@ -2482,7 +2482,7 @@ namespace TL
/// <param name="peer">The chat where the poll was sent</param>
/// <param name="msg_id">The message ID of the poll</param>
/// <param name="options">The options that were chosen</param>
public static Task<UpdatesBase> Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options)
public static Task<UpdatesBase> Messages_SendVote(this Client client, InputPeer peer, int msg_id, params byte[][] options)
=> client.Invoke(new Messages_SendVote
{
peer = peer,
@ -2548,7 +2548,7 @@ namespace TL
/// <summary>Get info about an emoji keyword localization <para>See <a href="https://corefork.telegram.org/method/messages.getEmojiKeywordsLanguages"/></para></summary>
/// <param name="lang_codes">Language codes</param>
public static Task<EmojiLanguage[]> Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes)
public static Task<EmojiLanguage[]> Messages_GetEmojiKeywordsLanguages(this Client client, params string[] lang_codes)
=> client.Invoke(new Messages_GetEmojiKeywordsLanguages
{
lang_codes = lang_codes,
@ -2624,7 +2624,7 @@ namespace TL
/// <summary>Get scheduled messages <para>See <a href="https://corefork.telegram.org/method/messages.getScheduledMessages"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.getScheduledMessages#possible-errors">details</a>)</para></summary>
/// <param name="peer">Peer</param>
/// <param name="id">IDs of scheduled messages</param>
public static Task<Messages_MessagesBase> Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id)
public static Task<Messages_MessagesBase> Messages_GetScheduledMessages(this Client client, InputPeer peer, params int[] id)
=> client.Invoke(new Messages_GetScheduledMessages
{
peer = peer,
@ -2634,7 +2634,7 @@ namespace TL
/// <summary>Send scheduled messages right away <para>See <a href="https://corefork.telegram.org/method/messages.sendScheduledMessages"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.sendScheduledMessages#possible-errors">details</a>)</para></summary>
/// <param name="peer">Peer</param>
/// <param name="id">Scheduled message IDs</param>
public static Task<UpdatesBase> Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id)
public static Task<UpdatesBase> Messages_SendScheduledMessages(this Client client, InputPeer peer, params int[] id)
=> client.Invoke(new Messages_SendScheduledMessages
{
peer = peer,
@ -2644,7 +2644,7 @@ namespace TL
/// <summary>Delete scheduled messages <para>See <a href="https://corefork.telegram.org/method/messages.deleteScheduledMessages"/></para></summary>
/// <param name="peer">Peer</param>
/// <param name="id">Scheduled message IDs</param>
public static Task<UpdatesBase> Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id)
public static Task<UpdatesBase> Messages_DeleteScheduledMessages(this Client client, InputPeer peer, params int[] id)
=> client.Invoke(new Messages_DeleteScheduledMessages
{
peer = peer,
@ -2705,7 +2705,7 @@ namespace TL
/// <summary>Reorder <a href="https://corefork.telegram.org/api/folders">folders</a> <para>See <a href="https://corefork.telegram.org/method/messages.updateDialogFiltersOrder"/></para></summary>
/// <param name="order">New <a href="https://corefork.telegram.org/api/folders">folder</a> order</param>
public static Task<bool> Messages_UpdateDialogFiltersOrder(this Client client, int[] order)
public static Task<bool> Messages_UpdateDialogFiltersOrder(this Client client, params int[] order)
=> client.Invoke(new Messages_UpdateDialogFiltersOrder
{
order = order,
@ -3061,7 +3061,7 @@ namespace TL
/// <summary>Get <a href="https://corefork.telegram.org/api/reactions">message reactions »</a> <para>See <a href="https://corefork.telegram.org/method/messages.getMessagesReactions"/></para></summary>
/// <param name="peer">Peer</param>
/// <param name="id">Message IDs</param>
public static Task<UpdatesBase> Messages_GetMessagesReactions(this Client client, InputPeer peer, int[] id)
public static Task<UpdatesBase> Messages_GetMessagesReactions(this Client client, InputPeer peer, params int[] id)
=> client.Invoke(new Messages_GetMessagesReactions
{
peer = peer,
@ -3264,7 +3264,7 @@ namespace TL
/// <param name="bot">Bot that owns the web app</param>
/// <param name="random_id">Unique client message ID to prevent duplicate sending of the same event</param>
/// <param name="button_text">Text of the <see cref="KeyboardButtonSimpleWebView"/> that was pressed to open the web app.</param>
/// <param name="data">Data to relay to the bot, obtained from a <a href="https://corefork.telegram.org/api/web-events#web_app_data_send"><c>web_app_data_send</c> JS event</a>.</param>
/// <param name="data">Data to relay to the bot, obtained from a <a href="https://corefork.telegram.org/api/web-events#web-app-data-send"><c>web_app_data_send</c> JS event</a>.</param>
public static Task<UpdatesBase> Messages_SendWebViewData(this Client client, InputUserBase bot, long random_id, string button_text, string data)
=> client.Invoke(new Messages_SendWebViewData
{
@ -3300,7 +3300,7 @@ namespace TL
/// <summary>Fetch <a href="https://corefork.telegram.org/api/custom-emoji">custom emoji stickers »</a>. <para>See <a href="https://corefork.telegram.org/method/messages.getCustomEmojiDocuments"/> [bots: ✓]</para></summary>
/// <param name="document_id"><a href="https://corefork.telegram.org/api/custom-emoji">Custom emoji</a> IDs from a <see cref="MessageEntityCustomEmoji"/>.</param>
public static Task<DocumentBase[]> Messages_GetCustomEmojiDocuments(this Client client, long[] document_id)
public static Task<DocumentBase[]> Messages_GetCustomEmojiDocuments(this Client client, params long[] document_id)
=> client.Invoke(new Messages_GetCustomEmojiDocuments
{
document_id = document_id,
@ -3705,7 +3705,7 @@ namespace TL
hash = hash,
});
/// <summary>Get Telegram Premim promotion information <para>See <a href="https://corefork.telegram.org/method/help.getPremiumPromo"/></para></summary>
/// <summary>Get Telegram Premium promotion information <para>See <a href="https://corefork.telegram.org/method/help.getPremiumPromo"/></para></summary>
public static Task<Help_PremiumPromo> Help_GetPremiumPromo(this Client client)
=> client.Invoke(new Help_GetPremiumPromo
{
@ -3724,7 +3724,7 @@ namespace TL
/// <summary>Delete messages in a <a href="https://corefork.telegram.org/api/channel">channel/supergroup</a> <para>See <a href="https://corefork.telegram.org/method/channels.deleteMessages"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400,403 (<a href="https://corefork.telegram.org/method/channels.deleteMessages#possible-errors">details</a>)</para></summary>
/// <param name="channel"><a href="https://corefork.telegram.org/api/channel">Channel/supergroup</a></param>
/// <param name="id">IDs of messages to delete</param>
public static Task<Messages_AffectedMessages> Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id)
public static Task<Messages_AffectedMessages> Channels_DeleteMessages(this Client client, InputChannelBase channel, params int[] id)
=> client.Invoke(new Channels_DeleteMessages
{
channel = channel,
@ -3735,7 +3735,7 @@ namespace TL
/// <param name="channel">Supergroup</param>
/// <param name="participant">Participant whose messages should be reported</param>
/// <param name="id">IDs of spam messages</param>
public static Task<bool> Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, int[] id)
public static Task<bool> Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, params int[] id)
=> client.Invoke(new Channels_ReportSpam
{
channel = channel,
@ -3980,7 +3980,7 @@ namespace TL
/// <summary>Mark <a href="https://corefork.telegram.org/api/channel">channel/supergroup</a> message contents as read <para>See <a href="https://corefork.telegram.org/method/channels.readMessageContents"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/channels.readMessageContents#possible-errors">details</a>)</para></summary>
/// <param name="channel"><a href="https://corefork.telegram.org/api/channel">Channel/supergroup</a></param>
/// <param name="id">IDs of messages whose contents should be marked as read</param>
public static Task<bool> Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id)
public static Task<bool> Channels_ReadMessageContents(this Client client, InputChannelBase channel, params int[] id)
=> client.Invoke(new Channels_ReadMessageContents
{
channel = channel,
@ -4169,7 +4169,7 @@ namespace TL
commands = commands,
});
/// <summary>Clear bot commands for the specified bot scope and language code <para>See <a href="https://corefork.telegram.org/method/bots.resetBotCommands"/> [bots: ✓]</para></summary>
/// <summary>Clear bot commands for the specified bot scope and language code <para>See <a href="https://corefork.telegram.org/method/bots.resetBotCommands"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/bots.resetBotCommands#possible-errors">details</a>)</para></summary>
/// <param name="scope">Command scope</param>
/// <param name="lang_code">Language code</param>
public static Task<bool> Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code)
@ -4542,7 +4542,7 @@ namespace TL
/// <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>
/// <param name="join_as">Join the group call, presenting yourself as the specified user/channel</param>
/// <param name="invite_hash">The invitation hash from the <a href="https://corefork.telegram.org/api/links#video-chat-video-chat-livestream-links">invite link »</a>, if provided allows speaking in a livestream or muted group chat.</param>
/// <param name="invite_hash">The invitation hash from the <a href="https://corefork.telegram.org/api/links#voice-chatvideo-chatlivestream-links">invite link »</a>, if provided allows speaking in a livestream or muted group chat.</param>
/// <param name="params_">WebRTC parameters</param>
public static Task<UpdatesBase> Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, bool muted = false, bool video_stopped = false, string invite_hash = null)
=> client.Invoke(new Phone_JoinGroupCall
@ -4623,7 +4623,7 @@ namespace TL
/// <summary>Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs.<br/>Returns an intersection of the source IDs specified in <c>sources</c>, and the source IDs currently being forwarded by the SFU. <para>See <a href="https://corefork.telegram.org/method/phone.checkGroupCall"/></para> <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/phone.checkGroupCall#possible-errors">details</a>)</para></summary>
/// <param name="call">Group call</param>
/// <param name="sources">Source IDs</param>
public static Task<int[]> Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources)
public static Task<int[]> Phone_CheckGroupCall(this Client client, InputGroupCall call, params int[] sources)
=> client.Invoke(new Phone_CheckGroupCall
{
call = call,
@ -4686,7 +4686,7 @@ namespace TL
peer = peer,
});
/// <summary>Get an <a href="https://corefork.telegram.org/api/links#voice-chat-video-chat-livestream-links">invite link</a> for a group call or livestream <para>See <a href="https://corefork.telegram.org/method/phone.exportGroupCallInvite"/></para> <para>Possible <see cref="RpcException"/> codes: 403 (<a href="https://corefork.telegram.org/method/phone.exportGroupCallInvite#possible-errors">details</a>)</para></summary>
/// <summary>Get an <a href="https://corefork.telegram.org/api/links#voice-chatvideo-chatlivestream-links">invite link</a> for a group call or livestream <para>See <a href="https://corefork.telegram.org/method/phone.exportGroupCallInvite"/></para> <para>Possible <see cref="RpcException"/> codes: 403 (<a href="https://corefork.telegram.org/method/phone.exportGroupCallInvite#possible-errors">details</a>)</para></summary>
/// <param name="can_self_unmute">For livestreams or muted group chats, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand).</param>
/// <param name="call">The group call</param>
public static Task<Phone_ExportedGroupCallInvite> Phone_ExportGroupCallInvite(this Client client, InputGroupCall call, bool can_self_unmute = false)
@ -4784,7 +4784,7 @@ namespace TL
/// <param name="lang_pack">Language pack name, usually obtained from a <a href="https://corefork.telegram.org/api/links#language-pack-links">language pack link</a></param>
/// <param name="lang_code">Language code</param>
/// <param name="keys">Strings to get</param>
public static Task<LangPackStringBase[]> Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys)
public static Task<LangPackStringBase[]> Langpack_GetStrings(this Client client, string lang_pack, string lang_code, params string[] keys)
=> client.Invoke(new Langpack_GetStrings
{
lang_pack = lang_pack,

View file

@ -212,7 +212,7 @@ namespace TL
{
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public long random_id;
/// <summary>Message lifetime. Has higher priority than <see cref="Layer8.DecryptedMessageActionSetMessageTTL"/>.<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>Message lifetime. Has higher priority than <see cref="Layer8.DecryptedMessageActionSetMessageTTL"/>.<br/>Parameter added in Layer 17.</summary>
public int ttl;
/// <summary>Message text</summary>
public string message;
@ -247,7 +247,7 @@ namespace TL
public int thumb_h;
/// <summary>Duration of video in seconds</summary>
public int duration;
/// <summary>MIME-type of the video file<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>MIME-type of the video file<br/>Parameter added in Layer 17.</summary>
public string mime_type;
/// <summary>Image width</summary>
public int w;
@ -266,7 +266,7 @@ namespace TL
{
/// <summary>Audio duration in seconds</summary>
public int duration;
/// <summary>MIME-type of the audio file<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-13">Layer 13</a>.</summary>
/// <summary>MIME-type of the audio file<br/>Parameter added in Layer 13.</summary>
public string mime_type;
/// <summary>File size</summary>
public int size;
@ -289,7 +289,7 @@ namespace TL
[TLDef(0xF3048883)]
public class DecryptedMessageActionNotifyLayer : DecryptedMessageAction
{
/// <summary>Layer number, must be <strong>17</strong> or higher (this constructor was introduced in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>).</summary>
/// <summary>Layer number, must be <strong>17</strong> or higher (this constructor was introduced in Layer 17.</summary>
public int layer;
}
/// <summary>User is preparing a message: typing, recording, uploading, etc. <para>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionTyping"/></para></summary>
@ -304,13 +304,13 @@ namespace TL
[TLDef(0x1BE31789)]
public class DecryptedMessageLayer : IObject
{
/// <summary>Set of random bytes to prevent content recognition in short encrypted messages.<br/>Clients are required to check that there are at least 15 random bytes included in each message. Messages with less than 15 random bytes must be ignored.<br/>Parameter moved here from <see cref="DecryptedMessage"/> in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>Set of random bytes to prevent content recognition in short encrypted messages.<br/>Clients are required to check that there are at least 15 random bytes included in each message. Messages with less than 15 random bytes must be ignored.<br/>Parameter moved here from <see cref="DecryptedMessage"/> in Layer 17.</summary>
public byte[] random_bytes;
/// <summary>Layer number. Mimimal value - <strong>17</strong> (the layer in which the constructor was added).</summary>
public int layer;
/// <summary>2x the number of messages in the sender's inbox (including deleted and service messages), incremented by 1 if current user was not the chat creator<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>2x the number of messages in the sender's inbox (including deleted and service messages), incremented by 1 if current user was not the chat creator<br/>Parameter added in Layer 17.</summary>
public int in_seq_no;
/// <summary>2x the number of messages in the recipient's inbox (including deleted and service messages), incremented by 1 if current user was the chat creator<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>2x the number of messages in the recipient's inbox (including deleted and service messages), incremented by 1 if current user was the chat creator<br/>Parameter added in Layer 17.</summary>
public int out_seq_no;
/// <summary>The content of message itself</summary>
public DecryptedMessageBase message;
@ -348,7 +348,7 @@ namespace TL
public Flags flags;
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public long random_id;
/// <summary>Message lifetime. Has higher priority than <see cref="Layer8.DecryptedMessageActionSetMessageTTL"/>.<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>Message lifetime. Has higher priority than <see cref="Layer8.DecryptedMessageActionSetMessageTTL"/>.<br/>Parameter added in Layer 17.</summary>
public int ttl;
/// <summary>Message text</summary>
public string message;
@ -412,7 +412,7 @@ namespace TL
public int thumb_h;
/// <summary>Duration of video in seconds</summary>
public int duration;
/// <summary>MIME-type of the video file<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>MIME-type of the video file<br/>Parameter added in Layer 17.</summary>
public string mime_type;
/// <summary>Image width</summary>
public int w;
@ -486,7 +486,7 @@ namespace TL
public Flags flags;
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public long random_id;
/// <summary>Message lifetime. Has higher priority than <see cref="Layer8.DecryptedMessageActionSetMessageTTL"/>.<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
/// <summary>Message lifetime. Has higher priority than <see cref="Layer8.DecryptedMessageActionSetMessageTTL"/>.<br/>Parameter added in Layer 17.</summary>
public int ttl;
/// <summary>Message text</summary>
public string message;