Beispiel #1
0
    def _register_effect_obj(self, effect):

        group_path = effect.message_group
        message_id_list = maybe_list(effect.message_id)
        states_to, states_from = effect.states_to, effect.states_from

        self._effect_patterns.append(
            (message_id_list, group_path, states_to, states_from, effect)
        )

        if self._is_index_built:
            self.rebuild_index()

        return effect
Beispiel #2
0
    def _register_handler_obj(self, handler):

        if handler.permission_checker is None:
            handler.permission_checker = OrChecker(
                self.default_permission_checker)

        group_path = handler.message_group
        message_id_list = maybe_list(handler.message_id)

        self._handler_patterns.append(
            (message_id_list, group_path, handler.states_from, handler)
        )

        if self._is_index_built:
            self.rebuild_index()

        return handler