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

[Commands] Having multiple optional command parameters that some are left blank causes them to move forward #1843

Closed
BlackLotusLV opened this issue Apr 13, 2024 · 0 comments · Fixed by #1897
Labels
bug commands For issues related to DSharpPlus.Commands
Milestone

Comments

@BlackLotusLV
Copy link

Summary

This issue was reported before, could not be reproduced and closed, and given that it is poorly worded and with some testing i found it goes a bit more deeper than original issue post. In short new report, and it's still a thing.
Og report: #1795

The Issue. If you have multiple optional parameters, example public async Task ExecuteAsync(CommandContext, string a ="", string b = "") and you leave the first option blank, it moves the second one as the first one.

What version of the library are you using?

v5.0.0-nightly (make sure you are using the latest nightly!)

What .NET version are you using? Make sure to use the latest patch release for your major version.

.NET 8.0

Operating System

win11

Reproduction Steps

Have these commands. These commands are created with AddCommands(assembly)

    public async Task ExecuteAsync(CommandContext ctx, string option1 = "", string option2 = "")
    {
        await ctx.RespondAsync($"This is string 1: `{option1}`\nThis is string 2: {option2}");
    }
    [Command("testOptionalMix")]
    public async Task ExecuteAsync(CommandContext ctx, int option1 = 0, string option2 = "")
    {
        await ctx.RespondAsync($"This is string 1: `{option1}`\nThis is string 2: {option2}");
    }

Calling testOptional in discord slash commands with option1 blank and option2 with "test" will actually set option1 as "test"
Calling testOptionalMix in discord slash commands with option1 blank and option2 with "test" will result a Failed to parse argument 'option1'

Here is a demonstration gif:
DiscordPTB_mZhYugpNRm

This is on the latest nightly(02204).

Trace Logs

No response

Exceptions or other error messages

No response

Anything else you'd like to share

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commands For issues related to DSharpPlus.Commands
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants