A null config value for "password" will also show a console prompt

This commit is contained in:
Wizou 2021-10-20 13:08:10 +02:00
parent a473475e11
commit 5e2ddf41f6
4 changed files with 17 additions and 7 deletions

2
.github/ci.yml vendored
View file

@ -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

View file

@ -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.
<br/>
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.
<br/>
See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs).
### Get all members from a chat

View file

@ -5,7 +5,7 @@
[![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient)
# <img src="logo.png" width="32"/> 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

View file

@ -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
};