O
O
Odil Davronov2018-08-11 17:47:14
Python
Odil Davronov, 2018-08-11 17:47:14

How can I teach a Telegram bot so that the bot sends messages from the user to my telegram?

I write a bot in Python. Certain answers (messages) of the user should come to my telegram.
How can I teach a Telegram bot so that the bot sends messages from the user to my telegram?
Thanks1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Irina, 2018-08-19
@vera_ira

Here is the most obvious option. You write a function and call where it is convenient. Before that, enter your chat ID (my_chat_id) into the constants.

def log (message):
    msg_to_me=str("Сообщение от: "+ message.from_user.first_name+" ID: "+str(message.from_user.id)+ "\nТекст: "+ message.text)
    bot.send_message(constants.my_chat_id, msg_to_me)

These are the responses from the bot that will come to you:
Message From: Myza ID: 000000000000
Text: Hello! You are the best bot in the world....

A
alexdora, 2018-08-26
@alexdora

https://core.telegram.org/bots/api#forwardmessage

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question