32 lines
653 B
Python
32 lines
653 B
Python
import asyncio
|
|
import uvicorn
|
|
|
|
from database.connection import init_db
|
|
from bot.setup import create_bot_and_dispatcher
|
|
from admin.app import create_admin_app
|
|
import config
|
|
|
|
|
|
async def main() -> None:
|
|
await init_db()
|
|
|
|
bot, dp = create_bot_and_dispatcher()
|
|
admin_app = create_admin_app()
|
|
|
|
server = uvicorn.Server(
|
|
uvicorn.Config(
|
|
admin_app,
|
|
host=config.ADMIN_HOST,
|
|
port=config.ADMIN_PORT,
|
|
log_level="info",
|
|
)
|
|
)
|
|
|
|
await asyncio.gather(
|
|
dp.start_polling(bot, skip_updates=True),
|
|
server.serve(),
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|