import { email } from "https://esm.town/v/std/email?v=9";
import { hnEmail } from "https://esm.town/v/akkartik/hnEmail";
import { hnFollowLastSyncTime } from "https://esm.town/v/akkartik/hnFollowLastSyncTime";
import { hnAuthors } from "https://esm.town/v/akkartik/hnAuthors";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts?v=18";
export const hnFollow = async () => {
let posts = await hnLatestPosts({
authors: hnAuthors,
lastSyncTime: hnFollowLastSyncTime,
search_by_date: true,
});
if (!posts?.length) {
return;
}
let { text, subject } = await hnEmail({ posts });
await email({ html: text, subject });
};