F
F
fleen2020-05-04 12:18:33
Python
fleen, 2020-05-04 12:18:33

Asking for input from user pytelegrambotapi python. How to implement?

In general, there is a code:

The code
def tokenpol(message):
        tkn = bot.send_message(message.chat.id, "Введите токен вашего бота:")
        bot.register_next_step_handler(tkn, idtgpol)

      def idtgpol(message):
        idtg = bot.send_message(message.chat.id, "Введите ваш id(ваш id ",'<pre>' +message.chat.id+'</pre>',")", parse_mode="HTML")
        bot.register_next_step_handler(idtg, file) 

      def file(message):
        bot.send_message(message.chat.id, "⏳Подождите.... В скором времени бот отправит ваш файл!")
        tgsl(tkn, idtg)

      tokenpol(message)


Can't implement bot.register_next_step_handler. Once it worked, but then it wrote that there is no tkn.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fleen, 2020-05-04
@fleen

Writes in general that the tkn variable was not found
To be more precise, then: NameError: name 'tkn' is not defined
In general, I found out everything
Through: bot.register_next_step_handler(msg, next_step)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question