Search user by username with send message test. (#356)

* Search user by username with send message test.
This commit is contained in:
Mikhail 2016-12-28 15:37:34 +01:00 committed by salarcode
parent 218de866cc
commit 0727b29fa3

View file

@ -371,6 +371,23 @@ namespace TLSharp.Core
return await SendRequestAsync<TLFound>(r);
}
/// <summary>
/// Serch user or chat. API: contacts.search#11f812d8 q:string limit:int = contacts.Found;
/// </summary>
/// <param name="q">User or chat name</param>
/// <param name="limit">Max result count</param>
/// <returns></returns>
public async Task<TLFound> SearchUserAsync(string q, int limit = 10)
{
var r = new TeleSharp.TL.Contacts.TLRequestSearch
{
q = q,
limit = limit
};
return await SendRequestAsync<TLFound>(r);
}
private void OnUserAuthenticated(TLUser TLUser)
{
_session.TLUser = TLUser;