diff --git a/nonebot/adapters/_base.py b/nonebot/adapters/_base.py index 25928d87..328883c8 100644 --- a/nonebot/adapters/_base.py +++ b/nonebot/adapters/_base.py @@ -351,7 +351,7 @@ class Event(abc.ABC, BaseModel): json_encoders = {Message: DataclassEncoder} @abc.abstractmethod - def get_type(self) -> Literal["message", "notice", "request", "meta_event"]: + def get_type(self) -> str: """ :说明: @@ -360,6 +360,7 @@ class Event(abc.ABC, BaseModel): :返回: * ``Literal["message", "notice", "request", "meta_event"]`` + * ``str`` """ raise NotImplementedError diff --git a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py index 2037577b..53497870 100644 --- a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py +++ b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py @@ -25,10 +25,10 @@ class Event(BaseEvent): __event__ = "" time: int self_id: int - post_type: Literal["message", "notice", "request", "meta_event"] + post_type: str @overrides(BaseEvent) - def get_type(self) -> Literal["message", "notice", "request", "meta_event"]: + def get_type(self) -> str: return self.post_type @overrides(BaseEvent)