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 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
Skull
SkullOP7mo ago
Node: v22.14.0
Mark
Mark7mo ago
set it in the message flags in an interaction reply
d.js docs
d.js docs7mo ago
:propertysignature: InteractionReplyOptions#flags discord.js@14.19.1 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
Skull
SkullOP7mo ago
okay. like this? await interaction.reply({'Skulls Socials', flags: MessageFlags.Ephemeral});
Inky
Inky7mo ago
Yes
Skull
SkullOP7mo ago
Okay
Mark
Mark7mo ago
needs content key { content: '...', flags: ... }
Skull
SkullOP7mo 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 docs7mo 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!');
Skull
SkullOP7mo ago
Ok Still have an error
d.js docs
d.js docs7mo 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!');
Skull
SkullOP7mo ago
Oh ok-
Inky
Inky7mo ago
Add in the back ticks as shown to get the formatting
Skull
SkullOP7mo ago
console.log(‘test’) Ooh I got an error when i ran this.
Samtino
Samtino7mo ago
What's the error?
Skull
SkullOP7mo ago
Ooh One sec
Samtino
Samtino7mo ago
Did you not import MessageFlags?
Skull
SkullOP7mo ago
Hm?
Skull
SkullOP7mo ago
This the error-
No description
Samtino
Samtino7mo ago
const { MessageFlags } = require('discord.js');
const { MessageFlags } = require('discord.js');
You need to import MessageFlags. It's an enum for numbers
Skull
SkullOP7mo ago
This what i have-
No description
Samtino
Samtino7mo ago
You still need to import MessageFlags. You're only importing SlashCommandBuilder
Skull
SkullOP7mo ago
Okay. So i add MessageFlags? Done, now what?
Samtino
Samtino7mo ago
Then you're done. That error is fixed Unless something else is wrong (which nothing is here) then it should work
Skull
SkullOP7mo ago
It works. But theres little dots under it- How do i remove those?
Samtino
Samtino7mo ago
What do you mean dots?
Skull
SkullOP7mo ago
These
Skull
SkullOP7mo ago
No description
Samtino
Samtino7mo 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
Skull
SkullOP7mo ago
Ill do b in a sec. Lemme find the file. Index?
Samtino
Samtino7mo 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
Skull
SkullOP7mo ago
Okay. Lemme send the file. One sec. Gotta open the app- very slow on pc- Heres the file.
Skull
SkullOP7mo ago
Skull
SkullOP7mo ago
Does it work? Going to bed Awake Can yall help?
Amgelo
Amgelo7mo 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
Skull
SkullOP7mo ago
It is
Amgelo
Amgelo7mo ago
sounds like a client issue then does it show the same thing in your pc client?
Skull
SkullOP7mo 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
Amgelo7mo ago
client issue then make sure it's updated
Skull
SkullOP7mo ago
Whats updated?
Amgelo
Amgelo7mo ago
your client aka your discord app
Skull
SkullOP7mo ago
Oh okatz Lemme look Its updated :)
Amgelo
Amgelo7mo ago
are you running stable or canary?
Skull
SkullOP7mo ago
Hm? How do i find that out?
Amgelo
Amgelo7mo ago
if you didn't register for canary then you aren't no idea then, but it's no longer a djs issue
Skull
SkullOP7mo ago
Okay. Who do i ask then?
d.js docs
d.js docs7mo 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
Skull
SkullOP7mo ago
You can mark it as done.

Did you find this page helpful?