Add telegram bot
This commit is contained in:
@@ -27,6 +27,7 @@ from app.schemas import (
|
||||
UserPublic,
|
||||
SetParticipantRole,
|
||||
)
|
||||
from app.services.telegram_notifier import telegram_notifier
|
||||
|
||||
router = APIRouter(prefix="/marathons", tags=["marathons"])
|
||||
|
||||
@@ -294,6 +295,9 @@ async def start_marathon(marathon_id: int, current_user: CurrentUser, db: DbSess
|
||||
|
||||
await db.commit()
|
||||
|
||||
# Send Telegram notifications
|
||||
await telegram_notifier.notify_marathon_start(db, marathon_id, marathon.title)
|
||||
|
||||
return await get_marathon(marathon_id, current_user, db)
|
||||
|
||||
|
||||
@@ -319,6 +323,9 @@ async def finish_marathon(marathon_id: int, current_user: CurrentUser, db: DbSes
|
||||
|
||||
await db.commit()
|
||||
|
||||
# Send Telegram notifications
|
||||
await telegram_notifier.notify_marathon_finish(db, marathon_id, marathon.title)
|
||||
|
||||
return await get_marathon(marathon_id, current_user, db)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user