@@ -15,12 +15,13 @@ class PlanFormat(StatesGroup):
1515 """State machine for selecting the format of the study plan."""
1616 waiting_for_format = State ()
1717 waiting_for_topic = State ()
18+ waiting_for_next_action = State ()
1819
1920 def __str__ (self ):
2021 return "PlanFormat FSM"
2122
2223
23- @router .message (Command ("plan" )) # Changed from /start to /plan
24+ @router .message (Command ("plan" ))
2425async def cmd_plan (message : types .Message , state : FSMContext ):
2526 await state .set_state (PlanFormat .waiting_for_format )
2627 await message .answer (
@@ -63,4 +64,29 @@ async def handle_topic(message: types.Message, state: FSMContext):
6364 document = types .FSInputFile (txt_path ),
6465 caption = "📄 Твой учебный план в TXT" )
6566
67+ await state .set_state (PlanFormat .waiting_for_next_action )
68+ await message .answer (
69+ "Что ещё ты хотел бы сделать?" ,
70+ reply_markup = types .InlineKeyboardMarkup (
71+ inline_keyboard = [
72+ [types .InlineKeyboardButton (text = "🔄 Создать новый план" ,
73+ callback_data = "new_plan" )],
74+ [types .InlineKeyboardButton (text = "👋 Ничего, хорошего дня!" ,
75+ callback_data = "goodbye" )]
76+ ]
77+ )
78+ )
79+
80+
81+ @router .callback_query (PlanFormat .waiting_for_next_action , F .data == "new_plan" )
82+ async def handle_new_plan (callback : types .CallbackQuery , state : FSMContext ):
83+ await callback .answer ()
84+ await callback .message .edit_text ("Создаем новый план!" )
85+ await cmd_plan (callback .message , state )
86+
87+
88+ @router .callback_query (PlanFormat .waiting_for_next_action , F .data == "goodbye" )
89+ async def handle_goodbye (callback : types .CallbackQuery , state : FSMContext ):
90+ await callback .answer ()
91+ await callback .message .edit_text ("Хорошего дня! 👋 Буду рад помочь снова, когда понадобится." )
6692 await state .clear ()
0 commit comments