feat(bot): ✨ Improve the startup script.

This commit is contained in:
Nyeki.py
2024-10-22 18:43:54 -03:00
parent edae71827b
commit c13b351649
3 changed files with 60 additions and 18 deletions
-8
View File
@@ -1,8 +1,5 @@
from datetime import datetime, timezone
import tortoise
from payphone.db import models
from payphone.core import config
@@ -10,8 +7,3 @@ async def init() -> None:
"""Initialize the database and it's connections."""
await tortoise.Tortoise.init(config.TORTOISE_ORM, use_tz=True)
await tortoise.Tortoise.generate_schemas(safe=True)
await models.Call.filter(ended_at=None).update(ended_at=datetime.now(timezone.utc))
await models.Channel.exclude(call_id=None).update(call_id=None)