首页 > 解决方案 > 我的新 Discord.Attachment() 不起作用 它在我的 discord.js 机器人中显示错误

问题描述

} else if (msg.content === '?_saifz test') {
      const attachment = new Discord.Attachment('https://th.bing.com/th/id/OIP.CK95Aog4xZCaWVHnAr61pwHaHa?w=183&h=183&c=7&o=5&dpr=1.25&pid=1.7') // the problem
      msg.channel.send(attachment)
    }
    })
    keepAlive()
    client.login(process.env.lolUCannotGetToken)

我没有放其他命令,因为它们有效。

标签: discord

解决方案


这不是有效的图像文件类型。您需要找到带有有效扩展名的图像的链接,例如.jpg,.png.jpeg.

此外,为了防止网站从他们的服务器上下载图像时出现问题,我建议您将图像下载到您的项目中,这样它就会永远存在。


推荐阅读