(message: types.Message, state: StateContext)
| 54 | # Handler for age input |
| 55 | @bot.message_handler(state=MyStates.age, is_digit=True) |
| 56 | def ask_color(message: types.Message, state: StateContext): |
| 57 | state.set(MyStates.color) |
| 58 | state.add_data(age=message.text) |
| 59 | |
| 60 | # Define reply keyboard for color selection |
| 61 | keyboard = types.ReplyKeyboardMarkup(row_width=2) |
| 62 | colors = ["Red", "Green", "Blue", "Yellow", "Purple", "Orange", "Other"] |
| 63 | buttons = [types.KeyboardButton(color) for color in colors] |
| 64 | keyboard.add(*buttons) |
| 65 | |
| 66 | bot.send_message( |
| 67 | message.chat.id, |
| 68 | "What is your favorite color? Choose from the options below.", |
| 69 | reply_markup=keyboard, |
| 70 | reply_parameters=ReplyParameters(message_id=message.message_id), |
| 71 | ) |
| 72 | |
| 73 | |
| 74 | # Handler for color input |
nothing calls this directly
no test coverage detected
searching dependent graphs…