mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
A null config value for "password" will also show a console prompt
This commit is contained in:
parent
a473475e11
commit
5e2ddf41f6
2
.github/ci.yml
vendored
2
.github/ci.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
18
EXAMPLES.md
18
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.
|
||||
<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
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
[](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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue