-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMybot.py
More file actions
26 lines (24 loc) · 722 Bytes
/
Copy pathMybot.py
File metadata and controls
26 lines (24 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import logging
import os
import asyncio
from aiogram import Bot, Dispatcher
from app.admin import admin
from app.user import user
from app.database.models import async_main
from dotenv import load_dotenv
async def main():
load_dotenv()
bot = Bot(token=os.getenv('TOKEN'))
MISTRAL_API_KEY = os.getenv("MISTRAL_API_KEY")
dp = Dispatcher()
dp.include_routers(user,admin)
dp.startup.register(on_startup)
await dp.start_polling(bot)
async def on_startup(dispatcher):
await async_main()
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO) # Подключение логирования
try:
asyncio.run(main())
except KeyboardInterrupt:
print('Exit')