fedimbed: minor fixes and more debug

This commit is contained in:
Cynthia Foxwell 2023-11-29 02:10:04 -07:00
parent c031f23a53
commit 13fd5a9899

View file

@ -564,11 +564,14 @@ async function processUrl(msg, url, spoiler = false) {
}; };
if (images.length > 0) { if (images.length > 0) {
if (images.length > 1) { if (images.length > 1) {
const links = images
.map((attachment, index) => `[Image ${index + 1}](${attachment.url})`)
.join(" | ");
if (links.length <= 1024)
baseEmbed.fields.push({ baseEmbed.fields.push({
name: "Images", name: "Images",
value: images value: links,
.map((attachment, index) => `[Image ${index + 1}](${attachment.url})`)
.join(" | "),
inline: true, inline: true,
}); });
} else { } else {
@ -721,18 +724,22 @@ async function processUrl(msg, url, spoiler = false) {
if (images.length <= 14) { if (images.length <= 14) {
const fourteen = images.slice(10, 14); const fourteen = images.slice(10, 14);
logger.verbose("fedimbed", `fourteen: $(fourteen.length}`);
for (const attachment of fourteen) { for (const attachment of fourteen) {
const embed = Object.assign({}, baseEmbed); const embed = Object.assign({}, baseEmbed);
embed.image = { embed.image = {
url: attachment.url, url: attachment.url,
}; };
embeds.push(embed); embeds.push(embed);
logger.verbose("fedimbed", "mlem");
} }
} }
if (images.length <= 18) { if (images.length <= 18) {
const eighteen = images.slice(14, 18); const eighteen = images.slice(14, 18);
const _embed = { const _embed = {
color: baseEmbed.color,
url: baseEmbed.url + "?_", url: baseEmbed.url + "?_",
title: "Additional Images", title: "Additional Images",
}; };