foxwells.vinboard: fix proxyURL missing
This commit is contained in:
parent
ebff919f50
commit
06646e01f5
1 changed files with 25 additions and 6 deletions
|
@ -198,7 +198,13 @@ async function findSuitableImage(msg) {
|
||||||
} else if (embed.video) {
|
} else if (embed.video) {
|
||||||
out.video = true;
|
out.video = true;
|
||||||
out.url = "attachment://thumb.jpg";
|
out.url = "attachment://thumb.jpg";
|
||||||
out.file = await fetch(embed.video.proxyURL + "?format=jpeg")
|
out.file = await fetch(
|
||||||
|
(embed.video.proxyURL ??
|
||||||
|
embed.video.url.replace(
|
||||||
|
"cdn.discordapp.com",
|
||||||
|
"media.discordapp.net"
|
||||||
|
)) + "?format=jpeg"
|
||||||
|
)
|
||||||
.then((res) => res.arrayBuffer())
|
.then((res) => res.arrayBuffer())
|
||||||
.then((buf) => Buffer.from(buf));
|
.then((buf) => Buffer.from(buf));
|
||||||
break;
|
break;
|
||||||
|
@ -243,7 +249,9 @@ async function createBoardMessage(msg, count, fetchAttachment = true) {
|
||||||
username: msg.member?.displayName ?? msg.author.username,
|
username: msg.member?.displayName ?? msg.author.username,
|
||||||
threadID: VINBOARD_THREAD_ID,
|
threadID: VINBOARD_THREAD_ID,
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
attachments: image?.file ? [{file: image.file, filename: "thumb.jpg"}] : null,
|
attachments: image?.file
|
||||||
|
? [{file: image.file, filename: "thumb.jpg"}]
|
||||||
|
: null,
|
||||||
wait: true,
|
wait: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -335,25 +343,36 @@ async function processReaction(_msg, reaction, user) {
|
||||||
);
|
);
|
||||||
props.embeds[0].title = `${trueCount} \u2b50`;
|
props.embeds[0].title = `${trueCount} \u2b50`;
|
||||||
props.embeds[0].color = pastelize(msg.author.username);
|
props.embeds[0].color = pastelize(msg.author.username);
|
||||||
await hf.bot.editWebhookMessage(vinboard_webhook.id, vinboard_webhook.token, _boardMessage.id, props);
|
await hf.bot.editWebhookMessage(
|
||||||
|
vinboard_webhook.id,
|
||||||
|
vinboard_webhook.token,
|
||||||
|
_boardMessage.id,
|
||||||
|
props
|
||||||
|
);
|
||||||
await setBoardEntry(msg.id, trueCount, _boardMessage.id);
|
await setBoardEntry(msg.id, trueCount, _boardMessage.id);
|
||||||
} else {
|
} else {
|
||||||
logger.verbose("vinboard", `Creating entry for "${msg.id}"`);
|
logger.verbose("vinboard", `Creating entry for "${msg.id}"`);
|
||||||
const boardMessage = await hf.bot.executeWebhook(vinboard_webhook.id, vinboard_webhook.token,
|
const boardMessage = await hf.bot.executeWebhook(
|
||||||
|
vinboard_webhook.id,
|
||||||
|
vinboard_webhook.token,
|
||||||
await createBoardMessage(msg, trueCount)
|
await createBoardMessage(msg, trueCount)
|
||||||
);
|
);
|
||||||
await setBoardEntry(msg.id, trueCount, boardMessage.id);
|
await setBoardEntry(msg.id, trueCount, boardMessage.id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.verbose("vinboard", `Creating entry for "${msg.id}"`);
|
logger.verbose("vinboard", `Creating entry for "${msg.id}"`);
|
||||||
const boardMessage = await hf.bot.executeWebhook(vinboard_webhook.id, vinboard_webhook.token,
|
const boardMessage = await hf.bot.executeWebhook(
|
||||||
|
vinboard_webhook.id,
|
||||||
|
vinboard_webhook.token,
|
||||||
await createBoardMessage(msg, trueCount)
|
await createBoardMessage(msg, trueCount)
|
||||||
);
|
);
|
||||||
await setBoardEntry(msg.id, trueCount, boardMessage.id);
|
await setBoardEntry(msg.id, trueCount, boardMessage.id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.verbose("vinboard", `Creating entry for "${msg.id}"`);
|
logger.verbose("vinboard", `Creating entry for "${msg.id}"`);
|
||||||
const boardMessage = await hf.bot.executeWebhook(vinboard_webhook.id, vinboard_webhook.token,
|
const boardMessage = await hf.bot.executeWebhook(
|
||||||
|
vinboard_webhook.id,
|
||||||
|
vinboard_webhook.token,
|
||||||
await createBoardMessage(msg, trueCount)
|
await createBoardMessage(msg, trueCount)
|
||||||
);
|
);
|
||||||
await setBoardEntry(msg.id, trueCount, boardMessage.id);
|
await setBoardEntry(msg.id, trueCount, boardMessage.id);
|
||||||
|
|
Loading…
Reference in a new issue