Discord.js-在我的电脑中选择随机图像

Discord.js-在我的电脑中选择随机图像,discord.js,Discord.js,我要在哪里发命令!发送图像将在我的电脑上随机发送指定图像。这是我的图像数组 常量图像=[ “/mybot/images/我在那里的任何图像”, “其他图像” ] 这就是它应该选择的方式 if(message.content === prefix + 'send image') { message.channel.send(`${message.author} here you have image`, { file: RetardedImage[

我要在哪里发命令!发送图像将在我的电脑上随机发送指定图像。这是我的图像数组

常量图像=[
“/mybot/images/我在那里的任何图像”,
“其他图像”
]
这就是它应该选择的方式

 if(message.content === prefix + 'send image')
    {
        message.channel.send(`${message.author} here you have image`, {
            file: RetardedImage[Math.floor(Math.random() * RetardedImage.length)]
        });
    }```

but it doesnt work and problem is that it doesnt even say error or something so i dont know what the problem is, can someone please help me?

消息没有
文件
选项,称为
文件
,它是一个数组:

if(message.content==前缀+“发送图像”)
{
message.channel.send(${message.author}这里有图像`{
档案:[
{
名称:“myimage.png”,
附件:delayedimage[数学地板(数学随机()*delayedimage.length)]
}
]
});
}

这将正确发送您的文件

您可以制作这样的附件

const attachment=new.attachment(“路径”,“名称.扩展名”)
message.channel.send(`blah blah`+附件)