mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 09:05:04 +08:00
⚗️ add new builtin plugin
This commit is contained in:
parent
853b797cd9
commit
f8304406c5
@ -933,7 +933,7 @@ def load_plugins(*plugin_dir: str) -> Set[Plugin]:
|
||||
return loaded_plugins
|
||||
|
||||
|
||||
def load_builtin_plugins() -> Optional[Plugin]:
|
||||
def load_builtin_plugins(name: str = "echo") -> Optional[Plugin]:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
@ -943,7 +943,7 @@ def load_builtin_plugins() -> Optional[Plugin]:
|
||||
|
||||
- ``Plugin``
|
||||
"""
|
||||
return load_plugin("nonebot.plugins.base")
|
||||
return load_plugin(f"nonebot.plugins.{name}")
|
||||
|
||||
|
||||
def get_plugin(name: str) -> Optional[Plugin]:
|
||||
|
@ -168,7 +168,7 @@ def load_plugins(*plugin_dir: str) -> Set[Plugin]:
|
||||
...
|
||||
|
||||
|
||||
def load_builtin_plugins():
|
||||
def load_builtin_plugins(name: str = ...):
|
||||
...
|
||||
|
||||
|
||||
|
20
nonebot/plugins/single_session.py
Normal file
20
nonebot/plugins/single_session.py
Normal file
@ -0,0 +1,20 @@
|
||||
from typing import Dict, Optional
|
||||
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.matcher import Matcher
|
||||
from nonebot.adapters import Bot, Event
|
||||
from nonebot.message import run_preprocessor, run_postprocessor, IgnoredException
|
||||
|
||||
_running_matcher: Dict[str, bool] = {}
|
||||
|
||||
|
||||
@run_preprocessor
|
||||
async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State):
|
||||
# TODO
|
||||
pass
|
||||
|
||||
|
||||
@run_postprocessor
|
||||
async def _(matcher: Matcher, exception: Optional[Exception], bot: Bot, event: Event, state: T_State):
|
||||
# TODO
|
||||
pass
|
Loading…
Reference in New Issue
Block a user