I am making command in my bot to send embed with specified parameters (like: title, description...), and I want my bot to recognize \n in user input as new line function (not just "\n" text).
This is how command input looks like:
And this is how command output looks like:
How command output should look like:
line1
line2
CodePudding user response:
I think it will be safer for your application to just manually replace them in content. You can simply use String.prototype.replaceAll
method:
const processedDescription = originalDescription.replaceAll("\\n", "\n");
Also, as additional note: it might be much comfortable to use Discord Modals for embeds instead of command arguments. You can checkout how to use them (if you're using discord.js) here.