feat(bot): ✨ Move background tasks to separate image.

This commit is contained in:
Nyeki.py
2024-11-01 01:52:53 -03:00
parent cd578e43bd
commit 3c7d9e193c
11 changed files with 71 additions and 32 deletions
+29
View File
@@ -0,0 +1,29 @@
import os
from payphone import bot
from payphone.db import setup
from payphone.core import config, logging
bot = bot.bot
bot.shard_ids = [config.SHARD_ID]
bot.shard_count = config.SHARD_COUNT
logging.setup("Payphone")
async def init() -> None:
"""Initializes the DB."""
if config.SHARD_ID == 0:
os.system("aerich upgrade")
await setup.init()
bot.loop.run_until_complete(init())
bot.run(config.TOKEN)