diff --git a/anilibria/client/client.py b/anilibria/client/client.py index 5e735e3..afa0c95 100644 --- a/anilibria/client/client.py +++ b/anilibria/client/client.py @@ -76,7 +76,7 @@ async def _on_playlist_update(self, event: PlaylistUpdate): "on_title_episode", TitleEpisode(title=title, episode=event.updated_episode) ) - def on(self, event: Type[BaseEvent]) -> Callable: + def on(self, event: BaseEvent): """ Декоратор для прослушивания событий. Принимает класс события. @@ -88,10 +88,12 @@ async def name_you_want(event: PlaylistUpdate): :param event: Класс ивента """ - def wrapper(coro: Callable[..., Coroutine]): + def wrapper(coro: Callable[..., Coroutine]) -> Callable[..., Coroutine]: event_name: str = "on_" + EventType(event).name.lower() self._websocket.dispatch.register(event_name, coro) + return coro + return wrapper def listen(self, coro: Callable[..., Coroutine] = MISSING, *, name: str = MISSING):