Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telegram Bot: Is it possible to get userid using username?

As the title says, is it possible to get userid using username? I mean, I would like to add a feature to my bot that tells you the user id from an other user using his username.

Does Telegram API give an option to do this?

like image 985
Abdelilah El Aissaoui Avatar asked Jan 06 '23 22:01

Abdelilah El Aissaoui


1 Answers

I believe what you mean by nickname is the username and userid is the unique id as described in the API documentation.It is still possible to do a reverse lookup using a bot.

This is possible with a boosted version of the Official Telegram API, known as PWRTelegram API

I quote from the documentation.

Resolving of usernames not only with channels and groups but also with normal users and bots

Update:

Here is a library I made for this purpose:

Update 2:

I no longer maintain the above library, you can however still resolve usernames with a td-cli binary.

like image 91
Mohamed Sohail Avatar answered Feb 16 '23 02:02

Mohamed Sohail