Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Add new method resolveUserName of API contacts.resolveUserName #1039

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions TLSharp.Core/TelegramClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,22 @@ await sender.SendPingAsync(token)
.ConfigureAwait(false);
}

/// <summary>
/// Resolve user or chat. API: contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer;
/// </summary>
/// <param name="username">User or chat name</param>
/// <returns></returns>
public async Task<TLResolvedPeer> resolveUserName(string username)
{
var r = new TeleSharp.TL.Contacts.TLRequestResolveUsername
{
Username = username
};

return await SendRequestAsync<TLResolvedPeer>(r)
.ConfigureAwait(false);
}

private void OnUserAuthenticated(TLUser TLUser)
{
session.TLUser = TLUser;
Expand Down