Answer the question
In order to leave comments, you need to log in
How to get the username that he entered himself in Telegram?
In general, I suffer from this issue for quite a long time. You need to get the first_name and last_name of the user by his ID. But exactly those that he entered himself in his settings. I use the Telegram User API (not to be confused with the Bot API). Using the users.getUsers method ( https://core.telegram.org/method/users.getUsers ) I get a user with the name that I gave him (when I added him to contacts). And it is it that is used in all events, etc.
I managed to get the original name only through the Bot API ( https://core.telegram.org/bots/api#getchat ), but this way I can only get the names of those users who have written to the bot at least once, because I get information about a chat with a person, not about him...
So the question arose ... How to get the real username through the User API? Or how to get the same through the Bot API, given that the bot has not contacted the user in any way?
Answer the question
In order to leave comments, you need to log in
In general, what solution has so far visited me, although it is not very "beautiful" - is to use a second account without contacts. That is, take a list of "your" contacts and get their names from another empty account instead of your own. In this case, the name that the user has set himself will be displayed ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question