From a67fa5107c3ba9ab104b29d94cdf9546dcaf5033 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Sat, 11 Apr 2020 22:53:30 +0800 Subject: [PATCH] fix docstring missing for command handler --- nonebot/command/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nonebot/command/__init__.py b/nonebot/command/__init__.py index 013919a3..d8248790 100644 --- a/nonebot/command/__init__.py +++ b/nonebot/command/__init__.py @@ -3,7 +3,7 @@ import shlex import asyncio import warnings from datetime import datetime -from functools import partial +from functools import partial, update_wrapper from typing import (Tuple, Union, Callable, Iterable, Any, Optional, List, Dict, Awaitable) @@ -27,7 +27,8 @@ CommandHandler_T = Callable[['CommandSession'], Any] class Command: __slots__ = ('name', 'func', 'permission', 'only_to_me', 'privileged', - 'args_parser_func') + 'args_parser_func', '__name__', '__qualname__', '__doc__', + '__annotations__', '__dict__') def __init__(self, *, name: CommandName_T, func: CommandHandler_T, permission: int, only_to_me: bool, privileged: bool): @@ -402,6 +403,8 @@ def on_command(name: Union[str, CommandName_T], CommandManager.add_command(cmd_name, cmd) CommandManager.add_aliases(aliases, cmd) + update_wrapper(wrapper=cmd, wrapped=func) # type: ignore + return cmd return deco