(interaction, config, client)
| 73 | category: "utility", |
| 74 | |
| 75 | async execute(interaction, config, client) { |
| 76 | try { |
| 77 | |
| 78 | if (!hasManageGuildPermission(interaction.member)) { |
| 79 | throw new TitanBotError( |
| 80 | 'User lacks ManageGuild permission', |
| 81 | ErrorTypes.PERMISSION, |
| 82 | 'You need **Manage Server** permission to use this command.' |
| 83 | ); |
| 84 | } |
| 85 | |
| 86 | const subcommand = interaction.options.getSubcommand(); |
| 87 | await InteractionHelper.safeDefer(interaction, { flags: MessageFlags.Ephemeral }); |
| 88 | |
| 89 | let responseEmbed; |
| 90 | |
| 91 | if (subcommand === "setup") { |
| 92 | await handleSetupSubcommand(interaction, client); |
| 93 | return; |
| 94 | } else if (subcommand === "dashboard") { |
| 95 | await handleConfigSubcommand(interaction, client); |
| 96 | return; |
| 97 | } |
| 98 | |
| 99 | } catch (error) { |
| 100 | try { |
| 101 | let errorMessage = 'An error occurred while executing this command.'; |
| 102 | |
| 103 | if (error instanceof TitanBotError) { |
| 104 | errorMessage = error.userMessage || 'An error occurred. Please try again.'; |
| 105 | logger.debug(`TitanBotError [${error.type}]: ${error.message}`, error.context || {}); |
| 106 | } else { |
| 107 | logger.error('Unexpected error in jointocreate command:', error); |
| 108 | errorMessage = 'An unexpected error occurred. Please try again or contact support.'; |
| 109 | } |
| 110 | |
| 111 | return replyUserError(interaction, { type: ErrorTypes.UNKNOWN, message: errorMessage }); |
| 112 | } catch (replyError) { |
| 113 | logger.error('Failed to send error message:', replyError); |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | }; |
| 118 | |
| 119 | async function handleSetupSubcommand(interaction, client) { |
nothing calls this directly
no test coverage detected