diff options
| author | Michael Van Buren <[email protected]> | 2017-02-08 20:54:28 -0800 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-02-10 03:35:25 -0500 |
| commit | 84dfd7b3e3dd8c7dcca3160be03214db1d05076f (patch) | |
| tree | 106b4f5a2357178514cd21ed01119755988ed02a | |
| parent | Fix Member.display_name to work. (diff) | |
| download | discord.py-84dfd7b3e3dd8c7dcca3160be03214db1d05076f.tar.xz discord.py-84dfd7b3e3dd8c7dcca3160be03214db1d05076f.zip | |
[commands] Add Command.usage argument to override argument display.
| -rw-r--r-- | discord/ext/commands/core.py | 3 | ||||
| -rw-r--r-- | discord/ext/commands/formatter.py | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 79dc1093..29ebd9d8 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -93,6 +93,8 @@ class Command: brief : str The short help text for the command. If this is not specified then the first line of the long help text is used instead. + usage : str + A replacement for arguments in the default help text. aliases : list The list of aliases the command can be invoked under. pass_context : bool @@ -145,6 +147,7 @@ class Command: self.enabled = kwargs.get('enabled', True) self.help = kwargs.get('help') self.brief = kwargs.get('brief') + self.usage = kwargs.get('usage') self.rest_is_raw = kwargs.get('rest_is_raw', False) self.aliases = kwargs.get('aliases', []) self.pass_context = kwargs.get('pass_context', True) diff --git a/discord/ext/commands/formatter.py b/discord/ext/commands/formatter.py index fb883d33..5fb51cfe 100644 --- a/discord/ext/commands/formatter.py +++ b/discord/ext/commands/formatter.py @@ -203,7 +203,9 @@ class HelpFormatter: result.append(name) params = cmd.clean_params - if len(params) > 0: + if cmd.usage: + result.append(cmd.usage) + elif len(params) > 0: for name, param in params.items(): if param.default is not param.empty: # We don't want None or '' to trigger the [name=value] case and instead it should |