Feat: 添加 CommandStart 依赖注入参数 (#915)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: yanyongyu <42488585+yanyongyu@users.noreply.github.com>
This commit is contained in:
MeetWq
2022-04-20 14:43:29 +08:00
committed by GitHub
parent f989710cd6
commit 533e99418c
6 changed files with 74 additions and 11 deletions

View File

@ -32,6 +32,7 @@ from nonebot.consts import (
CMD_ARG_KEY,
RAW_CMD_KEY,
REGEX_GROUP,
CMD_START_KEY,
REGEX_MATCHED,
)
@ -99,6 +100,15 @@ def CommandArg() -> Any:
return Depends(_command_arg)
def _command_start(state: T_State) -> str:
return state[PREFIX_KEY][CMD_START_KEY]
def CommandStart() -> str:
"""消息命令开头"""
return Depends(_command_start)
def _shell_command_args(state: T_State) -> Any:
return state[SHELL_ARGS]