mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-30 17:15:08 +08:00
删除类型
This commit is contained in:
parent
e29db806cc
commit
705a6f7fbf
@ -27,13 +27,11 @@ class Bot(abc.ABC):
|
|||||||
|
|
||||||
_calling_api_hook: Set[T_CallingAPIHook] = set()
|
_calling_api_hook: Set[T_CallingAPIHook] = set()
|
||||||
"""
|
"""
|
||||||
:类型: ``Set[T_CallingAPIHook]``
|
:说明: call_api 时执行的函数
|
||||||
:说明: call_api 时执行的函数
|
|
||||||
"""
|
"""
|
||||||
_called_api_hook: Set[T_CalledAPIHook] = set()
|
_called_api_hook: Set[T_CalledAPIHook] = set()
|
||||||
"""
|
"""
|
||||||
:类型: ``Set[T_CalledAPIHook]``
|
:说明: call_api 后执行的函数
|
||||||
:说明: call_api 后执行的函数
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, adapter: "Adapter", self_id: str):
|
def __init__(self, adapter: "Adapter", self_id: str):
|
||||||
|
@ -26,13 +26,11 @@ class MessageSegment(Mapping, abc.ABC, Generic[TM]):
|
|||||||
|
|
||||||
type: str
|
type: str
|
||||||
"""
|
"""
|
||||||
- 类型: ``str``
|
- 说明: 消息段类型
|
||||||
- 说明: 消息段类型
|
|
||||||
"""
|
"""
|
||||||
data: Dict[str, Any] = field(default_factory=lambda: {})
|
data: Dict[str, Any] = field(default_factory=lambda: {})
|
||||||
"""
|
"""
|
||||||
- 类型: ``Dict[str, Union[str, list]]``
|
- 说明: 消息段数据
|
||||||
- 说明: 消息段数据
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -137,8 +137,7 @@ class Env(BaseConfig):
|
|||||||
|
|
||||||
environment: str = "prod"
|
environment: str = "prod"
|
||||||
"""
|
"""
|
||||||
- **类型**: ``str``
|
- **默认值**: ``"prod"``
|
||||||
- **默认值**: ``"prod"``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
当前环境名。 NoneBot 将从 ``.env.{environment}`` 文件中加载配置。
|
当前环境名。 NoneBot 将从 ``.env.{environment}`` 文件中加载配置。
|
||||||
@ -163,8 +162,7 @@ class Config(BaseConfig):
|
|||||||
# nonebot configs
|
# nonebot configs
|
||||||
driver: str = "~fastapi"
|
driver: str = "~fastapi"
|
||||||
"""
|
"""
|
||||||
- **类型**: ``str``
|
- **默认值**: ``"~fastapi"``
|
||||||
- **默认值**: ``"~fastapi"``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -176,8 +174,7 @@ class Config(BaseConfig):
|
|||||||
"""
|
"""
|
||||||
host: IPvAnyAddress = IPv4Address("127.0.0.1") # type: ignore
|
host: IPvAnyAddress = IPv4Address("127.0.0.1") # type: ignore
|
||||||
"""
|
"""
|
||||||
- **类型**: ``IPvAnyAddress``
|
- **默认值**: ``127.0.0.1``
|
||||||
- **默认值**: ``127.0.0.1``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -185,8 +182,7 @@ class Config(BaseConfig):
|
|||||||
"""
|
"""
|
||||||
port: int = 8080
|
port: int = 8080
|
||||||
"""
|
"""
|
||||||
- **类型**: ``int``
|
- **默认值**: ``8080``
|
||||||
- **默认值**: ``8080``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -194,8 +190,7 @@ class Config(BaseConfig):
|
|||||||
"""
|
"""
|
||||||
log_level: Union[int, str] = "INFO"
|
log_level: Union[int, str] = "INFO"
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Union[int, str]``
|
- **默认值**: ``INFO``
|
||||||
- **默认值**: ``INFO``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -215,8 +210,7 @@ class Config(BaseConfig):
|
|||||||
# bot connection configs
|
# bot connection configs
|
||||||
api_timeout: Optional[float] = 30.0
|
api_timeout: Optional[float] = 30.0
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Optional[float]``
|
- **默认值**: ``30.``
|
||||||
- **默认值**: ``30.``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -226,8 +220,7 @@ class Config(BaseConfig):
|
|||||||
# bot runtime configs
|
# bot runtime configs
|
||||||
superusers: Set[str] = set()
|
superusers: Set[str] = set()
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Set[str]``
|
- **默认值**: ``set()``
|
||||||
- **默认值**: ``set()``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -241,8 +234,7 @@ class Config(BaseConfig):
|
|||||||
"""
|
"""
|
||||||
nickname: Set[str] = set()
|
nickname: Set[str] = set()
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Set[str]``
|
- **默认值**: ``set()``
|
||||||
- **默认值**: ``set()``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -250,8 +242,7 @@ class Config(BaseConfig):
|
|||||||
"""
|
"""
|
||||||
command_start: Set[str] = {"/"}
|
command_start: Set[str] = {"/"}
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Set[str]``
|
- **默认值**: ``{"/"}``
|
||||||
- **默认值**: ``{"/"}``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -259,8 +250,7 @@ class Config(BaseConfig):
|
|||||||
"""
|
"""
|
||||||
command_sep: Set[str] = {"."}
|
command_sep: Set[str] = {"."}
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Set[str]``
|
- **默认值**: ``{"."}``
|
||||||
- **默认值**: ``{"."}``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
@ -268,8 +258,7 @@ class Config(BaseConfig):
|
|||||||
"""
|
"""
|
||||||
session_expire_timeout: timedelta = timedelta(minutes=2)
|
session_expire_timeout: timedelta = timedelta(minutes=2)
|
||||||
"""
|
"""
|
||||||
- **类型**: ``timedelta``
|
- **默认值**: ``timedelta(minutes=2)``
|
||||||
- **默认值**: ``timedelta(minutes=2)``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
|
@ -41,18 +41,15 @@ class Driver(abc.ABC):
|
|||||||
|
|
||||||
_adapters: Dict[str, "Adapter"] = {}
|
_adapters: Dict[str, "Adapter"] = {}
|
||||||
"""
|
"""
|
||||||
:类型: ``Dict[str, Adapter]``
|
:说明: 已注册的适配器列表
|
||||||
:说明: 已注册的适配器列表
|
|
||||||
"""
|
"""
|
||||||
_bot_connection_hook: Set[T_BotConnectionHook] = set()
|
_bot_connection_hook: Set[T_BotConnectionHook] = set()
|
||||||
"""
|
"""
|
||||||
:类型: ``Set[T_BotConnectionHook]``
|
:说明: Bot 连接建立时执行的函数
|
||||||
:说明: Bot 连接建立时执行的函数
|
|
||||||
"""
|
"""
|
||||||
_bot_disconnection_hook: Set[T_BotDisconnectionHook] = set()
|
_bot_disconnection_hook: Set[T_BotDisconnectionHook] = set()
|
||||||
"""
|
"""
|
||||||
:类型: ``Set[T_BotDisconnectionHook]``
|
:说明: Bot 连接断开时执行的函数
|
||||||
:说明: Bot 连接断开时执行的函数
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, env: Env, config: Config):
|
def __init__(self, env: Env, config: Config):
|
||||||
@ -64,26 +61,20 @@ class Driver(abc.ABC):
|
|||||||
"""
|
"""
|
||||||
self.env: str = env.environment
|
self.env: str = env.environment
|
||||||
"""
|
"""
|
||||||
:类型: ``str``
|
:说明: 环境名称
|
||||||
:说明: 环境名称
|
|
||||||
"""
|
"""
|
||||||
self.config: Config = config
|
self.config: Config = config
|
||||||
"""
|
"""
|
||||||
:类型: ``Config``
|
:说明: 配置对象
|
||||||
:说明: 配置对象
|
|
||||||
"""
|
"""
|
||||||
self._clients: Dict[str, "Bot"] = {}
|
self._clients: Dict[str, "Bot"] = {}
|
||||||
"""
|
"""
|
||||||
:类型: ``Dict[str, Bot]``
|
:说明: 已连接的 Bot
|
||||||
:说明: 已连接的 Bot
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bots(self) -> Dict[str, "Bot"]:
|
def bots(self) -> Dict[str, "Bot"]:
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Dict[str, Bot]``
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
获取当前所有已连接的 Bot
|
获取当前所有已连接的 Bot
|
||||||
|
@ -168,7 +168,6 @@ class WebSocket(abc.ABC):
|
|||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def closed(self) -> bool:
|
def closed(self) -> bool:
|
||||||
"""
|
"""
|
||||||
:类型: ``bool``
|
|
||||||
:说明: 连接是否已经关闭
|
:说明: 连接是否已经关闭
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -48,90 +48,54 @@ class Config(BaseSettings):
|
|||||||
|
|
||||||
fastapi_openapi_url: Optional[str] = None
|
fastapi_openapi_url: Optional[str] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[str]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
``openapi.json`` 地址,默认为 ``None`` 即关闭
|
``openapi.json`` 地址,默认为 ``None`` 即关闭
|
||||||
"""
|
"""
|
||||||
fastapi_docs_url: Optional[str] = None
|
fastapi_docs_url: Optional[str] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[str]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
``swagger`` 地址,默认为 ``None`` 即关闭
|
``swagger`` 地址,默认为 ``None`` 即关闭
|
||||||
"""
|
"""
|
||||||
fastapi_redoc_url: Optional[str] = None
|
fastapi_redoc_url: Optional[str] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[str]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
``redoc`` 地址,默认为 ``None`` 即关闭
|
``redoc`` 地址,默认为 ``None`` 即关闭
|
||||||
"""
|
"""
|
||||||
fastapi_include_adapter_schema: bool = True
|
fastapi_include_adapter_schema: bool = True
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``bool``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
是否包含适配器路由的 schema,默认为 ``True``
|
是否包含适配器路由的 schema,默认为 ``True``
|
||||||
"""
|
"""
|
||||||
fastapi_reload: bool = False
|
fastapi_reload: bool = False
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``bool``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
开启/关闭冷重载
|
开启/关闭冷重载
|
||||||
"""
|
"""
|
||||||
fastapi_reload_dirs: Optional[List[str]] = None
|
fastapi_reload_dirs: Optional[List[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[List[str]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
重载监控文件夹列表,默认为 uvicorn 默认值
|
重载监控文件夹列表,默认为 uvicorn 默认值
|
||||||
"""
|
"""
|
||||||
fastapi_reload_delay: Optional[float] = None
|
fastapi_reload_delay: Optional[float] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[float]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
重载延迟,默认为 uvicorn 默认值
|
重载延迟,默认为 uvicorn 默认值
|
||||||
"""
|
"""
|
||||||
fastapi_reload_includes: Optional[List[str]] = None
|
fastapi_reload_includes: Optional[List[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[List[str]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||||
"""
|
"""
|
||||||
fastapi_reload_excludes: Optional[List[str]] = None
|
fastapi_reload_excludes: Optional[List[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[List[str]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||||
|
@ -56,50 +56,30 @@ class Config(BaseSettings):
|
|||||||
|
|
||||||
quart_reload: bool = False
|
quart_reload: bool = False
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``bool``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
开启/关闭冷重载
|
开启/关闭冷重载
|
||||||
"""
|
"""
|
||||||
quart_reload_dirs: Optional[List[str]] = None
|
quart_reload_dirs: Optional[List[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[List[str]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
重载监控文件夹列表,默认为 uvicorn 默认值
|
重载监控文件夹列表,默认为 uvicorn 默认值
|
||||||
"""
|
"""
|
||||||
quart_reload_delay: Optional[float] = None
|
quart_reload_delay: Optional[float] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[float]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
重载延迟,默认为 uvicorn 默认值
|
重载延迟,默认为 uvicorn 默认值
|
||||||
"""
|
"""
|
||||||
quart_reload_includes: Optional[List[str]] = None
|
quart_reload_includes: Optional[List[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[List[str]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||||
"""
|
"""
|
||||||
quart_reload_excludes: Optional[List[str]] = None
|
quart_reload_excludes: Optional[List[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型:
|
|
||||||
|
|
||||||
``Optional[List[str]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值
|
||||||
|
@ -66,7 +66,6 @@ T = TypeVar("T")
|
|||||||
|
|
||||||
matchers: Dict[int, List[Type["Matcher"]]] = defaultdict(list)
|
matchers: Dict[int, List[Type["Matcher"]]] = defaultdict(list)
|
||||||
"""
|
"""
|
||||||
:类型: ``Dict[int, List[Type[Matcher]]]``
|
|
||||||
:说明: 用于存储当前所有的事件响应器
|
:说明: 用于存储当前所有的事件响应器
|
||||||
"""
|
"""
|
||||||
current_bot: ContextVar[Bot] = ContextVar("current_bot")
|
current_bot: ContextVar[Bot] = ContextVar("current_bot")
|
||||||
@ -106,81 +105,66 @@ class Matcher(metaclass=MatcherMeta):
|
|||||||
|
|
||||||
plugin: Optional["Plugin"] = None
|
plugin: Optional["Plugin"] = None
|
||||||
"""
|
"""
|
||||||
:类型: ``Optional[Plugin]``
|
:说明: 事件响应器所在插件
|
||||||
:说明: 事件响应器所在插件
|
|
||||||
"""
|
"""
|
||||||
module: Optional[ModuleType] = None
|
module: Optional[ModuleType] = None
|
||||||
"""
|
"""
|
||||||
:类型: ``Optional[ModuleType]``
|
:说明: 事件响应器所在插件模块
|
||||||
:说明: 事件响应器所在插件模块
|
|
||||||
"""
|
"""
|
||||||
plugin_name: Optional[str] = None
|
plugin_name: Optional[str] = None
|
||||||
"""
|
"""
|
||||||
:类型: ``Optional[str]``
|
:说明: 事件响应器所在插件名
|
||||||
:说明: 事件响应器所在插件名
|
|
||||||
"""
|
"""
|
||||||
module_name: Optional[str] = None
|
module_name: Optional[str] = None
|
||||||
"""
|
"""
|
||||||
:类型: ``Optional[str]``
|
:说明: 事件响应器所在点分割插件模块路径
|
||||||
:说明: 事件响应器所在点分割插件模块路径
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type: str = ""
|
type: str = ""
|
||||||
"""
|
"""
|
||||||
:类型: ``str``
|
:说明: 事件响应器类型
|
||||||
:说明: 事件响应器类型
|
|
||||||
"""
|
"""
|
||||||
rule: Rule = Rule()
|
rule: Rule = Rule()
|
||||||
"""
|
"""
|
||||||
:类型: ``Rule``
|
:说明: 事件响应器匹配规则
|
||||||
:说明: 事件响应器匹配规则
|
|
||||||
"""
|
"""
|
||||||
permission: Permission = Permission()
|
permission: Permission = Permission()
|
||||||
"""
|
"""
|
||||||
:类型: ``Permission``
|
:说明: 事件响应器触发权限
|
||||||
:说明: 事件响应器触发权限
|
|
||||||
"""
|
"""
|
||||||
handlers: List[Dependent[Any]] = []
|
handlers: List[Dependent[Any]] = []
|
||||||
"""
|
"""
|
||||||
:类型: ``List[Handler]``
|
:说明: 事件响应器拥有的事件处理函数列表
|
||||||
:说明: 事件响应器拥有的事件处理函数列表
|
|
||||||
"""
|
"""
|
||||||
priority: int = 1
|
priority: int = 1
|
||||||
"""
|
"""
|
||||||
:类型: ``int``
|
:说明: 事件响应器优先级
|
||||||
:说明: 事件响应器优先级
|
|
||||||
"""
|
"""
|
||||||
block: bool = False
|
block: bool = False
|
||||||
"""
|
"""
|
||||||
:类型: ``bool``
|
:说明: 事件响应器是否阻止事件传播
|
||||||
:说明: 事件响应器是否阻止事件传播
|
|
||||||
"""
|
"""
|
||||||
temp: bool = False
|
temp: bool = False
|
||||||
"""
|
"""
|
||||||
:类型: ``bool``
|
:说明: 事件响应器是否为临时
|
||||||
:说明: 事件响应器是否为临时
|
|
||||||
"""
|
"""
|
||||||
expire_time: Optional[datetime] = None
|
expire_time: Optional[datetime] = None
|
||||||
"""
|
"""
|
||||||
:类型: ``Optional[datetime]``
|
:说明: 事件响应器过期时间点
|
||||||
:说明: 事件响应器过期时间点
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_default_state: T_State = {}
|
_default_state: T_State = {}
|
||||||
"""
|
"""
|
||||||
:类型: ``T_State``
|
:说明: 事件响应器默认状态
|
||||||
:说明: 事件响应器默认状态
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_default_type_updater: Optional[Dependent[str]] = None
|
_default_type_updater: Optional[Dependent[str]] = None
|
||||||
"""
|
"""
|
||||||
:类型: ``Optional[Dependent]``
|
:说明: 事件响应器类型更新函数
|
||||||
:说明: 事件响应器类型更新函数
|
|
||||||
"""
|
"""
|
||||||
_default_permission_updater: Optional[Dependent[Permission]] = None
|
_default_permission_updater: Optional[Dependent[Permission]] = None
|
||||||
"""
|
"""
|
||||||
:类型: ``Optional[Dependent]``
|
:说明: 事件响应器权限更新函数
|
||||||
:说明: 事件响应器权限更新函数
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
HANDLER_PARAM_TYPES = [
|
HANDLER_PARAM_TYPES = [
|
||||||
|
@ -77,10 +77,6 @@ class Permission:
|
|||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
存储 ``PermissionChecker``
|
存储 ``PermissionChecker``
|
||||||
|
|
||||||
:类型:
|
|
||||||
|
|
||||||
* ``Set[Dependent[bool]]``
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async def __call__(
|
async def __call__(
|
||||||
|
@ -485,15 +485,13 @@ class CommandGroup:
|
|||||||
"""
|
"""
|
||||||
self.basecmd: Tuple[str, ...] = (cmd,) if isinstance(cmd, str) else cmd
|
self.basecmd: Tuple[str, ...] = (cmd,) if isinstance(cmd, str) else cmd
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Tuple[str, ...]``
|
- **说明**: 命令前缀
|
||||||
- **说明**: 命令前缀
|
|
||||||
"""
|
"""
|
||||||
if "aliases" in kwargs:
|
if "aliases" in kwargs:
|
||||||
del kwargs["aliases"]
|
del kwargs["aliases"]
|
||||||
self.base_kwargs: Dict[str, Any] = kwargs
|
self.base_kwargs: Dict[str, Any] = kwargs
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Dict[str, Any]``
|
- **说明**: 其他传递给 ``on_command`` 的参数默认值
|
||||||
- **说明**: 其他传递给 ``on_command`` 的参数默认值
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def command(self, cmd: Union[str, Tuple[str, ...]], **kwargs) -> Type[Matcher]:
|
def command(self, cmd: Union[str, Tuple[str, ...]], **kwargs) -> Type[Matcher]:
|
||||||
@ -554,13 +552,11 @@ class MatcherGroup:
|
|||||||
"""
|
"""
|
||||||
self.matchers: List[Type[Matcher]] = []
|
self.matchers: List[Type[Matcher]] = []
|
||||||
"""
|
"""
|
||||||
:类型: ``List[Type[Matcher]]``
|
:说明: 组内事件响应器列表
|
||||||
:说明: 组内事件响应器列表
|
|
||||||
"""
|
"""
|
||||||
self.base_kwargs: Dict[str, Any] = kwargs
|
self.base_kwargs: Dict[str, Any] = kwargs
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Dict[str, Any]``
|
- **说明**: 其他传递给 ``on`` 的参数默认值
|
||||||
- **说明**: 其他传递给 ``on`` 的参数默认值
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on(self, **kwargs) -> Type[Matcher]:
|
def on(self, **kwargs) -> Type[Matcher]:
|
||||||
|
@ -10,7 +10,6 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
plugins: Dict[str, "Plugin"] = {}
|
plugins: Dict[str, "Plugin"] = {}
|
||||||
"""
|
"""
|
||||||
:类型: ``Dict[str, Plugin]``
|
|
||||||
:说明: 已加载的插件
|
:说明: 已加载的插件
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -21,43 +20,35 @@ class Plugin(object):
|
|||||||
|
|
||||||
name: str
|
name: str
|
||||||
"""
|
"""
|
||||||
- **类型**: ``str``
|
- **说明**: 插件名称,使用 文件/文件夹 名称作为插件名
|
||||||
- **说明**: 插件名称,使用 文件/文件夹 名称作为插件名
|
|
||||||
"""
|
"""
|
||||||
module: ModuleType
|
module: ModuleType
|
||||||
"""
|
"""
|
||||||
- **类型**: ``ModuleType``
|
- **说明**: 插件模块对象
|
||||||
- **说明**: 插件模块对象
|
|
||||||
"""
|
"""
|
||||||
module_name: str
|
module_name: str
|
||||||
"""
|
"""
|
||||||
- **类型**: ``str``
|
- **说明**: 点分割模块路径
|
||||||
- **说明**: 点分割模块路径
|
|
||||||
"""
|
"""
|
||||||
manager: "PluginManager"
|
manager: "PluginManager"
|
||||||
"""
|
"""
|
||||||
- **类型**: ``PluginManager``
|
- **说明**: 导入该插件的插件管理器
|
||||||
- **说明**: 导入该插件的插件管理器
|
|
||||||
"""
|
"""
|
||||||
export: Export = field(default_factory=Export)
|
export: Export = field(default_factory=Export)
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Export``
|
- **说明**: 插件内定义的导出内容
|
||||||
- **说明**: 插件内定义的导出内容
|
|
||||||
"""
|
"""
|
||||||
matcher: Set[Type[Matcher]] = field(default_factory=set)
|
matcher: Set[Type[Matcher]] = field(default_factory=set)
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Set[Type[Matcher]]``
|
- **说明**: 插件内定义的 ``Matcher``
|
||||||
- **说明**: 插件内定义的 ``Matcher``
|
|
||||||
"""
|
"""
|
||||||
parent_plugin: Optional["Plugin"] = None
|
parent_plugin: Optional["Plugin"] = None
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Optional[Plugin]``
|
- **说明**: 父插件
|
||||||
- **说明**: 父插件
|
|
||||||
"""
|
"""
|
||||||
sub_plugins: Set["Plugin"] = field(default_factory=set)
|
sub_plugins: Set["Plugin"] = field(default_factory=set)
|
||||||
"""
|
"""
|
||||||
- **类型**: ``Set[Plugin]``
|
- **说明**: 子插件集合
|
||||||
- **说明**: 子插件集合
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,10 +106,6 @@ class Rule:
|
|||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
存储 ``RuleChecker``
|
存储 ``RuleChecker``
|
||||||
|
|
||||||
:类型:
|
|
||||||
|
|
||||||
* ``Set[Dependent[bool]]``
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async def __call__(
|
async def __call__(
|
||||||
|
@ -47,8 +47,6 @@ def overrides(InterfaceClass: object):
|
|||||||
|
|
||||||
T_State = Dict[Any, Any]
|
T_State = Dict[Any, Any]
|
||||||
"""
|
"""
|
||||||
:类型: ``Dict[Any, Any]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
事件处理状态 State 类型
|
事件处理状态 State 类型
|
||||||
@ -56,24 +54,18 @@ T_State = Dict[Any, Any]
|
|||||||
|
|
||||||
T_BotConnectionHook = Callable[["Bot"], Awaitable[None]]
|
T_BotConnectionHook = Callable[["Bot"], Awaitable[None]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[[Bot], Awaitable[None]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
Bot 连接建立时执行的函数
|
Bot 连接建立时执行的函数
|
||||||
"""
|
"""
|
||||||
T_BotDisconnectionHook = Callable[["Bot"], Awaitable[None]]
|
T_BotDisconnectionHook = Callable[["Bot"], Awaitable[None]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[[Bot], Awaitable[None]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
Bot 连接断开时执行的函数
|
Bot 连接断开时执行的函数
|
||||||
"""
|
"""
|
||||||
T_CallingAPIHook = Callable[["Bot", str, Dict[str, Any]], Awaitable[None]]
|
T_CallingAPIHook = Callable[["Bot", str, Dict[str, Any]], Awaitable[None]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[[Bot, str, Dict[str, Any]], Awaitable[None]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
``bot.call_api`` 时执行的函数
|
``bot.call_api`` 时执行的函数
|
||||||
@ -82,8 +74,6 @@ T_CalledAPIHook = Callable[
|
|||||||
["Bot", Optional[Exception], str, Dict[str, Any], Any], Awaitable[None]
|
["Bot", Optional[Exception], str, Dict[str, Any], Any], Awaitable[None]
|
||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[[Bot, Optional[Exception], str, Dict[str, Any], Any], Awaitable[None]]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
``bot.call_api`` 后执行的函数,参数分别为 bot, exception, api, data, result
|
``bot.call_api`` 后执行的函数,参数分别为 bot, exception, api, data, result
|
||||||
@ -91,8 +81,6 @@ T_CalledAPIHook = Callable[
|
|||||||
|
|
||||||
T_EventPreProcessor = Callable[..., Union[None, Awaitable[None]]]
|
T_EventPreProcessor = Callable[..., Union[None, Awaitable[None]]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[..., Union[None, Awaitable[None]]]``
|
|
||||||
|
|
||||||
:依赖参数:
|
:依赖参数:
|
||||||
|
|
||||||
* ``DependParam``: 子依赖参数
|
* ``DependParam``: 子依赖参数
|
||||||
@ -107,8 +95,6 @@ T_EventPreProcessor = Callable[..., Union[None, Awaitable[None]]]
|
|||||||
"""
|
"""
|
||||||
T_EventPostProcessor = Callable[..., Union[None, Awaitable[None]]]
|
T_EventPostProcessor = Callable[..., Union[None, Awaitable[None]]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[..., Union[None, Awaitable[None]]]``
|
|
||||||
|
|
||||||
:依赖参数:
|
:依赖参数:
|
||||||
|
|
||||||
* ``DependParam``: 子依赖参数
|
* ``DependParam``: 子依赖参数
|
||||||
@ -123,8 +109,6 @@ T_EventPostProcessor = Callable[..., Union[None, Awaitable[None]]]
|
|||||||
"""
|
"""
|
||||||
T_RunPreProcessor = Callable[..., Union[None, Awaitable[None]]]
|
T_RunPreProcessor = Callable[..., Union[None, Awaitable[None]]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[..., Union[None, Awaitable[None]]]``
|
|
||||||
|
|
||||||
:依赖参数:
|
:依赖参数:
|
||||||
|
|
||||||
* ``DependParam``: 子依赖参数
|
* ``DependParam``: 子依赖参数
|
||||||
@ -140,8 +124,6 @@ T_RunPreProcessor = Callable[..., Union[None, Awaitable[None]]]
|
|||||||
"""
|
"""
|
||||||
T_RunPostProcessor = Callable[..., Union[None, Awaitable[None]]]
|
T_RunPostProcessor = Callable[..., Union[None, Awaitable[None]]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[..., Union[None, Awaitable[None]]]``
|
|
||||||
|
|
||||||
:依赖参数:
|
:依赖参数:
|
||||||
|
|
||||||
* ``DependParam``: 子依赖参数
|
* ``DependParam``: 子依赖参数
|
||||||
@ -159,8 +141,6 @@ T_RunPostProcessor = Callable[..., Union[None, Awaitable[None]]]
|
|||||||
|
|
||||||
T_RuleChecker = Callable[..., Union[bool, Awaitable[bool]]]
|
T_RuleChecker = Callable[..., Union[bool, Awaitable[bool]]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[..., Union[bool, Awaitable[bool]]]``
|
|
||||||
|
|
||||||
:依赖参数:
|
:依赖参数:
|
||||||
|
|
||||||
* ``DependParam``: 子依赖参数
|
* ``DependParam``: 子依赖参数
|
||||||
@ -175,8 +155,6 @@ T_RuleChecker = Callable[..., Union[bool, Awaitable[bool]]]
|
|||||||
"""
|
"""
|
||||||
T_PermissionChecker = Callable[..., Union[bool, Awaitable[bool]]]
|
T_PermissionChecker = Callable[..., Union[bool, Awaitable[bool]]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[..., Union[bool, Awaitable[bool]]]``
|
|
||||||
|
|
||||||
:依赖参数:
|
:依赖参数:
|
||||||
|
|
||||||
* ``DependParam``: 子依赖参数
|
* ``DependParam``: 子依赖参数
|
||||||
@ -191,16 +169,12 @@ T_PermissionChecker = Callable[..., Union[bool, Awaitable[bool]]]
|
|||||||
|
|
||||||
T_Handler = Callable[..., Any]
|
T_Handler = Callable[..., Any]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[..., Any]``
|
|
||||||
|
|
||||||
:说明:
|
:说明:
|
||||||
|
|
||||||
Handler 处理函数。
|
Handler 处理函数。
|
||||||
"""
|
"""
|
||||||
T_TypeUpdater = Callable[..., Union[str, Awaitable[str]]]
|
T_TypeUpdater = Callable[..., Union[str, Awaitable[str]]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[..., Union[None, Awaitable[None]]]``
|
|
||||||
|
|
||||||
:依赖参数:
|
:依赖参数:
|
||||||
|
|
||||||
* ``DependParam``: 子依赖参数
|
* ``DependParam``: 子依赖参数
|
||||||
@ -216,8 +190,6 @@ T_TypeUpdater = Callable[..., Union[str, Awaitable[str]]]
|
|||||||
"""
|
"""
|
||||||
T_PermissionUpdater = Callable[..., Union["Permission", Awaitable["Permission"]]]
|
T_PermissionUpdater = Callable[..., Union["Permission", Awaitable["Permission"]]]
|
||||||
"""
|
"""
|
||||||
:类型: ``Callable[..., Union[Permission, Awaitable[Permission]]]``
|
|
||||||
|
|
||||||
:依赖参数:
|
:依赖参数:
|
||||||
|
|
||||||
* ``DependParam``: 子依赖参数
|
* ``DependParam``: 子依赖参数
|
||||||
@ -233,7 +205,6 @@ T_PermissionUpdater = Callable[..., Union["Permission", Awaitable["Permission"]]
|
|||||||
"""
|
"""
|
||||||
T_DependencyCache = Dict[Callable[..., Any], "Task[Any]"]
|
T_DependencyCache = Dict[Callable[..., Any], "Task[Any]"]
|
||||||
"""
|
"""
|
||||||
:类型: ``Dict[Callable[..., Any], Task[Any]]``
|
|
||||||
:说明:
|
:说明:
|
||||||
依赖缓存, 用于存储依赖函数的返回值
|
依赖缓存, 用于存储依赖函数的返回值
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user