(interaction, client, args)
| 17 | name: 'ticket_feedback', |
| 18 | |
| 19 | async execute(interaction, client, args) { |
| 20 | |
| 21 | const [guildId, channelId, ratingStr] = args; |
| 22 | |
| 23 | if (!guildId || !channelId || !ratingStr) { |
| 24 | await InteractionHelper.safeReply(interaction, { |
| 25 | embeds: [ |
| 26 | new EmbedBuilder() |
| 27 | .setTitle('⚠️ Invalid Feedback Link') |
| 28 | .setDescription('This feedback link appears to be malformed.') |
| 29 | .setColor(getColor('error')), |
| 30 | ], |
| 31 | components: [], |
| 32 | }); |
| 33 | return; |
| 34 | } |
| 35 | |
| 36 | try { |
| 37 | await interaction.deferUpdate(); |
| 38 | } catch (err) { |
| 39 | logger.warn('ticketFeedback: interaction expired before deferUpdate', { guildId, channelId, error: err.message }); |
| 40 | return; |
| 41 | } |
| 42 | |
| 43 | let ticketData; |
| 44 | try { |
| 45 | ticketData = await getTicketData(guildId, channelId); |
| 46 | } catch (err) { |
| 47 | logger.warn('ticketFeedback: failed to load ticket data', { guildId, channelId, error: err.message }); |
| 48 | } |
| 49 | |
| 50 | if (!ticketData) { |
| 51 | await InteractionHelper.safeEditReply(interaction, { |
| 52 | embeds: [ |
| 53 | new EmbedBuilder() |
| 54 | .setTitle('⚠️ Ticket Not Found') |
| 55 | .setDescription('Could not find the ticket associated with this survey.') |
| 56 | .setColor(getColor('error')), |
| 57 | ], |
| 58 | components: [], |
| 59 | }); |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | if (interaction.user.id !== ticketData.userId) { |
| 64 | await InteractionHelper.safeEditReply(interaction, { |
| 65 | embeds: [ |
| 66 | new EmbedBuilder() |
| 67 | .setTitle('❌ Not Allowed') |
| 68 | .setDescription('Only the ticket creator can submit feedback for this ticket.') |
| 69 | .setColor(getColor('error')), |
| 70 | ], |
| 71 | components: [], |
| 72 | }); |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | if (ticketData.feedback?.rating) { |
nothing calls this directly
no test coverage detected