1212keyboard_builder = InlineKeyboardBuilder ()
1313keyboard_builder .button (text = "Update Interval" , callback_data = "interval_call" )
1414keyboard_builder .button (text = "Timezone Region" , callback_data = "timezone_call" )
15+ keyboard_builder .button (text = "Notification Time" , callback_data = "notification_call" )
1516keyboard = keyboard_builder .as_markup (row_width = 2 )
1617
1718class SettingsStates (StatesGroup ):
1819 waiting_for_interval = State ()
1920 waiting_for_timezone = State ()
21+ waiting_for_notification = State ()
2022
2123def settings_commands (dp ):
2224 @dp .message (Command ("settings" ), IsOwner ())
@@ -33,6 +35,10 @@ async def callback_handler(call: types.CallbackQuery, state: FSMContext):
3335 await call .message .answer ("Enter yout timezone location in America/New_York format" )
3436 await state .set_state (SettingsStates .waiting_for_timezone )
3537
38+ if call .data == "notification_call" :
39+ await call .message .answer ("Enter the time of daily notification in 8:00, 16:00, 22:00 format" )
40+ await state .set_state (SettingsStates .waiting_for_notification )
41+
3642 @dp .message (SettingsStates .waiting_for_interval , IsOwner ())
3743 async def process_interval (message : types .Message , state : FSMContext ):
3844 interval_val = message .text
@@ -43,4 +49,10 @@ async def process_interval(message: types.Message, state: FSMContext):
4349 async def process_timezone (message : types .Message , state : FSMContext ):
4450 timezone_val = message .text
4551 sett .write_settings ("timezone" , timezone_val )
52+ await state .clear ()
53+
54+ @dp .message (SettingsStates .waiting_for_timezone , IsOwner ())
55+ async def process_notification (message : types .Message , state : FSMContext ):
56+ notification_val = message .text
57+ sett .write_settings ("notification_time" , notification_val )
4658 await state .clear ()
0 commit comments