File tree Expand file tree Collapse file tree 3 files changed +20
-12
lines changed Expand file tree Collapse file tree 3 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -447,13 +447,17 @@ def add_default_value(
447
447
if self .type is ComponentType .user_select and not isinstance (
448
448
default_value , (User , Member )
449
449
):
450
- raise InvalidArgument ("Default values have to be of type User or Member with type ComponentType.user_select" )
450
+ raise InvalidArgument (
451
+ "Default values have to be of type User or Member with type ComponentType.user_select"
452
+ )
451
453
elif self .type is ComponentType .user_select :
452
454
default_value_type = SelectMenuDefaultValueType .User
453
455
if self .type is ComponentType .role_select and not isinstance (
454
456
default_value , Role
455
457
):
456
- raise InvalidArgument ("Default values have to be of type Role with type ComponentType.role_select" )
458
+ raise InvalidArgument (
459
+ "Default values have to be of type Role with type ComponentType.role_select"
460
+ )
457
461
elif self .type is ComponentType .role_select :
458
462
default_value_type = SelectMenuDefaultValueType .Role
459
463
if self .type is ComponentType .mentionable_select and not isinstance (
Original file line number Diff line number Diff line change @@ -49,15 +49,17 @@ async def channel_select_default(ctx: discord.ApplicationContext) -> None:
49
49
# Default values are set to the current channel.
50
50
class DefaultValueSelect (discord .ui .View ):
51
51
@discord .ui .channel_select (
52
- placeholder = "Select channels..." , min_values = 1 , max_values = 3 ,
53
- default_values = default_values
52
+ placeholder = "Select channels..." ,
53
+ min_values = 1 ,
54
+ max_values = 3 ,
55
+ default_values = default_values ,
54
56
) # Users can select a maximum of 3 channels in the dropdown
55
57
async def channel_select_dropdown_default (
56
- self , select : discord .ui .Select , interaction : discord .Interaction
58
+ self , select : discord .ui .Select , interaction : discord .Interaction
57
59
) -> None :
58
60
await interaction .response .send_message (
59
- f"You selected the following channels:"
60
- + f", " .join (f"{ channel .mention } " for channel in select .values )
61
+ f"You selected the following channels:"
62
+ + f", " .join (f"{ channel .mention } " for channel in select .values )
61
63
)
62
64
63
65
# Create the view containing our dropdown
Original file line number Diff line number Diff line change @@ -55,15 +55,17 @@ async def role_select_default(ctx: discord.ApplicationContext) -> None:
55
55
# Default values are set to the first three user's roles.
56
56
class DefaultDropdownView (discord .ui .View ):
57
57
@discord .ui .role_select (
58
- placeholder = "Select roles..." , min_values = 1 , max_values = 3 ,
59
- default_values = default_values
58
+ placeholder = "Select roles..." ,
59
+ min_values = 1 ,
60
+ max_values = 3 ,
61
+ default_values = default_values ,
60
62
) # Users can select a maximum of 3 roles in the dropdown
61
63
async def role_select_dropdown (
62
- self , select : discord .ui .Select , interaction : discord .Interaction
64
+ self , select : discord .ui .Select , interaction : discord .Interaction
63
65
) -> None :
64
66
await interaction .response .send_message (
65
- f"You selected the following roles:"
66
- + f", " .join (f"{ role .mention } " for role in select .values )
67
+ f"You selected the following roles:"
68
+ + f", " .join (f"{ role .mention } " for role in select .values )
67
69
)
68
70
69
71
# Create the view containing our dropdown
You can’t perform that action at this time.
0 commit comments