Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] [commands] custom default arguments #1849

Closed
wants to merge 4 commits into from

Commits on Apr 19, 2021

  1. [commands] custom default arguments

    Modeled slightly after Converters, allow specifying Converter-like class
    for context-based default parameters. e.g.
    
    ```py
    class Author(CustomDefault):
      async def default(self, ctx):
        return ctx.author
    
    async def my_command(ctx, user: discord.Member=Author):
      ...
    ```
    
    Also adds a few common cases (Author, Channel, Guild) for current
    author, ...
    khazhyk committed Apr 19, 2021
    Configuration menu
    Copy the full SHA
    5db770b View commit details
    Browse the repository at this point in the history
  2. [commands] add default __repr__ for CustomDefault

    With this change CustomDefaults display nicer in help commands and
    in command.signature
    thecaralice authored and khazhyk committed Apr 19, 2021
    Configuration menu
    Copy the full SHA
    fec34e0 View commit details
    Browse the repository at this point in the history
  3. [commands] add CustomDefault.converters to allow implicit conversions

    [khazhyk: rebased on latest and resolved conflicts in _get_converter]
    sgtlaggy authored and khazhyk committed Apr 19, 2021
    Configuration menu
    Copy the full SHA
    1fe24c9 View commit details
    Browse the repository at this point in the history
  4. [commands] handle CustomDefault in Greedy converter

    [khazhyk: removed list handling, adjusted message]
    sairam4123 authored and khazhyk committed Apr 19, 2021
    Configuration menu
    Copy the full SHA
    40c234c View commit details
    Browse the repository at this point in the history