mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-31 15:06:42 +00:00 
			
		
		
		
	🔖 Release 2.0.0rc3
This commit is contained in:
		| @@ -0,0 +1,3 @@ | ||||
| { | ||||
|   "position": 12 | ||||
| } | ||||
							
								
								
									
										89
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/index.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/index.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,89 @@ | ||||
| --- | ||||
| sidebar_position: 0 | ||||
| description: nonebot.plugin 模块 | ||||
| --- | ||||
|  | ||||
| # nonebot.plugin | ||||
|  | ||||
| 本模块为 NoneBot 插件开发提供便携的定义函数。 | ||||
|  | ||||
| ## 快捷导入 | ||||
|  | ||||
| 为方便使用,本模块从子模块导入了部分内容,以下内容可以直接通过本模块导入: | ||||
|  | ||||
| - `on` => [`on`](./on.md#on) | ||||
| - `on_metaevent` => [`on_metaevent`](./on.md#on_metaevent) | ||||
| - `on_message` => [`on_message`](./on.md#on_message) | ||||
| - `on_notice` => [`on_notice`](./on.md#on_notice) | ||||
| - `on_request` => [`on_request`](./on.md#on_request) | ||||
| - `on_startswith` => [`on_startswith`](./on.md#on_startswith) | ||||
| - `on_endswith` => [`on_endswith`](./on.md#on_endswith) | ||||
| - `on_fullmatch` => [`on_fullmatch`](./on.md#on_fullmatch) | ||||
| - `on_keyword` => [`on_keyword`](./on.md#on_keyword) | ||||
| - `on_command` => [`on_command`](./on.md#on_command) | ||||
| - `on_shell_command` => [`on_shell_command`](./on.md#on_shell_command) | ||||
| - `on_regex` => [`on_regex`](./on.md#on_regex) | ||||
| - `on_type` => [`on_type`](./on.md#on_type) | ||||
| - `CommandGroup` => [`CommandGroup`](./on.md#CommandGroup) | ||||
| - `Matchergroup` => [`MatcherGroup`](./on.md#MatcherGroup) | ||||
| - `load_plugin` => [`load_plugin`](./load.md#load_plugin) | ||||
| - `load_plugins` => [`load_plugins`](./load.md#load_plugins) | ||||
| - `load_all_plugins` => [`load_all_plugins`](./load.md#load_all_plugins) | ||||
| - `load_from_json` => [`load_from_json`](./load.md#load_from_json) | ||||
| - `load_from_toml` => [`load_from_toml`](./load.md#load_from_toml) | ||||
| - `load_builtin_plugin` => [`load_builtin_plugin`](./load.md#load_builtin_plugin) | ||||
| - `load_builtin_plugins` => [`load_builtin_plugins`](./load.md#load_builtin_plugins) | ||||
| - `require` => [`require`](./load.md#require) | ||||
| - `PluginMetadata` => [`PluginMetadata`](./plugin.md#PluginMetadata) | ||||
|  | ||||
| ## _def_ `get_plugin(name)` {#get_plugin} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   获取已经导入的某个插件。 | ||||
|  | ||||
|   如果为 `load_plugins` 文件夹导入的插件,则为文件(夹)名。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `name` (str): 插件名,即 [Plugin.name](./plugin.md#Plugin-name)。 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Plugin | None | ||||
|  | ||||
| ## _def_ `get_plugin_by_module_name(module_name)` {#get_plugin_by_module_name} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   通过模块名获取已经导入的某个插件。 | ||||
|  | ||||
|   如果提供的模块名为某个插件的子模块,同样会返回该插件。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `module_name` (str): 模块名,即 [Plugin.module_name](./plugin.md#Plugin-module_name)。 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Plugin | None | ||||
|  | ||||
| ## _def_ `get_loaded_plugins()` {#get_loaded_plugins} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   获取当前已导入的所有插件。 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - set[Plugin] | ||||
|  | ||||
| ## _def_ `get_available_plugin_names()` {#get_available_plugin_names} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   获取当前所有可用的插件名(包含尚未加载的插件)。 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - set[str] | ||||
							
								
								
									
										157
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/load.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										157
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/load.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,157 @@ | ||||
| --- | ||||
| sidebar_position: 1 | ||||
| description: nonebot.plugin.load 模块 | ||||
| --- | ||||
|  | ||||
| # nonebot.plugin.load | ||||
|  | ||||
| 本模块定义插件加载接口。 | ||||
|  | ||||
| ## _def_ `load_plugin(module_path)` {#load_plugin} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   加载单个插件,可以是本地插件或是通过 `pip` 安装的插件。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `module_path` (str | pathlib.Path): 插件名称 `path.to.your.plugin` 或插件路径 `pathlib.Path(path/to/your/plugin)` | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - [Plugin](./plugin.md#Plugin) | None | ||||
|  | ||||
| ## _def_ `load_plugins(*plugin_dir)` {#load_plugins} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   导入文件夹下多个插件,以 `_` 开头的插件不会被导入! | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `*plugin_dir` (str): 文件夹路径 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - set[[Plugin](./plugin.md#Plugin)] | ||||
|  | ||||
| ## _def_ `load_all_plugins(module_path, plugin_dir)` {#load_all_plugins} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   导入指定列表中的插件以及指定目录下多个插件,以 `_` 开头的插件不会被导入! | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `module_path` (Iterable[str]): 指定插件集合 | ||||
|  | ||||
|   - `plugin_dir` (Iterable[str]): 指定文件夹路径集合 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - set[[Plugin](./plugin.md#Plugin)] | ||||
|  | ||||
| ## _def_ `load_from_json(file_path, encoding='utf-8')` {#load_from_json} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   导入指定 json 文件中的 `plugins` 以及 `plugin_dirs` 下多个插件,以 `_` 开头的插件不会被导入! | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `file_path` (str): 指定 json 文件路径 | ||||
|  | ||||
|   - `encoding` (str): 指定 json 文件编码 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - set[[Plugin](./plugin.md#Plugin)] | ||||
|  | ||||
| - **用法** | ||||
|  | ||||
|   ```json title=plugins.json | ||||
|   { | ||||
|     "plugins": ["some_plugin"], | ||||
|     "plugin_dirs": ["some_dir"] | ||||
|   } | ||||
|   ``` | ||||
|  | ||||
|   ```python | ||||
|   nonebot.load_from_json("plugins.json") | ||||
|   ``` | ||||
|  | ||||
| ## _def_ `load_from_toml(file_path, encoding='utf-8')` {#load_from_toml} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   导入指定 toml 文件 `[tool.nonebot]` 中的 `plugins` 以及 `plugin_dirs` 下多个插件,以 `_` 开头的插件不会被导入! | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `file_path` (str): 指定 toml 文件路径 | ||||
|  | ||||
|   - `encoding` (str): 指定 toml 文件编码 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - set[[Plugin](./plugin.md#Plugin)] | ||||
|  | ||||
| - **用法** | ||||
|  | ||||
|   ```toml title=pyproject.toml | ||||
|   [tool.nonebot] | ||||
|   plugins = ["some_plugin"] | ||||
|   plugin_dirs = ["some_dir"] | ||||
|   ``` | ||||
|  | ||||
|   ```python | ||||
|   nonebot.load_from_toml("pyproject.toml") | ||||
|   ``` | ||||
|  | ||||
| ## _def_ `load_builtin_plugin(name)` {#load_builtin_plugin} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   导入 NoneBot 内置插件。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `name` (str): 插件名称 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - [Plugin](./plugin.md#Plugin) | None | ||||
|  | ||||
| ## _def_ `load_builtin_plugins(*plugins)` {#load_builtin_plugins} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   导入多个 NoneBot 内置插件。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `*plugins` (str): 插件名称列表 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - set[[Plugin](./plugin.md#Plugin)] | ||||
|  | ||||
| ## _def_ `require(name)` {#require} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   获取一个插件的导出内容。 | ||||
|  | ||||
|   如果为 `load_plugins` 文件夹导入的插件,则为文件(夹)名。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `name` (str): 插件名,即 [Plugin.name](./plugin.md#Plugin-name)。 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - module | ||||
|  | ||||
| - **异常** | ||||
|  | ||||
|   - `RuntimeError`: 插件无法加载 | ||||
							
								
								
									
										122
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/manager.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/manager.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,122 @@ | ||||
| --- | ||||
| sidebar_position: 5 | ||||
| description: nonebot.plugin.manager 模块 | ||||
| --- | ||||
|  | ||||
| # nonebot.plugin.manager | ||||
|  | ||||
| 本模块实现插件加载流程。 | ||||
|  | ||||
| 参考: [import hooks](https://docs.python.org/3/reference/import.html#import-hooks), [PEP302](https://www.python.org/dev/peps/pep-0302/) | ||||
|  | ||||
| ## _class_ `PluginManager(plugins=None, search_path=None)` {#PluginManager} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   插件管理器。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `plugins` (Iterable[str] | None): 独立插件模块名集合。 | ||||
|  | ||||
|   - `search_path` (Iterable[str] | None): 插件搜索路径(文件夹)。 | ||||
|  | ||||
| ### _property_ `available_plugins` {#PluginManager-available_plugins} | ||||
|  | ||||
| - **类型:** set[str] | ||||
|  | ||||
| - **说明:** 返回当前插件管理器中可用的插件名称。 | ||||
|  | ||||
| ### _property_ `searched_plugins` {#PluginManager-searched_plugins} | ||||
|  | ||||
| - **类型:** set[str] | ||||
|  | ||||
| - **说明:** 返回已搜索到的插件名称。 | ||||
|  | ||||
| ### _property_ `third_party_plugins` {#PluginManager-third_party_plugins} | ||||
|  | ||||
| - **类型:** set[str] | ||||
|  | ||||
| - **说明:** 返回所有独立插件名称。 | ||||
|  | ||||
| ### _method_ `load_all_plugins(self)` {#PluginManager-load_all_plugins} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   加载所有可用插件。 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - set[[Plugin](./plugin.md#Plugin)] | ||||
|  | ||||
| ### _method_ `load_plugin(self, name)` {#PluginManager-load_plugin} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   加载指定插件。 | ||||
|  | ||||
|   对于独立插件,可以使用完整插件模块名或者插件名称。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `name` (str): 插件名称。 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - [Plugin](./plugin.md#Plugin) | None | ||||
|  | ||||
| ### _method_ `prepare_plugins(self)` {#PluginManager-prepare_plugins} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   搜索插件并缓存插件名称。 | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - set[str] | ||||
|  | ||||
| ## _class_ `PluginFinder()` {#PluginFinder} | ||||
|  | ||||
| ### _method_ `find_spec(self, fullname, path, target=None)` {#PluginFinder-find_spec} | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `fullname` (str) | ||||
|  | ||||
|   - `path` (Sequence[str] | None) | ||||
|  | ||||
|   - `target` (module | None) | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Unknown | ||||
|  | ||||
| ## _class_ `PluginLoader(manager, fullname, path)` {#PluginLoader} | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `manager` ([PluginManager](#PluginManager)) | ||||
|  | ||||
|   - `fullname` (str) | ||||
|  | ||||
|   - `path` | ||||
|  | ||||
| ### _method_ `create_module(self, spec)` {#PluginLoader-create_module} | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `spec` | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - module | None | ||||
|  | ||||
| ### _method_ `exec_module(self, module)` {#PluginLoader-exec_module} | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `module` (module) | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - None | ||||
							
								
								
									
										914
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/on.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										914
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/on.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,914 @@ | ||||
| --- | ||||
| sidebar_position: 2 | ||||
| description: nonebot.plugin.on 模块 | ||||
| --- | ||||
|  | ||||
| # nonebot.plugin.on | ||||
|  | ||||
| 本模块定义事件响应器便携定义函数。 | ||||
|  | ||||
| ## _def_ `on(type='', rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个基础事件响应器,可自定义类型。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `type` (str): 事件响应器类型 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_metaevent(rule=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_metaevent} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个元事件响应器。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_message(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_message} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_notice(rule=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_notice} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个通知事件响应器。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_request(rule=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_request} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个请求事件响应器。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_startswith(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_startswith} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `msg` (str | tuple[str, ...]): 指定消息开头内容 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `ignorecase` (bool): 是否忽略大小写 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_endswith(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_endswith} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `msg` (str | tuple[str, ...]): 指定消息结尾内容 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `ignorecase` (bool): 是否忽略大小写 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_fullmatch(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_fullmatch} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息的**文本部分**与指定内容完全一致时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `msg` (str | tuple[str, ...]): 指定消息全匹配内容 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `ignorecase` (bool): 是否忽略大小写 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_keyword(keywords, rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_keyword} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `keywords` (set[str]): 关键词列表 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_command(cmd, rule=..., aliases=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_command} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息以指定命令开头时响应。 | ||||
|  | ||||
|   命令匹配规则参考: `命令形式匹配 <rule.md#command-command>`\_ | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `cmd` (str | tuple[str, ...]): 指定命令内容 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_shell_command(cmd, rule=..., aliases=..., parser=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_shell_command} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个支持 `shell_like` 解析参数的命令消息事件响应器。 | ||||
|  | ||||
|   与普通的 `on_command` 不同的是,在添加 `parser` 参数时, 响应器会自动处理消息。 | ||||
|  | ||||
|   并将用户输入的原始参数列表保存在 `state["argv"]`, `parser` 处理的参数保存在 `state["args"]` 中 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `cmd` (str | tuple[str, ...]): 指定命令内容 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 | ||||
|  | ||||
|   - `parser` ([ArgumentParser](../rule.md#ArgumentParser) | None): `nonebot.rule.ArgumentParser` 对象 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_regex(pattern, flags=..., rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_regex} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息匹配正则表达式时响应。 | ||||
|  | ||||
|   命令匹配规则参考: `正则匹配 <rule.md#regex-regex-flags-0>`\_ | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `pattern` (str): 正则表达式 | ||||
|  | ||||
|   - `flags` (int | re.RegexFlag): 正则匹配标志 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _def_ `on_type(types, rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on_type} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个事件响应器,并且当事件为指定类型时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `types` (Type[nonebot.internal.adapter.event.Event] | tuple[Type[nonebot.internal.adapter.event.Event], ...]): 事件类型 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _class_ `CommandGroup(cmd, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#CommandGroup} | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `cmd` (str | tuple[str, ...]) | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType) | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType) | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None) | ||||
|  | ||||
|   - `temp` (bool) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType) | ||||
|  | ||||
|   - `priority` (int) | ||||
|  | ||||
|   - `block` (bool) | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None) | ||||
|  | ||||
| ### _method_ `command(self, cmd, *, rule=..., aliases=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#CommandGroup-command} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个新的命令。新参数将会覆盖命令组默认值 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `cmd` (str | tuple[str, ...]): 指定命令内容 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `shell_command(self, cmd, *, rule=..., aliases=..., parser=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#CommandGroup-shell_command} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个新的 `shell_like` 命令。新参数将会覆盖命令组默认值 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `cmd` (str | tuple[str, ...]): 指定命令内容 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 | ||||
|  | ||||
|   - `parser` ([ArgumentParser](../rule.md#ArgumentParser) | None): `nonebot.rule.ArgumentParser` 对象 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ## _class_ `MatcherGroup(*, type=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup} | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `type` (str) | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType) | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType) | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None) | ||||
|  | ||||
|   - `temp` (bool) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType) | ||||
|  | ||||
|   - `priority` (int) | ||||
|  | ||||
|   - `block` (bool) | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None) | ||||
|  | ||||
| ### _method_ `on(self, *, type=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个基础事件响应器,可自定义类型。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `type` (str): 事件响应器类型 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_command(self, cmd, aliases=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_command} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息以指定命令开头时响应。 | ||||
|  | ||||
|   命令匹配规则参考: `命令形式匹配 <rule.md#command-command>`\_ | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `cmd` (str | tuple[str, ...]): 指定命令内容 | ||||
|  | ||||
|   - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_endswith(self, msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_endswith} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `msg` (str | tuple[str, ...]): 指定消息结尾内容 | ||||
|  | ||||
|   - `ignorecase` (bool): 是否忽略大小写 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_fullmatch(self, msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_fullmatch} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息的**文本部分**与指定内容完全一致时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `msg` (str | tuple[str, ...]): 指定消息全匹配内容 | ||||
|  | ||||
|   - `ignorecase` (bool): 是否忽略大小写 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_keyword(self, keywords, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_keyword} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `keywords` (set[str]): 关键词列表 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_message(self, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_message} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_metaevent(self, *, rule=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_metaevent} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个元事件响应器。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_notice(self, *, rule=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_notice} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个通知事件响应器。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_regex(self, pattern, flags=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_regex} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息匹配正则表达式时响应。 | ||||
|  | ||||
|   命令匹配规则参考: `正则匹配 <rule.md#regex-regex-flags-0>`\_ | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `pattern` (str): 正则表达式 | ||||
|  | ||||
|   - `flags` (int | re.RegexFlag): 正则匹配标志 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_request(self, *, rule=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_request} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个请求事件响应器。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_shell_command(self, cmd, aliases=..., parser=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_shell_command} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个支持 `shell_like` 解析参数的命令消息事件响应器。 | ||||
|  | ||||
|   与普通的 `on_command` 不同的是,在添加 `parser` 参数时, 响应器会自动处理消息。 | ||||
|  | ||||
|   并将用户输入的原始参数列表保存在 `state["argv"]`, `parser` 处理的参数保存在 `state["args"]` 中 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `cmd` (str | tuple[str, ...]): 指定命令内容 | ||||
|  | ||||
|   - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 | ||||
|  | ||||
|   - `parser` ([ArgumentParser](../rule.md#ArgumentParser) | None): `nonebot.rule.ArgumentParser` 对象 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_startswith(self, msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_startswith} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `msg` (str | tuple[str, ...]): 指定消息开头内容 | ||||
|  | ||||
|   - `ignorecase` (bool): 是否忽略大小写 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
|  | ||||
| ### _method_ `on_type(self, types, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on_type} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   注册一个事件响应器,并且当事件为指定类型时响应。 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `types` (Type[nonebot.internal.adapter.event.Event] | tuple[Type[nonebot.internal.adapter.event.Event]]): 事件类型 | ||||
|  | ||||
|   - `rule` (nonebot.internal.rule.Rule | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应规则 | ||||
|  | ||||
|   - `permission` (nonebot.internal.permission.Permission | (*Any, \*\*Any) -> bool | (*Any, \*\*Any) -> Awaitable[bool] | NoneType): 事件响应权限 | ||||
|  | ||||
|   - `handlers` (list[(*Any, \*\*Any) -> Any | (*Any, \*\*Any) -> Awaitable[Any] | [Dependent](../dependencies/index.md#Dependent)] | None): 事件处理函数列表 | ||||
|  | ||||
|   - `temp` (bool): 是否为临时事件响应器(仅执行一次) | ||||
|  | ||||
|   - `expire_time` (datetime.datetime | datetime.timedelta | NoneType): 事件响应器最终有效时间点,过时即被删除 | ||||
|  | ||||
|   - `priority` (int): 事件响应器优先级 | ||||
|  | ||||
|   - `block` (bool): 是否阻止事件向更低优先级传递 | ||||
|  | ||||
|   - `state` (dict[Any, Any] | None): 默认 state | ||||
|  | ||||
| - **返回** | ||||
|  | ||||
|   - Type[nonebot.internal.matcher.matcher.Matcher] | ||||
							
								
								
									
										116
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/plugin.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								website/versioned_docs/version-2.0.0rc3/api/plugin/plugin.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,116 @@ | ||||
| --- | ||||
| sidebar_position: 3 | ||||
| description: nonebot.plugin.plugin 模块 | ||||
| --- | ||||
|  | ||||
| # nonebot.plugin.plugin | ||||
|  | ||||
| 本模块定义插件对象。 | ||||
|  | ||||
| ## _class_ `PluginMetadata(name, description, usage, config=None, extra=<factory>)` {#PluginMetadata} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   插件元信息,由插件编写者提供 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `name` (str) | ||||
|  | ||||
|   - `description` (str) | ||||
|  | ||||
|   - `usage` (str) | ||||
|  | ||||
|   - `config` (Type[pydantic.main.BaseModel] | None) | ||||
|  | ||||
|   - `extra` (dict[Any, Any]) | ||||
|  | ||||
| ### _class-var_ `config` {#PluginMetadata-config} | ||||
|  | ||||
| - **类型:** Type[pydantic.main.BaseModel] | None | ||||
|  | ||||
| - **说明:** 插件配置项 | ||||
|  | ||||
| ### _instance-var_ `name` {#PluginMetadata-name} | ||||
|  | ||||
| - **类型:** str | ||||
|  | ||||
| - **说明:** 插件可阅读名称 | ||||
|  | ||||
| ### _instance-var_ `description` {#PluginMetadata-description} | ||||
|  | ||||
| - **类型:** str | ||||
|  | ||||
| - **说明:** 插件功能介绍 | ||||
|  | ||||
| ### _instance-var_ `usage` {#PluginMetadata-usage} | ||||
|  | ||||
| - **类型:** str | ||||
|  | ||||
| - **说明:** 插件使用方法 | ||||
|  | ||||
| ## _class_ `Plugin(name, module, module_name, manager, matcher=<factory>, parent_plugin=None, sub_plugins=<factory>, metadata=None)` {#Plugin} | ||||
|  | ||||
| - **说明** | ||||
|  | ||||
|   存储插件信息 | ||||
|  | ||||
| - **参数** | ||||
|  | ||||
|   - `name` (str) | ||||
|  | ||||
|   - `module` (module) | ||||
|  | ||||
|   - `module_name` (str) | ||||
|  | ||||
|   - `manager` (PluginManager) | ||||
|  | ||||
|   - `matcher` (set[Type[nonebot.internal.matcher.matcher.Matcher]]) | ||||
|  | ||||
|   - `parent_plugin` (Plugin | None) | ||||
|  | ||||
|   - `sub_plugins` (set[Plugin]) | ||||
|  | ||||
|   - `metadata` ([PluginMetadata](#PluginMetadata) | None) | ||||
|  | ||||
| ### _class-var_ `parent_plugin` {#Plugin-parent_plugin} | ||||
|  | ||||
| - **类型:** Plugin | None | ||||
|  | ||||
| - **说明:** 父插件 | ||||
|  | ||||
| ### _instance-var_ `name` {#Plugin-name} | ||||
|  | ||||
| - **类型:** str | ||||
|  | ||||
| - **说明:** 插件索引标识,NoneBot 使用 文件/文件夹 名称作为标识符 | ||||
|  | ||||
| ### _instance-var_ `module` {#Plugin-module} | ||||
|  | ||||
| - **类型:** module | ||||
|  | ||||
| - **说明:** 插件模块对象 | ||||
|  | ||||
| ### _instance-var_ `module_name` {#Plugin-module_name} | ||||
|  | ||||
| - **类型:** str | ||||
|  | ||||
| - **说明:** 点分割模块路径 | ||||
|  | ||||
| ### _instance-var_ `manager` {#Plugin-manager} | ||||
|  | ||||
| - **类型:** PluginManager | ||||
|  | ||||
| - **说明:** 导入该插件的插件管理器 | ||||
|  | ||||
| ### _instance-var_ `matcher` {#Plugin-matcher} | ||||
|  | ||||
| - **类型:** set[Type[nonebot.internal.matcher.matcher.Matcher]] | ||||
|  | ||||
| - **说明:** 插件内定义的 `Matcher` | ||||
|  | ||||
| ### _instance-var_ `sub_plugins` {#Plugin-sub_plugins} | ||||
|  | ||||
| - **类型:** set[Plugin] | ||||
|  | ||||
| - **说明:** 子插件集合 | ||||
		Reference in New Issue
	
	Block a user