Feature: 命令匹配支持强制指定空白符 (#1748)

This commit is contained in:
Ju4tCode
2023-02-27 00:11:24 +08:00
committed by GitHub
parent f8c67ebdf6
commit 433c672130
8 changed files with 154 additions and 19 deletions

View File

@ -39,6 +39,7 @@ from nonebot.consts import (
FULLMATCH_KEY,
REGEX_MATCHED,
STARTSWITH_KEY,
CMD_WHITESPACE_KEY,
)
@ -114,6 +115,15 @@ def CommandStart() -> str:
return Depends(_command_start)
def _command_whitespace(state: T_State) -> str:
return state[PREFIX_KEY][CMD_WHITESPACE_KEY]
def CommandWhitespace() -> str:
"""消息命令与参数之间的空白"""
return Depends(_command_whitespace)
def _shell_command_args(state: T_State) -> Any:
return state[SHELL_ARGS] # Namespace or ParserExit