discord.js bot 在尝试发送嵌入时报告 [object object]
discord.js bot reports [object object] when trying to send an embed
我正在编写一个必须发送嵌入的机器人程序。但是发送嵌入时,机器人会说 [object Object]
。
嵌入代码:
const embed9 = new Discord.MessageEmbed()
.setTitle("1h Until Convoy - Sim1")
.setURL("https://www.scanialtd.com/")
.setColor(16571139)
.setDescription("There is 1 hour untill the convoy on Simulation 1 in ETS2. Get ready to join by launching ETS2 and logging on to Simulation 1. Join the Convoy Lounge while you wait.")
.setFooter("Created by ScaniaLTD Convoy Announcements Bot, https://www.scanialtd.com/uploads/6/3/4/9/63493649/published/logo_3.png")
.setImage("http://i.imgur.com/yVpymuV.png")
.setThumbnail("https://www.scanialtd.com/uploads/6/3/4/9/63493649/published/logo_3.png")
.setTimestamp()
message.channel.send('@ConvoyReminders' + {embed9})
您正在连接一个字符串和一个内部带有 embed9 的对象。
要提及某人,您需要在 .setDescription
中添加 @<Username>
。然后你可以做 message.channel.send(embed9)
因为您尝试在 1 个参数中发送 stirng + 嵌入对象。
你不能用他们的 name + @
来提及 peaple,你需要为此使用 user.id
,比如 <@213123131321>
或 <@&1232312123132>
作为角色。
正确的方法:
const embed9 = new Discord.MessageEmbed()
.setTitle("1h Until Convoy - Sim1")
.setURL("https://www.scanialtd.com/")
.setColor(16571139)
.setDescription("There is 1 hour untill the convoy on Simulation 1 in ETS2. Get ready to join by launching ETS2 and logging on to Simulation 1. Join the Convoy Lounge while you wait.")
.setFooter("Created by ScaniaLTD Convoy Announcements Bot, https://www.scanialtd.com/uploads/6/3/4/9/63493649/published/logo_3.png")
.setImage("http://i.imgur.com/yVpymuV.png")
.setThumbnail("https://www.scanialtd.com/uploads/6/3/4/9/63493649/published/logo_3.png")
.setTimestamp()
message.channel.send('@ConvoyReminders', embed9)
我正在编写一个必须发送嵌入的机器人程序。但是发送嵌入时,机器人会说 [object Object]
。
嵌入代码:
const embed9 = new Discord.MessageEmbed()
.setTitle("1h Until Convoy - Sim1")
.setURL("https://www.scanialtd.com/")
.setColor(16571139)
.setDescription("There is 1 hour untill the convoy on Simulation 1 in ETS2. Get ready to join by launching ETS2 and logging on to Simulation 1. Join the Convoy Lounge while you wait.")
.setFooter("Created by ScaniaLTD Convoy Announcements Bot, https://www.scanialtd.com/uploads/6/3/4/9/63493649/published/logo_3.png")
.setImage("http://i.imgur.com/yVpymuV.png")
.setThumbnail("https://www.scanialtd.com/uploads/6/3/4/9/63493649/published/logo_3.png")
.setTimestamp()
message.channel.send('@ConvoyReminders' + {embed9})
您正在连接一个字符串和一个内部带有 embed9 的对象。
要提及某人,您需要在 .setDescription
中添加 @<Username>
。然后你可以做 message.channel.send(embed9)
因为您尝试在 1 个参数中发送 stirng + 嵌入对象。
你不能用他们的 name + @
来提及 peaple,你需要为此使用 user.id
,比如 <@213123131321>
或 <@&1232312123132>
作为角色。
正确的方法:
const embed9 = new Discord.MessageEmbed()
.setTitle("1h Until Convoy - Sim1")
.setURL("https://www.scanialtd.com/")
.setColor(16571139)
.setDescription("There is 1 hour untill the convoy on Simulation 1 in ETS2. Get ready to join by launching ETS2 and logging on to Simulation 1. Join the Convoy Lounge while you wait.")
.setFooter("Created by ScaniaLTD Convoy Announcements Bot, https://www.scanialtd.com/uploads/6/3/4/9/63493649/published/logo_3.png")
.setImage("http://i.imgur.com/yVpymuV.png")
.setThumbnail("https://www.scanialtd.com/uploads/6/3/4/9/63493649/published/logo_3.png")
.setTimestamp()
message.channel.send('@ConvoyReminders', embed9)