This commit is contained in:
@@ -34,18 +34,19 @@ async def on_startup(dispatcher):
|
|||||||
@dispatcher.callback_query_handler(lambda call: call.data.startswith("action_"))
|
@dispatcher.callback_query_handler(lambda call: call.data.startswith("action_"))
|
||||||
async def handle_callback(call: types.CallbackQuery):
|
async def handle_callback(call: types.CallbackQuery):
|
||||||
print(f"[DEBUG handle_callback] Received call.data: {call.data!r}")
|
print(f"[DEBUG handle_callback] Received call.data: {call.data!r}")
|
||||||
|
print(f"[DEBUG handle_callback] call.data repr: {repr(call.data)}")
|
||||||
timer_manager = dispatcher['timer_manager']
|
timer_manager = dispatcher['timer_manager']
|
||||||
|
|
||||||
if call.data == "action_pomodoro":
|
if "pomodoro" in call.data:
|
||||||
await timer_manager.start_timer(call.from_user.id, 25*60, call.message.chat.id, 'Pomodoro')
|
await timer_manager.start_timer(call.from_user.id, 25*60, call.message.chat.id, 'Pomodoro')
|
||||||
await call.message.answer("Начался 25-минутный Pomodoro! 🔥")
|
await call.message.answer("Начался 25-минутный Pomodoro! 🔥")
|
||||||
elif call.data == "action_shortbreak":
|
elif "shortbreak" in call.data:
|
||||||
await timer_manager.start_timer(call.from_user.id, 5*60, call.message.chat.id, 'Short Break')
|
await timer_manager.start_timer(call.from_user.id, 5*60, call.message.chat.id, 'Short Break')
|
||||||
await call.message.answer("Начался 5-минутный перерыв ☕")
|
await call.message.answer("Начался 5-минутный перерыв ☕")
|
||||||
elif call.data == "action_longbreak":
|
elif "longbreak" in call.data:
|
||||||
await timer_manager.start_timer(call.from_user.id, 15*60, call.message.chat.id, 'Long Break')
|
await timer_manager.start_timer(call.from_user.id, 15*60, call.message.chat.id, 'Long Break')
|
||||||
await call.message.answer("Начался длинный перерыв 😌")
|
await call.message.answer("Начался длинный перерыв 😌")
|
||||||
elif call.data == "action_stop":
|
elif "stop" in call.data:
|
||||||
await timer_manager.stop_timer(call.from_user.id)
|
await timer_manager.stop_timer(call.from_user.id)
|
||||||
await call.message.answer("Таймер остановлен ⏹")
|
await call.message.answer("Таймер остановлен ⏹")
|
||||||
await call.answer()
|
await call.answer()
|
||||||
|
|||||||
Reference in New Issue
Block a user