How to respond with a local image to a slash command discord.js v13 [closed]
I'm making a bot that has slash commands and I want to attach a file, no message, only an image file. I tried doing this, but it ends up giving me an empty message error.
const attachment = new MessageAttachment("image.bmp");
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
files: [attachment]
}
}
})
So my question is, how do I attach an image with this JSON format discord interaction?
UPDATE: I currently have this, which still doesn't work, but gives me this.
const file = new MessageAttachment (
"image.bmp"
);
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content: "hello",
"embeds": [
{
"title": `This is a cool embed`,
image: {
url: 'attachment://image.bmp',
},
"type": "rich",
"description": "",
"color": 0x00FFFF
}
]
},
}
})
from Recent Questions - Stack Overflow https://ift.tt/3IZF1YP
https://ift.tt/eA8V8J
Comments
Post a Comment