mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-07 04:26:45 +00:00
令参数列表符合 autodoc 格式
This commit is contained in:
@ -67,7 +67,7 @@ class Adapter(abc.ABC):
|
||||
|
||||
:参数:
|
||||
|
||||
* `api: str`: API 名称
|
||||
* `**data`: API 数据
|
||||
api: API 名称
|
||||
**data: API 数据
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
@ -38,8 +38,8 @@ class Bot(abc.ABC):
|
||||
"""
|
||||
:参数:
|
||||
|
||||
* `self_id: str`: 机器人 ID
|
||||
* `request: HTTPConnection`: request 连接对象
|
||||
self_id: 机器人 ID
|
||||
request: request 连接对象
|
||||
"""
|
||||
self.adapter: "Adapter" = adapter
|
||||
self.self_id: str = self_id
|
||||
@ -62,8 +62,8 @@ class Bot(abc.ABC):
|
||||
|
||||
:参数:
|
||||
|
||||
* `api: str`: API 名称
|
||||
* `**data`: API 数据
|
||||
api: API 名称
|
||||
**data: API 数据
|
||||
|
||||
:示例:
|
||||
|
||||
@ -131,9 +131,9 @@ class Bot(abc.ABC):
|
||||
|
||||
:参数:
|
||||
|
||||
* `event: Event`: 上报事件
|
||||
* `message: Union[str, Message, MessageSegment]`: 要发送的消息
|
||||
* `**kwargs`
|
||||
event: 上报事件
|
||||
message: 要发送的消息
|
||||
**kwargs
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@ -144,9 +144,9 @@ class Bot(abc.ABC):
|
||||
|
||||
:参数:
|
||||
|
||||
* `bot: Bot`: 当前 bot 对象
|
||||
* `api: str`: 调用的 api 名称
|
||||
* `data: Dict[str, Any]`: api 调用的参数字典
|
||||
bot: 当前 bot 对象
|
||||
api: 调用的 api 名称
|
||||
data: api 调用的参数字典
|
||||
"""
|
||||
cls._calling_api_hook.add(func)
|
||||
return func
|
||||
@ -158,11 +158,11 @@ class Bot(abc.ABC):
|
||||
|
||||
:参数:
|
||||
|
||||
* `bot: Bot`: 当前 bot 对象
|
||||
* `exception: Optional[Exception]`: 调用 api 时发生的错误
|
||||
* `api: str`: 调用的 api 名称
|
||||
* `data: Dict[str, Any]`: api 调用的参数字典
|
||||
* `result: Any`: api 调用的返回
|
||||
bot: 当前 bot 对象
|
||||
exception: 调用 api 时发生的错误
|
||||
api: 调用的 api 名称
|
||||
data: api 调用的参数字典
|
||||
result: api 调用的返回
|
||||
"""
|
||||
cls._called_api_hook.add(func)
|
||||
return func
|
||||
|
@ -20,7 +20,7 @@ class Event(abc.ABC, BaseModel):
|
||||
|
||||
:返回:
|
||||
|
||||
* `Literal["message", "notice", "request", "meta_event"]`
|
||||
Literal["message", "notice", "request", "meta_event"]
|
||||
* 其他自定义 `str`
|
||||
"""
|
||||
raise NotImplementedError
|
||||
@ -32,7 +32,7 @@ class Event(abc.ABC, BaseModel):
|
||||
|
||||
:返回:
|
||||
|
||||
* `str`
|
||||
str
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@ -43,7 +43,7 @@ class Event(abc.ABC, BaseModel):
|
||||
|
||||
:返回:
|
||||
|
||||
* `str`
|
||||
str
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@ -56,7 +56,7 @@ class Event(abc.ABC, BaseModel):
|
||||
|
||||
:返回:
|
||||
|
||||
* `str`
|
||||
str
|
||||
|
||||
:异常:
|
||||
|
||||
@ -71,7 +71,7 @@ class Event(abc.ABC, BaseModel):
|
||||
|
||||
:返回:
|
||||
|
||||
* `str`
|
||||
str
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@ -82,7 +82,7 @@ class Event(abc.ABC, BaseModel):
|
||||
|
||||
:返回:
|
||||
|
||||
* `str`
|
||||
str
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@ -93,7 +93,7 @@ class Event(abc.ABC, BaseModel):
|
||||
|
||||
:返回:
|
||||
|
||||
* `Message`
|
||||
Message
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@ -103,7 +103,7 @@ class Event(abc.ABC, BaseModel):
|
||||
|
||||
:返回:
|
||||
|
||||
* `str`
|
||||
str
|
||||
"""
|
||||
return self.get_message().extract_plain_text()
|
||||
|
||||
@ -114,6 +114,6 @@ class Event(abc.ABC, BaseModel):
|
||||
|
||||
:返回:
|
||||
|
||||
* `bool`
|
||||
bool
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
@ -99,7 +99,7 @@ class Message(List[TMS], abc.ABC):
|
||||
"""
|
||||
:参数:
|
||||
|
||||
* `message: Union[str, list, dict, MessageSegment, Message, Any]`: 消息内容
|
||||
message: 消息内容
|
||||
"""
|
||||
super().__init__(*args, **kwargs)
|
||||
if message is None:
|
||||
@ -137,7 +137,7 @@ class Message(List[TMS], abc.ABC):
|
||||
|
||||
:参数:
|
||||
|
||||
* `format_string: str`: 格式化字符串
|
||||
format_string: 格式化字符串
|
||||
|
||||
:返回:
|
||||
|
||||
@ -190,7 +190,7 @@ class Message(List[TMS], abc.ABC):
|
||||
|
||||
:参数:
|
||||
|
||||
* `obj: Union[str, MessageSegment]`: 要添加的消息段
|
||||
obj: 要添加的消息段
|
||||
"""
|
||||
if isinstance(obj, MessageSegment):
|
||||
super(Message, self).append(obj)
|
||||
@ -206,7 +206,7 @@ class Message(List[TMS], abc.ABC):
|
||||
|
||||
:参数:
|
||||
|
||||
* `obj: Union[Message, Iterable[MessageSegment]]`: 要添加的消息数组
|
||||
obj: 要添加的消息数组
|
||||
"""
|
||||
for segment in obj:
|
||||
self.append(segment)
|
||||
|
@ -51,8 +51,8 @@ class MessageTemplate(Formatter, Generic[TF]):
|
||||
|
||||
:参数:
|
||||
|
||||
* `template: Union[str, Message]`: 模板
|
||||
* `factory: Union[str, Message]`: 消息构造类型,默认为 `str`
|
||||
template: 模板
|
||||
factory: 消息构造类型,默认为 `str`
|
||||
"""
|
||||
self.template: TF = template
|
||||
self.factory: Type[TF] = factory
|
||||
|
Reference in New Issue
Block a user