DiscordJS参数片段

时间:2020-07-04 16:32:55

标签: discord.js

我想通过参数嵌入图像,但是无法设置嵌入的标题。 但是当我尝试运行命令时,它会出错并且嵌入不会出现

if(message.content.startsWith(prefix + "foto-annuncio"))
{

if(!message.member.hasPermission(["MANAGE_MESSAGES"]))
{
  /* error message pops out */
}
let argsresult;
let mChannel = message.mentions.channels.first()
message.delete()
argsresult = args.slice(1).join(" ")
let url = args.slice(1).join(" ");
let title = args.slice(2);
message.delete();
const embed = new Discord.RichEmbed ()
.setImage(url)
.setColor('#008000')
.setAuthor('Delta Logistics', 'https://cdn.discordapp.com/attachments/604963851561336832/665504827044003860/zoom_delta_6_discord.png')
.setTitle(title)   
mChannel.send(embed).catch(err => console.log(err));
message.channel.send("Done!");
}

1 个答案:

答案 0 :(得分:0)

正如Giuuliopime所说,您不能将数组设置为标题,您可能想加入参数:

const title = args.slice(2).join(" ");