Telegram bot переход на следующий вопрос после календаря

Пишу бота анкету. После ответа должен задаваться следующий вопрос. В одном из пунктов нужно выбрать дату. Я использую уже готовый календарь. Но после выбора даты следующий вопрос не задается, но скрипт не падает, а ждет ввода и выдает Exception - ooops!. Как поправитьч что бы выводило вопрос "Фамилия Имя Отчество". Спасибо. Вот код часть кода, которая включает предыдущий вопрос календарь и следующий вопрос:

    def process_Personenanzahl_step(message):
    try:
        chat_id = message.chat.id
        user = user_dict[chat_id]
        user.carModel = message.text

        markup = types.ReplyKeyboardMarkup(one_time_keyboard=True, resize_keyboard=True)
        itembtn1 = types.KeyboardButton('1')
        itembtn2 = types.KeyboardButton('2')
        itembtn3 = types.KeyboardButton('3')
        itembtn4 = types.KeyboardButton('4')
        itembtn5 = types.KeyboardButton('5')
        markup.add(itembtn1, itembtn2, itembtn3, itembtn4, itembtn5)

        msg = bot.send_message(chat_id, 'Количесвтво', reply_markup=markup)
        bot.register_next_step_handler(msg, check_calendar_messages)

    except Exception as e:
        bot.reply_to(message, 'ooops!!')



calendar_1 = CallbackData("calendar_1", "action", "year", "month", "day")


def check_calendar_messages(message):
    now = datetime.datetime.now()  # Get the current date
    bot.send_message(
        message.chat.id,
        "Selected date",
        reply_markup=telebot_calendar.create_calendar(
            name=calendar_1.prefix,
            year=now.year,
            month=now.month,  # Specify the NAME of your calendar
        ),
    )


@bot.callback_query_handler(func=lambda call: call.data.startswith(calendar_1.prefix))
def callback_inline(call: object) -> object:
    # At this point, we are sure that this calendar is ours. So we cut the line by the separator of our calendar
    name, action, year, month, day = call.data.split(calendar_1.sep)
    # Processing the calendar. Get either the date or None if the buttons are of a different type
    date = telebot_calendar.calendar_query_handler(
        bot=bot, call=call, name=name, action=action, year=year, month=month, day=day
    )
    # There are additional steps. Let's say if the date DAY is selected, you can execute your code. I sent a message.
    if action == "DAY":
        msg = bot.send_message(
            chat_id=call.from_user.id,
            text=f"You have chosen {date.strftime('%d.%m.%Y')}",
            reply_markup=ReplyKeyboardRemove(),
        )
        print(f"{calendar_1}: Day: {date.strftime('%d.%m.%Y')}")
        bot.register_next_step_handler(msg, process_fullname_step)


def process_fullname_step(message):
    try:
        chat_id = message.chat.id
        user_dict[chat_id] = User(message.text)


        markup = types.ReplyKeyboardRemove(selective=False)

        msg = bot.send_message(chat_id, 'Фамилия Имя Отчество', reply_markup=markup)
        bot.register_next_step_handler(msg, process_fullname_step)

    except Exception as e:
        bot.reply_to(message, 'ooops!!')

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

Автор решения: Alex23cm

У вас в коде присутствует ошибка

Exception - ooops!

выполняется в том случае, когда у вас в коде присутствует ошибка, нужно логировать действия или выложите полный код.

→ Ссылка