Runs every 15 min
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import process from "node:process";
import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts";
export async function hnValTown({ lastRunAt }: Interval) {
let posts = await hnLatestPosts({
query: '"val town" || "val.town"',
lastSyncTime: lastRunAt,
search_by_date: true,
});
let { text } = await hnEmail({ posts, footer: false });
if (posts.length) {
await discordWebhook({
url: process.env.mentionsDiscord,
content: text,
});
}
}
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.