Public
Script
October 23, 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import process from "node:process";
import { postToMastodon } from "https://esm.town/v/sebdd/postToMastodon";
import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems?v=6";
export async function tootLatestPosts({ lastRunAt }: Interval) {
return Promise.all(
(await newRSSItems({
url: "https://sebastiandedeyne.com/index.xml",
lastRunAt,
}))
.slice(0, 2)
.map((item) =>
postToMastodon(
"https://mastodon.social/api/v1",
process.env.mastodonAccessToken,
`${item.title.charAt(0) === "โ" ? "๐" : "โ๏ธ"} ${
item.title.replace("โ ", "")
} ${item.link}`,
)
),
);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
October 23, 2023
Blog context: https://sebastiandedeyne.com/auto-tooting-new-posts-with-val-town