export async function post_to_bsky(text, identifier, password) {
const { default: bsky } = await import("npm:@atproto/api");
const { BskyAgent, RichText } = bsky;
const agent = new BskyAgent({ service: "https://bsky.social" });
await agent.login({ identifier, password });
const post = new RichText({ text });
await post.detectFacets(agent);
const postRecord = {
$type: "app.bsky.feed.post",
text: post.text,
facets: post.facets,
createdAt: new Date().toISOString(),
};
return await agent.post(postRecord);
}