Files
payphone/run.py
T

33 lines
563 B
Python

import aerich
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:
command = aerich.Command(config.TORTOISE_ORM, "models", "./payphone/db/migrations")
await command.init_db(True)
await command.upgrade()
await setup.init()
bot.loop.run_until_complete(init())
bot.run(config.TOKEN)