Skip to content

Make ParameterChoice constructor public#3169

Merged
Misha-133 merged 1 commit into
discord-net:devfrom
LXGaming:feat/public-parameter-choice
Jul 28, 2025
Merged

Make ParameterChoice constructor public#3169
Misha-133 merged 1 commit into
discord-net:devfrom
LXGaming:feat/public-parameter-choice

Conversation

@LXGaming

Copy link
Copy Markdown
Contributor

Description

This PR changes the ParameterChoice constructor from internal to public, this is necessary so that a ParameterChoice can be manually constructed for SlashCommandParameterBuilder.WithChoices.

Changes

  • Changed constructor visibility from internal to public.
  • Documented the constructor.

Related Issues

@Misha-133

Copy link
Copy Markdown
Member

Hey!
That's an internal type for the Discord.Interactions builders. Those serve a different purpose compared to ones from the Discord namespace. You are likely confusing them together

@LXGaming

Copy link
Copy Markdown
Contributor Author

I'm attempting to use the builders to manually construct interactions.

await InteractionService.CreateModuleAsync("Example", null, moduleBuilder => {
    moduleBuilder.AddSlashCommand(slashCommandBuilder => {
        slashCommandBuilder.AddParameter(slashCommandParameterBuilder => {
            slashCommandParameterBuilder.WithChoices(new ParameterChoice("Hello", "World?")); // Impossible due to internal constructor.
        });
    });
});

@Misha-133 Misha-133 merged commit 9cb6ffd into discord-net:dev Jul 28, 2025
2 checks passed
@LXGaming LXGaming deleted the feat/public-parameter-choice branch July 28, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants