mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-29 09:10:22 +00:00
Add comment
This commit is contained in:
@ -15,6 +15,21 @@ class ValidateError(ValueError):
|
|||||||
|
|
||||||
async def run_arg_filters(session: 'CommandSession',
|
async def run_arg_filters(session: 'CommandSession',
|
||||||
arg_filters: List[ArgFilter_T]) -> None:
|
arg_filters: List[ArgFilter_T]) -> None:
|
||||||
|
"""
|
||||||
|
Run a specific list of argument filters on a command session.
|
||||||
|
|
||||||
|
This will call all argument filter functions successively,
|
||||||
|
with `session.current_arg` as the argument.
|
||||||
|
|
||||||
|
If all filters are passed, the final result will be put into
|
||||||
|
`session.state` with the key `session.current_key`.
|
||||||
|
|
||||||
|
If some validation failed, the session will be paused and
|
||||||
|
failure message will be sent to the user.
|
||||||
|
|
||||||
|
:param session: command session to run on
|
||||||
|
:param arg_filters: argument filters
|
||||||
|
"""
|
||||||
arg = session.current_arg
|
arg = session.current_arg
|
||||||
for f in arg_filters:
|
for f in arg_filters:
|
||||||
try:
|
try:
|
||||||
|
Reference in New Issue
Block a user