Add error handlign to the /vc command
All checks were successful
Build and push / changes (push) Successful in 4s
Build and push / Lint-Python (push) Successful in 2s
Build and push / Build-and-Push-Docker (push) Successful in 1m1s
Build and push / sync-argocd-app (push) Successful in 3s
Build and push / post-failure-to-discord (push) Has been skipped
Build and push / post-success-to-discord (push) Successful in 2s

This commit is contained in:
Luke R 2025-04-30 14:28:10 -07:00
parent 65028b70d5
commit fcc7bbd605

View File

@ -229,7 +229,10 @@ class ServerUtils(commands.Cog):
# Check that the role/channel doesnt already exist
# returns either a string or None, so we'll proceed on the None condition
if discord.utils.find(lambda r: r.name == channel_role_name, ctx.guild.roles):
await ctx.send(f":x: A role named `{channel_role_name}` already exists :x:")
await ctx.respond(
f":x: A role named `{channel_role_name}` already exists :x:",
delete_after=3,
)
return
# Create a role and assign it a random color
@ -258,11 +261,10 @@ class ServerUtils(commands.Cog):
)
await ctx.respond(
":white_check_mark: Created a role + voice channel for %s"
% role.mention
f":white_check_mark: Created a role + voice channel for {role.mention} :white_check_mark:"
)
except Exception as e:
await ctx.respond(":x: Error: %s :x:" % e)
await ctx.respond(f":x: Error: {e} :x:")
@commands.slash_command(
guild_ids=None, name="topic", description="Change the channel's topic"