How to add "ephemeral message" code to my code

i have commands that i need to add this to, and dont know how to do it.
49 Replies
d.js toolkit
d.js toolkit2d 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
Skullfromroblox
SkullfromrobloxOP2d ago
Node: v22.14.0
Mark
Mark2d ago
set it in the message flags in an interaction reply
d.js docs
d.js docs2d ago
:propertysignature: InteractionReplyOptions#flags [email protected] Which flags to set for the message. Only MessageFlags.Ephemeral, MessageFlags.SuppressEmbeds, and MessageFlags.SuppressNotifications can be set. The ephemeral option when replying to an interaction will be removed in v15
- {..., ephemeral: true}
+ {..., flags: MessageFlags.Ephemeral}
- {..., ephemeral: true}
+ {..., flags: MessageFlags.Ephemeral}
Read here on how to specify multiple flags
Skullfromroblox
SkullfromrobloxOP2d ago
okay. like this? await interaction.reply({'Skulls Socials', flags: MessageFlags.Ephemeral});
Inky
Inky2d ago
Yes
Skullfromroblox
SkullfromrobloxOP2d ago
Okay
Mark
Mark2d ago
needs content key { content: '...', flags: ... }
Skullfromroblox
SkullfromrobloxOP2d ago
Okayz So like this? await interaction.reply({content:'Skulls Socials', flags: MessageFlags.Ephemeral}); How do you highlight code? It gave an error
d.js docs
d.js docs2d ago
Codeblocks: ```js const Discord = require("discord.js"); // further code ``` becomes
const Discord = require("discord.js");
// further code
const Discord = require("discord.js");
// further code
Inline Code: `console.log('inline!');` becomes console.log('inline!');
Skullfromroblox
SkullfromrobloxOP2d ago
Ok Still have an error
d.js docs
d.js docs2d ago
Codeblocks: ```js const Discord = require("discord.js"); // further code ``` becomes
const Discord = require("discord.js");
// further code
const Discord = require("discord.js");
// further code
Inline Code: `console.log('inline!');` becomes console.log('inline!');
Skullfromroblox
SkullfromrobloxOP2d ago
Oh ok-
Inky
Inky2d ago
Add in the back ticks as shown to get the formatting
Skullfromroblox
SkullfromrobloxOP2d ago
console.log(‘test’) Ooh I got an error when i ran this.
Samtino
Samtino2d ago
What's the error?
Skullfromroblox
SkullfromrobloxOP2d ago
Ooh One sec
Samtino
Samtino2d ago
Did you not import MessageFlags?
Skullfromroblox
SkullfromrobloxOP2d ago
Hm?
Skullfromroblox
SkullfromrobloxOP2d ago
This the error-
No description
Samtino
Samtino2d ago
const { MessageFlags } = require('discord.js');
const { MessageFlags } = require('discord.js');
You need to import MessageFlags. It's an enum for numbers
Skullfromroblox
SkullfromrobloxOP2d ago
This what i have-
No description
Samtino
Samtino2d ago
You still need to import MessageFlags. You're only importing SlashCommandBuilder
Skullfromroblox
SkullfromrobloxOP2d ago
Okay. So i add MessageFlags? Done, now what?
Samtino
Samtino2d ago
Then you're done. That error is fixed Unless something else is wrong (which nothing is here) then it should work
Skullfromroblox
SkullfromrobloxOP2d ago
It works. But theres little dots under it- How do i remove those?
Samtino
Samtino2d ago
What do you mean dots?
Skullfromroblox
SkullfromrobloxOP2d ago
These
Skullfromroblox
SkullfromrobloxOP2d ago
No description
Samtino
Samtino2d ago
A. It's a bug with Discord...try restarting your app or trying on desktop/web B. There's something happening before you send your interaction to your command file...can you send your file that contains your client.on('interactionCreate')? C. Idk
Skullfromroblox
SkullfromrobloxOP2d ago
Ill do b in a sec. Lemme find the file. Index?
Samtino
Samtino2d ago
I don't know what it is for you. It could be in your index.js unless you moved it out into events/interactionCreate.js or something similar
Skullfromroblox
SkullfromrobloxOP2d ago
Okay. Lemme send the file. One sec. Gotta open the app- very slow on pc- Heres the file.
Skullfromroblox
SkullfromrobloxOP15h ago
Does it work? Going to bed Awake Can yall help?
Amgelo
Amgelo15h ago
make sure this is your actual code in your command the screenshot suggests you haven't saved yet nvm doesn't look like it says that, still double check
Skullfromroblox
SkullfromrobloxOP14h ago
It is
Amgelo
Amgelo14h ago
sounds like a client issue then does it show the same thing in your pc client?
Skullfromroblox
SkullfromrobloxOP13h ago
I dont know im not home right now. Ill lyk when i get home. No. It doesnt do it on pc. Just mobile.
Amgelo
Amgelo13h ago
client issue then make sure it's updated
Skullfromroblox
SkullfromrobloxOP12h ago
Whats updated?
Amgelo
Amgelo12h ago
your client aka your discord app
Skullfromroblox
SkullfromrobloxOP12h ago
Oh okatz Lemme look Its updated :)
Amgelo
Amgelo12h ago
are you running stable or canary?
Skullfromroblox
SkullfromrobloxOP12h ago
Hm? How do i find that out?
Amgelo
Amgelo12h ago
if you didn't register for canary then you aren't no idea then, but it's no longer a djs issue
Skullfromroblox
SkullfromrobloxOP12h ago
Okay. Who do i ask then?
d.js docs
d.js docs12h ago
We are not Discord, just some nerds who develop Discord bots! - /report appeals and age updates - /howtoreport reports (harassment/hacking/spam/abuse) - /support anything Discord related - /billing payment/nitro - /feedback feedback/feature requests
Skullfromroblox
SkullfromrobloxOP8h ago
You can mark it as done.

Did you find this page helpful?