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 > 1) {
|
||||
const links = images
|
||||
.map((attachment, index) => `[Image ${index + 1}](${attachment.url})`)
|
||||
.join(" | ");
|
||||
|
||||
if (links.length <= 1024)
|
||||
baseEmbed.fields.push({
|
||||
name: "Images",
|
||||
value: images
|
||||
.map((attachment, index) => `[Image ${index + 1}](${attachment.url})`)
|
||||
.join(" | "),
|
||||
value: links,
|
||||
inline: true,
|
||||
});
|
||||
} else {
|
||||
|
@ -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",
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue