MCPcopy
hub / github.com/codebymitch/TitanBot / execute

Function execute

src/interactions/selectMenus/ticketFeedback.js:18–125  ·  view source on GitHub ↗
(interaction, client, args)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

getColorFunction · 0.90
getTicketDataFunction · 0.90
saveTicketDataFunction · 0.90
logTicketFeedbackFunction · 0.90

Tested by

no test coverage detected