-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
32 lines (21 loc) · 754 Bytes
/
Copy pathbot.py
File metadata and controls
32 lines (21 loc) · 754 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
import os
from aiogram import Bot, Dispatcher
from aiogram.fsm.storage.memory import MemoryStorage
storage: MemoryStorage = MemoryStorage()
from handlers import command_handlers, other_handlers, fms_menu
logging.basicConfig(level=logging.INFO)
bot: Bot = Bot(token=os.getenv("TG_API"), parse_mode='HTML')
async def main():
logging.info('Starting bot')
dp: Dispatcher = Dispatcher(storage=storage)
dp.include_router(command_handlers.router)
dp.include_router(fms_menu.router)
dp.include_router(other_handlers.router)
await dp.start_polling(bot)
if __name__ == '__main__':
try:
asyncio.run(main())
except (KeyboardInterrupt, SystemExit):
logging.error('Bot stopped')