misc.woflram: don't fail if can't grab image

This commit is contained in:
Cynthia Foxwell 2022-06-22 10:53:43 -06:00
parent cfa87eb297
commit 76ee7a789b

View file

@ -124,9 +124,15 @@ wolfram.callback = async function (msg, line) {
let image; let image;
if (data[1].subpods[0].img.src) if (data[1].subpods[0].img.src)
image = Buffer.from( try {
await fetch(data[1].subpods[0].img.src).then((x) => x.arrayBuffer()) const res = await fetch(data[1].subpods[0].img.src);
); if (res) {
const imgData = await res.arrayBuffer();
image = Buffer.from(imgData);
}
} catch {
//
}
let string = ""; let string = "";
if (data[1].subpods[0].plaintext.length > 0) if (data[1].subpods[0].plaintext.length > 0)