-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (26 loc) · 930 Bytes
/
main.py
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
29
30
31
32
33
34
35
36
37
38
39
import asyncio
from aiogram import Dispatcher
from bot.bot_instance import bot
from bot.handlers.message_handlers import message_router
from bot.handlers.user_handlers import user_router
from bot.handlers.art_handlers import art_router
from bot.callbacks.callback import callback_router
def register_routers(dp: Dispatcher) -> None:
"""Registers routers"""
dp.include_router(message_router)
dp.include_router(user_router)
dp.include_router(art_router)
# callback routers
dp.include_router(callback_router)
async def main() -> None:
"""The main function which will execute our event loop and start polling."""
try:
dp = Dispatcher()
print('Bot Starting....')
register_routers(dp)
print("Polling ....")
await dp.start_polling(bot)
except:
print("Some error occurred")
if __name__ == "__main__":
asyncio.run(main())