TLSharp
TLSharp copied to clipboard
Get current user
Hi. TelegramClient
has a method IsUserAuthorized()
. Is there any way to get currently authorized user if IsUserAuthorized
() returns true?
I'm looking for the same thing.
I have same question too.
The current user can be obtained from the TLUser
property of the client's Session
property.
var client = new TelegramClient(...);
await client.ConnectAsync();
if (client.IsUserAuthorized())
{
var me = client.Session.TLUser;
Console.WriteLine("Hello, {0}!", me.FirstName);
}
Thanks, @MiffOttah . It works