fedimbed.bluesky: deleted quote post support, better icons
This commit is contained in:
parent
ec151a9e18
commit
15f709ed13
2 changed files with 33 additions and 8 deletions
|
@ -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 <t:${Math.floor(
|
||||
content: `-# ${getStatsBluesky(quote)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
|
||||
new Date(quote.value.createdAt).getTime() / 1000
|
||||
)}:F>`,
|
||||
},
|
||||
|
@ -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 <t:${Math.floor(
|
||||
content: `-# ${getStatsBluesky(post)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
|
||||
new Date(post.record.createdAt).getTime() / 1000
|
||||
)}:F>`,
|
||||
},
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue