Skip to content

Commit

Permalink
Print informative errors in discord if perm issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ankith26 committed Aug 30, 2024
1 parent 7499e04 commit 2ec4202
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions bot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,21 @@ async def post_verification(
await ctx.guild.leave()
return

await assign_role(member, server_config)
await delete_role(member, server_config)
try:
await assign_role(member, server_config)
await delete_role(member, server_config)
except discord.DiscordException:
await ctx.reply(
"Failed to assign or delete roles. "
"The server admin(s) should set up the right permissions for the bot"
)

try:
await set_nickname(member, server_config)
except discord.DiscordException:
await ctx.reply(
"Bot should have a role higher than you to change your nickname",
ephemeral=True,
"Failed to set nickname. "
"The server admin(s) should set up the right permissions for the bot."
)

await ctx.reply(f"{member.mention} has been CAS-verified on this server!")
Expand Down

0 comments on commit 2ec4202

Please sign in to comment.