diff --git a/.github/dev.yml b/.github/dev.yml index cd93e3d..15ebd73 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.4.1-dev.$(Rev:r) +name: 2.4.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index cb9065c..114ad3c 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -124,7 +124,7 @@ await client.SendMessageAsync(chats.chats[chatId], "Hello, World"); Notes: - This list does not include discussions with other users. For this, you need to use [Messages_GetAllDialogs](#list-dialogs). - The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.MD#access-hash) about this. -- If a small private chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result, +- If a basic chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result, but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology). - You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) @@ -187,7 +187,7 @@ See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Progr ### Get all members from a chat -For a simple Chat: *(see Terminology in [ReadMe](README.md#terminology))* +For a basic Chat: *(see Terminology in [ReadMe](README.md#terminology))* ```csharp var chatFull = await client.Messages_GetFullChat(1234567890); // the chat we want foreach (var (id, user) in chatFull.users) diff --git a/README.md b/README.md index 3604084..afd4a89 100644 --- a/README.md +++ b/README.md @@ -119,8 +119,8 @@ await client.SendMessageAsync(target, "Hello, World"); # 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)* or a broadcast channel (the `broadcast` flag differentiate those) -- `Chat` : A private simple chat group 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`, `Channel` or a private chat with a `User` diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 06c3878..5952c9f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -639,6 +639,14 @@ namespace WTelegram else return await this.Messages_GetMessages(id); } + + public async Task DeleteMessages(InputPeer peer, params int[] id) + { + if (peer is InputPeerChannel channel) + return await this.Channels_DeleteMessages(channel, id); + else + return await this.Messages_DeleteMessages(id); + } #endregion } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 58738ce..912553e 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1223,7 +1223,7 @@ namespace TL phone = phone, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns the list of messages by their IDs. See [bots: ✓]
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns the list of messages by their IDs. See
[bots: ✓]
/// Message ID list public static Task Messages_GetMessages(this Client client, params InputMessage[] id) => client.Invoke(new Messages_GetMessages @@ -1333,7 +1333,7 @@ namespace TL max_date = max_date.GetValueOrDefault(), }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes messages by their identifiers. See
[bots: ✓] Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes messages by their identifiers. See [bots: ✓] Possible codes: 400,403 (details)
/// Whether to delete messages for all participants of the chat /// Message ID list public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) @@ -1343,7 +1343,7 @@ namespace TL id = id, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
/// Maximum message ID available in a client. public static Task Messages_ReceivedMessages(this Client client, int max_id = default) => client.Invoke(new Messages_ReceivedMessages @@ -1476,7 +1476,7 @@ namespace TL message = message, }); - /// Returns chat basic info on their IDs. See [bots: ✓] Possible codes: 400 (details) + /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns chat basic info on their IDs. See [bots: ✓] Possible codes: 400 (details)
/// List of chat IDs public static Task Messages_GetChats(this Client client, long[] id) => client.Invoke(new Messages_GetChats @@ -1484,7 +1484,7 @@ namespace TL id = id, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Get full info about a basic group. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Get full info about a basic group. See [bots: ✓] Possible codes: 400 (details)
/// Basic group ID. public static Task Messages_GetFullChat(this Client client, long chat_id) => client.Invoke(new Messages_GetFullChat @@ -1492,7 +1492,7 @@ namespace TL chat_id = chat_id, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Chat ID /// New chat name, different from the old one public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) @@ -1502,7 +1502,7 @@ namespace TL title = title, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details)
/// Chat ID /// Photo to be set public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) @@ -1512,7 +1512,7 @@ namespace TL photo = photo, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details)
/// Chat ID /// User ID to be added /// Number of last messages to be forwarded @@ -1524,7 +1524,7 @@ namespace TL fwd_limit = fwd_limit, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Remove the entire chat history of the specified user in this chat. /// Chat ID /// User ID to be deleted @@ -1668,7 +1668,7 @@ namespace TL peer = peer, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Notifies the sender about the recipient having listened a voice message or watched a video. See
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Notifies the sender about the recipient having listened a voice message or watched a video. See
/// Message ID list public static Task Messages_ReadMessageContents(this Client client, int[] id) => client.Invoke(new Messages_ReadMessageContents @@ -1796,7 +1796,7 @@ namespace TL increment = increment, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Make a user admin in a
basic group. See Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Make a user admin in a basic group. See Possible codes: 400 (details)
/// The ID of the group /// The user to make admin /// Whether to make them admin @@ -1808,7 +1808,7 @@ namespace TL is_admin = is_admin, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403 (details)
/// Basic group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat @@ -2736,7 +2736,7 @@ namespace TL peer = peer, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
/// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) => client.Invoke(new Messages_DeleteChat @@ -3183,7 +3183,7 @@ namespace TL theme_params = theme_params, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
See
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
See
public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) => client.Invoke(new Messages_SendWebViewResultMessage {