This interaction failed

export default {
  data: new SlashCommandBuilder()
    .setName('generate')
    .setDescription('Generate a card.')
    .addStringOption((option) => option.setName('uid').setDescription('HSR UID')),
  execute: async (interaction: ChatInputCommandInteraction) => {
    const uid = interaction.options.getString('uid');

    const select = new StringSelectMenuBuilder()
      .setCustomId('starter')
      .setPlaceholder('Make a selection!');

    await interaction
      .deferReply()
      .then(async () => {
        await interaction.followUp(`Getting characters for UID ${uid}`);
      })
      .then(async () => {
        const { characters } = await getCharacter(uid ?? '', 'en');

        characters.forEach(({ name }, index) => {
          select.addOptions(
            new StringSelectMenuOptionBuilder()
              .setLabel(name)
              .setValue(index.toString())
              .setDescription(name)
          );
        });

        const row = new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(select);
        const response = await interaction.editReply({
          content: 'Please select a character',
          components: [row],
        });

        const collectorFilter = (i: any) => i.user.id === interaction.user.id;
        await response
          .awaitMessageComponent({
            filter: collectorFilter,
            time: 60_000,
          })
          .then(async (componentInteraction) => {
            if (componentInteraction.isAnySelectMenu()) {
              const c = characters[parseInt(componentInteraction.values[0])];
              return await interaction.editReply({
                content: 'Here is your card!',
                files: [await imageGen(c)],
              });
            }
          })
          .catch(async (error) => {
            console.error(error);
            return interaction.editReply('No selection was made.');
          })
          .then(() => {
            return interaction.deferReply();
          });
      });
  },
});

The code itself is working with no console errors but the "this interaction failed" prompt appears in the message.
Was this page helpful?