From 1ed011d9c0ed4f32e96a023b467e74fa343272c4 Mon Sep 17 00:00:00 2001 From: Cynthia Date: Fri, 2 Dec 2022 23:27:42 -0700 Subject: [PATCH] foxwells.vinboard: more attachment fixes --- src/modules/foxwells.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/modules/foxwells.js b/src/modules/foxwells.js index 4e307ad..3b8f76a 100644 --- a/src/modules/foxwells.js +++ b/src/modules/foxwells.js @@ -191,20 +191,20 @@ async function findSuitableImage(msg) { .then((res) => res.arrayBuffer()) .then((buf) => Buffer.from(buf)); } - } - - for (const embed of msg.embeds) { - if (!embed.url) continue; - if (embed.image) { - out.url = embed.image.url; - break; - } else if (embed.video) { - out.video = true; - out.url = "attachment://thumb.jpg"; - out.file = await fetch(embed.video.proxyURL + "?format=jpeg") - .then((res) => res.arrayBuffer()) - .then((buf) => Buffer.from(buf)); - break; + } else { + for (const embed of msg.embeds) { + if (!embed.url) continue; + if (embed.image) { + out.url = embed.image.url; + break; + } else if (embed.video) { + out.video = true; + out.url = "attachment://thumb.jpg"; + out.file = await fetch(embed.video.proxyURL + "?format=jpeg") + .then((res) => res.arrayBuffer()) + .then((buf) => Buffer.from(buf)); + break; + } } } @@ -244,7 +244,7 @@ async function createBoardMessage(msg, count) { threadID: VINBOARD_THREAD_ID, threadName: "Vinboard", embeds: [embed], - attachments: image.file ? {file: image.file, filename: "thumb.jpg"} : null, + files: image.file ? [{file: image.file, filename: "thumb.jpg"}] : null, }; }