我试图在不和谐的情况下发送带有代码块的嵌入,这是它的三次`
我的代码是我可以做什么在代码块中添加oldMessage.cleanContent和newMessage.cleanContent

client.on('messageUpdate', function(oldMessage, newMessage) {

    if (newMessage.channel.type == 'text' && newMessage.cleanContent != oldMessage.cleanContent) {

        var log = newMessage.guild.channels.find(ch => ch.name.includes('member-log'))
        if (log != null)

                var sEmbed = new Discord.RichEmbed()
                .setColor("e8a515")
                .setTitle(`:information_source: A Message Was Edited!`)
                .setDescription(`**USER**\n${newMessage.author.username}`)
                .addField(`Before `,` ${oldMessage.cleanContent} `) //what can i do to put oldMessage.cleanContent in codeblock
                .addField(`After`,`${newMessage.cleanContent} `)
                log.send(sEmbed);


    }

});

最佳答案

您可以通过两种正确的方式来做到这一点:

您只需用引号注释逗号

.addField(`Before `,"```" + ` ${oldMessage.cleanContent} `+"```")


或者您可以用斜杠评论

.addField(`Before `,` \`\`\` ${oldMessage.cleanContent} \`\`\` `)

09-28 02:56