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

Function handlePanelMessage

src/commands/Ticket/modules/ticket_dashboard.js:326–380  ·  view source on GitHub ↗
(selectInteraction, rootInteraction, guildConfig, guildId, client)

Source from the content-addressed store, hash-verified

324};
325
326async function handlePanelMessage(selectInteraction, rootInteraction, guildConfig, guildId, client) {
327 const modal = new ModalBuilder()
328 .setCustomId('ticket_cfg_panel_msg')
329 .setTitle('📝 Edit Panel Message')
330 .addComponents(
331 new ActionRowBuilder().addComponents(
332 new TextInputBuilder()
333 .setCustomId('panel_msg_input')
334 .setLabel('Panel Message')
335 .setStyle(TextInputStyle.Paragraph)
336 .setValue(
337 guildConfig.ticketPanelMessage ||
338 'Click the button below to create a support ticket.',
339 )
340 .setMaxLength(2000)
341 .setMinLength(1)
342 .setRequired(true)
343 .setPlaceholder('Click the button below to create a support ticket.'),
344 ),
345 );
346
347 await selectInteraction.showModal(modal);
348
349 const submitted = await selectInteraction
350 .awaitModalSubmit({
351 filter: i =>
352 i.customId === 'ticket_cfg_panel_msg' && i.user.id === selectInteraction.user.id,
353 time: 120_000,
354 })
355 .catch(() => null);
356
357 if (!submitted) return;
358
359 const newMessage = submitted.fields.getTextInputValue('panel_msg_input').trim();
360 guildConfig.ticketPanelMessage = newMessage;
361 await client.db.set(getGuildConfigKey(guildId), guildConfig);
362
363 const panelUpdated = await updateLivePanel(client, rootInteraction.guild, guildConfig);
364
365 await submitted.reply({
366 embeds: [
367 successEmbed(
368 '✅ Panel Message Updated',
369 `The panel message has been updated.${
370 panelUpdated
371 ? '\nThe live ticket panel has also been refreshed.'
372 : '\n> **Note:** The live panel could not be located. The new message will apply the next time you run `/ticket setup`.'
373 }`,
374 ),
375 ],
376 flags: MessageFlags.Ephemeral,
377 });
378
379 await refreshDashboard(rootInteraction, guildConfig, guildId);
380}
381
382async function handleButtonLabel(selectInteraction, rootInteraction, guildConfig, guildId, client) {
383 const modal = new ModalBuilder()

Callers 1

executeFunction · 0.85

Calls 5

getGuildConfigKeyFunction · 0.90
successEmbedFunction · 0.90
updateLivePanelFunction · 0.70
refreshDashboardFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected