mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 07:39:45 +08:00
✨ get plugin func
This commit is contained in:
parent
e5213eb95a
commit
1aba139136
@ -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
|
||||
|
@ -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]``
|
||||
"""
|
||||
|
@ -141,6 +141,10 @@ def load_builtin_plugins():
|
||||
...
|
||||
|
||||
|
||||
def get_plugin(name: str) -> Optional[Plugin]:
|
||||
...
|
||||
|
||||
|
||||
def get_loaded_plugins() -> Set[Plugin]:
|
||||
...
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user