mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-07 04:26:45 +00:00
删除说明前缀
This commit is contained in:
@ -41,15 +41,15 @@ class Driver(abc.ABC):
|
||||
|
||||
_adapters: Dict[str, "Adapter"] = {}
|
||||
"""
|
||||
:说明: 已注册的适配器列表
|
||||
已注册的适配器列表
|
||||
"""
|
||||
_bot_connection_hook: Set[T_BotConnectionHook] = set()
|
||||
"""
|
||||
:说明: Bot 连接建立时执行的函数
|
||||
Bot 连接建立时执行的函数
|
||||
"""
|
||||
_bot_disconnection_hook: Set[T_BotDisconnectionHook] = set()
|
||||
"""
|
||||
:说明: Bot 连接断开时执行的函数
|
||||
Bot 连接断开时执行的函数
|
||||
"""
|
||||
|
||||
def __init__(self, env: Env, config: Config):
|
||||
@ -61,31 +61,27 @@ class Driver(abc.ABC):
|
||||
"""
|
||||
self.env: str = env.environment
|
||||
"""
|
||||
:说明: 环境名称
|
||||
环境名称
|
||||
"""
|
||||
self.config: Config = config
|
||||
"""
|
||||
:说明: 配置对象
|
||||
配置对象
|
||||
"""
|
||||
self._clients: Dict[str, "Bot"] = {}
|
||||
"""
|
||||
:说明: 已连接的 Bot
|
||||
已连接的 Bot
|
||||
"""
|
||||
|
||||
@property
|
||||
def bots(self) -> Dict[str, "Bot"]:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
获取当前所有已连接的 Bot
|
||||
获取当前所有已连接的 Bot
|
||||
"""
|
||||
return self._clients
|
||||
|
||||
def register_adapter(self, adapter: Type["Adapter"], **kwargs) -> None:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
注册一个协议适配器
|
||||
注册一个协议适配器
|
||||
|
||||
:参数:
|
||||
|
||||
@ -119,9 +115,7 @@ class Driver(abc.ABC):
|
||||
@abc.abstractmethod
|
||||
def run(self, *args, **kwargs):
|
||||
"""
|
||||
:说明:
|
||||
|
||||
启动驱动框架
|
||||
启动驱动框架
|
||||
|
||||
:参数:
|
||||
* ``*args``
|
||||
@ -143,9 +137,7 @@ class Driver(abc.ABC):
|
||||
|
||||
def on_bot_connect(self, func: T_BotConnectionHook) -> T_BotConnectionHook:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
装饰一个函数使他在 bot 通过 WebSocket 连接成功时执行。
|
||||
装饰一个函数使他在 bot 通过 WebSocket 连接成功时执行。
|
||||
|
||||
:函数参数:
|
||||
|
||||
@ -156,9 +148,7 @@ class Driver(abc.ABC):
|
||||
|
||||
def on_bot_disconnect(self, func: T_BotDisconnectionHook) -> T_BotDisconnectionHook:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
装饰一个函数使他在 bot 通过 WebSocket 连接断开时执行。
|
||||
装饰一个函数使他在 bot 通过 WebSocket 连接断开时执行。
|
||||
|
||||
:函数参数:
|
||||
|
||||
|
@ -39,9 +39,7 @@ class BlockDriver(Driver):
|
||||
@overrides(Driver)
|
||||
def on_startup(self, func: STARTUP_FUNC) -> STARTUP_FUNC:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
注册一个启动时执行的函数
|
||||
注册一个启动时执行的函数
|
||||
|
||||
:参数:
|
||||
|
||||
@ -53,9 +51,7 @@ class BlockDriver(Driver):
|
||||
@overrides(Driver)
|
||||
def on_shutdown(self, func: SHUTDOWN_FUNC) -> SHUTDOWN_FUNC:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
注册一个停止时执行的函数
|
||||
注册一个停止时执行的函数
|
||||
|
||||
:参数:
|
||||
|
||||
|
@ -168,7 +168,7 @@ class WebSocket(abc.ABC):
|
||||
@abc.abstractmethod
|
||||
def closed(self) -> bool:
|
||||
"""
|
||||
:说明: 连接是否已经关闭
|
||||
连接是否已经关闭
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
@ -48,57 +48,39 @@ class Config(BaseSettings):
|
||||
|
||||
fastapi_openapi_url: Optional[str] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
``openapi.json`` 地址,默认为 ``None`` 即关闭
|
||||
``openapi.json`` 地址,默认为 ``None`` 即关闭
|
||||
"""
|
||||
fastapi_docs_url: Optional[str] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
``swagger`` 地址,默认为 ``None`` 即关闭
|
||||
``swagger`` 地址,默认为 ``None`` 即关闭
|
||||
"""
|
||||
fastapi_redoc_url: Optional[str] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
``redoc`` 地址,默认为 ``None`` 即关闭
|
||||
``redoc`` 地址,默认为 ``None`` 即关闭
|
||||
"""
|
||||
fastapi_include_adapter_schema: bool = True
|
||||
"""
|
||||
:说明:
|
||||
|
||||
是否包含适配器路由的 schema,默认为 ``True``
|
||||
是否包含适配器路由的 schema,默认为 ``True``
|
||||
"""
|
||||
fastapi_reload: bool = False
|
||||
"""
|
||||
:说明:
|
||||
|
||||
开启/关闭冷重载
|
||||
开启/关闭冷重载
|
||||
"""
|
||||
fastapi_reload_dirs: Optional[List[str]] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
重载监控文件夹列表,默认为 uvicorn 默认值
|
||||
重载监控文件夹列表,默认为 uvicorn 默认值
|
||||
"""
|
||||
fastapi_reload_delay: Optional[float] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
重载延迟,默认为 uvicorn 默认值
|
||||
重载延迟,默认为 uvicorn 默认值
|
||||
"""
|
||||
fastapi_reload_includes: Optional[List[str]] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||
"""
|
||||
fastapi_reload_excludes: Optional[List[str]] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||
"""
|
||||
|
||||
class Config:
|
||||
|
@ -56,33 +56,23 @@ class Config(BaseSettings):
|
||||
|
||||
quart_reload: bool = False
|
||||
"""
|
||||
:说明:
|
||||
|
||||
开启/关闭冷重载
|
||||
开启/关闭冷重载
|
||||
"""
|
||||
quart_reload_dirs: Optional[List[str]] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
重载监控文件夹列表,默认为 uvicorn 默认值
|
||||
重载监控文件夹列表,默认为 uvicorn 默认值
|
||||
"""
|
||||
quart_reload_delay: Optional[float] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
重载延迟,默认为 uvicorn 默认值
|
||||
重载延迟,默认为 uvicorn 默认值
|
||||
"""
|
||||
quart_reload_includes: Optional[List[str]] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||
"""
|
||||
quart_reload_excludes: Optional[List[str]] = None
|
||||
"""
|
||||
:说明:
|
||||
|
||||
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||
"""
|
||||
|
||||
class Config:
|
||||
|
Reference in New Issue
Block a user