Как сделать чтобы допустим если вбить "стрижка" то переходил к ней, но если вбить "Женская" то он не переходил пока не было слова "стрижка"

import telebot 
from telebot import types
import time

token = ''
bot = telebot.TeleBot(token)


    # List commands #
@bot.message_handler(commands=['start'])
def start(message):
    button = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
    haircut = types.KeyboardButton(text='Стрижка ??‍♀')
    hair_coloring = types.KeyboardButton(text='Окрашивание ??')
    biowave = types.KeyboardButton(text='Биозавивка')
    hair_extension = types.KeyboardButton(text='Наращивание волос')
    button.add(haircut, hair_coloring, biowave, hair_extension)
    greeting = f'Здраствуйте, <b>{message.from_user.first_name}</b> какую услугу хотите?'
    bot.send_message(chat_id=message.chat.id, text=greeting, parse_mode='html', reply_markup=button)

@bot.message_handler(commands=['help'])
def help(message):
    list_command = '/start - <b>Выбрать услугу</b>\n/help - <b>Список комманд</b>\n/stop - <b>Остоновить бота</b>\n/admin - <b>Панель админестратора</b>\n/setings - <b>Настройки бота (бета)</b>\n/developer - <b>Панель разработчика</b>\n'
    bot.send_message(chat_id=message.chat.id, text=list_command, parse_mode='html')

@bot.message_handler(commands=['stop'])
def stop(message):
    bot.send_message(chat_id=message.chat.id, text='На этот момент данная команда недоступна\nЕсли хотите остановить бота очистите историю')


@bot.message_handler(commands=['admin'])
def admin(message):
    enter_password = f'<b>{message.from_user.first_name}</b> введите пароль '
    bot.send_message(chat_id=message.chat.id, text=enter_password, parse_mode='html')
    if message.text == 'QWa4MnkcZ':
        bot.send_message(chat_id=message.chat.id, text='Вы вошли в панель админестратора')

@bot.message_handler(commands=['setings'])
def setings(message):
    bot.send_message(chat_id=message.chat.id, text='На этот момент данная команда недоступна\nВозможно функция добавится в дальнейшем')

@bot.message_handler(commands=['developer'])
def developer(message):
    bot.send_message(chat_id=message.chat.id, text=message)

@bot.message_handler()
def replay(message):
    if message.text in ['Стрижка ??‍♀', 'Стрижка', 'cтрижка', 'Стрижку', 'стрижку']:
        button = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
        men_haircut = types.KeyboardButton(text='Мужская стрижка ??‍♂')
        women_haircut = types.KeyboardButton(text='Женская стрижка ??‍♀')
        kids_haircut = types.KeyboardButton(text='Детская стрижка ??')
        button.add(men_haircut, women_haircut, kids_haircut)
        bot.send_message(chat_id=message.chat.id, text='Выберите тип услуги', reply_markup=button)

        if message.text in ['Мужская стрижка ??‍♂', 'Мужская', 'Мужская стрижка']:
            button = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
            men_haircut_hair_comparison = types.KeyboardButton(text='Равнение волос')
            button.add(men_haircut_hair_comparison)
            bot.send_message(chat_id=message.chat.id, text='Выбирите стрижку ??‍♂', reply_markup=button)

        elif message.text in ['Женская стрижка ??‍♀', 'Женская', 'Женская стрижка']:
            button = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
            women_haircut_hair_comparison = types.KeyboardButton(text='Равнение волос')
            button.add(women_haircut_hair_comparison)
            bot.send_message(chat_id=message.chat.id, text='Выбирите стрижку ??‍♀', reply_markup=button)

        elif message.text in ['Детская стрижка ??', 'Детская', 'Детская стрижка']:
            button = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
            kids_haircut_hair_comparison = types.KeyboardButton(text='Равнение волос')
            button.add(kids_haircut_hair_comparison)
            bot.send_message(chat_id=message.chat.id, text='Выбирите стрижку ??', reply_markup=button)

    elif message.text in ['Окрашивание ??', 'Окрашивание', 'окрашивание', 'покраску', 'Покраску']:
        message.text = 'окрашивание'
        button = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
        men_staining = types.KeyboardButton(text='Мужское окрашивание ??‍♂')
        women_staining = types.KeyboardButton(text='Женское окрашивание ??')
        kids_staining = types.KeyboardButton(text='Детское окрашивание ??')
        button.add(men_staining, women_staining, kids_staining)
        bot.send_message(chat_id=message.chat.id, text='Выберите тип услуги', reply_markup=button)

        if message.text in ['Мужское окрашивание ??‍♂', 'Мужское', 'Мужское окрашивание']:
            button = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
            men_staining_color = types.KeyboardButton(text='Окрашивание волос ??‍♂')
            button.add(men_staining_color)
            bot.send_message(chat_id=message.chat.id, text='Выбирите окрашивание ??‍♂', reply_markup=button)
            
        elif message.text in ['Женское окрашивание ??', 'Женское', 'Женское окрашивание']:
            button = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
            women_staining_color = types.KeyboardButton(text='Окрашивание волос ??')
            button.add(women_staining_color)
            bot.send_message(chat_id=message.chat.id, text='Выбирите окрашивание ??', reply_markup=button)

        elif message.text in ['Детское окрашивание ??', 'Детское', 'Детское окрашивание']:
            button = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
            kids_staining_color = types.KeyboardButton(text='Окрашивание волос ??')
            button.add(kids_staining_color)
            bot.send_message(chat_id=message.chat.id, text='Выбирите окрашивание ??', reply_markup=button)
    else:
        random_text(message)

    # Error #
@bot.message_handler(content_types=['text'])
def random_text(message):
    not_understand = 'К сожалению, мы не совсем поняли,\nчто вы имеете в виду!\nВоспользуйтесь командой /help \nдля просмотра доступных команд'
    bot.send_message(chat_id=message.chat.id, text=not_understand)

@bot.message_handler(content_types=['photo'])
def random_photo(message):
    not_understand_photo = 'К сожалению, наш бот не умеет распозновать\nфото, возможно функция добавится в дальнейшем!\nВоспользуйтесь командой /help \nдля просмотра доступных команд'
    bot.send_message(chat_id=message.chat.id, text=not_understand_photo)


    # Start #
def main():
    bot.polling(none_stop=True)

    # Name and main #
if __name__ == "__main__":
    main()

Ответы (0 шт):