diff --git a/.github/ci.yml b/.github/ci.yml index fd3c7a2..a69bda1 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.3.1-ci.$(Rev:r) +name: 1.3.2-ci.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index d2ca444..d67ecf2 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -26,10 +26,20 @@ var imported = await client.Contacts_ImportContacts(new[] { new InputPhoneContac await client.SendMessageAsync(imported.users[0], "Hello!"); ``` ### List all chats (groups/channels) the user is in and send a message to one - -See [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) - +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chats = await client.Messages_GetAllChats(null); +foreach (var chat in chats.chats) + Console.WriteLine($"{chat.ID} : {chat}"); +Console.Write("Choose a chat ID to send a message to: "); +long id = long.Parse(Console.ReadLine()); +var target = chats.chats.First(chat => chat.ID == id); +await client.SendMessageAsync(target, "Hello, World"); +``` Note: the list returned by Messages_GetAllChats contains the `access_hash` for those chats. +
+See a longer version of this example in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) ### Schedule a message to be sent to a chat ```csharp @@ -76,7 +86,7 @@ if (dialogsBase is Messages_Dialogs dialogs) ``` Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users. - +
See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). ### Get all members from a chat diff --git a/README.md b/README.md index dc28ae6..bc2d6c7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) # WTelegramClient -### _Telegram client library written 100% in C# and .NET Standard_ +### _Telegram Client API library written 100% in C# and .NET Standard_ ## How to use diff --git a/src/Client.cs b/src/Client.cs index 13a0e54..16bb40a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -103,7 +103,7 @@ namespace WTelegram "lang_pack" => "", "lang_code" => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, "user_id" => "-1", - "verification_code" => AskConfig(config), + "verification_code" or "password" => AskConfig(config), _ => null // api_id api_hash phone_number... it's up to you to reply to these correctly };