我正在编码一个必须发送嵌入代码的机器人。但是当嵌入文件发送后,机器人会说[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})
答案 0 :(得分:0)
您正在串联一个字符串和一个对象,其中包含embed9。
要提及某人,您需要在@<Username>
中添加.setDescription
。然后,您可以message.channel.send(embed9)
答案 1 :(得分:0)
因为您尝试在1个args中发送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)