2024-12-01 12:31:11 +08:00
|
|
|
from datetime import datetime, timedelta
|
2020-09-28 00:09:12 +08:00
|
|
|
import re
|
2023-03-29 23:09:33 +08:00
|
|
|
from types import ModuleType
|
2024-12-01 12:31:11 +08:00
|
|
|
from typing import Any
|
2020-09-28 00:09:12 +08:00
|
|
|
|
2022-08-30 09:54:09 +08:00
|
|
|
from nonebot.adapters import Event
|
2021-12-12 18:19:08 +08:00
|
|
|
from nonebot.dependencies import Dependent
|
2023-09-09 13:46:09 +08:00
|
|
|
from nonebot.matcher import Matcher, MatcherSource
|
2024-12-01 12:31:11 +08:00
|
|
|
from nonebot.permission import Permission
|
|
|
|
from nonebot.rule import ArgumentParser, Rule
|
|
|
|
from nonebot.typing import T_Handler, T_PermissionChecker, T_RuleChecker, T_State
|
2020-09-28 00:09:12 +08:00
|
|
|
|
2023-09-27 16:00:26 +08:00
|
|
|
from .model import Plugin
|
2023-03-29 23:09:33 +08:00
|
|
|
|
2023-06-24 14:47:35 +08:00
|
|
|
def store_matcher(matcher: type[Matcher]) -> None: ...
|
|
|
|
def get_matcher_plugin(depth: int = ...) -> Plugin | None: ...
|
|
|
|
def get_matcher_module(depth: int = ...) -> ModuleType | None: ...
|
2023-09-09 13:46:09 +08:00
|
|
|
def get_matcher_source(depth: int = ...) -> MatcherSource | None: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on(
|
|
|
|
type: str = "",
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_metaevent(
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on_message(
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on_notice(
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on_request(
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on_startswith(
|
2023-06-24 14:47:35 +08:00
|
|
|
msg: str | tuple[str, ...],
|
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
ignorecase: bool = ...,
|
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on_endswith(
|
2023-06-24 14:47:35 +08:00
|
|
|
msg: str | tuple[str, ...],
|
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
ignorecase: bool = ...,
|
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2022-02-15 08:20:29 +08:00
|
|
|
def on_fullmatch(
|
2023-06-24 14:47:35 +08:00
|
|
|
msg: str | tuple[str, ...],
|
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
2022-02-15 08:20:29 +08:00
|
|
|
ignorecase: bool = ...,
|
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2022-02-15 08:20:29 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2022-02-15 08:20:29 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on_keyword(
|
2023-06-24 14:47:35 +08:00
|
|
|
keywords: set[str],
|
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on_command(
|
2023-06-24 14:47:35 +08:00
|
|
|
cmd: str | tuple[str, ...],
|
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
aliases: set[str | tuple[str, ...]] | None = ...,
|
|
|
|
force_whitespace: str | bool | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on_shell_command(
|
2023-06-24 14:47:35 +08:00
|
|
|
cmd: str | tuple[str, ...],
|
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
aliases: set[str | tuple[str, ...]] | None = ...,
|
|
|
|
parser: ArgumentParser | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def on_regex(
|
|
|
|
pattern: str,
|
2023-06-24 14:47:35 +08:00
|
|
|
flags: int | re.RegexFlag = ...,
|
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2022-08-30 09:54:09 +08:00
|
|
|
def on_type(
|
2023-06-24 14:47:35 +08:00
|
|
|
types: type[Event] | tuple[type[Event], ...],
|
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
2022-08-30 09:54:09 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2022-08-30 09:54:09 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2022-08-30 09:54:09 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
|
2023-07-06 15:18:08 +08:00
|
|
|
class _Group:
|
|
|
|
matchers: list[type[Matcher]] = ...
|
2023-07-17 20:42:15 +08:00
|
|
|
base_kwargs: dict[str, Any] = ...
|
2023-07-06 15:18:08 +08:00
|
|
|
def _get_final_kwargs(
|
2023-07-17 20:42:15 +08:00
|
|
|
self, update: dict[str, Any], *, exclude: set[str] | None = None
|
|
|
|
) -> dict[str, Any]: ...
|
2023-07-06 15:18:08 +08:00
|
|
|
|
|
|
|
class CommandGroup(_Group):
|
|
|
|
basecmd: tuple[str, ...] = ...
|
|
|
|
prefix_aliases: bool = ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def __init__(
|
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
cmd: str | tuple[str, ...],
|
2023-07-01 15:40:30 +08:00
|
|
|
prefix_aliases: bool = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
): ...
|
|
|
|
def command(
|
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
cmd: str | tuple[str, ...],
|
2020-12-20 11:59:23 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
aliases: set[str | tuple[str, ...]] | None = ...,
|
|
|
|
force_whitespace: str | bool | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2020-12-20 11:59:23 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-11-22 23:21:26 +08:00
|
|
|
def shell_command(
|
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
cmd: str | tuple[str, ...],
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
aliases: set[str | tuple[str, ...]] | None = ...,
|
|
|
|
parser: ArgumentParser | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-04-04 12:19:03 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-04-04 12:19:03 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-04 01:41:23 +08:00
|
|
|
|
2023-07-06 15:18:08 +08:00
|
|
|
class MatcherGroup(_Group):
|
2021-11-22 23:21:26 +08:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
*,
|
|
|
|
type: str = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
): ...
|
|
|
|
def on(
|
|
|
|
self,
|
|
|
|
*,
|
|
|
|
type: str = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_metaevent(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_message(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_notice(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_request(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_startswith(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
msg: str | tuple[str, ...],
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
|
|
|
ignorecase: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_endswith(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
msg: str | tuple[str, ...],
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
|
|
|
ignorecase: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2022-02-15 08:20:29 +08:00
|
|
|
def on_fullmatch(
|
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
msg: str | tuple[str, ...],
|
2022-02-15 08:20:29 +08:00
|
|
|
*,
|
|
|
|
ignorecase: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2022-02-15 08:20:29 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2022-02-15 08:20:29 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_keyword(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
keywords: set[str],
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_command(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
cmd: str | tuple[str, ...],
|
|
|
|
aliases: set[str | tuple[str, ...]] | None = ...,
|
|
|
|
force_whitespace: str | bool | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2021-02-02 11:59:14 +08:00
|
|
|
def on_shell_command(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
cmd: str | tuple[str, ...],
|
|
|
|
aliases: set[str | tuple[str, ...]] | None = ...,
|
|
|
|
parser: ArgumentParser | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2020-12-20 11:59:23 +08:00
|
|
|
def on_regex(
|
2021-11-22 23:21:26 +08:00
|
|
|
self,
|
|
|
|
pattern: str,
|
2023-06-24 14:47:35 +08:00
|
|
|
flags: int | re.RegexFlag = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2021-11-22 23:21:26 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|
2022-08-30 09:54:09 +08:00
|
|
|
def on_type(
|
|
|
|
self,
|
2023-06-24 14:47:35 +08:00
|
|
|
types: type[Event] | tuple[type[Event]],
|
2022-08-30 09:54:09 +08:00
|
|
|
*,
|
2023-06-24 14:47:35 +08:00
|
|
|
rule: Rule | T_RuleChecker | None = ...,
|
|
|
|
permission: Permission | T_PermissionChecker | None = ...,
|
2024-08-06 14:19:17 +08:00
|
|
|
handlers: list[T_Handler | Dependent[Any]] | None = ...,
|
2022-08-30 09:54:09 +08:00
|
|
|
temp: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
expire_time: datetime | timedelta | None = ...,
|
2022-08-30 09:54:09 +08:00
|
|
|
priority: int = ...,
|
|
|
|
block: bool = ...,
|
2023-06-24 14:47:35 +08:00
|
|
|
state: T_State | None = ...,
|
|
|
|
) -> type[Matcher]: ...
|