this repo has no description
at main 870 B view raw
1#!/usr/bin/env bun 2import { AtpAgent } from '@atproto/api' 3 4// Read credentials from .env file 5const username = process.env.BSKY_USERNAME 6const password = process.env.BSKY_PASSWORD 7 8if (!username || !password) { 9 console.error('Please provide BSKY_USERNAME and BSKY_PASSWORD in .env file') 10 console.error('Format:') 11 console.error('BSKY_USERNAME=your-handle.bsky.social') 12 console.error('BSKY_PASSWORD=xxxx-xxxx-xxxx-xxxx') 13 process.exit(1) 14} 15 16async function main() { 17 const agent = new AtpAgent({ service: 'https://bsky.social' }) 18 19 await agent.login({ 20 identifier: username, 21 password: password 22 }) 23 24 console.log('Connected! Your DID:', agent.session?.did) 25 26 // Your code here! 27 // Try: 28 // - agent.post({ text: 'Hello world!' }) 29 // - agent.getProfile({ actor: agent.session.did }) 30 // - agent.getTimeline() 31 32} 33 34main().catch(console.error)