-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (24 loc) · 854 Bytes
/
main.py
File metadata and controls
32 lines (24 loc) · 854 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
29
30
31
32
import asyncio
import logging
from aiogram import Bot, Dispatcher
from aiogram.fsm.storage.memory import MemoryStorage
from src.bot.core.config import BotConfig
from src.bot.middlewares.subscription import SubscriptionMiddleware
from src.bot.handlers import base, vacancies, ads, admin, applications
async def main():
logging.basicConfig(level=logging.INFO)
config = BotConfig.from_env()
bot = Bot(token=config.token)
dp = Dispatcher(storage=MemoryStorage())
dp.message.middleware(SubscriptionMiddleware())
dp.callback_query.middleware(SubscriptionMiddleware())
dp.include_routers(
base.router,
vacancies.router,
ads.router,
admin.router,
applications.router
)
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())