[英]Making an embed on Discord.js
所以我正在制作一个不和谐的机器人,我希望它在我输入hy!help时发送一个嵌入,所以我使用了 discord.js 文档中的格式,到目前为止我的代码看起来像这样
const client = new Discord.Client({
token: "pls-no-hack-ty"
});
client.on("ready", () => {
//do stuff lol
});
client.on("message", message => {
if(message.content === "hy!help") {
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/wSTFkRM.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/wSTFkRM.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');
channel.send(exampleEmbed);
} } )
但是我收到一个channel dot defined
错误。
我究竟做错了什么? 谢谢-rly907
在你的最后一行而不是channel.send(exampleEmbed);
做
message.channel.send(exampleEmbed);
你应该使用message.channel .send它不能使用channel.send
message.channel.send(Embed);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.