mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-04-04 14:07:41 +00:00
added Markdown.Escape
improved MarkdownToEntities a bit
This commit is contained in:
parent
7616625ac3
commit
3d561ff63e
2 changed files with 52 additions and 40 deletions
|
|
@ -34,13 +34,13 @@ if (contacts.imported.Length > 0)
|
|||
### Send a Markdown message to ourself (Saved Messages)
|
||||
```csharp
|
||||
using var client = new WTelegram.Client(Environment.GetEnvironmentVariable);
|
||||
await client.LoginUserIfNeeded();
|
||||
var text = "Hello __dear *friend*__!\nEnjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)";
|
||||
var user = await client.LoginUserIfNeeded();
|
||||
var text = $"Hello __dear *{Markdown.Escape(user.first_name)}*__\nEnjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)";
|
||||
var entities = client.MarkdownToEntities(ref text);
|
||||
await client.SendMessageAsync(InputPeer.Self, text, entities: entities);
|
||||
```
|
||||
See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) for details.
|
||||
<br/>For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#Collect-Access-Hash-and-save-them-for-later-use))
|
||||
<br/>*Note: For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#Collect-Access-Hash-and-save-them-for-later-use))*
|
||||
|
||||
### List all chats (groups/channels) the user is in and send a message to one
|
||||
```csharp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue