commandName = interaction.data.name;
try {
modulePath = `./${commandName}.ts`;
commandModule = await import(modulePath);
} catch {
modulePath = `./${commandName}.js`;
commandModule = await import(modulePath);
}
if (!commandModule.execute) throw new Error('Command not found');
return await executeCommandModule(commandModule as ChatInputCommand, interaction, env, ctx);
commandName = interaction.data.name;
try {
modulePath = `./${commandName}.ts`;
commandModule = await import(modulePath);
} catch {
modulePath = `./${commandName}.js`;
commandModule = await import(modulePath);
}
if (!commandModule.execute) throw new Error('Command not found');
return await executeCommandModule(commandModule as ChatInputCommand, interaction, env, ctx);