💡 update source docstring #46 #49

This commit is contained in:
yanyongyu
2020-11-13 01:46:26 +08:00
parent 5c29abd724
commit 28e3177e60
10 changed files with 160 additions and 77 deletions

View File

@ -60,6 +60,19 @@ class BaseBot(abc.ABC):
async def check_permission(cls, driver: Driver, connection_type: str,
headers: dict,
body: Optional[dict]) -> Union[str, NoReturn]:
"""
:说明:
检查连接请求是否合法的函数,如果合法则返回当前连接 ``唯一标识符``,通常为机器人 ID如果不合法则抛出 ``RequestDenied`` 异常。
:参数:
* ``driver: Driver``: Driver 对象
* ``connection_type: str``: 连接类型
* ``headers: dict``: 请求头
* ``body: Optional[dict]``: 请求数据WebSocket 连接该部分为空
:返回:
- ``str``: 连接唯一标识符
:异常:
- ``RequestDenied``: 请求非法
"""
raise NotImplementedError
@abc.abstractmethod
@ -84,7 +97,7 @@ class BaseBot(abc.ABC):
.. code-block:: python
await bot.call_api("send_msg", data={"message": "hello world"})
await bot.call_api("send_msg", message="hello world"})
await bot.send_msg(message="hello world")
"""
raise NotImplementedError