通过 link 在 Discord 附件中使用 PHP 生成的图像

Using PHP generated images in Discord attachment via link

我正在尝试通过我的 Discord 机器人从 link 上传一张图片。图片是用PHP使用Image Processing and Generation生成的,输出为png格式。

虽然当我尝试像这样将图像附加到我的机器人消息时,它会上传一个随机文件,我认为这是 png 背后的代码。

message.channel.send({files: ["https://banlister.com/profiling/profile.php?id=76561198153846406"]});

我已经给了这个 google 并花了一些时间尝试想出其他解决方法,但我不太喜欢每次都下载图像,所以我想我可能会能在这里得到一些帮助吗?

当我用 imgur link 尝试这个时,当我 linked 本地图像时它也有效:

我的印象是只有每次都下载图像才能做到这一点,尽管我认为我不妨请专家来确定一下。

Bot 将图像发送为 profile.php,因为 url 将发送到 profile.php,因此您需要指定格式。例如你可以这样做:

message.channel.send({
  files: [{
    attachment: 'https://banlister.com/profiling/profile.php?id=76561198153846406',
    name: 'profile.png'
  }]
})