diff --git a/.github/dev.yml b/.github/dev.yml index 7e13821..de5e874 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ trigger: - master -name: 3.5.4-dev.$(Rev:r) +name: 3.5.5-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index b9e21be..a001ced 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -8,7 +8,7 @@ pool: variables: buildConfiguration: 'Release' - releaseNotes: $[replace(variables['releaseNotes'], '"', '''''')] + releaseNotes2: $[replace($(releaseNotes), '"', '''''')] stages: - stage: publish diff --git a/EXAMPLES.md b/EXAMPLES.md index c0aa92c..2687469 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -199,7 +199,8 @@ You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. See the `HandleMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). -You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. +You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. +See also [explanation below](#message-user) to extract user/chat info from messages. ## Downloading photos, medias, files @@ -270,6 +271,7 @@ InputPeer peer = chats.chats[1234567890]; // the chat we want DateTime when = DateTime.UtcNow.AddMinutes(3); await client.SendMessageAsync(peer, "This will be posted in 3 minutes", schedule_date: when); ``` +*Note: Make sure your computer clock is synchronized with Internet time* ## Fun with stickers, GIFs, dice, and animated emojies @@ -471,7 +473,7 @@ dialogs.CollectUsersChats(_users, _chats); private async Task OnUpdate(UpdatesBase updates) { - updates.CollectUsersChats(_users, _chats); + updates.CollectUsersChats(_users, _chats); ... } diff --git a/README.md b/README.md index 580eec0..5383898 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-162-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-163-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://www.buymeacoffee.com/wizou) diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 5df6b44..cc64f91 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -21,6 +21,7 @@ namespace WTelegram int RemoteLayer { get; } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles")] public sealed class SecretChats : IDisposable { public event Action OnChanged; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 07f74ff..fa98dac 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2286,13 +2286,13 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Topic title. + /// New topic title. [IfFlag(0)] public string title; - /// ID of the custom emoji used as topic icon. + /// ID of the new custom emoji used as topic icon, or if it was removed. [IfFlag(1)] public long icon_emoji_id; - /// Whether the topic was closed. + /// Whether the topic was opened or closed. [IfFlag(2)] public bool closed; - /// Whether the topic was hidden (only valid for the "General" topic, id=1). + /// Whether the topic was hidden or unhidden (only valid for the "General" topic, id=1). [IfFlag(3)] public bool hidden; [Flags] public enum Flags : uint @@ -3406,6 +3406,21 @@ namespace TL /// Usernames. public Username[] usernames; } + /// See + [TLDef(0x8951ABEF)] + public class UpdateNewAuthorization : Update + { + public Flags flags; + public long hash; + [IfFlag(0)] public DateTime date; + [IfFlag(0)] public string device; + [IfFlag(0)] public string location; + + [Flags] public enum Flags : uint + { + unconfirmed = 0x1, + } + } /// New encrypted message. See [TLDef(0x12BCBD9A)] public class UpdateNewEncryptedMessage : Update @@ -3571,15 +3586,23 @@ namespace TL public int pts_count; } /// Contents of messages in the common message box were read See - [TLDef(0x68C13933)] + [TLDef(0xF8227181)] public class UpdateReadMessagesContents : Update { + public Flags flags; /// IDs of read messages public int[] messages; /// Event count after generation public int pts; /// Number of events that were generated public int pts_count; + [IfFlag(0)] public DateTime date; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_date = 0x1, + } } /// There are new updates in the specified channel, the client must fetch them.
If the difference is too long or if the channel isn't currently in the states, start fetching from the specified pts. See
[TLDef(0x108D941F)] @@ -6258,6 +6281,7 @@ namespace TL encrypted_requests_disabled = 0x8, /// Whether this session will accept phone calls call_requests_disabled = 0x10, + unconfirmed = 0x20, } } @@ -13869,7 +13893,7 @@ namespace TL } /// Represents a bot web app that can be launched from the attachment menu » See - [TLDef(0xC8AA2CD2)] + [TLDef(0xD90D8DFE)] public class AttachMenuBot : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13879,7 +13903,7 @@ namespace TL /// Attachment menu item name public string short_name; /// List of dialog types where this attachment menu entry should be shown - public AttachMenuPeerType[] peer_types; + [IfFlag(3)] public AttachMenuPeerType[] peer_types; /// List of platform-specific static icons and animations to use for the attachment menu button public AttachMenuBotIcon[] icons; @@ -13891,6 +13915,9 @@ namespace TL has_settings = 0x2, /// Whether the bot would like to send messages to the user. request_write_access = 0x4, + show_in_attach_menu = 0x8, + show_in_side_menu = 0x10, + side_menu_disclaimer_needed = 0x20, } } @@ -14784,6 +14811,7 @@ namespace TL inactive = 0x1, /// The bot is asking permission to send messages to the user: if the user agrees, set the write_allowed flag when invoking Messages_RequestAppWebView. request_write_access = 0x2, + has_settings = 0x4, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 90a1cbe..7556273 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1010,10 +1010,10 @@ namespace TL /// Session ID from the , fetchable using Account_GetAuthorizations /// Whether to enable or disable receiving encrypted chats: if the flag is not set, the previous setting is not changed /// Whether to enable or disable receiving calls: if the flag is not set, the previous setting is not changed - public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default) + public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default, bool confirmed = false) => client.Invoke(new Account_ChangeAuthorizationSettings { - flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0)), + flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0) | (confirmed ? 0x8 : 0)), hash = hash, encrypted_requests_disabled = encrypted_requests_disabled.GetValueOrDefault(), call_requests_disabled = call_requests_disabled.GetValueOrDefault(), @@ -3095,7 +3095,7 @@ namespace TL /// Invite link /// Search for a user in the pending join requests » list: only available when the requested flag is set, cannot be used together with a specific link. /// Offsets for pagination, for more info click here - /// User ID for pagination + /// User ID for pagination: if set, offset_date must also be set. /// Maximum number of results to return, see pagination public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date = default, InputUserBase offset_user = null, int limit = int.MaxValue, string link = null, string q = null, bool requested = false) => client.Invoke(new Messages_GetChatInviteImporters @@ -3423,12 +3423,13 @@ namespace TL /// Web app URL /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, string platform, DataJSON theme_params = null, bool from_switch_webview = false) + public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string platform, DataJSON theme_params = null, string url = null, string start_param = null, bool from_switch_webview = false, bool from_side_menu = false) => client.Invoke(new Messages_RequestSimpleWebView { - flags = (Messages_RequestSimpleWebView.Flags)((theme_params != null ? 0x1 : 0) | (from_switch_webview ? 0x2 : 0)), + flags = (Messages_RequestSimpleWebView.Flags)((theme_params != null ? 0x1 : 0) | (url != null ? 0x8 : 0) | (start_param != null ? 0x10 : 0) | (from_switch_webview ? 0x2 : 0) | (from_side_menu ? 0x4 : 0)), bot = bot, url = url, + start_param = start_param, theme_params = theme_params, platform = platform, }); @@ -6600,6 +6601,7 @@ namespace TL.Methods { has_encrypted_requests_disabled = 0x1, has_call_requests_disabled = 0x2, + confirmed = 0x8, } } @@ -8647,12 +8649,13 @@ namespace TL.Methods } } - [TLDef(0x299BEC8E)] + [TLDef(0x1A46500A)] public class Messages_RequestSimpleWebView : IMethod { public Flags flags; public InputUserBase bot; - public string url; + [IfFlag(3)] public string url; + [IfFlag(4)] public string start_param; [IfFlag(0)] public DataJSON theme_params; public string platform; @@ -8660,6 +8663,9 @@ namespace TL.Methods { has_theme_params = 0x1, from_switch_webview = 0x2, + from_side_menu = 0x4, + has_url = 0x8, + has_start_param = 0x10, } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index eb65064..da062dc 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -6,7 +6,7 @@ namespace TL { public static class Layer { - public const int Version = 162; // fetched 06/09/2023 16:21:22 + public const int Version = 163; // fetched 18/09/2023 17:16:36 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -271,6 +271,7 @@ namespace TL [0x07761198] = typeof(UpdateChatParticipants), [0xE5BDF8DE] = typeof(UpdateUserStatus), [0xA7848924] = typeof(UpdateUserName), + [0x8951ABEF] = typeof(UpdateNewAuthorization), [0x12BCBD9A] = typeof(UpdateNewEncryptedMessage), [0x1710F156] = typeof(UpdateEncryptedChatTyping), [0xB4A2E88D] = typeof(UpdateEncryption), @@ -285,7 +286,7 @@ namespace TL [0x9C974FDF] = typeof(UpdateReadHistoryInbox), [0x2F2F21BF] = typeof(UpdateReadHistoryOutbox), [0x7F891213] = typeof(UpdateWebPage), - [0x68C13933] = typeof(UpdateReadMessagesContents), + [0xF8227181] = typeof(UpdateReadMessagesContents), [0x108D941F] = typeof(UpdateChannelTooLong), [0x635B4C09] = typeof(UpdateChannel), [0x62BA04D9] = typeof(UpdateNewChannelMessage), @@ -1011,7 +1012,7 @@ namespace TL [0x2DBF3432] = typeof(Phone_GroupCallStreamRtmpUrl), [0x4576F3F0] = typeof(AttachMenuBotIconColor), [0xB2A7386B] = typeof(AttachMenuBotIcon), - [0xC8AA2CD2] = typeof(AttachMenuBot), + [0xD90D8DFE] = typeof(AttachMenuBot), [0xF1D88A5C] = null,//AttachMenuBotsNotModified [0x3C4301C0] = typeof(AttachMenuBots), [0x93BF667F] = typeof(AttachMenuBotsBot), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 4705f74..7fb65db 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,7 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 162 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 163 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient