sochix / TLSharp

Telegram client library implemented in C#
1k stars 380 forks source link

Send message to username instead of phonenumber problem incorrect user returned #813

Open AndresRGC opened 6 years ago

AndresRGC commented 6 years ago

Hello, I am trying to send a message to a user that I do not have a phone number but only username, but in my tests I see that it is not the Alias ​​because it does not start with @

The problem I have is that in order to find the user to be able to respond to him, I use this method:

var task = api.SearchUserAsync (username); task.Wait (); TLFound found = task.Result; task.Dispose ();

where username is the username field, of the user returned by the TLRequestFullUser call.

The problem is that this method gets me the users that do not correspond.

Because the case I have is that a user with Username = "Marcos" sent me a message.

When trying to answer the method SearchUserAsync ("Marcos"), I only returned a user with Username = "Marcos BL", which is not correct.

I need to know if what happens is that I am not getting the alias, or there is a problem.

Thank you

AndresRGC commented 5 years ago

Hello, this is important because for more than I have tried I can not solve the problem and it must be a bug because when I get the user's information, it does not return anything else.

ktwzk commented 5 years ago

Hi! Try to use TLRequestResolveUsername() {Username = "marcos"} from Contacts https://github.com/sochix/TLSharp/blob/47e973823a0c0695cde4c70e0ab3da27b611d280/TeleSharp.TL/TL/Contacts/TLRequestResolveUsername.cs