File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -497,15 +497,17 @@ def __init__(
497
497
self .name : Optional [str ] = kwargs .pop ("name" , None )
498
498
self .description = description or "No description provided"
499
499
500
- self .channel_types = []
500
+ self .channel_types : List [ ChannelType ] = kwargs . pop ( "channel_types" , [])
501
501
if not isinstance (input_type , OptionType ):
502
502
self .input_type = OptionType .from_datatype (input_type )
503
503
if self .input_type == OptionType .channel :
504
- input_type = (input_type ,) if not isinstance (input_type , tuple ) else input_type
504
+ if not isinstance (input_type , tuple ):
505
+ input_type = (input_type ,)
505
506
for i in input_type :
506
507
if i .__name__ == 'GuildChannel' :
507
508
continue
508
- channel_type = channel_type_map [i .__name__ ].value
509
+
510
+ channel_type = channel_type_map [i .__name__ ]
509
511
self .channel_types .append (channel_type )
510
512
else :
511
513
self .input_type = input_type
@@ -526,7 +528,7 @@ def to_dict(self) -> Dict:
526
528
"choices" : [c .to_dict () for c in self .choices ],
527
529
}
528
530
if self .channel_types :
529
- as_dict ["channel_types" ] = self .channel_types
531
+ as_dict ["channel_types" ] = [ t . value for t in self .channel_types ]
530
532
531
533
return as_dict
532
534
Original file line number Diff line number Diff line change @@ -611,7 +611,7 @@ def from_datatype(cls, datatype):
611
611
return cls .mentionable
612
612
else :
613
613
raise TypeError ('Invalid usage of typing.Union' )
614
-
614
+
615
615
if issubclass (datatype , str ):
616
616
return cls .string
617
617
if issubclass (datatype , bool ):
You can’t perform that action at this time.
0 commit comments