(interaction, config, client)
| 24 | category: "moderation", |
| 25 | |
| 26 | async execute(interaction, config, client) { |
| 27 | const deferSuccess = await InteractionHelper.safeDefer(interaction); |
| 28 | if (!deferSuccess) { |
| 29 | logger.warn(`Unban interaction defer failed`, { |
| 30 | userId: interaction.user.id, |
| 31 | guildId: interaction.guildId, |
| 32 | commandName: 'unban' |
| 33 | }); |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | try { |
| 38 | const targetUser = interaction.options.getUser("target"); |
| 39 | const reason = interaction.options.getString("reason") || "No reason provided"; |
| 40 | |
| 41 | const result = await ModerationService.unbanUser({ |
| 42 | guild: interaction.guild, |
| 43 | user: targetUser, |
| 44 | moderator: interaction.member, |
| 45 | reason |
| 46 | }); |
| 47 | |
| 48 | await InteractionHelper.safeEditReply(interaction, { |
| 49 | embeds: [ |
| 50 | successEmbed( |
| 51 | "✅ User Unbanned", |
| 52 | `Successfully unbanned **${targetUser.tag}** from the server.\n\n**Reason:** ${reason}\n**Case ID:** #${result.caseId}` |
| 53 | ) |
| 54 | ] |
| 55 | }); |
| 56 | } catch (error) { |
| 57 | logger.error('Unban command error:', error); |
| 58 | await handleInteractionError(interaction, error, { subtype: 'unban_failed' }); |
| 59 | } |
| 60 | } |
| 61 | }; |
nothing calls this directly
no test coverage detected