This bot accepts a Telegram username such as @durov or https://t.me/durov and replies with the profile details Telegram exposes.
This is only for personal project use. Do not use it for bad things.
It uses:
- the Telegram Bot API directly through Node.js
fetch telegram(GramJS) for MTProto username resolution
Telegram's simple Bot API is not enough for arbitrary username resolution. This project uses MTProto with your bot token plus API_ID and API_HASH, so the bot can resolve public usernames and fetch richer profile data.
- Create a bot with @BotFather and copy the bot token.
- Create an app at my.telegram.org and copy your
API_IDandAPI_HASH. - Copy
.env.exampleto.envand fill in the values. - Install dependencies:
npm install- Start the bot:
npm startSend either of these to the bot:
@usernamehttps://t.me/username/lookup @username
The bot will reply with the public information Telegram returns for that username. If the username belongs to a public channel or supergroup, the bot will return chat info instead.
- Telegram only returns the data your bot is allowed to see.
- Private usernames, deleted accounts, and restricted entities may return lookup errors.
- This project uses long polling for simplicity.
- Licensed under the MIT License.