D
D
dz_off2021-03-09 00:59:16
API
dz_off, 2021-03-09 00:59:16

How to access a specific user in a telegram bot?

How to access a specific user in a telegram bot? To do a personal mailing, in my case, sending homework to a named specific person

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stefan, 2021-03-09
@MEDIOFF

By its id, call the bot's method for sending a message, and pass the user's id to chat_id, the semantics may differ slightly from the library used, but the meaning is the same everywhere

Y
yarfer, 2021-03-09
@yarfer

bot.send_message(user_id, 'Текст')
It is possible through request:

requests.get('https://api.telegram.org/bot'+TOKEN+'/sendMessage?chat_id='+CHAT_ID+'&text='+TEXT)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question