mirror of
https://github.com/ada-dmitry/vol_bot.git
synced 2026-09-24 00:30:19 +00:00
init project
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from aiogram import Bot, Dispatcher
|
||||
from aiogram.fsm.storage.memory import MemoryStorage
|
||||
from handlers import user, admin
|
||||
from database import engine, Base
|
||||
import asyncio
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
async def on_startup():
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
|
||||
async def main():
|
||||
bot = Bot(token=os.getenv("BOT_TOKEN"))
|
||||
dp = Dispatcher(storage=MemoryStorage())
|
||||
dp.include_routers(user.router, admin.router)
|
||||
await on_startup()
|
||||
await dp.start_polling(bot)
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user