-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (25 loc) · 715 Bytes
/
main.py
File metadata and controls
33 lines (25 loc) · 715 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
33
import asyncio
import logging
from aiogram import Bot, Dispatcher
from dotenv import load_dotenv
import os
from app.handlers import router
load_dotenv()
logging.basicConfig(
level=logging.ERROR,
format="%(asctime)s [%(levelname)s] %(message)s",
handlers=[
logging.FileHandler("bot.log"),
logging.StreamHandler()
]
)
logger = logging.getLogger(__name__)
async def main():
bot = Bot(token=os.getenv('BOT_TOKEN'))
dp = Dispatcher()
dp.include_router(router)
logger.info("Бот запущено і готовий до роботи")
print("^^^^^^ Запуск бота ^^^^^^")
await dp.start_polling(bot)
if __name__=='__main__':
asyncio.run(main())