From 15f709ed1378a9f0e85977bef9805ae596b2248e Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Fri, 18 Apr 2025 15:58:48 -0600 Subject: [PATCH] fedimbed.bluesky: deleted quote post support, better icons --- src/modules/fedimbed.js | 32 ++++++++++++++++++++++++-------- src/util/constants.js | 9 +++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index 75fd6e4..74fd914 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -9,6 +9,7 @@ const logger = require("#lib/logger.js"); const {hasFlag} = require("#lib/guildSettings.js"); const InteractionCommand = require("#lib/interactionCommand.js"); +const {Icons} = require("#util/constants.js"); const {MessageFlags, ApplicationCommandOptionTypes, Permissions} = require("#util/dconstants.js"); const {getUploadLimit} = require("#util/misc.js"); const {htmlToMarkdown} = require("#util/html.js"); @@ -308,10 +309,10 @@ function processBlueskyFacets(str, facets) { function getStatsBluesky(post) { const stats = []; - if (post.replyCount > 0) stats.push(`\u21a9 ${statsFormatter.format(post.replyCount)}`); - if (post.repostCount > 0) stats.push(`\ud83d\udd01 ${statsFormatter.format(post.repostCount)}`); - if (post.quoteCount > 0) stats.push(`\u2198 ${statsFormatter.format(post.quoteCount)}`); - if (post.likeCount > 0) stats.push(`\u2665 ${statsFormatter.format(post.likeCount)}`); + if (post.replyCount > 0) stats.push(`${Icons.fedimbed.reply} ${statsFormatter.format(post.replyCount)}`); + if (post.repostCount > 0) stats.push(`${Icons.fedimbed.repost} ${statsFormatter.format(post.repostCount)}`); + if (post.quoteCount > 0) stats.push(`${Icons.fedimbed.quote} ${statsFormatter.format(post.quoteCount)}`); + if (post.likeCount > 0) stats.push(`${Icons.fedimbed.like} ${statsFormatter.format(post.likeCount)}`); return stats.join("\u3000"); } @@ -325,6 +326,21 @@ async function blueskyQuoteEmbed(quote) { let spoiler = false; const tags = []; + if (quote.notFound) { + return { + components: [ + { + type: 10, + content: `-# ${Icons.fedimbed.quote} Quoted post was deleted`, + }, + ], + adult, + hidden, + spoiler, + tags, + }; + } + for (const label of quote.labels) { if (label.val === "!hide") { hidden = true; @@ -346,7 +362,7 @@ async function blueskyQuoteEmbed(quote) { const header = [ { type: 10, - content: "-# <:i:1308640087759654922> Quoted Post", + content: `-# ${Icons.fedimbed.quote} Quoted Post`, }, { type: 9, @@ -426,7 +442,7 @@ async function blueskyQuoteEmbed(quote) { components: [ { type: 10, - content: `${getStatsBluesky(quote)}\n<:i:1362895346690424832> Bluesky \u2022 `, }, @@ -626,7 +642,7 @@ async function bluesky(msg, url, spoiler = false) { let context = ""; if (data.thread.parent) { const reply = data.thread.parent.post; - context = `-# <:i:1308640078825787412> Replying to: [${reply.author.displayName} (@${ + context = `-# ${Icons.fedimbed.reply} Replying to: [${reply.author.displayName} (@${ reply.author.handle })](https://bsky.app/profile/${reply.author.did}/post/${reply.uri.substring(reply.uri.lastIndexOf("/") + 1)})`; } @@ -665,7 +681,7 @@ async function bluesky(msg, url, spoiler = false) { components: [ { type: 10, - content: `${getStatsBluesky(post)}\n<:i:1362895346690424832> Bluesky \u2022 `, }, diff --git a/src/util/constants.js b/src/util/constants.js index 08930bd..d213135 100644 --- a/src/util/constants.js +++ b/src/util/constants.js @@ -575,6 +575,15 @@ module.exports.Icons = { offline: "<:i:1273105449318875228>", blank: "<:i:1273123564173918268>", boat: "<:i:1273105457661087755>", + fedimbed: { + quote: "<:i:1308640087759654922>", + reply: "<:i:1308640078825787412>", + repost: "<:i:1362905247181439168>", + like: "<:i:1362907286263300356>", + bookmark: "<:i:1362908185781997719>", + views: "<:i:1362909322597765270>", + bluesky: "<:i:1362895346690424832>", + }, }; module.exports.ChannelTypeNames = {