Ошибка выдаёт когда запускаю бот IndentationError: unindent does not match any outer indentation level

Рейтинг: -1Ответов: 1Опубликовано: 26.04.2023

Когда запускаю бот возникает вот такая проблема

File "/storage/emulated/0/bot.py", line 169
    @bot.message_handler(content_types=['photo'])
                                                 ^
IndentationError: unindent does not match any outer indentation level 

Код:

@bot.message_handler(content_types=['photo'])
 def bot_photo(message):
    if message.chat.type == 'private':
        chat_info = db.get_active_chat(message.chat.id)
        if chat_info != False:
            bot.send_photo(chat_info[1], message.photo.file_id)
        else:
            bot.send_message(message.chat.id, '❌ Шумо ҳоло чатро сар накардед!')

Ответы

▲ 0Принят

Вы уберите пробел перед def bot_photo....

То есть так:

@bot.message_handler(content_types=['photo'])
def bot_photo(message):
^
| -- здесь