【发布时间】:2021-10-21 03:22:31
【问题描述】:
const fetch = require('node-fetch');
const fs = require('fs')
var data = fs.createReadStream('2.png')
const fileSizeInBytes = data.size;
var URL = "apikey";
fetch(URL, {
"method":"POST",
"headers": {
"Content-length": fileSizeInBytes,
'Content-Type': 'multipart/form-data',
'Content-Disposition': 'form-data; name="2"; filename="2.png"'
},
"body": JSON.stringify({
"file":data
})
})
.then(res=> console.log(res))
.catch(err => console.error(err));
如何通过 discord webhook 发送图像?我已经尝试了上述方法,但它不起作用。并且在不和谐的文档上没有合适的例子。
【问题讨论】:
标签: javascript node.js discord fetch webhooks