aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/infini/handler.py
blob: 8444d3b6a6bf2276d29a081ee07ca5a67b409754 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from abc import ABCMeta, abstractmethod
from .event import MatcherEvent, InfiniEvent

__all__ = ["Handler"]


# class Result:
#     """规则包运行结果"""

#     event: str
#     status: bool
#     kwargs: dict = {}

#     def __init__(self, event: str, status: bool, **kwargs) -> None:
#         self.event = event
#         self.status = status
#         self.kwargs = kwargs


class Handler(metaclass=ABCMeta):
    """规则包业务基类"""

    name: str
    priority: int = 0

    # def __init_subclass__(cls) -> None:
    #     handlers.regist(cls.name, cls())

    @abstractmethod
    def process(self, event: MatcherEvent) -> InfiniEvent:
        raise NotImplementedError