Answer the question
In order to leave comments, you need to log in
Teletob how to write a user's message to a variable?
I have a button "Add task"
After which the user is prompted to send a link to the bot.
I need to copy this link and add it to a txt file, I can't figure out how to implement it.
I work through TeleBot
Answer the question
In order to leave comments, you need to log in
1. the bot has a register_next_step_handler
, for example, it answers "give a link" and after the user's response, it executes the function specified in register_next_step_handler
2. Just get the message?
@bot.message_handler(func=lambda message: True)
def handle_message(message):
print(message.text)
// вывод сообщения которое написал пользователь
sent = bot.send_message(message.chat.id, "Введите ссылку :")
bot.register_next_step_handler(sent, save_link)
def save_link(message):
my_link = message.text
bot.send_message(message.chat.id, "Сохранил!")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question