0

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.

sorax
  • 63
  • 1
  • 8

1 Answers1

2

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.

GioIacca9
  • 406
  • 4
  • 8