javascript -/n 不显示为换行符

标签 javascript node.js discord discord.js

/n 没有在我的嵌入消息中打断。我的代码及其发送的嵌入位于下面。有人可以帮忙吗?

image of embed

代码部分:

client.on("message", (message) => {
  if (!message.content.startsWith(prefix) || message.author.bot) return;

  if (message.content.toLowerCase().startsWith(prefix + `rules`)) {
    const embed = new Discord.RichEmbed()
    .setTitle(`OFFICIAL SERVER RULES`)
    .setColor(0xCF40FA)
    .setDescription(`Official rules for the USA discord server. Last updated: 1st October 2018`)
    .addField(`**GENERAL RULES**`, `1.Swearing is allowed, But not targeted towards a person./n2. Be respectful to everyone in the server./n3. No form of racism./n4. No public arguments./n5. Anything not suitable for work if forbidden./n6. All conversations are limited to English./n7. Spamming or mass mentioning is strictly forbidden./n8. Keep messages in their respective channels./n9. Fake or bad links, advertising anything non-US related, stays out of this discord./n10. Keep bot commands in #bot-commands ./n11. No talking in #announcements .`)
    message.channel.send({ embed: embed });
  }
});

最佳答案

换行符的正确转义字符是 \n 而不是 /n

关于javascript -/n 不显示为换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52595901/

相关文章:

javascript - Angular HttpClient如何将结果传递给模板

javascript - for循环不返回结果

node.js - 如何使用 React、Node 和 Webpack 渲染 pug/jade 模板?

javascript - 在 vscode 中使用 Node.js 进行调试时,console.timeEnd() 被未知的 constructor.js 欺骗。这是什么?

python - Discord Bot - "Attribute Error: ' NoneType' 对象没有属性 'strip.'

javascript - 使用 XMLHttpRequest 的 AJAX 文件上传

javascript - window.history.pushState() 数据,如何以及何时检索它们?

javascript - 如何以人们可以打开的方式编译neutralinojs项目?

node.js - 未找到 FFMPEG Discord.js

discord - 是否有可能制作一个不和谐的 js 网站以及如何制作?