An example of how to edit an ephemeral message after clicking a button on an ephemeral message. Simply ensure the button ID is the same as the button defined on the original message.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
const message = context.params.event.message;
const event = context.params.event;
await axios.patch(`https://discord.com/api/webhooks/${event.application_id}/${event.token}/messages/${event.message.id}`, {
flags: 64,
content: `Nice job <@${event.member.user.id}>!`,
embeds: [
{
type: 'rich',
title: `๐ You successfully edited an ephemeral message! ๐`,
description: 'Now you know how to create interactive UIs in private!',
color: 0xf00ff,
},
],
});