Skip to content

Commit

Permalink
Merge pull request #3 from hwsuk/feature/role-update
Browse files Browse the repository at this point in the history
add failsafe for if user is not verified
  • Loading branch information
emberdex authored Oct 10, 2023
2 parents 43012a9 + 615a6f3 commit 1b442d7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion harmony_cogs/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1b442d7

Please sign in to comment.