2020-10-18 15:04:45 +08:00
|
|
|
"""
|
|
|
|
插件
|
|
|
|
====
|
|
|
|
|
|
|
|
为 NoneBot 插件开发提供便携的定义函数。
|
|
|
|
"""
|
2020-06-30 10:13:58 +08:00
|
|
|
|
2021-11-11 17:33:30 +08:00
|
|
|
from typing import List, Optional
|
2021-11-08 01:02:35 +08:00
|
|
|
from contextvars import ContextVar
|
2021-09-18 16:11:03 +08:00
|
|
|
|
2021-11-11 17:33:30 +08:00
|
|
|
_managers: List["PluginManager"] = []
|
2021-11-22 23:21:26 +08:00
|
|
|
_current_plugin: ContextVar[Optional["Plugin"]] = ContextVar(
|
|
|
|
"_current_plugin", default=None
|
|
|
|
)
|
2020-06-30 10:13:58 +08:00
|
|
|
|
2021-11-11 17:33:30 +08:00
|
|
|
from .on import on as on
|
|
|
|
from .manager import PluginManager
|
2021-11-08 01:02:35 +08:00
|
|
|
from .export import Export as Export
|
2021-09-18 16:11:03 +08:00
|
|
|
from .export import export as export
|
2021-11-11 17:33:30 +08:00
|
|
|
from .load import require as require
|
|
|
|
from .on import on_regex as on_regex
|
2021-11-08 01:02:35 +08:00
|
|
|
from .plugin import Plugin as Plugin
|
2021-11-11 17:33:30 +08:00
|
|
|
from .on import on_notice as on_notice
|
|
|
|
from .on import on_command as on_command
|
|
|
|
from .on import on_keyword as on_keyword
|
|
|
|
from .on import on_message as on_message
|
|
|
|
from .on import on_request as on_request
|
|
|
|
from .on import on_endswith as on_endswith
|
|
|
|
from .load import load_plugin as load_plugin
|
|
|
|
from .on import CommandGroup as CommandGroup
|
|
|
|
from .on import MatcherGroup as MatcherGroup
|
|
|
|
from .on import on_metaevent as on_metaevent
|
2021-11-08 01:02:35 +08:00
|
|
|
from .plugin import get_plugin as get_plugin
|
2021-11-11 17:33:30 +08:00
|
|
|
from .load import load_plugins as load_plugins
|
|
|
|
from .on import on_startswith as on_startswith
|
|
|
|
from .load import load_from_json as load_from_json
|
|
|
|
from .load import load_from_toml as load_from_toml
|
|
|
|
from .on import on_shell_command as on_shell_command
|
|
|
|
from .load import load_all_plugins as load_all_plugins
|
2021-11-08 01:02:35 +08:00
|
|
|
from .plugin import get_loaded_plugins as get_loaded_plugins
|
2021-11-11 17:33:30 +08:00
|
|
|
from .load import load_builtin_plugins as load_builtin_plugins
|