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__(
219
219
self ._before_hook : Callable [[Component_T , Context ], Coro ] | Callable [[Context ], Coro ] | None = None
220
220
self ._after_hook : Callable [[Component_T , Context ], Coro ] | Callable [[Context ], Coro ] | None = None
221
221
222
+ self ._help : str = callback .__doc__ or ""
223
+ self .__doc__ = self ._help
224
+
222
225
def __repr__ (self ) -> str :
223
226
return f"Command(name={ self ._name } , parent={ self .parent } )"
224
227
@@ -229,6 +232,16 @@ async def __call__(self, context: Context) -> Any:
229
232
callback = self ._callback (self ._injected , context ) if self ._injected else self ._callback (context ) # type: ignore
230
233
return await callback # type: ignore will fix later
231
234
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
+
232
245
@property
233
246
def component (self ) -> Component_T | None :
234
247
"""Property returning the :class:`~.commands.Component` associated with this command or
You can’t perform that action at this time.
0 commit comments