D
D
dirtiernastierr2020-09-22 17:34:21
Python
dirtiernastierr, 2020-09-22 17:34:21

How to make a telegram bot to send a message?

The task is this - to make a bot that will respond to the user's messages, and he will copy this message and forward it to me.
Here's an example: any user writes something to my bot, and he, in turn, thanks and at the same time copies the message and sends it to me. In the meantime, I can scroll through these messages with one button / command
Thank you very much in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
cython, 2020-09-22
@cython

Find out your id and when you receive a message, send a text to your id.

D
Difficult, 2020-09-23
@Difficult

Well, look, to save the text of the message, it is enough to write one line in the code txt = message.text
To get the id:
user_id = message.from_user.id
When someone sends a message to the bot, the user_id variable will receive its id
Sending a message by id:
bot.send_message(user_id, txt)
Something like this...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question