2020-09-28 00:09:12 +08:00
|
|
|
import re
|
2020-12-06 02:30:19 +08:00
|
|
|
from types import ModuleType
|
2021-04-04 12:19:03 +08:00
|
|
|
from dataclasses import dataclass
|
|
|
|
from typing import Set, List, Dict, Type, Tuple, Union, Optional, TYPE_CHECKING
|
2020-09-28 00:09:12 +08:00
|
|
|
|
2020-12-06 02:30:19 +08:00
|
|
|
from nonebot.matcher import Matcher
|
2021-03-19 14:59:59 +08:00
|
|
|
from nonebot.handler import Handler
|
2020-12-06 02:30:19 +08:00
|
|
|
from nonebot.permission import Permission
|
2021-02-02 11:59:14 +08:00
|
|
|
from nonebot.rule import Rule, ArgumentParser
|
2020-12-20 11:59:23 +08:00
|
|
|
from nonebot.typing import T_State, T_StateFactory, T_Handler, T_RuleChecker
|
2020-09-28 00:09:12 +08:00
|
|
|
|
2021-04-04 12:19:03 +08:00
|
|
|
from .export import Export, export
|
|
|
|
from .manager import PluginManager
|
2020-11-21 20:40:09 +08:00
|
|
|
|
2021-04-04 12:19:03 +08:00
|
|
|
plugins: Dict[str, "Plugin"] = ...
|
|
|
|
PLUGIN_NAMESPACE: str = ...
|
2020-11-21 20:40:09 +08:00
|
|
|
|
|
|
|
|
2021-04-04 12:19:03 +08:00
|
|
|
@dataclass(eq=False)
|
|
|
|
class Plugin(object):
|
|
|
|
name: str
|
|
|
|
module: ModuleType
|
2020-11-21 20:40:09 +08:00
|
|
|
|
2021-04-04 12:19:03 +08:00
|
|
|
@property
|
|
|
|
def export(self) -> Export:
|
2020-11-21 20:40:09 +08:00
|
|
|
...
|
|
|
|
|
2021-04-04 12:19:03 +08:00
|
|
|
@property
|
|
|
|
def matcher(self) -> Set[Type[Matcher]]:
|
2020-11-21 20:40:09 +08:00
|
|
|
...
|
2020-09-28 00:09:12 +08:00
|
|
|
|
|
|
|
|
2021-04-04 12:19:03 +08:00
|
|
|
def on(type: str = "",
|
2020-12-17 21:09:30 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2020-09-28 00:09:12 +08:00
|
|
|
*,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 00:09:12 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_metaevent(
|
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
|
|
|
*,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 00:09:12 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2020-12-17 21:09:30 +08:00
|
|
|
def on_message(rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2020-09-28 00:09:12 +08:00
|
|
|
*,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 00:09:12 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2020-12-17 21:09:30 +08:00
|
|
|
def on_notice(rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-09-28 00:09:12 +08:00
|
|
|
*,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 00:09:12 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2020-12-17 21:09:30 +08:00
|
|
|
def on_request(rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-09-28 00:09:12 +08:00
|
|
|
*,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 00:09:12 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_startswith(
|
|
|
|
msg: str,
|
|
|
|
rule: Optional[Optional[Union[Rule, T_RuleChecker]]] = ...,
|
2021-04-04 12:19:03 +08:00
|
|
|
ignorecase: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
*,
|
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 00:09:12 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def on_endswith(msg: str,
|
2020-12-17 21:09:30 +08:00
|
|
|
rule: Optional[Optional[Union[Rule, T_RuleChecker]]] = ...,
|
2021-04-04 12:19:03 +08:00
|
|
|
ignorecase: bool = ...,
|
2020-09-28 00:09:12 +08:00
|
|
|
*,
|
2020-10-30 16:26:04 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 00:09:12 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2020-10-30 16:26:04 +08:00
|
|
|
def on_keyword(keywords: Set[str],
|
2021-04-04 12:19:03 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-10-30 16:26:04 +08:00
|
|
|
*,
|
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-10-30 16:26:04 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-10-30 16:26:04 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2020-09-28 12:45:55 +08:00
|
|
|
def on_command(cmd: Union[str, Tuple[str, ...]],
|
2020-12-17 21:09:30 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-10-22 22:08:19 +08:00
|
|
|
aliases: Optional[Set[Union[str, Tuple[str, ...]]]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
*,
|
2020-10-30 16:26:04 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 12:45:55 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2021-04-04 12:19:03 +08:00
|
|
|
def on_shell_command(
|
|
|
|
cmd: Union[str, Tuple[str, ...]],
|
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
|
|
|
aliases: Optional[Set[Union[str, Tuple[str, ...]]]] = ...,
|
|
|
|
parser: Optional[ArgumentParser] = ...,
|
|
|
|
*,
|
|
|
|
permission: Optional[Permission] = ...,
|
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2021-02-01 22:28:48 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
2020-09-28 00:09:12 +08:00
|
|
|
def on_regex(pattern: str,
|
2021-04-04 12:19:03 +08:00
|
|
|
flags: Union[int, re.RegexFlag] = ...,
|
2021-03-13 15:35:13 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-09-28 00:09:12 +08:00
|
|
|
*,
|
2020-10-30 16:26:04 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 00:09:12 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
class CommandGroup:
|
|
|
|
|
|
|
|
def __init__(self,
|
|
|
|
cmd: Union[str, Tuple[str, ...]],
|
2021-04-04 12:19:03 +08:00
|
|
|
*,
|
2020-12-17 21:09:30 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-09-28 12:45:55 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2021-04-04 12:19:03 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...):
|
|
|
|
...
|
2020-09-28 00:09:12 +08:00
|
|
|
|
2020-10-22 22:08:19 +08:00
|
|
|
def command(self,
|
|
|
|
cmd: Union[str, Tuple[str, ...]],
|
2020-12-04 01:41:23 +08:00
|
|
|
*,
|
2021-04-04 12:19:03 +08:00
|
|
|
aliases: Optional[Set[Union[str, Tuple[str, ...]]]],
|
2020-12-17 21:09:30 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-10-22 22:08:19 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-10-22 22:08:19 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-09-28 00:09:12 +08:00
|
|
|
...
|
2020-12-04 01:41:23 +08:00
|
|
|
|
2021-02-02 11:59:14 +08:00
|
|
|
def shell_command(
|
|
|
|
self,
|
|
|
|
cmd: Union[str, Tuple[str, ...]],
|
|
|
|
*,
|
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2021-04-04 12:19:03 +08:00
|
|
|
aliases: Optional[Set[Union[str, Tuple[str, ...]]]],
|
2021-02-02 11:59:14 +08:00
|
|
|
parser: Optional[ArgumentParser] = ...,
|
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2021-02-02 11:59:14 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
|
|
|
...
|
|
|
|
|
2020-12-04 01:41:23 +08:00
|
|
|
|
|
|
|
class MatcherGroup:
|
|
|
|
|
|
|
|
def __init__(self,
|
|
|
|
*,
|
|
|
|
type: str = ...,
|
2020-12-17 21:09:30 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-12-04 01:41:23 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-12-04 01:41:23 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2021-04-04 12:19:03 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...):
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
def on(self,
|
|
|
|
*,
|
|
|
|
type: str = ...,
|
2020-12-17 21:09:30 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-12-04 01:41:23 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-12-04 01:41:23 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_metaevent(
|
|
|
|
self,
|
|
|
|
*,
|
2021-04-04 12:19:03 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_message(
|
|
|
|
self,
|
|
|
|
*,
|
2021-04-04 12:19:03 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
|
|
|
permission: Optional[Permission] = ...,
|
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_notice(
|
|
|
|
self,
|
|
|
|
*,
|
2021-04-04 12:19:03 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_request(
|
|
|
|
self,
|
|
|
|
*,
|
2021-04-04 12:19:03 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_startswith(
|
|
|
|
self,
|
|
|
|
msg: str,
|
2021-02-05 11:49:12 +08:00
|
|
|
*,
|
2021-04-04 12:19:03 +08:00
|
|
|
ignorecase: bool = ...,
|
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_endswith(
|
|
|
|
self,
|
|
|
|
msg: str,
|
2021-02-05 11:49:12 +08:00
|
|
|
*,
|
2021-04-04 12:19:03 +08:00
|
|
|
ignorecase: bool = ...,
|
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_keyword(
|
|
|
|
self,
|
|
|
|
keywords: Set[str],
|
2021-02-05 11:49:12 +08:00
|
|
|
*,
|
2021-04-04 12:19:03 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_command(
|
|
|
|
self,
|
|
|
|
cmd: Union[str, Tuple[str, ...]],
|
|
|
|
aliases: Optional[Set[Union[str, Tuple[str, ...]]]] = ...,
|
2021-02-05 11:49:12 +08:00
|
|
|
*,
|
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
|
|
|
|
2021-02-02 11:59:14 +08:00
|
|
|
def on_shell_command(
|
|
|
|
self,
|
|
|
|
cmd: Union[str, Tuple[str, ...]],
|
|
|
|
aliases: Optional[Set[Union[str, Tuple[str, ...]]]] = ...,
|
|
|
|
parser: Optional[ArgumentParser] = ...,
|
2021-02-05 11:49:12 +08:00
|
|
|
*,
|
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2021-02-02 11:59:14 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2021-02-02 11:59:14 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
|
|
|
...
|
|
|
|
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_regex(
|
|
|
|
self,
|
|
|
|
pattern: str,
|
2021-04-04 12:19:03 +08:00
|
|
|
flags: Union[int, re.RegexFlag] = ...,
|
2021-02-05 11:49:12 +08:00
|
|
|
*,
|
2021-03-13 15:35:13 +08:00
|
|
|
rule: Optional[Union[Rule, T_RuleChecker]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
permission: Optional[Permission] = ...,
|
2021-03-19 14:59:59 +08:00
|
|
|
handlers: Optional[List[Union[T_Handler, Handler]]] = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
temp: bool = ...,
|
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
|
|
|
state: Optional[T_State] = ...,
|
|
|
|
state_factory: Optional[T_StateFactory] = ...) -> Type[Matcher]:
|
2020-12-04 01:41:23 +08:00
|
|
|
...
|
2021-04-04 12:19:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
def load_plugin(module_path: str) -> Optional[Plugin]:
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def load_plugins(*plugin_dir: str) -> Set[Plugin]:
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def load_all_plugins(module_path: Set[str],
|
|
|
|
plugin_dir: Set[str]) -> Set[Plugin]:
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def load_from_json(file_path: str, encoding: str = ...) -> Set[Plugin]:
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def load_from_toml(file_path: str, encoding: str = ...) -> Set[Plugin]:
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def load_builtin_plugins(name: str = ...) -> Optional[Plugin]:
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def get_plugin(name: str) -> Optional[Plugin]:
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def get_loaded_plugins() -> Set[Plugin]:
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def require(name: str) -> Optional[Export]:
|
|
|
|
...
|