-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] Automatic facet parsing #68
Comments
For Hashtags and base-level URLs (where you have a raw URL in the post, but don't want to embed it inside of other text for an anchor link), then a generic ParseFacets could be done, but for Mentions, it's tricky. Those need to be So, it would need to be That said, a generic FishyFlip/src/FishyFlip/Models/Facet.cs Lines 55 to 82 in 822c319
For handles, I think it's best left to the developer to figure out how to get the For creating the Facets themselves, I can see a generic All that said, if you have an implementation for your idea in mind, you (or anyone else!) are welcome to PR it and I'll be happy to review. |
Looks like the ATProto TypeScript SDK parses the handles and requires you to fetch your own DIDs: https://github.com/bluesky-social/atproto/blob/main/packages/api/src/rich-text/detection.ts - so makes sense. I don't really have much of an impl in mind, but it's possible that this somewhat-canonical impl can be ported. |
@NotNite I made some changes with #73 to add more helper methods var postText = "@drasticactions.dev This is a #test #test of #testing the #FishyFlip #API. https://github.com/drasticactions DAHome. @drasticactions.jp https://github.com/drasticactions/FishyFlip @drasticactions.dev Weee!";
var postHandles = ATHandle.FromPostText(postText);
var feedProfiles = (await atProtocol.Actor.GetProfilesAsync(postHandles)).HandleResult();
var handleFacets = Facet.ForMentions(postText, feedProfiles!.Profiles!);
var hashtagFacets = Facet.ForHashtags(postText);
var uriFacets = Facet.ForUris(postText);
var baseUriFacets = Facet.ForUris(postText, "DAHome", "https://github.com/drasticactions");
var facets = handleFacets.Concat(hashtagFacets).Concat(uriFacets).Concat(baseUriFacets).ToArray();
var result = (await atProtocol.Repo.CreatePostAsync(postText, facets)).HandleResult(); In short, take your post text and pass it through the various For Handles, you can generate them with either an array of https://www.nuget.org/packages/FishyFlip/2.1.0-alpha.20 Try it out and let me know what you think. |
I'm working on an app for Bluesky. My code path receives a
string content
and then I directly post that, but of course the facets are missing from the post, so any links/hashtags/mentions/etc don't work. It would be nice to have an API like:so I can automatically detect facets in the post text without having to implement my own parser.
The text was updated successfully, but these errors were encountered: