Answer the question
In order to leave comments, you need to log in
How to set up data forwarding from a bot?
@bot.message_handler(commands=['help'])
def start(message):
sent = bot.send_message(message.chat.id, 'введите номер телефона')
bot.register_next_step_handler(sent, hello)
def hello(message):
open('problem.txt', 'w').write(message.chat.id + ' | ' + message.text + '||')
bot.send_message(message.chat.id, 'Thank you!')
#bot.send_message(message.chat.id + ' | ' + message.text)
#bot.send_message(message.chat.id, 'Привет, {name}! Рад тебя видеть!'.format(name=message.text))
Answer the question
In order to leave comments, you need to log in
Here is the implementation of the state machine using the aiogram library as an example, you need it. Follow the example and do it, the concept is the same.
Here is the .txt entry:
with open('file.txt', 'w') as f:
f.write('some text\n')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question