37 lines
653 B
Python
37 lines
653 B
Python
|
import asyncio
|
||
|
import logging
|
||
|
import sys
|
||
|
|
||
|
from aiogram import Dispatcher
|
||
|
|
||
|
from core import bot
|
||
|
from handlers import routers
|
||
|
from utils.db import Postgres
|
||
|
# from utils.middleware import DeleteMessage
|
||
|
|
||
|
dp = Dispatcher()
|
||
|
dp.include_routers(*routers)
|
||
|
# dp.update.middleware.register(
|
||
|
# middleware=DeleteMessage()
|
||
|
# )
|
||
|
|
||
|
|
||
|
async def start():
|
||
|
"""
|
||
|
Запускает бота
|
||
|
:return:
|
||
|
"""
|
||
|
p = Postgres()
|
||
|
await p.create_tables()
|
||
|
|
||
|
await bot.delete_webhook()
|
||
|
await dp.start_polling(bot)
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
logging.basicConfig(
|
||
|
level=logging.INFO,
|
||
|
stream=sys.stdout
|
||
|
)
|
||
|
asyncio.run(start())
|