Removed unused _sem in Session

This commit is contained in:
Wizou 2021-10-20 00:24:50 +02:00
parent c3dcd2a367
commit a473475e11
4 changed files with 5 additions and 7 deletions

View file

@ -25,7 +25,7 @@ await client.LoginUserIfNeeded();
var imported = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); var imported = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } });
await client.SendMessageAsync(imported.users[0], "Hello!"); await client.SendMessageAsync(imported.users[0], "Hello!");
``` ```
### Get the list of all chats (groups/channels) the user is in and send a message to one ### List all chats (groups/channels) the user is in and send a message to one
See [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) See [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs)

View file

@ -16,7 +16,6 @@ After installing WTelegramClient through Nuget, your first Console program will
static async Task Main(string[] _) static async Task Main(string[] _)
{ {
using var client = new WTelegram.Client(); using var client = new WTelegram.Client();
await client.ConnectAsync();
var user = await client.LoginUserIfNeeded(); var user = await client.LoginUserIfNeeded();
Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name} (id {user.id})"); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name} (id {user.id})");
} }
@ -97,9 +96,9 @@ Console.WriteLine($"Sending a message in chat {target.ID}: {target.Title}");
await client.SendMessageAsync(target, "Hello, World"); await client.SendMessageAsync(target, "Hello, World");
``` ```
### Terminology in Telegram Client API # Terminology in Telegram Client API
Some of these terms/classnames can be confusing as they differ from the terms shown to end-users In the API, Telegram uses some terms/classnames that can be confusing as they differ from the terms shown to end-users:
- `Channel` : A (large) chat group *(sometimes called supergroup)* or a broadcast channel (the `broadcast` flag differenciate those) - `Channel` : A (large) chat group *(sometimes called supergroup)* or a broadcast channel (the `broadcast` flag differenciate those)
- `Chat` : A private simple chat group with few people (it may be migrated to a supergroup/channel when it doesn't fit anymore) - `Chat` : A private simple chat group with few people (it may be migrated to a supergroup/channel when it doesn't fit anymore)
- Chats : In plural, it means either `Chat` or `Channel` - Chats : In plural, it means either `Chat` or `Channel`
@ -129,7 +128,7 @@ This library works best with **.NET 5.0+** and is also available for **.NET Stan
# Troubleshooting guide # Troubleshooting guide
Here is a list of common issues and how to fix them so that your program work correctly: Here is a list of common issues and how to fix them so that your program work correctly:
1) Are you using the Nuget package instead of the library source code? 1) Are you using the Nuget package or the library source code?
<br/>It is not recommended to copy/compile the source code of the library for a normal usage. <br/>It is not recommended to copy/compile the source code of the library for a normal usage.
<br/>When built in DEBUG mode, the source code connects to Telegram test servers. So you can either: <br/>When built in DEBUG mode, the source code connects to Telegram test servers. So you can either:
- **Recommended:** Use the [official Nuget package](https://www.nuget.org/packages/WTelegramClient) or the [private nuget feed of development builds](https://dev.azure.com/wiz0u/WTelegramClient/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) - **Recommended:** Use the [official Nuget package](https://www.nuget.org/packages/WTelegramClient) or the [private nuget feed of development builds](https://dev.azure.com/wiz0u/WTelegramClient/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet)

View file

@ -34,7 +34,6 @@ namespace WTelegram
} }
public DateTime SessionStart => _sessionStart; public DateTime SessionStart => _sessionStart;
public readonly SemaphoreSlim _sem = new(1);
private readonly DateTime _sessionStart = DateTime.UtcNow; private readonly DateTime _sessionStart = DateTime.UtcNow;
private readonly SHA256 _sha256 = SHA256.Create(); private readonly SHA256 _sha256 = SHA256.Create();
private string _pathname; private string _pathname;

View file

@ -12,7 +12,7 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl> <PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources> <EmbedUntrackedSources>true</EmbedUntrackedSources>
<PackageId>WTelegramClient</PackageId> <PackageId>WTelegramClient</PackageId>
<Description>Telegram client library written 100% in C# and .NET Standard | Latest MTProto &amp; API layer version</Description> <Description>Telegram Client API library written 100% in C# and .NET Standard | Latest MTProto &amp; API layer version</Description>
<Authors>Wizou</Authors> <Authors>Wizou</Authors>
<Copyright>Copyright © Olivier Marcoux 2021</Copyright> <Copyright>Copyright © Olivier Marcoux 2021</Copyright>
<PackageIcon>logo.png</PackageIcon> <PackageIcon>logo.png</PackageIcon>