クイックスタート

handle=yui.syui.ai
curl -sL "https://bsky.social/xrpc/com.atproto.repo.listRecords?repo=${handle}&collection=app.bsky.feed.post&limit=1"

例えば、blueskyで@yui.syui.ai /cardとmention(メンション)するには以下のコマンドを実行します。

data=`curl -sL -X POST -H "Content-Type: application/json" -d "{\"identifier\":\"$handle\",\"password\":\"$pass\"}" https://bsky.social/xrpc/com.atproto.server.createSession`
token=`echo $data|jq -r .accessJwt`

did=`echo $data|jq -r .did`

handle_m=yui.syui.ai
did_m=`curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" "https://bsky.social/xrpc/app.bsky.actor.getProfile?actor=${handle_m}"|jq -r .did`

at=@${handle_m}
s=0
e=`echo $at|wc -c`
col=app.bsky.feed.post
created_at=`date --iso-8601=seconds`

text="$at /card"
json="{
        \"did\": \"$did\",
        \"repo\": \"$handle\",
        \"collection\": \"$col\",
        \"record\": {
            \"text\": \"$text\",
            \"\$type\": \"$col\",
            \"createdAt\": \"$created_at\",
            \"facets\": [
            {
                \"\$type\": \"app.bsky.richtext.facet\",
                \"index\": {
                    \"byteEnd\": $e,
                    \"byteStart\": $s
                },\"features\": [
                {
                    \"did\": \"$did_m\",
                    \"\$type\": \"app.bsky.richtext.facet#mention\"
                }
                ]
            }
            ]
        }
}"
curl -sL -X POST -H "Content-Type: application/json" \
         -H "Authorization: Bearer $token" \
         -d "$json" \
         https://bsky.social/xrpc/com.atproto.repo.createRecord

results matching ""

    No results matching ""