Skip to content

Commit

Permalink
add try catch for roles
Browse files Browse the repository at this point in the history
  • Loading branch information
Techbot121 authored and Meta Construct committed Nov 8, 2024
1 parent 7f43a57 commit ef3c46c
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions app/services/discord/modules/commands/Role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,24 +313,31 @@ export const SlashRoleCommand: SlashCommand = {
execute: async ctx => {
await ctx.deferReply({ ephemeral: true });
const cmd = ctx.options.getSubcommand();
switch (cmd) {
case "add":
case "add_rgb":
case "add_hex":
await addRole(ctx);
break;
case "add_emoji":
await addRoleIcon(ctx, false);
break;
case "add_icon":
await addRoleIcon(ctx, true);
break;
case "remove":
await removeRole(ctx);
break;
case "remove_icon":
await removeRoleIcon(ctx);
break;
try {
switch (cmd) {
case "add":
case "add_rgb":
case "add_hex":
await addRole(ctx);
break;
case "add_emoji":
await addRoleIcon(ctx, false);
break;
case "add_icon":
await addRoleIcon(ctx, true);
break;
case "remove":
await removeRole(ctx);
break;
case "remove_icon":
await removeRoleIcon(ctx);
break;
}
} catch (err) {
console.error(err);
await ctx.followUp(
EphemeralResponse(`Something went wrong adding your role :(\n` + err)
);
}
},
initialize: async bot => {
Expand Down

0 comments on commit ef3c46c

Please sign in to comment.