MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / execute

Function execute

src/commands/ServerStats/serverstats.js:89–124  ·  view source on GitHub ↗
(interaction, guildConfig, client)

Source from the content-addressed store, hash-verified

87 ),
88
89 async execute(interaction, guildConfig, client) {
90 const subcommand = interaction.options.getSubcommand();
91
92 try {
93 switch (subcommand) {
94 case "create":
95 await handleCreate(interaction, client);
96 break;
97 case "list":
98 await handleList(interaction, client);
99 break;
100 case "update":
101 await handleUpdate(interaction, client);
102 break;
103 case "delete":
104 await handleDelete(interaction, client);
105 break;
106 default:
107 await replyUserError(interaction, { type: ErrorTypes.VALIDATION, message: 'Unknown subcommand.' });
108 }
109 } catch (error) {
110 logger.error(`Error in serverstats ${subcommand}:`, error);
111
112 const errorEmbedMsg = createEmbed({
113 title: "❌ Error",
114 description: "An error occurred while processing your request.",
115 color: getColor('error')
116 });
117
118 if (!interaction.replied && !interaction.deferred) {
119 await InteractionHelper.safeReply(interaction, { embeds: [errorEmbedMsg], flags: MessageFlags.Ephemeral }).catch(logger.error);
120 } else {
121 await interaction.followUp({ embeds: [errorEmbedMsg], flags: MessageFlags.Ephemeral }).catch(logger.error);
122 }
123 }
124 }
125};

Callers

nothing calls this directly

Calls 9

handleCreateFunction · 0.90
handleListFunction · 0.90
handleUpdateFunction · 0.90
handleDeleteFunction · 0.90
createEmbedFunction · 0.90
getColorFunction · 0.90
replyUserErrorFunction · 0.85
safeReplyMethod · 0.80
followUpMethod · 0.80

Tested by

no test coverage detected