diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index b3c4bde..d056f8a 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -1456,15 +1456,25 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote = }, }; if (images.length > 0) { + const overMax = images.length + videos.length > 40; if (images.length > 10) { + let i = 0; while (images.length > 10) { + let max = 10; + if (i == 3 && overMax) { + if (videos.length > 0) max -= videos.length; + } + if (i == 4) break; + container.components.push({ type: 12, - items: images.splice(0, 10), + items: images.splice(0, max), }); + i++; } } + // FIXME: guhhhhhh math container.components.push({ type: 12, items: images, @@ -1478,7 +1488,8 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote = }); } - if (audios.length > 0) { + // FIXME: splitting if >5 + if (audios.length > 0 && audios.length < 6) { container.components.push( { type: 10, @@ -1512,11 +1523,7 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote = } else { quoteComponents.splice(0, 0, {type: 10, content: quoteContext}); } - if (container.components.length + quoteComponents.length + 1 > 10) { - components.push(quoteComponents); - } else { - container.components.push({type: 14}, ...quoteComponents); - } + container.components.push({type: 14}, ...quoteComponents); } return {