Форум сайта python.su
API TelegramBot библиотека “telebot”
Есть ли такая возможность узнать юзернейм(@username) или Имя человека зная его id c помощью бота, без личной переписки человека с ботом?
Если есть, то как?
Как пример @SangMataInfo_bot, он может найти все юзернеймы человека по его id
Отредактировано danker038 (Апрель 8, 2020 20:27:10)
Офлайн
Офлайн
немного не разобрался, как их использовать
как и куда вставлять
можете подробнее рассказать?
Офлайн
danker038У тебя должен быть бот в виде кода. Вот его скинь сюда.
как и куда вставлять
Офлайн
import telebot bot = telebot.TeleBot(token) def log(message): print("Message from {0}, {1}, id = {2}\nMessage text: {3}".format(message.from_user.first_name, message.from_user.last_name, str(message.from_user.id), message.text)) log(message) @bot.message_handler(content_types=['text']) def send_text(message): ID = message.text """ тут он должен обработать ID и выдать @username пользователя, никогда не писавший лично боту что либо """ log(message) bot.polling(none_stop=True)
Отредактировано danker038 (Апрель 9, 2020 02:45:35)
Офлайн
Скорее всего, не получится так сделать. У Telegram боты сильно ограничены.
https://core.telegram.org/api
We offer two kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages for an interface. The Telegram API and TDLib allow you to build your own customized Telegram clients.
Obtaining api_id
In order to obtain an API id and develop your own application using the Telegram API you need to do the following:
Sign up for Telegram using any application.
Log in to your Telegram core: https://my.telegram.org.
Go to ‘API development tools’ and fill out the form.
You will get basic addresses as well as the api_id and api_hash parameters required for user authorization.
For the moment each number can only have one api_id connected to it.
We will be sending important developer notifications to the phone number that you use in this process, so please use an up-to-date number connected to your active Telegram account.
Офлайн
Ладно, спасибо!
Офлайн