mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-01-03 07:09:56 +01:00
minor documentation update
This commit is contained in:
parent
9b7e4293d8
commit
f1448ac517
34
EXAMPLES.md
34
EXAMPLES.md
|
|
@ -59,7 +59,7 @@ var sent2 = await client.SendMessageAsync(InputPeer.Self, text2, entities: entit
|
|||
// if you need to convert a sent/received Message to Markdown: (easier to store)
|
||||
text2 = client.EntitiesToMarkdown(sent2.message, sent2.entities);
|
||||
```
|
||||
See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) and [HTML formatting style](https://core.telegram.org/bots/api/#html-style) for details.
|
||||
See [HTML formatting style](https://core.telegram.org/bots/api/#html-style) and [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) for details.
|
||||
*Note: For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#collect-access-hash))*
|
||||
|
||||
<a name="fun"></a>
|
||||
|
|
@ -112,7 +112,7 @@ await Task.Delay(5000);
|
|||
```
|
||||
|
||||
<a name="list-chats"></a>
|
||||
### List all chats (groups/channels) the user is in and send a message to one
|
||||
### List all chats (groups/channels NOT users) that we joined and send a message to one
|
||||
```csharp
|
||||
var chats = await client.Messages_GetAllChats();
|
||||
foreach (var (id, chat) in chats.chats)
|
||||
|
|
@ -129,6 +129,21 @@ Notes:
|
|||
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)
|
||||
|
||||
<a name="list-dialogs"></a>
|
||||
### List all dialogs (chats/groups/channels/user chat) we are currently in
|
||||
```csharp
|
||||
var dialogs = await client.Messages_GetAllDialogs();
|
||||
foreach (var dialog in dialogs.dialogs)
|
||||
switch (dialogs.UserOrChat(dialog))
|
||||
{
|
||||
case User user when user.IsActive: Console.WriteLine("User " + user); break;
|
||||
case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break;
|
||||
}
|
||||
```
|
||||
|
||||
*Note: the lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users.*
|
||||
See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs).
|
||||
|
||||
<a name="schedule-msg"></a>
|
||||
### Schedule a message to be sent to a chat
|
||||
```csharp
|
||||
|
|
@ -171,21 +186,6 @@ await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album");
|
|||
```
|
||||
*Note: Don't mix Photos and file Documents in your album, it doesn't work well*
|
||||
|
||||
<a name="list-dialogs"></a>
|
||||
### List all dialogs (chats/groups/channels/user chat) the user is in
|
||||
```csharp
|
||||
var dialogs = await client.Messages_GetAllDialogs();
|
||||
foreach (var dialog in dialogs.dialogs)
|
||||
switch (dialogs.UserOrChat(dialog))
|
||||
{
|
||||
case User user when user.IsActive: Console.WriteLine("User " + user); break;
|
||||
case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break;
|
||||
}
|
||||
```
|
||||
|
||||
*Note: the lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users.*
|
||||
See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs).
|
||||
|
||||
<a name="list-members"></a>
|
||||
### Get all members from a chat
|
||||
For a basic Chat: *(see Terminology in [ReadMe](README.md#terminology))*
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ namespace WTelegramClientTest
|
|||
{
|
||||
case UpdateNewMessage unm: await DisplayMessage(unm.message); break;
|
||||
case UpdateEditMessage uem: await DisplayMessage(uem.message, true); break;
|
||||
// Note: UpdateNewChannelMessage and UpdateEditChannelMessage are also handled by above cases
|
||||
case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {Chat(udcm.channel_id)}"); break;
|
||||
case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break;
|
||||
case UpdateUserTyping uut: Console.WriteLine($"{User(uut.user_id)} is {uut.action}"); break;
|
||||
|
|
|
|||
|
|
@ -690,8 +690,8 @@ namespace WTelegram
|
|||
return tcpClient;
|
||||
}
|
||||
|
||||
/// <summary>Establish connection to Telegram servers</summary>
|
||||
/// <remarks>Config callback is queried for: <b>server_address</b></remarks>
|
||||
/// <summary>Establish connection to Telegram servers without negociating a user session</summary>
|
||||
/// <remarks>Usually you shouldn't need to call this method: Use <see cref="LoginUserIfNeeded">LoginUserIfNeeded</see> instead. <br/>Config callback is queried for: <b>server_address</b></remarks>
|
||||
/// <returns>Most methods of this class are async (Task), so please use <see langword="await"/></returns>
|
||||
public async Task ConnectAsync()
|
||||
{
|
||||
|
|
@ -893,7 +893,7 @@ namespace WTelegram
|
|||
}
|
||||
|
||||
/// <summary>Login as a user (if not already logged-in).
|
||||
/// <br/><i>(this method calls ConnectAsync if necessary)</i></summary>
|
||||
/// <br/><i>(this method calls <see cref="ConnectAsync">ConnectAsync</see> if necessary)</i></summary>
|
||||
/// <remarks>Config callback is queried for: <b>phone_number</b>, <b>verification_code</b> <br/>and eventually <b>first_name</b>, <b>last_name</b> (signup required), <b>password</b> (2FA auth), <b>user_id</b> (alt validation)</remarks>
|
||||
/// <param name="settings">(optional) Preference for verification_code sending</param>
|
||||
/// <param name="reloginOnFailedResume">Proceed to logout and login if active user session cannot be resumed successfully</param>
|
||||
|
|
|
|||
Loading…
Reference in a new issue