-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.py
More file actions
28 lines (19 loc) · 678 Bytes
/
app.py
File metadata and controls
28 lines (19 loc) · 678 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
27
28
from loader import db
from loader import bot, storage
from src.utils.db_api import db_gino
from src.utils.set_bot_commands import set_default_commands
async def on_startup(dp):
import src.middlewares
src.middlewares.setup(dp)
await set_default_commands(dp)
from src.utils.notify_admins import on_startup_notify
await on_startup_notify(dp)
await db_gino.on_startup(dp)
await db.gino.create_all()
async def on_shutdown(dp):
await bot.close()
await storage.close()
if __name__ == '__main__':
from aiogram import executor
from src.handlers import dp
executor.start_polling(dp, on_startup=on_startup, on_shutdown=on_shutdown)