B
B
bakin20042019-10-06 19:58:42
Python
bakin2004, 2019-10-06 19:58:42

What is the error in the bot's telegram code. I'm trying to set a variable through a message.?

Here is the code itself:

@bot.message_handler(func=lambda message: message.chat.id not in users)
def CheckUser(message):
    bot.send_message(message.chat.id, "Привет.")

@bot.message_handler(content_types=['text'])
def handle_text(message):
    bot.send_message(message.chat.id, "Введите номер в формате  +7XXXXXXXXXX")
    @bot.message_handler(content_types=['text'])
    def handle_text(message):
        phone = message.text

bot.polling(none_stop=True, interval=0)

I want that after checking the id for access to the bot, a variable is accepted and the main code is executed. But something goes wrong.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question