handle newline in string for build embed

Hello so i decided to make an slash command for build embed message, and on of option is description of building embed, but after type an some text\nanother some text looks like this, and it is my question. how to handle newline in string and make it in embed?
6 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
sexy dark chocolate
string.replaceAll("\n", "\n") should work \\n .replaceAll("\\n", "\n")
wisienka
wisienkaOP2y ago
let description = interaction.options.getString(`description`);
description.replaceAll("\\n", "\n");
embed.setDescription(description);
let description = interaction.options.getString(`description`);
description.replaceAll("\\n", "\n");
embed.setDescription(description);
still doesn't work using \\n and \n in string option
sexy dark chocolate
description = description.replaceAll(...) Or getString(...)?.replaceAll(...) Or .setDescription(description.replaceAll(...))
wisienka
wisienkaOP2y ago
bless you variable = variable.replaceall works fine
sexy dark chocolate
All of them would work
Want results from more Discord servers?
Add your server