nonebot2/nonebot/plugin.pyi

179 lines
5.3 KiB
Python
Raw Normal View History

2020-09-28 00:09:12 +08:00
import re
2020-09-28 12:45:55 +08:00
from typing import overload
2020-09-28 00:09:12 +08:00
from nonebot.typing import Rule, Matcher, Handler, Permission, RuleChecker, MatcherGroup
from nonebot.typing import Set, List, Dict, Type, Tuple, Union, Optional, ModuleType
plugins: Dict[str, "Plugin"] = ...
_tmp_matchers: Set[Type[Matcher]] = ...
class Plugin(object):
name: str
module: ModuleType
matcher: Set[Type[Matcher]]
2020-10-16 15:12:15 +08:00
def on(type: str = ...,
rule: Optional[Union[Rule, RuleChecker]] = ...,
2020-09-28 12:45:55 +08:00
permission: Optional[Permission] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
2020-09-28 00:09:12 +08:00
...
2020-09-28 12:45:55 +08:00
def on_metaevent(rule: Optional[Union[Rule, RuleChecker]] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
2020-09-28 00:09:12 +08:00
...
2020-09-28 12:45:55 +08:00
def on_message(rule: Optional[Union[Rule, RuleChecker]] = ...,
permission: Optional[Permission] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
2020-09-28 00:09:12 +08:00
...
2020-09-28 12:45:55 +08:00
def on_notice(rule: Optional[Union[Rule, RuleChecker]] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
2020-09-28 00:09:12 +08:00
...
2020-09-28 12:45:55 +08:00
def on_request(rule: Optional[Union[Rule, RuleChecker]] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
2020-09-28 00:09:12 +08:00
...
def on_startswith(msg: str,
2020-09-28 12:45:55 +08:00
rule: Optional[Optional[Union[Rule, RuleChecker]]] = ...,
permission: Optional[Permission] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
2020-09-28 00:09:12 +08:00
...
def on_endswith(msg: str,
2020-09-28 12:45:55 +08:00
rule: Optional[Optional[Union[Rule, RuleChecker]]] = ...,
permission: Optional[Permission] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
2020-09-28 00:09:12 +08:00
...
2020-09-28 12:45:55 +08:00
@overload
def on_command(cmd: Union[str, Tuple[str, ...]],
rule: Optional[Union[Rule, RuleChecker]] = ...,
aliases: None = ...,
permission: Optional[Permission] = ...,
*,
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
...
@overload
def on_command(cmd: Union[str, Tuple[str, ...]],
rule: Optional[Union[Rule, RuleChecker]] = ...,
aliases: Set[Union[str, Tuple[str, ...]]] = ...,
permission: Optional[Permission] = ...,
*,
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> MatcherGroup:
2020-09-28 00:09:12 +08:00
...
def on_regex(pattern: str,
flags: Union[int, re.RegexFlag] = 0,
2020-09-28 12:45:55 +08:00
rule: Optional[Rule] = ...,
permission: Optional[Permission] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
2020-09-28 00:09:12 +08:00
...
def load_plugin(module_path: str) -> Optional[Plugin]:
...
def load_plugins(*plugin_dir: str) -> Set[Plugin]:
...
def load_builtin_plugins():
...
def get_loaded_plugins() -> Set[Plugin]:
...
class CommandGroup:
def __init__(self,
cmd: Union[str, Tuple[str, ...]],
2020-09-28 12:45:55 +08:00
rule: Optional[Union[Rule, RuleChecker]] = ...,
permission: Optional[Permission] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...):
2020-09-28 00:09:12 +08:00
...
def command(
self,
cmd: Union[str, Tuple[str, ...]],
2020-09-28 12:45:55 +08:00
rule: Optional[Union[Rule, RuleChecker]] = ...,
aliases: Set[Union[str, Tuple[str, ...]]] = ...,
permission: Optional[Permission] = ...,
2020-09-28 00:09:12 +08:00
*,
2020-09-28 12:45:55 +08:00
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Union[Type[Matcher], MatcherGroup]:
2020-09-28 00:09:12 +08:00
...