⚗️ change allowed types for cqhttp #222

Co-authored-by: synodriver <624805065@qq.com>
This commit is contained in:
yanyongyu 2021-02-21 10:56:09 +08:00
parent 2c85b2aa19
commit f9d4bcba3d
2 changed files with 4 additions and 3 deletions

View File

@ -351,7 +351,7 @@ class Event(abc.ABC, BaseModel):
json_encoders = {Message: DataclassEncoder} json_encoders = {Message: DataclassEncoder}
@abc.abstractmethod @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"]`` * ``Literal["message", "notice", "request", "meta_event"]``
* ``str``
""" """
raise NotImplementedError raise NotImplementedError

View File

@ -25,10 +25,10 @@ class Event(BaseEvent):
__event__ = "" __event__ = ""
time: int time: int
self_id: int self_id: int
post_type: Literal["message", "notice", "request", "meta_event"] post_type: str
@overrides(BaseEvent) @overrides(BaseEvent)
def get_type(self) -> Literal["message", "notice", "request", "meta_event"]: def get_type(self) -> str:
return self.post_type return self.post_type
@overrides(BaseEvent) @overrides(BaseEvent)