fix routes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-28 20:10:12 +05:00
parent 9e1e5c16da
commit 4183875ff8
4 changed files with 13 additions and 15 deletions

View File

@@ -1,13 +1,10 @@
import asyncio
from pomodoro_bot.user_manager import user_manager
from pomodoro_bot.models import UserState
from aiogram import Bot
import os
bot = Bot(token=os.getenv("BOT_TOKEN"))
from .user_manager import user_manager
from .models import UserState
class TimerManager:
def __init__(self):
def __init__(self, bot):
self.bot = bot
self.tasks = {}
async def start_timer(self, user_id, duration, chat_id, label):
@@ -17,7 +14,7 @@ class TimerManager:
await asyncio.sleep(duration)
if label == 'Pomodoro':
await user_manager.increment_pomodoros(user_id)
await bot.send_message(chat_id, f"{label} завершён!")
await self.bot.send_message(chat_id, f"{label} завершён!")
task = asyncio.create_task(timer())
user = user_manager.get_user(user_id)
@@ -31,4 +28,4 @@ class TimerManager:
user.task.cancel()
user.task = None
user.current_timer = None
self.tasks.pop(user_id, None)
self.tasks.pop(user_id, None)