From c591c09f95e4f243b4e19c0bd8e407c552103034 Mon Sep 17 00:00:00 2001 From: "Karina J. Kwiatek" Date: Mon, 19 Aug 2024 12:05:28 +0200 Subject: [PATCH] Fix lint/type errors --- src/commands/passwd.py | 23 ++++++++++++----------- src/commands/team.py | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/commands/passwd.py b/src/commands/passwd.py index 5c097e5..27c79de 100644 --- a/src/commands/passwd.py +++ b/src/commands/passwd.py @@ -24,15 +24,16 @@ async def passwd( '\n'.join([f"**{team}:** {password}" for team, password in interaction.client.passwords.items()]), ephemeral=True, ) - if new_password is not None: - if not interaction.user.guild_permissions.administrator: - await interaction.response.send_message( - "You do not have permission to change team passwords.", - ephemeral=True - ) - return - interaction.client.set_password(tla, new_password) - await interaction.response.send_message(f"The password for {tla.upper()} has been changed.", ephemeral=True) else: - password = interaction.client.passwords[tla] - await interaction.response.send_message(f"The password for {tla.upper()} is `{password}`", ephemeral=True) + if new_password is not None: + if isinstance(interaction.user, discord.Member) and not interaction.user.guild_permissions.administrator: + await interaction.response.send_message( + "You do not have permission to change team passwords.", + ephemeral=True + ) + return + interaction.client.set_password(tla, new_password) + await interaction.response.send_message(f"The password for {tla.upper()} has been changed.", ephemeral=True) + else: + password = interaction.client.passwords[tla] + await interaction.response.send_message(f"The password for {tla.upper()} is `{password}`", ephemeral=True) diff --git a/src/commands/team.py b/src/commands/team.py index 70853f1..2029c1b 100644 --- a/src/commands/team.py +++ b/src/commands/team.py @@ -22,7 +22,7 @@ @app_commands.guild_only() @app_commands.default_permissions() class Team(app_commands.Group): - def __init__(self): + def __init__(self) -> None: super().__init__(description="Manage teams")