Discord.py: Redesign HelpFormatter

Created on 27 Feb 2019  路  6Comments  路  Source: Rapptz/discord.py

The current design is intimidating for users and too complicated for most people. Reconsider a design that makes it better to use and properly implement all help command related things in the HelpFormatter (e.g. the i18n attributes and the help attributes dictionary)

A new design should have the following checklist.

  • [x] It implements the logic for the help command itself.
  • [x] allows usage of embeds
  • [x] is i18n friendly
  • [x] easily extensible
  • [x] can be disabled by passing formatter=None

    • this requires the use of a sentinel type as the default.

This is just an initial checklist. Feel free to use this issue as a wish list of what you want to happen.

RFC feature request v1.0-alpha

Most helpful comment

Maybe add emoji pagination functionality.
I know this is a thing that you can make yourself, however it would be nice to see this in the actual lib itself

All 6 comments

Maybe add emoji pagination functionality.
I know this is a thing that you can make yourself, however it would be nice to see this in the actual lib itself

Maybe add emoji pagination functionality.

I think this would be best as an opt-in in the ext directory rather than in HelpFormatter proper.

One of the issues I had with HelpFormatter was that most of the work is done by one long method, format. In order to customize the behavior, I had to copy and paste the default implementation of that entire method, rather than overriding a few methods. Additionally, I wanted to customize how subcommands were formatted, and that's controlled by _add_subcommands_to_page, which is marked private.

@bryanforbes I see your point

A few things I've run into when trying to format help for a couple of bots I've written:

  1. Command.signature returns a formatted string that HelpFormatter.get_command_signature(). That should probably be done in HelpFormatter so it can be overridden at the bot level.
  2. Breaking up HelpFormatter.format() into some override-able methods like:

    • format_bot_commands(commands: Iterable[Tuple[str, Command]]) -> None

    • format_command(command: Command) -> None

    • format_group(group: Group) -> None

  3. Add parameters for sorting commands so it doesn't have to be done in format(): HelpFormatter.filter_command_list(*, sorted: bool = False, key: Optional[Callable[..., bool]] = None).
  4. Add HelpFormatter.get_beginning_note() to compliment HelpFormatter.get_ending_note().

I would honestly hope that it would be made more self explanatory. Because "some functions" doesn't help, what functions? no documentation? no examples? I tried to work with it but gave up because of those questions. It basically was no easy way, you basically had to rewrite the whole full thing from what i could pick up.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mercurial picture Mercurial  路  22Comments

downloadpizza picture downloadpizza  路  14Comments

wolfclaws picture wolfclaws  路  17Comments

xomien picture xomien  路  17Comments

Chicchi73930 picture Chicchi73930  路  17Comments