fedimbed: minor fixes and more debug
This commit is contained in:
parent
c031f23a53
commit
13fd5a9899
1 changed files with 14 additions and 7 deletions
|
@ -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",
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue