mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
TelegramClient.ResolveUsernameAsync
This commit is contained in:
parent
bca8bc5631
commit
900ed3a705
|
|
@ -300,6 +300,17 @@ namespace TLSharp.Core
|
|||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<TLResolvedPeer> ResolveUsernameAsync(string usernameToResolve, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
if (usernameToResolve.StartsWith("@"))
|
||||
usernameToResolve = usernameToResolve.Substring(1);
|
||||
|
||||
var req = new TLRequestResolveUsername() { Username = usernameToResolve };
|
||||
|
||||
return await SendAuthenticatedRequestAsync<TLResolvedPeer>(req, token)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<TLImportedContacts> ImportContactsAsync(IReadOnlyList<TLInputPhoneContact> contacts, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
var req = new TLRequestImportContacts { Contacts = new TLVector<TLInputPhoneContact>(contacts)};
|
||||
|
|
|
|||
Loading…
Reference in a new issue