Remora.Discord icon indicating copy to clipboard operation
Remora.Discord copied to clipboard

Fix validation for MinValue and MaxValue attributes

Open murl-digital opened this issue 3 years ago • 3 comments

closes #234

Added some tests and fixed the bug I found. While working on this I also noticed that the min and max value attributes can't be applied to integers, should this be changed?

murl-digital avatar Sep 17 '22 14:09 murl-digital

Can you elaborate more on "min and max value attributes can't be applied to integers" please

MazeXP avatar Sep 17 '22 19:09 MazeXP

Can you elaborate more on "min and max value attributes can't be applied to integers" please

I could just be completely missing something, but it seems like the attributes only take ulongs, longs, floats, or doubles as parameters. It took me until right about now that that probably doesn't matter since that's seperate to how parameters are parsed for commands.

murl-digital avatar Sep 17 '22 19:09 murl-digital

Technically it does support integers as well, as its value will be implicitly casted to long or ulong. Same would also count for float and double.

Maybe @Nihlus could elaborate why the attribute uses the types in the OneOf. Related line: https://github.com/Remora/Remora.Discord/blob/main/Remora.Discord.Commands/Attributes/MinValueAttribute.cs#L39

MazeXP avatar Sep 17 '22 20:09 MazeXP