AI agent skills related to using social media
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

More improvements to `bluesky_open`

+46 -11
+6 -1
atproto/xrpc.rkt
··· 40 40 (hash-set base-headers 'atproto-proxy service) 41 41 base-headers)) 42 42 (define response (get (format "~a/xrpc/~a~a" pds-url method-nsid query-string) #:headers headers)) 43 - (check-response-ok 'agent-xrpc-get response) 43 + (unless (<= 200 (response-status-code response) 299) 44 + (raise-arguments-error 'agent-xrpc-get "received a non-2XX HTTP response" 45 + "xrpc endpoint" method-nsid 46 + "response code" (response-status-code response) 47 + "message" (response-status-message response) 48 + "response" (response-json response))) 44 49 (response-json response)) 45 50 46 51
+9
bluesky/info.rkt
··· 1 + #lang info 2 + 3 + 4 + (define racket-launcher-names 5 + (list "bluesky_open")) 6 + 7 + 8 + (define racket-launcher-libraries 9 + (list "open-app.rkt"))
+31 -10
bluesky/open-app.rkt
··· 3 3 4 4 (require net/http-easy 5 5 racket/list 6 + racket/match 6 7 racket/string 7 8 rebellion/streaming/reducer 8 9 rebellion/streaming/transducer ··· 13 14 social-skills/private/check-response-ok) 14 15 15 16 17 + (module+ main 18 + (require racket/cmdline)) 19 + 20 + 16 21 ;@---------------------------------------------------------------------------------------------------- 17 22 18 23 ··· 20 25 (define agent-name (bluesky-lookup-name (agent-atproto-did) (agent-atproto-app-password))) 21 26 (printf "You are ~a on Bluesky. Choose an action:\n" agent-name) 22 27 (newline) 23 - (printf " - Open your notifications ~a(`open-notifictions`)\n" (unread-notifications-badge)) 24 - (printf " - Open your DMs ~a(`open-dms`)\n" (unread-dms-badge)) 25 - (printf " - Read your timeline (`read-timeline`)\n")) 28 + (printf " - Open your notifications ~a(`bluesky_open_notifictions`)\n" (unread-notifications-badge)) 29 + (printf " - Open your DMs ~a(`bluesky_open_dms`)\n" (unread-dms-badge)) 30 + (print-feeds)) 31 + 32 + 33 + (define (print-feeds) 34 + (define saved-feeds-preference 35 + (transduce (hash-ref (agent-xrpc-get "app.bsky.actor.getPreferences") 'preferences) 36 + (filtering 37 + (λ (pref) (equal? (hash-ref pref '$type) "app.bsky.actor.defs#savedFeedsPrefV2"))) 38 + #:into into-only-element)) 39 + (for ([feed (in-list (hash-ref saved-feeds-preference 'items))]) 40 + (match (hash-ref feed 'type) 41 + ["feed" 42 + (define feed-url (hash-ref feed 'value)) 43 + (define feed-response (agent-xrpc-get "app.bsky.feed.getFeedGenerator" (hash 'feed feed-url))) 44 + (define feed-view (hash-ref feed-response 'view)) 45 + (printf " - Read your ~a feed (~a) (`bluesky_read_feed ~a`\n" 46 + (hash-ref feed-view 'displayName) 47 + (hash-ref feed-view 'description) 48 + feed-url)] 49 + ["timeline" 50 + (printf " - Read your timeline (`bluesky_read_timeline`)\n")]))) 26 51 27 52 28 53 (define (bluesky-lookup-name user-did app-password-file) ··· 57 82 58 83 59 84 (module+ main 60 - ; TODO: replace manual main code with racket/cmdline tool 61 - (define agent-vars 62 - (make-environment-variables 63 - #"AGENT_ATPROTO_DID" #"did:plc:36zqqogbeg4i3nsqfkq64idw" 64 - #"AGENT_ATPROTO_APP_PASSWORD" #"/Users/jackfirth/.claude-social/app-password")) 65 - (parameterize ([current-environment-variables agent-vars]) 66 - (bluesky-open-app))) 85 + (command-line 86 + #:args () 87 + (bluesky-open-app)))