File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,9 @@ def __init__(
219219 self ._before_hook : Callable [[Component_T , Context ], Coro ] | Callable [[Context ], Coro ] | None = None
220220 self ._after_hook : Callable [[Component_T , Context ], Coro ] | Callable [[Context ], Coro ] | None = None
221221
222+ self ._help : str = callback .__doc__ or ""
223+ self .__doc__ = self ._help
224+
222225 def __repr__ (self ) -> str :
223226 return f"Command(name={ self ._name } , parent={ self .parent } )"
224227
@@ -229,6 +232,16 @@ async def __call__(self, context: Context) -> Any:
229232 callback = self ._callback (self ._injected , context ) if self ._injected else self ._callback (context ) # type: ignore
230233 return await callback # type: ignore will fix later
231234
235+ @property
236+ def help (self ) -> str :
237+ """Property returning a :class:`str` which is the docstring associated with the command callback.
238+
239+ If no docstring is present on the callback of the command, an empty string will be returned instead.
240+
241+ .. versionadded:: 3.1
242+ """
243+ return self ._help
244+
232245 @property
233246 def component (self ) -> Component_T | None :
234247 """Property returning the :class:`~.commands.Component` associated with this command or
You can’t perform that action at this time.
0 commit comments