-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
34 lines (25 loc) · 813 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
import logging
from os import getenv
from asyncio import run
from aiogram import Bot, Dispatcher
from aiogram.enums import ParseMode
from aiogram.client.default import DefaultBotProperties
from aiogram.fsm.storage.memory import MemoryStorage
from handlers import handlers
from database.db import Database
from dotenv import load_dotenv
db = Database()
load_dotenv()
async def main():
storage = MemoryStorage()
dp = Dispatcher(storage=storage)
dp.include_router(handlers.router)
TOKEN = getenv('BOT_TOKEN')
bot = Bot(token=TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML))
await dp.start_polling(bot)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
try:
run(main())
finally:
db.close()