edit ephemeral embeds

I have an ephemeral embed which has one ActionRow with 3 Buttons (Which you can find in the attachment ). The left button triggers some dm messages to the interaction user. After answering the message it should update the ephemeral embed.

I read the forum post i found about that topic but didnt quite understand how he could call
interaction.update({ephemeral: true, content: "stuff"}) 

at all. Cause im not able to do so.

PS: Im not calling any deferUpdate or deferReply beforehand.

Let me explain my setup a bit more detailed:

I read the interaction.message to get the embed and build a new embed on top of that
message = interaction.message; //Interaction is a ButtonInteraction

const embed = new EmbedBuilder(message.embeds[0]) //embeds[0] is the correct embed
            .setFields([
                { name: "Team Ranks", value: "anotherValue" }
            ])



i tried to update the embed with the ButtonInteraction#update function which looks like that:
await interaction.update({ embeds: [embed] })


But i receive following error:

DiscordAPIError[10062]: Unknown interaction
    at handleErrors (@discordjs/rest/dist/index.js:687:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async BurstHandler.runRequest (@discordjs/rest/dist/index.js:786:23)
    at async _REST.request (/home/torben/coding/MatchBuddy/node_modules/@discordjs/rest/dist/index.js:1218:22)
    at async ButtonInteraction.update (discord.js/src/structures/interfaces/InteractionResponses.js:233:5)
    at async InteractionCollector.<anonymous> (file://bot/src/slashCommands/init.ts:158:55) {
  requestBody: {
    files: [],
    json: {
      type: 7,
      data: {
        content: undefined,
        tts: false,
        nonce: undefined,
        embeds: [
          {
            type: 'rich',
            title: 'Gespeicherte Suche',
            fields: [Array],
            description: 'Folgende Einstellungen wurden hinterlegt',
            color: 3201601
          }
        ],
        components: undefined,
        username: undefined,
        avatar_url: undefined,
        allowed_mentions: undefined,
        flags: undefined,
        message_reference: undefined,
        attachments: undefined,
        sticker_ids: undefined,
        thread_name: undefined
      }
    }
  },
  rawError: { message: 'Unknown interaction', code: 10062 },
  code: 10062,
  status: 404,
  method: 'POST',
  url: 'https://discord.com/api/v10/interactions/1155983696248176681/aW50ZXJhY3Rpb246MTE1NTk4MzY5NjI0ODE3NjY4MTpkSDczOWFXSDJnaDlxSnBGTlAwOEl0Zk1sdGNacm11RmhGNVRIRHhIVndINk1OQzBOaElROHF0NVIwZnlnaTgzSERUZE84czZYd213bU5vT29vMzY2cUM0UzBQc2VBZFdET1hEaDJvekFXbG9LUFl1ZG1Td0luN2pLR0dOYnVBTA/callback'
}
image.png
Was this page helpful?