Support for TLS MTProxy

This commit is contained in:
Wizou 2022-01-11 04:14:23 +01:00
parent 16258cb5ba
commit d6d656c8fe
6 changed files with 237 additions and 43 deletions

View file

@ -14,16 +14,6 @@ and add at least these variables with adequate value: **api_id, api_hash, phone_
Remember that these are just simple example codes that you should adjust to your needs.
In real production code, you might want to properly test the success of each operation or handle exceptions.
<a name="join-channel"></a>
### Join a channel/group by @channelname
```csharp
using var client = new WTelegram.Client(Environment.GetEnvironmentVariable);
await client.LoginUserIfNeeded();
var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @
if (resolved.Chat is Channel channel)
await client.Channels_JoinChannel(channel);
```
<a name="msg-by-name"></a>
### Send a message to someone by @username
```csharp
@ -218,6 +208,16 @@ var channel = (Channel)chats.chats[1234567890]; // the channel we want
var participants = await client.Channels_GetAllParticipants(channel);
```
<a name="join-channel"></a>
### Join a channel/group by @channelname
```csharp
using var client = new WTelegram.Client(Environment.GetEnvironmentVariable);
await client.LoginUserIfNeeded();
var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @
if (resolved.Chat is Channel channel)
await client.Channels_JoinChannel(channel);
```
<a name="add-members"></a>
### Add/Invite/Remove someone in a chat
```csharp