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