discord - 我的新 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)
我没有放其他命令,因为它们有效。
解决方案
这不是有效的图像文件类型。您需要找到带有有效扩展名的图像的链接,例如.jpg
,.png
或.jpeg
.
此外,为了防止网站从他们的服务器上下载图像时出现问题,我建议您将图像下载到您的项目中,这样它就会永远存在。
推荐阅读
- javascript - 验证新密码并确认密码
- python - 通过 pip 安装 pytext 时如何解决此问题?
- javascript - 条件渲染 react-redux
- openpyxl - 工作表对象不可调用
- java - 如何使用logstash过滤java日志?
- php - 如何将值保存到表单中的变量
- vue.js - 如何使用 vuejs 和 axios 将数据显示到 v-data-table 中?
- oop - 不同作用域的构造函数
- aws-lambda - Lamba 调用总是触发回退意图?如何使用 amzon lex identifypoolID 授权 botium?
- excel - 从工作表单元格选择结果到用户表单组合框