Discord-Net-Labs / Discord.Net-Labs

An experimental fork of Discord.Net that implements the newest discord features for testing and development to eventually get merged into Discord.Net
https://labs.discordnet.dev
MIT License
156 stars 42 forks source link

ComponentBuilder uses LessThan instead of AtMost for checking option count #281

Closed Z3RYX closed 2 years ago

Z3RYX commented 2 years ago

The component builder uses Preconditions.LessThan to check if you suppied a valid amount of options, but that fails when you give exactly 25 options (since 25 < 25 is false).

Therefore it should be changed to Preconditions.AtMost since you can have at most 25 options, not less than 25 options.

I also want to mention that I found a faulty LessThan usage in the REST client upon creating a channel where it checks if the channel name is less than 100 characters, but in this case it should also be AtMost.

Z3RYX commented 2 years ago

I'll consider this issue partially fixed, since I also mentioned that https://github.com/Discord-Net-Labs/Discord.Net-Labs/blob/release/3.x/src/Discord.Net.Rest/DiscordRestApiClient.cs#L342 needs to be fixed, unless you want a new issue for that specifically

Edit: Seems to happen multiple times within the REST API client, not just on the line I mentioned