调整缩进

This commit is contained in:
hemengyang
2022-01-12 19:10:29 +08:00
parent 6d21cbed55
commit 0e97022d3b
18 changed files with 309 additions and 319 deletions

View File

@ -66,7 +66,7 @@ class Adapter(abc.ABC):
`adapter` 实际调用 api 的逻辑实现函数,实现该方法以调用 api。
参数:
api: API 名称
**data: API 数据
api: API 名称
**data: API 数据
"""
raise NotImplementedError

View File

@ -37,8 +37,8 @@ class Bot(abc.ABC):
def __init__(self, adapter: "Adapter", self_id: str):
"""
参数:
self_id: 机器人 ID
request: request 连接对象
self_id: 机器人 ID
request: request 连接对象
"""
self.adapter: "Adapter" = adapter
self.self_id: str = self_id
@ -60,8 +60,8 @@ class Bot(abc.ABC):
调用机器人 API 接口,可以通过该函数或直接通过 bot 属性进行调用
参数:
api: API 名称
**data: API 数据
api: API 名称
**data: API 数据
用法:
```python
@ -127,9 +127,8 @@ class Bot(abc.ABC):
调用机器人基础发送消息接口
参数:
event: 上报事件
message: 要发送的消息
**kwargs
event: 上报事件
message: 要发送的消息
"""
raise NotImplementedError
@ -139,9 +138,9 @@ class Bot(abc.ABC):
调用 api 预处理。
参数:
bot: 当前 bot 对象
api: 调用的 api 名称
data: api 调用的参数字典
bot: 当前 bot 对象
api: 调用的 api 名称
data: api 调用的参数字典
"""
cls._calling_api_hook.add(func)
return func
@ -152,11 +151,11 @@ class Bot(abc.ABC):
调用 api 后处理。
参数:
bot: 当前 bot 对象
exception: 调用 api 时发生的错误
api: 调用的 api 名称
data: api 调用的参数字典
result: api 调用的返回
bot: 当前 bot 对象
exception: 调用 api 时发生的错误
api: 调用的 api 名称
data: api 调用的参数字典
result: api 调用的返回
"""
cls._called_api_hook.add(func)
return func

View File

@ -42,7 +42,7 @@ class Event(abc.ABC, BaseModel):
获取事件日志信息的方法,通常你不需要修改这个方法,只有当希望 NoneBot 隐藏该事件日志时,可以抛出 `NoLogException` 异常。
异常:
NoLogException
NoLogException
"""
return f"[{self.get_event_name()}]: {self.get_event_description()}"

View File

@ -98,7 +98,7 @@ class Message(List[TMS], abc.ABC):
):
"""
参数:
message: 消息内容
message: 消息内容
"""
super().__init__(*args, **kwargs)
if message is None:
@ -134,10 +134,10 @@ class Message(List[TMS], abc.ABC):
```
参数:
format_string: 格式化字符串
format_string: 格式化字符串
返回:
MessageFormatter[TM]: 消息格式化器
MessageFormatter[TM]: 消息格式化器
"""
return MessageTemplate(format_string, cls)
@ -185,7 +185,7 @@ class Message(List[TMS], abc.ABC):
添加一个消息段到消息数组末尾
参数:
obj: 要添加的消息段
obj: 要添加的消息段
"""
if isinstance(obj, MessageSegment):
super(Message, self).append(obj)
@ -200,7 +200,7 @@ class Message(List[TMS], abc.ABC):
拼接一个消息数组或多个消息段到消息数组末尾
参数:
obj: 要添加的消息数组
obj: 要添加的消息数组
"""
for segment in obj:
self.append(segment)

View File

@ -50,8 +50,8 @@ class MessageTemplate(Formatter, Generic[TF]):
创建一个模板
参数:
template: 模板
factory: 消息构造类型,默认为 `str`
template: 模板
factory: 消息构造类型,默认为 `str`
"""
self.template: TF = template
self.factory: Type[TF] = factory