Reputation: 73
Hi i'm working on a Telegram bot and i need to get the id of any one just form his username. I searched for this question a lot but I did not find a solution and therefore I asked this question here, please help.
Upvotes: 1
Views: 5376
Reputation: 436
With the Bot API you can't. You can use the users.getUsers
method from the Telegram APIs (the ones for clients, not for Bots) but it's a bit complicated. Otherwise you can store in a database all user_id
and username
from users when they start the bot so you'll be able to get the user_id
from the username
and viceversa.
Upvotes: 3