bugfix: #394 Bluesky posts now support "richtext" (URLs, tags, etc)

This commit is contained in:
jamesread 2024-10-28 23:34:22 +00:00
parent 48634c554b
commit fab0b524b7
1 changed files with 9 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import {
} from '@gitroom/nestjs-libraries/integrations/social/social.integrations.interface';
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
import { BskyAgent } from '@atproto/api';
import { BskyAgent, RichText } from '@atproto/api';
import dayjs from 'dayjs';
import { Integration } from '@prisma/client';
import { AuthService } from '@gitroom/helpers/auth/auth.service';
@ -132,9 +132,16 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
}) || []
);
const rt = new RichText({
text: post.message,
})
await rt.detectFacets(agent)
// @ts-ignore
const { cid, uri, commit } = await agent.post({
text: post.message,
text: rt.text,
facets: rt.facets,
createdAt: new Date().toISOString(),
...(images.length
? {