令返回符合格式

This commit is contained in:
hemengyang
2022-01-12 18:43:07 +08:00
parent 456d333568
commit 187532930b
11 changed files with 20 additions and 232 deletions

View File

@ -17,11 +17,6 @@ class Event(abc.ABC, BaseModel):
def get_type(self) -> str:
"""
获取事件类型的方法,类型通常为 NoneBot 内置的四种类型。
:返回:
Literal["message", "notice", "request", "meta_event"]
* 其他自定义 `str`
"""
raise NotImplementedError
@ -29,10 +24,6 @@ class Event(abc.ABC, BaseModel):
def get_event_name(self) -> str:
"""
获取事件名称的方法。
:返回:
str
"""
raise NotImplementedError
@ -40,10 +31,6 @@ class Event(abc.ABC, BaseModel):
def get_event_description(self) -> str:
"""
获取事件描述的方法,通常为事件具体内容。
:返回:
str
"""
raise NotImplementedError
@ -54,10 +41,6 @@ class Event(abc.ABC, BaseModel):
"""
获取事件日志信息的方法,通常你不需要修改这个方法,只有当希望 NoneBot 隐藏该事件日志时,可以抛出 `NoLogException` 异常。
:返回:
str
:异常:
- `NoLogException`
@ -68,10 +51,6 @@ class Event(abc.ABC, BaseModel):
def get_user_id(self) -> str:
"""
获取事件主体 id 的方法,通常是用户 id 。
:返回:
str
"""
raise NotImplementedError
@ -79,10 +58,6 @@ class Event(abc.ABC, BaseModel):
def get_session_id(self) -> str:
"""
获取会话 id 的方法,用于判断当前事件属于哪一个会话,通常是用户 id、群组 id 组合。
:返回:
str
"""
raise NotImplementedError
@ -90,20 +65,12 @@ class Event(abc.ABC, BaseModel):
def get_message(self) -> "Message":
"""
获取事件消息内容的方法。
:返回:
Message
"""
raise NotImplementedError
def get_plaintext(self) -> str:
"""
获取消息纯文本的方法,通常不需要修改,默认通过 `get_message().extract_plain_text` 获取。
:返回:
str
"""
return self.get_message().extract_plain_text()
@ -111,9 +78,5 @@ class Event(abc.ABC, BaseModel):
def is_tome(self) -> bool:
"""
获取事件是否与机器人有关的方法。
:返回:
bool
"""
raise NotImplementedError