Updating ephemeral

Hi, is it possible to update ephemeral in a message after it's been deferred, in v13 it was, can't find if it was removed in v14. Here's my code: interactionCreate.js await interaction.deferReply(); embed.js await interaction.editReply({ embeds: [embed], components, ephemeral: true });
20 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
monbrey
monbrey7mo ago
no it wasnt It was never possible to change the ephemeral state of a message
Harrison
Harrison7mo ago
aye it was
monbrey
monbrey7mo ago
yeah nah it wasnt If you want to defer, you have to decide when deferring that it's going to be ephemeral
Harrison
Harrison7mo ago
explain this then ?
No description
No description
Harrison
Harrison7mo ago
lol in v13 you could defo change it
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
monbrey
monbrey7mo ago
I'm looking at two different things?
Harrison
Harrison7mo ago
it's not a follow up
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
monbrey
monbrey7mo ago
One is /tclose, and the other appears to be something else entirely. A create? Two different commands Neither of those show a defer, so I can't possibly know if it was edited or not But once a message is ephemeral it stays ephemeral
Harrison
Harrison7mo ago
okay so I'm deferring in interactionCreate.js yeah? and i wanna make it so i can have either ephemeral or not one
monbrey
monbrey7mo ago
Do you just defer every single interaction?
shazai
shazai7mo ago
module.exports = {
name: 'interactionCreate',
enabled: true,
async execute(client, interaction) {
if (!interaction.isCommand()) return;

await interaction.deferReply();
const member = interaction.guild.members.cache.get(interaction.user.id);
const command = interaction.client.commands.get(interaction.commandName);

if (!command) return;

const rows = await interaction.client.database.selectData('profiles', `user_id = ${member.id}`);

interaction.client.database.insertData('profiles', { user_id: member.id, blacklisted: 0})

if (rows[0] && rows[0].blacklisted == 1 && !member.permissions.has('ADMINISTRATOR')) {
editEmbedInteraction(interaction, blacklisted);
setTimeout(() => interaction.deleteReply(), 3000);
return;
}

hasPermission = false;

try {

if (command.roles.length == 0) hasPermission = true;
if (member.roles.cache.some((role) => command.roles.includes(role.name)
|| command.roles.includes(role.id))) hasPermission = true;

if (hasPermission != true) {
editEmbedInteraction(interaction, 'Invalid Permission', '', '', '', 'You don\'t have the correct permissions to use this command.')
setTimeout(() => interaction.deleteReply(), 3000);
return;
}

await command.execute(interaction);
} catch (error) {
if (error) {
console.error(error);
editEmbedInteraction(interaction, 'Command Error', '', '', '', `There was an error whilst executing this command:\n${error}`)
return;
}
}
},
};
module.exports = {
name: 'interactionCreate',
enabled: true,
async execute(client, interaction) {
if (!interaction.isCommand()) return;

await interaction.deferReply();
const member = interaction.guild.members.cache.get(interaction.user.id);
const command = interaction.client.commands.get(interaction.commandName);

if (!command) return;

const rows = await interaction.client.database.selectData('profiles', `user_id = ${member.id}`);

interaction.client.database.insertData('profiles', { user_id: member.id, blacklisted: 0})

if (rows[0] && rows[0].blacklisted == 1 && !member.permissions.has('ADMINISTRATOR')) {
editEmbedInteraction(interaction, blacklisted);
setTimeout(() => interaction.deleteReply(), 3000);
return;
}

hasPermission = false;

try {

if (command.roles.length == 0) hasPermission = true;
if (member.roles.cache.some((role) => command.roles.includes(role.name)
|| command.roles.includes(role.id))) hasPermission = true;

if (hasPermission != true) {
editEmbedInteraction(interaction, 'Invalid Permission', '', '', '', 'You don\'t have the correct permissions to use this command.')
setTimeout(() => interaction.deleteReply(), 3000);
return;
}

await command.execute(interaction);
} catch (error) {
if (error) {
console.error(error);
editEmbedInteraction(interaction, 'Command Error', '', '', '', `There was an error whilst executing this command:\n${error}`)
return;
}
}
},
};
interactionCreate.js
monbrey
monbrey7mo ago
Well, you'd need some property to decide, like interaction.deferReply({ ephemeral: command.ephemeral })
Harrison
Harrison7mo ago
bruv
monbrey
monbrey7mo ago
yeah idk why you'd automatically defer every interaction but okay
Harrison
Harrison7mo ago
it works, buddy well did till i updated to v14
monbrey
monbrey7mo ago
I'm not having an argument about the way the Discord API is demonstrably not working We dont control this Our versions can't change the fact that Discord's API doesn't work this way
Harrison
Harrison7mo ago
ok djs mod