fedimbed: potentially better spacing between stats and timestamp

This commit is contained in:
Cynthia Foxwell 2025-04-19 16:03:56 -06:00
parent 31d61af27e
commit efcd4fbe7b
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -443,7 +443,7 @@ async function blueskyQuoteEmbed(quote) {
components: [ components: [
{ {
type: 10, type: 10,
content: `-# ${getStatsBluesky(quote)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor( content: `### -# ${getStatsBluesky(quote)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
new Date(quote.value.createdAt).getTime() / 1000 new Date(quote.value.createdAt).getTime() / 1000
)}:F>`, )}:F>`,
}, },
@ -682,7 +682,7 @@ async function bluesky(msg, url, spoiler = false) {
components: [ components: [
{ {
type: 10, type: 10,
content: `-# ${getStatsBluesky(post)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor( content: `### -# ${getStatsBluesky(post)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
new Date(post.record.createdAt).getTime() / 1000 new Date(post.record.createdAt).getTime() / 1000
)}:F>`, )}:F>`,
}, },
@ -1443,7 +1443,7 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
components: [ components: [
{ {
type: 10, type: 10,
content: `${stats.length > 0 ? "-# " + stats + "\n" : ""}${ content: `${stats.length > 0 ? "### -# " + stats + "\n" : ""}${
footerIcon ? footerIcon + " " : "" footerIcon ? footerIcon + " " : ""
}${platformName} \u2022 <t:${Math.floor(new Date(timestamp).getTime() / 1000)}:F>`, }${platformName} \u2022 <t:${Math.floor(new Date(timestamp).getTime() / 1000)}:F>`,
}, },
@ -1502,6 +1502,8 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
container.components.push(footer); container.components.push(footer);
const components = [cw.length > 0 && warningText, container];
if (quoteRes) { if (quoteRes) {
const quoteComponents = quoteRes.response.components[0].components; const quoteComponents = quoteRes.response.components[0].components;
const quoteContext = `-# ${Icons.fedimbed.quote} Quoted Post`; const quoteContext = `-# ${Icons.fedimbed.quote} Quoted Post`;
@ -1510,13 +1512,17 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
} else { } else {
quoteComponents.splice(0, 0, {type: 10, content: quoteContext}); quoteComponents.splice(0, 0, {type: 10, content: quoteContext});
} }
container.components.push({type: 14}, ...quoteComponents); if (container.components.length + quoteComponents.length + 1 > 10) {
components.push(quoteComponents);
} else {
container.components.push({type: 14}, ...quoteComponents);
}
} }
return { return {
response: { response: {
flags: 1 << 15, flags: 1 << 15,
components: [cw.length > 0 && warningText, container].filter((x) => !!x), components: components.filter((x) => !!x),
allowedMentions: { allowedMentions: {
repliedUser: false, repliedUser: false,
}, },