2021-12-20 00:28:02 +08:00
|
|
|
from typing import List, Tuple
|
|
|
|
|
|
|
|
from nonebot.typing import T_State
|
|
|
|
from nonebot.adapters import Message
|
|
|
|
from nonebot.params import (
|
|
|
|
Command,
|
2022-10-12 13:41:28 +08:00
|
|
|
Keyword,
|
|
|
|
Endswith,
|
|
|
|
Fullmatch,
|
2021-12-20 00:28:02 +08:00
|
|
|
RegexDict,
|
|
|
|
CommandArg,
|
|
|
|
RawCommand,
|
|
|
|
RegexGroup,
|
2022-10-12 13:41:28 +08:00
|
|
|
Startswith,
|
2022-04-20 14:43:29 +08:00
|
|
|
CommandStart,
|
2021-12-20 00:28:02 +08:00
|
|
|
RegexMatched,
|
|
|
|
ShellCommandArgs,
|
|
|
|
ShellCommandArgv,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2022-05-22 19:42:30 +08:00
|
|
|
async def legacy_state(state):
|
|
|
|
return state
|
|
|
|
|
|
|
|
|
|
|
|
async def not_legacy_state(state: int):
|
|
|
|
...
|
|
|
|
|
|
|
|
|
2021-12-20 00:28:02 +08:00
|
|
|
async def command(cmd: Tuple[str, ...] = Command()) -> Tuple[str, ...]:
|
|
|
|
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
|
|
|
|
|
|
|
|
|
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(
|
|
|
|
shell_command_argv: List[str] = ShellCommandArgv(),
|
|
|
|
) -> List[str]:
|
|
|
|
return shell_command_argv
|
|
|
|
|
|
|
|
|
|
|
|
async def regex_dict(regex_dict: dict = RegexDict()) -> dict:
|
|
|
|
return regex_dict
|
|
|
|
|
|
|
|
|
|
|
|
async def regex_group(regex_group: Tuple = RegexGroup()) -> Tuple:
|
|
|
|
return regex_group
|
|
|
|
|
|
|
|
|
|
|
|
async def regex_matched(regex_matched: str = RegexMatched()) -> str:
|
|
|
|
return regex_matched
|
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
|