(interaction, config, client)
| 154 | }, |
| 155 | |
| 156 | async execute(interaction, config, client) { |
| 157 | try { |
| 158 | if (!(await ensureManageGuild(interaction))) { |
| 159 | return; |
| 160 | } |
| 161 | |
| 162 | const subcommand = interaction.options.getSubcommand(); |
| 163 | |
| 164 | if (subcommand === 'dashboard') { |
| 165 | const deferred = await InteractionHelper.safeDefer(interaction, { flags: MessageFlags.Ephemeral }); |
| 166 | if (!deferred) { |
| 167 | return; |
| 168 | } |
| 169 | |
| 170 | const view = await buildDashboardView(client, interaction.guildId, interaction.guild, 'overview'); |
| 171 | await InteractionHelper.safeEditReply(interaction, { |
| 172 | embeds: [view.embed], |
| 173 | components: view.components, |
| 174 | }); |
| 175 | |
| 176 | const replyMessage = await interaction.fetchReply().catch(() => null); |
| 177 | if (!replyMessage) { |
| 178 | return; |
| 179 | } |
| 180 | |
| 181 | const collector = replyMessage.createMessageComponentCollector({ |
| 182 | filter: createDashboardCollectorFilter(interaction.user.id, interaction.guildId), |
| 183 | time: DASHBOARD_TIMEOUT_MS, |
| 184 | }); |
| 185 | |
| 186 | collector.on('collect', async (componentInteraction) => { |
| 187 | try { |
| 188 | if (!isCommandAccessCustomId(componentInteraction.customId)) { |
| 189 | return; |
| 190 | } |
| 191 | await handleDashboardComponent(componentInteraction, client); |
| 192 | } catch (error) { |
| 193 | logger.error('Command access dashboard interaction failed', { |
| 194 | error: error.message, |
| 195 | customId: componentInteraction.customId, |
| 196 | guildId: interaction.guildId, |
| 197 | }); |
| 198 | await replyUserError(componentInteraction, { |
| 199 | type: ErrorTypes.UNKNOWN, |
| 200 | message: error.message || 'Failed to update command access.', |
| 201 | }).catch(() => {}); |
| 202 | } |
| 203 | }); |
| 204 | |
| 205 | collector.on('end', async () => { |
| 206 | const finalView = await buildDashboardView(client, interaction.guildId, interaction.guild, 'overview'); |
| 207 | const disabledComponents = finalView.components.map((row) => { |
| 208 | const newRow = row.toJSON(); |
| 209 | newRow.components = newRow.components.map((component) => ({ ...component, disabled: true })); |
| 210 | return newRow; |
| 211 | }); |
| 212 | |
| 213 | await replyMessage.edit({ components: disabledComponents }).catch(() => {}); |
nothing calls this directly
no test coverage detected