I developing ASP.NET application and I have the next code to get client for each request:
private readonly Client _client;
public TelegramClient()
{
_client = new Client("", "");
}
public async Task<Client> GetClient(string phoneNumber)
{
if (string.IsNullOrEmpty(phoneNumber))
{
throw new UserFriendlyException("Add phone number first!");
}
if (_client.User == null)
{
await _client.Login(phoneNumber);
}
return _client;
}
Is there way to somehow to check that previous session can be connected (for example when user terminated session)?
The point is that _client.Login() sends verification codes when this is not needed.
I developing ASP.NET application and I have the next code to get client for each request:
Is there way to somehow to check that previous session can be connected (for example when user terminated session)? The point is that _client.Login() sends verification codes when this is not needed.