From f9d4bcba3d03d3ec89944273fadac6ec6fd1c066 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Sun, 21 Feb 2021 10:56:09 +0800 Subject: [PATCH] :alembic: change allowed types for cqhttp #222 Co-authored-by: synodriver <624805065@qq.com> --- nonebot/adapters/_base.py | 3 ++- .../nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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)