14 lines
349 B
Python
14 lines
349 B
Python
from aiogram import BaseMiddleware
|
|
from aiogram.types import TelegramObject
|
|
|
|
from repos.dao import DAO
|
|
|
|
|
|
class DaoMiddleware(BaseMiddleware):
|
|
def __init__(self, dao: DAO):
|
|
self._dao = dao
|
|
|
|
async def __call__(self, handler, event: TelegramObject, data: dict):
|
|
data["dao"] = self._dao
|
|
return await handler(event, data)
|