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

[Bug]: Command with Option optional parameter won't register correctly #217

Open
Rutherther opened this issue Jun 29, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Rutherther
Copy link
Contributor

Description

I've noticed an issue when I wanted to create a command that has a required parameter as well as Option parameter that is optional. Remora will put the optional parameter as a first one (I suspect this is because Remora.Commands just puts Option parameters as first for easier handling) and that creates a problem when registering it as a slash command.

Steps to Reproduce

A command such as this will fail to register

[Command("echo")]
[Description("Send a message")]
public Task<Result> HandleEchoAsync
(
    string message,
    [Option('c', "channel")] Snowflake? channel = null
);

Expected Behavior

Registers the slash command correctly.

Current Behavior

Puts the Option as first parameter and results in APPLICATION_COMMAND_OPTIONS_REQUIRED_INVALID Required options must be placed before non-required options error.

Library / Runtime Information

Remora.Command v10.0.1, Remora.Discord.Commands v25.1.0
.NET 6

@Rutherther Rutherther added the bug Something isn't working label Jun 29, 2022
@Nihlus Nihlus closed this as completed in b53d679 Jun 30, 2022
@Nihlus Nihlus reopened this Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants