this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

two

alice 4d300971 371c7329

+74 -31
+55 -31
index.ts
··· 1 - import pkg from '@atproto/api'; 2 - const { BskyAgent } = pkg; 1 + import bsky from '@atproto/api'; 2 + const { BskyAgent, RichText } = bsky; 3 3 import * as dotenv from 'dotenv'; 4 4 import process from 'node:process'; 5 5 dotenv.config(); ··· 16 16 password: process.env.BSKY_PASSWORD!, 17 17 }); 18 18 19 - const bloot = 20 - 'You can find the code for this bleet >>>here<<<, now with a link card that has a nice title and description!'; 21 - await agent.post({ 22 - text: bloot, 23 - entities: [ 24 - { 25 - index: { start: bloot.indexOf('>>>') + 3, end: bloot.indexOf('<<<') }, 26 - type: 'link', 27 - value: 'https://github.com/aliceisjustplaying/bluesky-experiments', 19 + const one = false; 20 + 21 + if (one) { 22 + const bloot = 23 + 'You can find the code for this bleet >>>here<<<, now with a link card that has a nice title and description!'; 24 + await agent.post({ 25 + text: bloot, 26 + entities: [ 27 + { 28 + index: { start: bloot.indexOf('>>>') + 3, end: bloot.indexOf('<<<') }, 29 + type: 'link', 30 + value: 'https://github.com/aliceisjustplaying/bluesky-experiments', 31 + }, 32 + ], 33 + embed: { 34 + $type: 'app.bsky.embed.external', 35 + external: { 36 + uri: 'https://github.com/aliceisjustplaying/bluesky-experiments', 37 + title: "alice's bluesky experiments", 38 + description: "now i'm just playing around with the api", 39 + }, 28 40 }, 29 - ], 30 - // facets: [ 31 - // { 32 - // index: { byteStart: bloot.indexOf('>>>') + 3, byteEnd: bloot.indexOf('<<<') }, 33 - // features: [ 34 - // { 35 - // $type: 'app.bsky.richtext.facet#link', 36 - // uri: 'https://github.com/aliceisjustplaying/bluesky-experiments', 37 - // }, 38 - // ], 39 - // }, 40 - // ], 41 - embed: { 42 - $type: 'app.bsky.embed.external', 43 - external: { 44 - uri: 'https://github.com/aliceisjustplaying/bluesky-experiments', 45 - title: "alice's bluesky experiments", 46 - description: "now i'm just playing around with the api", 41 + }); 42 + } 43 + 44 + const two = true; 45 + 46 + if (two) { 47 + const flirt = `could have saved myself some trouble by 48 + 49 + *checks notes* 50 + 51 + reading the README but hey I managed to discover features the app client/web doesn't have yet. 52 + 53 + autogenerated link, but no card yet: https://github.com/aliceisjustplaying/bluesky-experiments`; 54 + const rt = new RichText({ text: flirt }); 55 + rt; 56 + await rt.detectFacets(agent); // automatically detects mentions and links 57 + await agent.post({ 58 + $type: 'app.bsky.feed.post', 59 + text: rt.text, 60 + facets: rt.facets, 61 + createdAt: new Date().toISOString(), 62 + reply: { 63 + root: { 64 + uri: 'at://did:plc:by3jhwdqgbtrcc7q4tkkv3cf/app.bsky.feed.post/3jszamd374c2h', 65 + cid: 'bafyreidt72dmp3dsq5qs5mocrauyj3ctwzyywxnjcd45rde2quae3zanjq', 66 + }, 67 + parent: { 68 + uri: 'at://did:plc:by3jhwdqgbtrcc7q4tkkv3cf/app.bsky.feed.post/3jszamd374c2h', 69 + cid: 'bafyreidt72dmp3dsq5qs5mocrauyj3ctwzyywxnjcd45rde2quae3zanjq', 70 + }, 47 71 }, 48 - }, 49 - }); 72 + }); 73 + }
+19
payload-reply-example.json
··· 1 + { 2 + "collection": "app.bsky.feed.post", 3 + "repo": "did:plc:by3jhwdqgbtrcc7q4tkkv3cf", 4 + "record": { 5 + "text": "this is a reply", 6 + "reply": { 7 + "root": { 8 + "uri": "at://did:plc:by3jhwdqgbtrcc7q4tkkv3cf/app.bsky.feed.post/3jszamd374c2h", 9 + "cid": "bafyreidt72dmp3dsq5qs5mocrauyj3ctwzyywxnjcd45rde2quae3zanjq" 10 + }, 11 + "parent": { 12 + "uri": "at://did:plc:by3jhwdqgbtrcc7q4tkkv3cf/app.bsky.feed.post/3jszamd374c2h", 13 + "cid": "bafyreidt72dmp3dsq5qs5mocrauyj3ctwzyywxnjcd45rde2quae3zanjq" 14 + } 15 + }, 16 + "createdAt": "2023-04-10T11:37:37.791Z", 17 + "$type": "app.bsky.feed.post" 18 + } 19 + }