Skip to content

Commit cd3b261

Browse files
style(pre-commit): auto fixes from pre-commit.com hooks
1 parent e7b8707 commit cd3b261

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

discord/ui/select.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,17 @@ def add_default_value(
447447
if self.type is ComponentType.user_select and not isinstance(
448448
default_value, (User, Member)
449449
):
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+
)
451453
elif self.type is ComponentType.user_select:
452454
default_value_type = SelectMenuDefaultValueType.User
453455
if self.type is ComponentType.role_select and not isinstance(
454456
default_value, Role
455457
):
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+
)
457461
elif self.type is ComponentType.role_select:
458462
default_value_type = SelectMenuDefaultValueType.Role
459463
if self.type is ComponentType.mentionable_select and not isinstance(

examples/views/channel_select.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ async def channel_select_default(ctx: discord.ApplicationContext) -> None:
4949
# Default values are set to the current channel.
5050
class DefaultValueSelect(discord.ui.View):
5151
@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,
5456
) # Users can select a maximum of 3 channels in the dropdown
5557
async def channel_select_dropdown_default(
56-
self, select: discord.ui.Select, interaction: discord.Interaction
58+
self, select: discord.ui.Select, interaction: discord.Interaction
5759
) -> None:
5860
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)
6163
)
6264

6365
# Create the view containing our dropdown

examples/views/role_select.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,17 @@ async def role_select_default(ctx: discord.ApplicationContext) -> None:
5555
# Default values are set to the first three user's roles.
5656
class DefaultDropdownView(discord.ui.View):
5757
@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,
6062
) # Users can select a maximum of 3 roles in the dropdown
6163
async def role_select_dropdown(
62-
self, select: discord.ui.Select, interaction: discord.Interaction
64+
self, select: discord.ui.Select, interaction: discord.Interaction
6365
) -> None:
6466
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)
6769
)
6870

6971
# Create the view containing our dropdown

0 commit comments

Comments
 (0)