From 615a6f34f6cde0f0dec1f7f70b6c867204a8311d Mon Sep 17 00:00:00 2001 From: Toby Jones Date: Tue, 10 Oct 2023 22:04:57 +0100 Subject: [PATCH] add failsafe for if user is not verified --- harmony_cogs/verify.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/harmony_cogs/verify.py b/harmony_cogs/verify.py index 86e9e4a..53bcca5 100644 --- a/harmony_cogs/verify.py +++ b/harmony_cogs/verify.py @@ -342,7 +342,19 @@ async def whois_user(self, interaction: discord.Interaction, member: discord.Mem @app_commands.checks.has_role(config["discord"]["harmony_management_role_id"]) async def update_role(self, interaction: discord.Interaction, member: discord.Member): - await interaction.response.send_message("Please select the new role:", view=UpdateRoleView(target_member=member), ephemeral=True) + verification_data = harmony_db.get_verification_data(member.id) + + if not verification_data: + await interaction.response.send_message( + f"**{member.name}** hasn't verified themselves, so their flair can't be updated. " + "(I don't know their Reddit username 🙃)", ephemeral=True + ) + else: + await interaction.response.send_message( + "## Please select the new role:", + view=UpdateRoleView(target_member=member), + ephemeral=True + ) async def handle_error(interaction: discord.Interaction, error: Exception) -> None: