intra_max_chatbot/main.py

44 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import asyncio
import uvicorn
from bot.logging_setup import setup_logging
setup_logging() # до всех остальных импортов
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:
if config.DRY_RUN:
print(
"\n" + "=" * 60 + "\n"
" ⚠️ DRY-RUN режим активен\n"
" Записи в Intradesk API выполняться НЕ будут.\n"
" Payload запросов будет выводиться в консоль.\n"
+ "=" * 60 + "\n"
)
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())