大佬教程收集整理的这篇文章主要介绍了DiscordAPIError: Invalid Form Body embed.image.url: 不支持方案“[对象响应]”。方案必须是 ('http', 'https'),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
所以我尝试使用以下代码从 quickchart.io 获取 .png 文件:
async exec(message,args) {
console.log(chalk.green("chart requested " + chalk.yellow(message.author.userName) + " in " + chalk.magentaBright(message.chAnnel.guild.Name)));
console.log(args.coin)
const getChart = async () => {
const result = await fetch(`https://quickchart.io/chart?chart={
type: 'line',data: {
labels: ['Q1','Q2','Q3','Q4'],datasets: [{
label: 'Revenue',data: [100,200,300,400],fill:false
}]
}
}&BACkgroundcolor=@R_419_3318@&wIDth=500&height=300&devicePixelRatio=1.0&format=png&version=2.9.3`)
const Json = await result
return Json
}
let com = await getChart()
if (messagE) {
let embed = new discord.messageEmbed()
.setimage(`${Com}`)
message.chAnnel.send({ embed }).catch(function (rej) {
message.chAnnel.send("Sorry,I was unable to process this command. Make sure that I have full send permissions for embeds and messages and then try again!");
console.log(chalk.red('Error sending trending List! : ' + chalk.cyan(rej)));
});
}
}
我知道我犯了一个巨大的错误,但我想更多地了解这个错误以及我做错了什么。 谢谢
您必须提供图像网址,以便您必须提供快速图表链接,而不是您当前尝试获取图像的位置,如下所示:
let com = `https://quickchart.io/chart?chart={
type: 'line',data: {
labels: ['Q1','Q2','Q3','Q4'],datasets: [{
label: 'Revenue',data: [100,200,300,400],fill:false
}]
}
}&BACkgroundColor=transparent&width=500&height=300&devicePixelRatio=1.0&format=png&version=2.9.3`
if (messagE) {
// rest of code
}
以上是大佬教程为你收集整理的DiscordAPIError: Invalid Form Body embed.image.url: 不支持方案“[对象响应]”。方案必须是 ('http', 'https')全部内容,希望文章能够帮你解决DiscordAPIError: Invalid Form Body embed.image.url: 不支持方案“[对象响应]”。方案必须是 ('http', 'https')所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。