get plugin func

This commit is contained in:
yanyongyu 2020-11-21 18:33:35 +08:00 committed by pull[bot]
parent e5213eb95a
commit 1aba139136
3 changed files with 19 additions and 2 deletions

View File

@ -239,4 +239,5 @@ async def _start_scheduler():
from nonebot.plugin import on_message, on_notice, on_request, on_metaevent, CommandGroup
from nonebot.plugin import on_startswith, on_endswith, on_keyword, on_command, on_regex
from nonebot.plugin import load_plugin, load_plugins, load_builtin_plugins, get_loaded_plugins
from nonebot.plugin import load_plugin, load_plugins, load_builtin_plugins
from nonebot.plugin import get_plugin, get_loaded_plugins

View File

@ -459,10 +459,22 @@ def load_builtin_plugins() -> Optional[Plugin]:
return load_plugin("nonebot.plugins.base")
def get_plugin(name: str) -> Optional[Plugin]:
"""
:说明:
获取当前导入的某个插件
:参数:
* ``name: str``: 插件名 ``load_plugin`` 参数一致如果为 ``load_plugins`` 导入的插件则为文件()
:返回:
- ``Optional[Plugin]``
"""
return plugins.get(name)
def get_loaded_plugins() -> Set[Plugin]:
"""
:说明:
获取当前已导入的插件
获取当前已导入的所有插件
:返回:
- ``Set[Plugin]``
"""

View File

@ -141,6 +141,10 @@ def load_builtin_plugins():
...
def get_plugin(name: str) -> Optional[Plugin]:
...
def get_loaded_plugins() -> Set[Plugin]:
...