JDA icon indicating copy to clipboard operation
JDA copied to clipboard

add support for string option bounds

Open sebm253 opened this issue 3 years ago • 5 comments

Pull Request Etiquette

Changes

  • [ ] Internal code
  • [x] Library interface (affecting end-user code)
  • [ ] Documentation
  • [ ] Other: _____

Closes Issue: NaN

Description

this PR adds support for setting the minimum and maximum length for STRING options: https://github.com/discord/discord-api-docs/pull/5143

it's been a while since I touched JDA/Java so there may be things I forgot to add/change.

sebm253 avatar Jul 02 '22 09:07 sebm253

Could we allow to use setRequiredRange for these as well?

https://github.com/DV8FromTheWorld/JDA/blob/master/src/main/java/net/dv8tion/jda/api/interactions/commands/build/OptionData.java#L559

MinnDevelopment avatar Jul 02 '22 10:07 MinnDevelopment

Could we allow to use setRequiredRange for these as well?

master/src/main/java/net/dv8tion/jda/api/interactions/commands/build/OptionData.java#L559

something like OptionData#setRequiredLengthRange?

sebm253 avatar Jul 02 '22 10:07 sebm253

something like OptionData#setRequiredLengthRange?

no, just the same method with a conditional check for type.

MinnDevelopment avatar Jul 02 '22 10:07 MinnDevelopment

something like OptionData#setRequiredLengthRange?

no, just the same method with a conditional check for type.

I feel like that could be a bit confusing. introducing a new method would get rid of having to explain 2 behaviors of that method in the docs + long -> int conversions. making an overload which'd accept ints instead would probably confuse/annoy users as well - if they wanted to set the range for an integer option, they'd have to use Longs specifically otherwise it'd clash with the ints overload and throw, or am I misunderstanding here?

sebm253 avatar Jul 02 '22 10:07 sebm253

I feel like that could be a bit confusing

I think it's more confusing for it not to work, which is why I'm suggesting it.

making an overload which'd accept ints instead

I don't think we need one?

MinnDevelopment avatar Jul 02 '22 10:07 MinnDevelopment