aiogram-dialog¶
Though it is not required, you can use dishka-aiogram_dialog integration. It allows you to inject object into aiogram-dialog handlers.
How to use¶
Setup aiogram integration
Import decorator
from dishka.integrations.aiogram_dialog import FromDishka, inject
Mark those of your
aiogram-dialoghandlers and getters parameters which are to be injected withFromDishka[]decorate them using imported@injectdecorator.
@inject
async def getter(
a: FromDishka[RequestDep],
mock: FromDishka[Mock],
**kwargs,
):
...
@inject
async def on_click(
event,
widget,
manager,
a: FromDishka[RequestDep],
mock: FromDishka[Mock],
):
...