yo. Excluding command handling I have something like this:
client.on("interactionCreate", (interaction: Interaction) => {
// if interaction is component I run execution method
const loadingContent = loadingEmoji ? `<a:${loadingEmoji.name}:${loadingEmoji.id}>` : "...";
const message = await interaction.reply({ content: loadingContent, ephemeral: true, fetchReply: true }) : null;
reply(opts: ...) {
delete opts .ephemeral;
await message.edit(opts as ...);
}
// here are some actions. they are takes 2-30secs
// and at the end I run reply function to send a message
const error = await reply({ content: null, embeds: [...], files: [...] }).then(() => null).catch((e: Error) => e);
// sometimes error is null, sometimes its not
});