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]: Autocomplete doesn't respect [Option] name #299

Open
VelvetToroyashi opened this issue Apr 14, 2023 · 0 comments
Open

[Bug]: Autocomplete doesn't respect [Option] name #299

VelvetToroyashi opened this issue Apr 14, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@VelvetToroyashi
Copy link
Contributor

Description

When using an autocomplete provider, it's reasonable to assume that if the parameter is marked with the [Option] attribute, that name is given precedence over the parameter's name (which actually won't work when Remora/Remora.Commands#20 gets merged)

Steps to Reproduce

public class ReproCommand : CommandGroup
{
  [Command("autocomplete")]
  public async Task<Result> AutoCompleteAsync([Option("mismatched")] string parameter) => Result.FromSuccess();
}

Expected Behavior

Autocomplete uses the hint name of the parameter, allowing parameter name to be mismatched from the presented option

Current Behavior

The LINQ query throws, because Remora assumes the command parameter name matches what Discord returns in the focused option.

https://github.com/Remora/Remora.Discord/blob/3818e52/Remora.Discord.Commands/Responders/AutocompleteResponder.cs#L122-L125

Library / Runtime Information

C# 11, .NET 7.0.2, Remora.Discord.Commands 26.2.3

@VelvetToroyashi VelvetToroyashi added the bug Something isn't working label Apr 14, 2023
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

1 participant