nonebot2/nonebot/plugin.pyi

174 lines
5.2 KiB
Python
Raw Normal View History

2020-09-28 00:09:12 +08:00
import re
2020-10-22 22:08:19 +08:00
from nonebot.typing import Rule, Matcher, Handler, Permission, RuleChecker
2020-09-28 00:09:12 +08:00
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]]] = ...,
2020-09-28 00:09:12 +08:00
*,
permission: Optional[Permission] = ...,
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]]] = ...,
2020-09-28 00:09:12 +08:00
*,
permission: Optional[Permission] = ...,
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_keyword(keywords: Set[str],
rule: Optional[Optional[Union[Rule, RuleChecker]]] = ...,
*,
permission: Optional[Permission] = ...,
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
...
2020-09-28 12:45:55 +08:00
def on_command(cmd: Union[str, Tuple[str, ...]],
rule: Optional[Union[Rule, RuleChecker]] = ...,
2020-10-22 22:08:19 +08:00
aliases: Optional[Set[Union[str, Tuple[str, ...]]]] = ...,
2020-09-28 12:45:55 +08:00
*,
permission: Optional[Permission] = ...,
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_regex(pattern: str,
flags: Union[int, re.RegexFlag] = 0,
2020-09-28 12:45:55 +08:00
rule: Optional[Rule] = ...,
2020-09-28 00:09:12 +08:00
*,
permission: Optional[Permission] = ...,
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
...
2020-10-22 22:08:19 +08:00
def command(self,
cmd: Union[str, Tuple[str, ...]],
rule: Optional[Union[Rule, RuleChecker]] = ...,
aliases: Optional[Set[Union[str, Tuple[str, ...]]]] = ...,
permission: Optional[Permission] = ...,
*,
handlers: Optional[List[Handler]] = ...,
temp: bool = ...,
priority: int = ...,
block: bool = ...,
state: Optional[dict] = ...) -> Type[Matcher]:
2020-09-28 00:09:12 +08:00
...