Faced with some strange issue using Telegram Client API. I use https://github.com/wiz0u/WTelegramClient to read messages from group i am already in.
But on new message event - i can't retrieve user's username by calling Client.Users_GetFullUser method - it firing "USER_ID_INVALID". It works well for me as a user, but not for the sender of exact message to the chat...
Can't find the information why it may happens. Any limitations from Telegram's side?
//works like a charm
Users.TryGetValue({my_id}, out var u);
var usr = await Client.Users_GetFullUser(new InputUser({my_id}, u.access_hash));
//does not work, USER_ID_INVALID throwing
Users.TryGetValue(unm.message.From.ID, out var u);
var usr = await Client.Users_GetFullUser(new InputUser(unm.message.From.ID, u.access_hash));
The reason is Privacy/Perf optimizations :
Check documentation : https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#4-how-to-use-ids-and-access_hash-why-the-error-channel_invalid-or-user_id_invalid
It says :
This flag described here : https://core.telegram.org/api/min
So the reason is : all users are coming with Base info (with min flag) and to get extended information, you need any "proof". MessageId from Chat is enough, see working solution.