MCPcopy Create free account
hub / github.com/codebymitch/TitanBot / execute

Function execute

src/handlers/helpSelectMenus.js:374–414  ·  view source on GitHub ↗
(interaction, client)

Source from the content-addressed store, hash-verified

372export const helpCategorySelectMenu = {
373 name: CATEGORY_SELECT_ID,
374 async execute(interaction, client) {
375 try {
376 if (!interaction.deferred && !interaction.replied) {
377 await interaction.deferUpdate();
378 }
379
380 const selectedCategory = interaction.values[0];
381
382 if (selectedCategory === ALL_COMMANDS_ID) {
383 const { embeds, components } = await createAllCommandsMenu(1, client);
384 await interaction.editReply({
385 embeds,
386 components,
387 });
388 } else {
389 const { embeds, components } = await createCategoryCommandsMenu(selectedCategory, client);
390 await interaction.editReply({
391 embeds,
392 components,
393 });
394 }
395 } catch (error) {
396 if (error?.code === 40060 || error?.code === 10062) {
397 logger.warn('Help category select interaction already acknowledged or expired.', {
398 event: 'interaction.help.select.unavailable',
399 errorCode: String(error.code),
400 customId: interaction.customId,
401 interactionId: interaction.id,
402 });
403 return;
404 }
405
406 logger.error('Error in help category select menu handler:', error);
407 if (!interaction.replied && !interaction.deferred) {
408 await interaction.reply({
409 content: 'An error occurred while loading help categories.',
410 flags: MessageFlags.Ephemeral,
411 });
412 }
413 }
414 },
415};

Callers

nothing calls this directly

Calls 2

createAllCommandsMenuFunction · 0.85

Tested by

no test coverage detected