From 73838ac46adcbdfaea23e87406440aea03053817 Mon Sep 17 00:00:00 2001 From: Richard Chien Date: Fri, 25 Jan 2019 13:29:15 +0800 Subject: [PATCH] Add comment --- nonebot/command/argfilter/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nonebot/command/argfilter/__init__.py b/nonebot/command/argfilter/__init__.py index ae6e09cc..ace534de 100644 --- a/nonebot/command/argfilter/__init__.py +++ b/nonebot/command/argfilter/__init__.py @@ -15,6 +15,21 @@ class ValidateError(ValueError): async def run_arg_filters(session: 'CommandSession', 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 for f in arg_filters: try: