我想打印author.name的内容和嵌入的描述,但是我不知道怎么做。
Error:
Uncaught ReferenceError: author is not defined
const user = author.name;
message.channel.send(`${user} !!!`);
console.log(`${user} !!!`);
的例子我想从嵌入中返回.setAuthor
的名称"Juan"
和.setDescription的名称"text"
,它不是消息
const embed = new MessageEmbed()
.setAuthor('Juan')
.setColor('RANDOM')
.setDescription("text")
message.channel.send(embed);
听起来你需要使用message.author.username
client.on((message) => {
const username = message.author.username;
message.channel.send(`${username} !!!`);
console.log(`${username} !!!`);
})
问题解决
if(message.embeds.length >= 0)
{
let embed = message.embeds
for(let i = 0; i < embed.length; i++)
{
if (!embed[i] || !embed[i].author || embed[i].author.name === null) return;
{
const string4 = (embed[i].author.name);
message.channel.send(string4)
}
}
}