2024-04-16 00:33:48 +08:00
|
|
|
from re import Match
|
2021-12-20 00:28:02 +08:00
|
|
|
|
|
|
|
from nonebot.adapters import Message
|
|
|
|
from nonebot.params import (
|
|
|
|
Command,
|
2024-12-01 12:31:11 +08:00
|
|
|
CommandArg,
|
|
|
|
CommandStart,
|
|
|
|
CommandWhitespace,
|
2022-10-12 13:41:28 +08:00
|
|
|
Endswith,
|
|
|
|
Fullmatch,
|
2024-12-01 12:31:11 +08:00
|
|
|
Keyword,
|
2021-12-20 00:28:02 +08:00
|
|
|
RawCommand,
|
2024-12-01 12:31:11 +08:00
|
|
|
RegexDict,
|
2021-12-20 00:28:02 +08:00
|
|
|
RegexGroup,
|
|
|
|
RegexMatched,
|
2024-12-01 12:31:11 +08:00
|
|
|
RegexStr,
|
2021-12-20 00:28:02 +08:00
|
|
|
ShellCommandArgs,
|
|
|
|
ShellCommandArgv,
|
2024-12-01 12:31:11 +08:00
|
|
|
Startswith,
|
2021-12-20 00:28:02 +08:00
|
|
|
)
|
2024-12-01 12:31:11 +08:00
|
|
|
from nonebot.typing import T_State
|
2021-12-20 00:28:02 +08:00
|
|
|
|
|
|
|
|
2022-01-10 11:20:06 +08:00
|
|
|
async def state(x: T_State) -> T_State:
|
2021-12-20 00:28:02 +08:00
|
|
|
return x
|
|
|
|
|
|
|
|
|
2024-05-09 15:08:49 +08:00
|
|
|
async def postpone_state(x: "T_State") -> T_State:
|
|
|
|
return x
|
|
|
|
|
|
|
|
|
2022-05-22 19:42:30 +08:00
|
|
|
async def legacy_state(state):
|
|
|
|
return state
|
|
|
|
|
|
|
|
|
2024-02-06 12:48:23 +08:00
|
|
|
async def not_legacy_state(state: int): ...
|
2022-05-22 19:42:30 +08:00
|
|
|
|
|
|
|
|
2024-04-16 00:33:48 +08:00
|
|
|
async def command(cmd: tuple[str, ...] = Command()) -> tuple[str, ...]:
|
2021-12-20 00:28:02 +08:00
|
|
|
return cmd
|
|
|
|
|
|
|
|
|
|
|
|
async def raw_command(raw_cmd: str = RawCommand()) -> str:
|
|
|
|
return raw_cmd
|
|
|
|
|
|
|
|
|
|
|
|
async def command_arg(cmd_arg: Message = CommandArg()) -> Message:
|
|
|
|
return cmd_arg
|
|
|
|
|
|
|
|
|
2022-04-20 14:43:29 +08:00
|
|
|
async def command_start(start: str = CommandStart()) -> str:
|
|
|
|
return start
|
|
|
|
|
|
|
|
|
2023-02-27 00:11:24 +08:00
|
|
|
async def command_whitespace(whitespace: str = CommandWhitespace()) -> str:
|
|
|
|
return whitespace
|
|
|
|
|
|
|
|
|
2021-12-20 00:28:02 +08:00
|
|
|
async def shell_command_args(
|
|
|
|
shell_command_args: dict = ShellCommandArgs(),
|
|
|
|
) -> dict:
|
|
|
|
return shell_command_args
|
|
|
|
|
|
|
|
|
|
|
|
async def shell_command_argv(
|
2024-04-16 00:33:48 +08:00
|
|
|
shell_command_argv: list[str] = ShellCommandArgv(),
|
|
|
|
) -> list[str]:
|
2021-12-20 00:28:02 +08:00
|
|
|
return shell_command_argv
|
|
|
|
|
|
|
|
|
|
|
|
async def regex_dict(regex_dict: dict = RegexDict()) -> dict:
|
|
|
|
return regex_dict
|
|
|
|
|
|
|
|
|
2024-04-16 00:33:48 +08:00
|
|
|
async def regex_group(regex_group: tuple = RegexGroup()) -> tuple:
|
2021-12-20 00:28:02 +08:00
|
|
|
return regex_group
|
|
|
|
|
|
|
|
|
2023-04-27 21:58:56 +08:00
|
|
|
async def regex_matched(regex_matched: Match[str] = RegexMatched()) -> Match[str]:
|
2021-12-20 00:28:02 +08:00
|
|
|
return regex_matched
|
2022-10-12 13:41:28 +08:00
|
|
|
|
|
|
|
|
2024-01-11 11:52:07 +08:00
|
|
|
async def regex_str(
|
|
|
|
entire: str = RegexStr(),
|
|
|
|
type_: str = RegexStr("type"),
|
|
|
|
second: str = RegexStr(2),
|
2024-04-16 00:33:48 +08:00
|
|
|
groups: tuple[str, ...] = RegexStr(1, "arg"),
|
|
|
|
) -> tuple[str, str, str, tuple[str, ...]]:
|
2024-01-11 11:52:07 +08:00
|
|
|
return entire, type_, second, groups
|
2022-12-09 14:42:54 +08:00
|
|
|
|
|
|
|
|
2022-10-12 13:41:28 +08:00
|
|
|
async def startswith(startswith: str = Startswith()) -> str:
|
|
|
|
return startswith
|
|
|
|
|
|
|
|
|
|
|
|
async def endswith(endswith: str = Endswith()) -> str:
|
|
|
|
return endswith
|
|
|
|
|
|
|
|
|
|
|
|
async def fullmatch(fullmatch: str = Fullmatch()) -> str:
|
|
|
|
return fullmatch
|
|
|
|
|
|
|
|
|
|
|
|
async def keyword(keyword: str = Keyword()) -> str:
|
|
|
|
return keyword
|