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,13 +564,16 @@ async function processUrl(msg, url, spoiler = false) {
|
||||||
};
|
};
|
||||||
if (images.length > 0) {
|
if (images.length > 0) {
|
||||||
if (images.length > 1) {
|
if (images.length > 1) {
|
||||||
baseEmbed.fields.push({
|
const links = images
|
||||||
name: "Images",
|
.map((attachment, index) => `[Image ${index + 1}](${attachment.url})`)
|
||||||
value: images
|
.join(" | ");
|
||||||
.map((attachment, index) => `[Image ${index + 1}](${attachment.url})`)
|
|
||||||
.join(" | "),
|
if (links.length <= 1024)
|
||||||
inline: true,
|
baseEmbed.fields.push({
|
||||||
});
|
name: "Images",
|
||||||
|
value: links,
|
||||||
|
inline: true,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
baseEmbed.fields.push({
|
baseEmbed.fields.push({
|
||||||
name: "Image",
|
name: "Image",
|
||||||
|
@ -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