Dave
Dave

Reputation: 269

JDA List/Collection of SelectOption

I cant create a List or a Collection of SelectOptions in JDA. I tried it like that:

List<SelectOption> li = new ArrayList<>();
    li.add(new SelectOption("", ""));

The error message tells me this:

'SelectOption(java.lang.String, java.lang.String)' has protected access in 'net.dv8tion.jda.api.interactions.components.selections.SelectOption'

I dont know what does this mean and how i fix that.

Upvotes: 0

Views: 365

Answers (1)

Minn
Minn

Reputation: 6131

Use the factory method SelectOption.of:

SelectOption.of("What the user sees", "id used in event")
  .withDescription("Some description to show below the label")

Upvotes: 1

Related Questions