fedimbed: move timestamp next to username in minimal
This commit is contained in:
parent
cafe25d614
commit
71829a58ac
1 changed files with 60 additions and 71 deletions
|
@ -381,7 +381,9 @@ async function blueskyQuoteEmbed(quote, minimal = false) {
|
|||
? [
|
||||
{
|
||||
type: 10,
|
||||
content: `### ${Icons.fedimbed.quote} [${quote.author.displayName} (@${quote.author.handle})](${quoteUrl})\n${content}`,
|
||||
content: `### ${Icons.fedimbed.quote} [${quote.author.displayName} (@${
|
||||
quote.author.handle
|
||||
})](${quoteUrl}) \u2022 <t:${Math.floor(new Date(quote.value.createdAt).getTime() / 1000)}:F>\n${content}`,
|
||||
},
|
||||
]
|
||||
: [
|
||||
|
@ -456,28 +458,23 @@ async function blueskyQuoteEmbed(quote, minimal = false) {
|
|||
}
|
||||
}
|
||||
|
||||
const footer = minimal
|
||||
? {
|
||||
const footer = {
|
||||
type: 9,
|
||||
components: [
|
||||
{
|
||||
type: 10,
|
||||
content: `<t:${Math.floor(new Date(quote.value.createdAt).getTime() / 1000)}:F>`,
|
||||
}
|
||||
: {
|
||||
type: 9,
|
||||
components: [
|
||||
{
|
||||
type: 10,
|
||||
content: `### -# ${getStatsBluesky(quote)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
|
||||
new Date(quote.value.createdAt).getTime() / 1000
|
||||
)}:F>`,
|
||||
},
|
||||
],
|
||||
accessory: {
|
||||
type: 2,
|
||||
style: 5,
|
||||
label: "View Post",
|
||||
url: quoteUrl,
|
||||
},
|
||||
};
|
||||
content: `### -# ${getStatsBluesky(quote)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
|
||||
new Date(quote.value.createdAt).getTime() / 1000
|
||||
)}:F>`,
|
||||
},
|
||||
],
|
||||
accessory: {
|
||||
type: 2,
|
||||
style: 5,
|
||||
label: "View Post",
|
||||
url: quoteUrl,
|
||||
},
|
||||
};
|
||||
|
||||
if (images.length > 0) {
|
||||
components.push({
|
||||
|
@ -491,7 +488,7 @@ async function blueskyQuoteEmbed(quote, minimal = false) {
|
|||
items: [video],
|
||||
});
|
||||
}
|
||||
components.push(footer);
|
||||
if (!minimal) components.push(footer);
|
||||
|
||||
return {components, adult, hidden, spoiler, tags};
|
||||
}
|
||||
|
@ -680,7 +677,9 @@ async function bluesky(msg, url, spoiler = false, minimal = false) {
|
|||
const contentComponent = {
|
||||
type: 10,
|
||||
content: minimal
|
||||
? `### [${post.author.displayName} (@${post.author.handle})](${url})\n${content}`
|
||||
? `### [${post.author.displayName} (@${post.author.handle})](${url}) \u2022 <t:${Math.floor(
|
||||
new Date(post.record.createdAt).getTime() / 1000
|
||||
)}:F>\n${content}`
|
||||
: `## ${post.author.displayName}\n-# [@${post.author.handle}](https://bsky.app/profile/${post.author.did})\n${content}`,
|
||||
};
|
||||
|
||||
|
@ -704,28 +703,23 @@ async function bluesky(msg, url, spoiler = false, minimal = false) {
|
|||
].filter((x) => !!x);
|
||||
container.components.push(...header);
|
||||
|
||||
const footer = minimal
|
||||
? {
|
||||
const footer = {
|
||||
type: 9,
|
||||
components: [
|
||||
{
|
||||
type: 10,
|
||||
content: `<t:${Math.floor(new Date(post.record.createdAt).getTime() / 1000)}:F>`,
|
||||
}
|
||||
: {
|
||||
type: 9,
|
||||
components: [
|
||||
{
|
||||
type: 10,
|
||||
content: `### -# ${getStatsBluesky(post)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
|
||||
new Date(post.record.createdAt).getTime() / 1000
|
||||
)}:F>`,
|
||||
},
|
||||
],
|
||||
accessory: {
|
||||
type: 2,
|
||||
style: 5,
|
||||
label: "View Post",
|
||||
url,
|
||||
},
|
||||
};
|
||||
content: `### -# ${getStatsBluesky(post)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
|
||||
new Date(post.record.createdAt).getTime() / 1000
|
||||
)}:F>`,
|
||||
},
|
||||
],
|
||||
accessory: {
|
||||
type: 2,
|
||||
style: 5,
|
||||
label: "View Post",
|
||||
url,
|
||||
},
|
||||
};
|
||||
|
||||
if (images.length > 0) {
|
||||
container.components.push({
|
||||
|
@ -739,7 +733,7 @@ async function bluesky(msg, url, spoiler = false, minimal = false) {
|
|||
items: [video],
|
||||
});
|
||||
}
|
||||
container.components.push(footer);
|
||||
if (!minimal) container.components.push(footer);
|
||||
|
||||
if (quoteOnly && !hasQuote) return {};
|
||||
|
||||
|
@ -1410,7 +1404,9 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
|
|||
};
|
||||
|
||||
let headerContent = minimal
|
||||
? `### [${author.name ? `${author.name} (${author.handle})` : author.handle}](${realUrl})`
|
||||
? `### [${author.name ? `${author.name} (${author.handle})` : author.handle}](${realUrl}) \u2022 <t:${Math.floor(
|
||||
new Date(timestamp).getTime() / 1000
|
||||
)}:F>`
|
||||
: `${author.name ? `## ${author.name}\n` : ""}-# [${author.handle}](${author.url})`;
|
||||
|
||||
if (title) headerContent += minimal ? "\n**__" + title + "__**" : "\n### " + title;
|
||||
|
@ -1478,30 +1474,23 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
|
|||
}
|
||||
|
||||
const footerIcon = PLATFORM_ICONS[platformName.toLowerCase()];
|
||||
const footer = minimal
|
||||
? {
|
||||
const footer = {
|
||||
type: 9,
|
||||
components: [
|
||||
{
|
||||
type: 10,
|
||||
content: `${platformName === "Twitter" ? "" : platformName + " "}<t:${Math.floor(
|
||||
new Date(timestamp).getTime() / 1000
|
||||
)}:F>`,
|
||||
}
|
||||
: {
|
||||
type: 9,
|
||||
components: [
|
||||
{
|
||||
type: 10,
|
||||
content: `${stats.length > 0 ? "### -# " + stats + "\n" : ""}${
|
||||
footerIcon ? footerIcon + " " : ""
|
||||
}${platformName} \u2022 <t:${Math.floor(new Date(timestamp).getTime() / 1000)}:F>`,
|
||||
},
|
||||
],
|
||||
accessory: {
|
||||
type: 2,
|
||||
style: 5,
|
||||
label: "View Post",
|
||||
url: realUrl,
|
||||
},
|
||||
};
|
||||
content: `${stats.length > 0 ? "### -# " + stats + "\n" : ""}${
|
||||
footerIcon ? footerIcon + " " : ""
|
||||
}${platformName} \u2022 <t:${Math.floor(new Date(timestamp).getTime() / 1000)}:F>`,
|
||||
},
|
||||
],
|
||||
accessory: {
|
||||
type: 2,
|
||||
style: 5,
|
||||
label: "View Post",
|
||||
url: realUrl,
|
||||
},
|
||||
};
|
||||
if (images.length > 0) {
|
||||
const overMax = images.length + videos.length > 40;
|
||||
if (images.length > 10) {
|
||||
|
@ -1557,7 +1546,7 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
|
|||
);
|
||||
}
|
||||
|
||||
container.components.push(footer);
|
||||
if (!minimal) container.components.push(footer);
|
||||
|
||||
const components = [cw.length > 0 && warningText, container];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue