mirukana/mio

Room event callbacks

mirukana opened this issue · 0 comments

  • Rooms.callbacks field of type Dict[Type[Event[ContentT]], Set[Callable[[Room, Event], None]]], users can manually add or remove callbacks with e.g. client.rooms.callbacks[TimelineEvent[Text]].add(my_func).
    The type keys can be an Event type, Content type, or Event[Content].

  • Callback groups: a class for which every user-defined, non-underscore-prefixed method will automatically be registered as a callback.
    Methods would have signatures such as: async def any_name(self, room: Room, event: Timeline[Text]) -> None: ....
    The event parameter's type should be introspected using inspect.signature(func).