Unlisted
Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { latest_rss as latest_rss2 } from "https://esm.town/v/jordan/latest_rss";
import process from "node:process";
export async function rss_to_bsky(text) {
import bsky from "npm:@atproto/api";
const { BskyAgent, RichText } = bsky;
const agent = new BskyAgent({ service: "https://bsky.social" });
await agent.login({
identifier: process.env.BLUESKY_USERNAME!,
password: process.env.BLUESKY_PASSWORD!,
});
const post = new RichText({ text: text });
await post.detectFacets(agent);
const postRecord = {
$type: 'app.bsky.feed.post',
text: post.text,
facets: post.facets,
createdAt: new Date().toISOString()
};
const latest_rss = latest_rss2;
if(latest_rss !== undefined) {
await agent.post(postRecord);
}
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023