最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Discord.js embed image spoiler - Stack Overflow

programmeradmin0浏览0评论

I have a bot that sends embeds. Sometimes I send embeds with a picture, but I want to put a spoiler over it. Is that possible? The problem is that I get the image from a link, so I can't rename it to 'SPOILER_'. Downloading the image and renaming it would be very troublesome, there must be another way. This is how the code I insert the image with:

{
  "embed": {
    "image": {
      "url": url
    }
  }
}

I have a bot that sends embeds. Sometimes I send embeds with a picture, but I want to put a spoiler over it. Is that possible? The problem is that I get the image from a link, so I can't rename it to 'SPOILER_'. Downloading the image and renaming it would be very troublesome, there must be another way. This is how the code I insert the image with:

{
  "embed": {
    "image": {
      "url": url
    }
  }
}
Share Improve this question edited Nov 20, 2019 at 9:49 Christian Proschek asked Nov 20, 2019 at 9:42 Christian ProschekChristian Proschek 711 silver badge6 bronze badges 1
  • 1 Possible duplicate of Is there anyway to mark images as spoiler? – Ben Fortune Commented Nov 20, 2019 at 9:46
Add a ment  | 

1 Answer 1

Reset to default 4

Unfortunately, this is not possible via renaming the image file with SPOILER_

Taken from the docs, with TextChannel.send() you're able to fetch an image, rename it and then send it in an embed, like so:

channel.send({
  embed: {
    image: {
         url: "attachment://SPOILER_FILE.jpg"
      }
   },
   files: [{
      attachment: "https://cdn.pixabay./photo/2018/04/05/18/28/cute-3293750_960_720.jpg",
      name: "SPOILER_FILE.jpg"
   }]
});

But if you test this out, the image will still be visible.

However, if you remove the embed part of the message, it works:

channel.send({
   files: [{
      attachment: "https://cdn.pixabay./photo/2018/04/05/18/28/cute-3293750_960_720.jpg",
      name: "SPOILER_FILE.jpg"
   }]
});


So what now?

Give them feedback: upvote and ment on this suggestion and other places to let them know, and hopefully they'll add it soon.

发布评论

评论列表(0)

  1. 暂无评论