in src/utils/discord.ts [120:155]
export async function fetchImagesFromComposite(
compositeImageData: EmbedImageData | null,
count: number,
imageWidth: number,
imageHeight: number
): Promise<Buffer[] | null> {
if (!compositeImageData || count == 0) {
return null;
}
const width = compositeImageData.width;
const height = compositeImageData.height;
if (!width || !height) {
return null;
}
try {
const { data, status } = await axios.get(compositeImageData.url, {
responseType: "arraybuffer",
});
let compositeBuffer = Buffer.from(data);
const images = await extractImagesFromComposite(
compositeBuffer,
width,
height,
count,
imageWidth,
imageHeight
);
return images;
} catch (e) {
if (LOG_ERRORS) {
console.log(`Save encountered an error ${e}`);
}
return null;
}
}