#not really djs related but lets talk here
1 messages · Page 1 of 1 (latest)
umm i am not sure, when I open the url, it just loads for some time and I get the image
no, like if you use axios, jquery or a library like these ones, how is the image returned, as a buffer or how exactly
i will show u wait 1 sec
@regal granite
this is how the data is returned
I think it is base64 encoding, make a buffer from it using Buffer.from(<Data>, 'base64') and then make it an attachment with AttachmentBuilder and send it
for now send it like that so we can see if it works
ok hold on lemme do it
nah man it didnt work @regal granite
let data;
await axios.get(`https://apiv2.spapi.ga/image/triggered?image=https://cdn.discordapp.com/avatars/1017416456897560588/fc0b1df1086899bb1eeadfe6766c4e75.png`).then(res => {
data=Buffer.from(res.data, "base64")
})
const attachment = new AttachmentBuilder(data, {name: "image.png"})
await message.reply({embeds: [new EmbedBuilder().setImage("attachment://image.png")], files: [attachment]})
yeah it is
i did
idk, try with binary
this was the result of console.log(data)
ok hold on
we need to find the right encoding and it will work
binary kinda worked but it returned a blank image
or I could say broken image
if the image isn't showing 💩, I think the problem is from the api
at least I tried to help you :D
this was the result from binary
yeah u did thanks man
try with utf-8 encoding, idk how encoding really works soo @nova crown
k
it didn't work too🥲
I have no more ideas 
try this
k
set it to binary and then base64 if it doesn't work
ok and response type arraybuffer right
yeah, then log the response, I think it will return the actual buffer
so you'll not have to make it a buffer again
I think
:D
const response = await axios.request({
method: 'GET',
url: 'https://apiv2.spapi.ga/image/triggered?image=https://cdn.discordapp.com/avatars/1017416456897560588/fc0b1df1086899bb1eeadfe6766c4e75.png',
responseType: 'arraybuffer',
responseEncoding: 'base64'
});
console.log(response.data);
const attachment = new AttachmentBuilder(response.data, {name: "image.png"})
await message.reply({embeds: [new EmbedBuilder().setImage("attachment://image.png")], files: [attachment]})
this worked