Currently, context.ephemeralReply returns void because:
This does not return a reply handle; ephemeral replies can't be updated or deleted manually
— interaction-context.ts:52
However, I did a little testing and it seems to update just like regular replies. Maybe there was an API update since then?
Here's my test code:
import assert from "assert";
import { Client, Intents } from "discord.js";
import { setTimeout } from "timers/promises";
import { GUILD_ID, TOKEN } from "../src/config";
console.clear();
const client = new Client({
intents: [Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILDS],
});
client.login(TOKEN);
client.on("ready", async () => {
const acm = client.application?.commands;
assert(acm);
const cmd = await acm.create(
{
type: "CHAT_INPUT",
name: "edit-reply",
description: "Editind ephemeral reply",
},
GUILD_ID!,
);
});
client.on("interactionCreate", async (interaction) => {
assert(interaction.isApplicationCommand());
await interaction.deferReply({ ephemeral: true });
await setTimeout(1_000);
await interaction.editReply({
embeds: [{ color: "RED", description: "First reply" }],
// prettier-ignore
components: [
{type: "ACTION_ROW", components: [
{type: "BUTTON", disabled: true, style: "PRIMARY", label: "Am I enabled?", customId: "btn"},
]},
],
});
await setTimeout(1_000);
await interaction.editReply({
embeds: [{ color: "AQUA", description: "Edited reply" }],
// prettier-ignore
components: [
{type: "ACTION_ROW", components: [
{type: "BUTTON", disabled: false, style: "PRIMARY", label: "I'm enabled!", customId: "btn"},
]},
],
});
});
Currently,
context.ephemeralReplyreturnsvoidbecause:However, I did a little testing and it seems to update just like regular replies. Maybe there was an API update since then?
Here's my test code: