sapphiredev/framework

Parse interaction options with sapphire resolvers

noftaly opened this issue · 3 comments

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

Maybe we should add a way to parse interaction options with sapphire resolvers?

Because there aren't many Discord's default types, so maybe Sapphire can offer a better api than manually importing resolvers...

Desired solution

const args = this.parseOptions(interaction); // Method in the core SapphireCommand class
args.get('option-name', 'date');
args.get('option-name2', 'hyperlink');
args.get('option-name3'); // Resolve with the discord's type entered in the option array.
// and so on

Alternatives considered

Using resolvers imported manually. It would work, but adding syntactic sugar: that's what a framework is for :)

Additional context

Vladdy told me on discord this was considered, but needs a refactor of the Arguments class to make it more abstract, so I thought I'd put it there as a reminder.

I'm willing to work on this if needed.

favna commented

Resolvers to be fully compatible with interactions is just one of many things that still needs doing before release yeah.

favna commented

This will be split in 2 parts. In v3 of the framework you will be able to directly call the various resolvers and pass interactions into them, i.e. for resolveMessage this is relevant. In v4 we will have Args support for interactions.

favna commented

This particular issue will be closed as part of v3, and the Args support has been moved to #494