问题
The new discord update added the feature to mark images and text as spoilers for text: you just have to type || text ||. For images, there is a check mark at the bottom of the attachment prompt:
Is there a way to mark images as spoiler or is the feature too new?
This does not work:
let image = new Attachment('./img/image.jpg');
message.channel.send("|| " + image + " ||");`
回答1:
a quick way of doing it would be starting the filename with SPOILER_
for example img.png would become SPOILER_img.png
回答2:
This is what the API has listed for the image for embeds and it doesn't seem to mention marking as a spoiler so perhaps it is yet to be added for bots. I can't find anything about spoilers in the API, maybe you'll have more luck.
回答3:
message.channel.send({
files: [{
attachment: 'IMG LINK',
name: 'SPOILER_NAME.jpg'
}]
})
来源:https://stackoverflow.com/questions/54476198/is-there-anyway-to-mark-images-as-spoiler