B
B
Bartolomio022022-02-15 20:45:48
Telegram
Bartolomio02, 2022-02-15 20:45:48

How to get telegram user ID by its username?

I want to write a bot to check the subscription to the channel by the user, without the user contacting the bot itself, by its user name(@example_username). This requires a telegram user ID, googling I did not find a way to get the id by username. But I found a bot that can do this (@get_any_telegram_id_bot), so there is a way.
Any tips on where to look for information or ready-made solutions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Evseev, 2022-02-15
@ultraevs

user_name = message.from_user.id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question