简体   繁体   中英

How can i get someone telegram chat id with python?

Hi everyone i want to create a new telegram bot similar to @usinifobot. this is how it works: you just send someone username to this bot and it will give you back his/her chat id. i want to do same thing but i dont khow how to do it with python-telegram-bot.

python-telegram-bot can't help with this, because telegram bot api can't provide ids of unrelated entities to the bot - only ones with which bot iteracts

you need telegram client api for this and to hold a real account (not a bot) online to make checks by another library

and with bot library like python-telegram-bot you could only get ids of users who write to bot, channels and groups bot is in and reposted messages from other users

I created similar bot @username_to_id_bot for getting ids of any entity and faced all these moments

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM