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 toolkit14mo 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
wisienka14mo 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
wisienka14mo ago
bless you variable = variable.replaceall works fine
sexy dark chocolate
All of them would work