-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.py
35 lines (28 loc) · 853 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
import asyncio
import logging
import sys
import coloredlogs
from aiogram import Bot, Dispatcher
from config import BOT_API
from telegram.handlers import main_handler
from telegram.keyboards.main_menu import set_main_menu
async def main():
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
stream=sys.stdout,
)
coloredlogs.install(
level='INFO',
fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
isatty=True,
stream=sys.stdout,
)
bot = Bot(token=BOT_API, parse_mode='HTML')
dp = Dispatcher()
await set_main_menu(bot)
dp.include_router(main_handler.router)
await bot.delete_webhook(drop_pending_updates=True)
await dp.start_polling(bot)
if __name__ == '__main__':
asyncio.run(main())