mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-30 22:46:40 +00:00 
			
		
		
		
	
		
			
				
	
	
	
		
			2.3 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			2.3 KiB
		
	
	
	
	
	
	
	
sidebar_position, description
| sidebar_position | description | 
|---|---|
| 5 | nonebot.plugin.manager 模块 | 
nonebot.plugin.manager
本模块实现插件加载流程。
参考: import hooks, PEP302
class PluginManager(plugins=None, search_path=None)
- 
说明: 插件管理器。 
- 
参数 - 
plugins(Iterable[str] | None): 独立插件模块名集合。
- 
search_path(Iterable[str] | None): 插件搜索路径(文件夹)。
 
- 
property third_party_plugins
- 
类型: set[str] 
- 
说明: 返回所有独立插件名称。 
property searched_plugins
- 
类型: set[str] 
- 
说明: 返回已搜索到的插件名称。 
property available_plugins
- 
类型: set[str] 
- 
说明: 返回当前插件管理器中可用的插件名称。 
method prepare_plugins()
- 
说明: 搜索插件并缓存插件名称。 
- 
参数 empty 
- 
返回 - set[str]
 
method load_plugin(name)
- 
说明 加载指定插件。 对于独立插件,可以使用完整插件模块名或者插件名称。 
- 
参数 - name(str): 插件名称。
 
- 
返回 - Plugin | None
 
method load_all_plugins()
- 
说明: 加载所有可用插件。 
- 
参数 empty 
- 
返回 - set[Plugin]
 
class PluginFinder(<auto>)
- 
参数 auto 
method find_spec(fullname, path, target=None)
- 
参数 - 
fullname(str)
- 
path(Sequence[str] | None)
- 
target(ModuleType | None)
 
- 
- 
返回 - untyped
 
class PluginLoader(manager, fullname, path)
- 
参数 - 
manager(PluginManager)
- 
fullname(str)
- 
path
 
- 
method create_module(spec)
- 
参数 - spec
 
- 
返回 - ModuleType | None
 
method exec_module(module)
- 
参数 - module(ModuleType)
 
- 
返回 - None