Skip to content

Conversation

@sgtlaggy
Copy link

@sgtlaggy sgtlaggy commented May 3, 2019

Summary

Quick enhancement. This basically moves annotations from arguments to the CustomDefault class. This adds consistency with arg=True where it'll implicitly use the bool converter. The converters attribute will be ignored in the case annotations are provided in the command signature, as with the bool example.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

khazhyk and others added 2 commits April 28, 2019 12:21
Modeled slightly after Converters, allow specifying Converter-like class
for context-based default parameters. e.g.

```py
class Author(ParamDefault):
  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 khazhyk force-pushed the rfc-param-default branch from b113c8c to 48f9c91 Compare May 8, 2019 03:41
@khazhyk khazhyk force-pushed the rfc-param-default branch 3 times, most recently from 5c73c53 to e62b715 Compare May 19, 2019 23:43
@khazhyk khazhyk force-pushed the rfc-param-default branch 2 times, most recently from d774448 to a266a02 Compare June 24, 2019 01:11
@khazhyk
Copy link
Owner

khazhyk commented Apr 19, 2021

oh I like this, neat

@khazhyk khazhyk force-pushed the rfc-param-default branch 2 times, most recently from 9677dcb to 40c234c Compare April 19, 2021 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants