File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -528,6 +528,11 @@ def __init__(
528
528
for o in kwargs .pop ("choices" , list ())
529
529
]
530
530
self .default = kwargs .pop ("default" , None )
531
+ self .min_value : Optional [Union [int , float ]] = kwargs .pop ("min_value" )
532
+ self .max_value : Optional [Union [int , float ]] = kwargs .pop ("max_value" )
533
+
534
+ if any ([self .max_value , self .min_value ]) and not self .input_type in {SlashCommandOptionType .integer , SlashCommandOptionType .number }:
535
+ raise TypeError ('min_value and max_value can only be set on options with of type integer or number.' )
531
536
532
537
def to_dict (self ) -> Dict :
533
538
as_dict = {
@@ -539,6 +544,10 @@ def to_dict(self) -> Dict:
539
544
}
540
545
if self .channel_types :
541
546
as_dict ["channel_types" ] = [t .value for t in self .channel_types ]
547
+ if self .min_value :
548
+ as_dict ["min_value" ] = self .min_value
549
+ if self .max_value :
550
+ as_dict ["max_value" ] = self .max_value
542
551
543
552
return as_dict
544
553
You can’t perform that action at this time.
0 commit comments