(interaction, config, client)
| 19 | category: "moderation", |
| 20 | |
| 21 | async execute(interaction, config, client) { |
| 22 | const deferSuccess = await InteractionHelper.safeDefer(interaction); |
| 23 | if (!deferSuccess) { |
| 24 | logger.warn(`Untimeout interaction defer failed`, { |
| 25 | userId: interaction.user.id, |
| 26 | guildId: interaction.guildId, |
| 27 | commandName: 'untimeout' |
| 28 | }); |
| 29 | return; |
| 30 | } |
| 31 | |
| 32 | try { |
| 33 | const targetUser = interaction.options.getUser("target"); |
| 34 | const member = interaction.options.getMember("target"); |
| 35 | |
| 36 | if (!targetUser) { |
| 37 | throw new TitanBotError( |
| 38 | 'Missing target user', |
| 39 | ErrorTypes.USER_INPUT, |
| 40 | 'You must specify a user to untimeout.', |
| 41 | { subtype: 'invalid_user' }, |
| 42 | ); |
| 43 | } |
| 44 | |
| 45 | if (!member) { |
| 46 | throw new TitanBotError( |
| 47 | "Target not found", |
| 48 | ErrorTypes.USER_INPUT, |
| 49 | "The target user is not currently in this server." |
| 50 | ); |
| 51 | } |
| 52 | |
| 53 | await ModerationService.removeTimeoutUser({ |
| 54 | guild: interaction.guild, |
| 55 | member, |
| 56 | moderator: interaction.member |
| 57 | }); |
| 58 | |
| 59 | await InteractionHelper.safeEditReply(interaction, { |
| 60 | embeds: [ |
| 61 | successEmbed( |
| 62 | `🔓 **Removed timeout** from ${targetUser.tag}`, |
| 63 | ), |
| 64 | ], |
| 65 | }); |
| 66 | } catch (error) { |
| 67 | logger.error('Untimeout command error:', error); |
| 68 | await handleInteractionError(interaction, error, { subtype: 'untimeout_failed' }); |
| 69 | } |
| 70 | } |
| 71 | }; |
nothing calls this directly
no test coverage detected