Nilin
Nilin
DIAdiscord.js - Imagine an app
Created by Nilin on 3/18/2024 in #djs-questions
Deleting ephemeral replies
Is there a way to delete/hide a previous ephemeral reply after user clicks the button? I know await interaction.deleteReply(); will do it, but im not sure how to point it correctly here so its targeting the previous reply instead of the current one. My thinking is ill need to write a function to do so? fetch interaction.id -> forward it, then delete that id after the new reply is created
const {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
} = require("discord.js");

module.exports = {
data: {
name: `confirmation-menu`,
},
async execute(interaction) {

const confirm = new ButtonBuilder()
.setCustomId('confirm')
.setLabel('Confirm')
.setStyle(ButtonStyle.Success);

const cancel = new ButtonBuilder()
.setCustomId('cancel')
.setLabel('Cancel')
.setStyle(ButtonStyle.Danger);

await interaction.reply({
components: [new ActionRowBuilder().addComponents(confirm, cancel)],
ephemeral: true,
});
},
};
const {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
} = require("discord.js");

module.exports = {
data: {
name: `confirmation-menu`,
},
async execute(interaction) {

const confirm = new ButtonBuilder()
.setCustomId('confirm')
.setLabel('Confirm')
.setStyle(ButtonStyle.Success);

const cancel = new ButtonBuilder()
.setCustomId('cancel')
.setLabel('Cancel')
.setStyle(ButtonStyle.Danger);

await interaction.reply({
components: [new ActionRowBuilder().addComponents(confirm, cancel)],
ephemeral: true,
});
},
};
module.exports = {
data: {
name: `confirm`,
},
async execute(interaction) {
await interaction.reply({
content: `Confirmed`,
});
},
};
module.exports = {
data: {
name: `confirm`,
},
async execute(interaction) {
await interaction.reply({
content: `Confirmed`,
});
},
};
6 replies