ai/at
ai/at
1
0
This commit is contained in:
syui 2025-03-19 12:08:22 +09:00
parent dc7df561c3
commit b6b1e341f2
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
2 changed files with 29 additions and 53 deletions

View File

@ -47,7 +47,7 @@ case $1 in
;; ;;
create-game-user) create-game-user)
source $d/src/ai/syui/game/character.zsh source $d/src/ai/syui/game/character.zsh
ai_create_user $2 create_game_user $2
;; ;;
get-game-user) get-game-user)
source $d/src/ai/syui/game/character.zsh source $d/src/ai/syui/game/character.zsh

View File

@ -189,7 +189,33 @@ json="{
} }
function ai_create_user() { function get_game_user() {
rkey=$did.$pds
pds=bsky.social
if [ "$1" = "syui" ] || [ "$1" = "ai" ];then
rkey=$1
fi
req=com.atproto.repo.getRecord
url="https://$pds/xrpc/$req?rkey=$rkey&repo=$did_yui&collection=ai.syui.game"
curl -sL $url|jq .
}
delete_game_user() {
rkey=$2
if [ -z "$1" ];then
col=ai.syui.game
else
col=$1
fi
req=com.atproto.repo.DeleteRecord
url=https://$pds/xrpc/$req
repo=$did_yui
json="{\"collection\":\"$col\", \"rkey\":\"$rkey\", \"repo\":\"$repo\"}"
echo $json
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url
}
function create_game_user() {
col=ai.syui.game col=ai.syui.game
rkey=$1 rkey=$1
did=$did_yui did=$did_yui
@ -306,59 +332,9 @@ if echo $json|jq . ;then
echo $t|jq . echo $t|jq .
f=~/ai/ue/json/v${version}_${rkey}.json f=~/ai/ue/json/v${version}_${rkey}.json
if [ -f $f ];then if [ -f $f ];then
echo $t|jq . >! $f get_game_user $rkey >! $f
fi fi
fi fi
fi fi
#col=ai.syui.game
#rkey=self
#at_uri=at://$did_yui/ai.syui.game.user/ai
#
#json="
#{
# \"repo\": \"$handle_yui\",
# \"did\": \"$did_yui\",
# \"collection\": \"$col\",
# \"rkey\": \"$rkey\",
# \"record\": {
# \"account\": \"$at_uri\",
# \"username\": \"ai\",
# \"createdAt\": \"$created\"
#}
#}"
#
#if echo $json|jq . ;then
# echo y
# read y
# if [ "y" = "$y" ];then
# curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url
# fi
#fi
} }
get_game_user() {
rkey=$did.$pds
pds=bsky.social
if [ "$1" = "syui" ] || [ "$1" = "ai" ];then
rkey=$1
fi
req=com.atproto.repo.getRecord
url="https://$pds/xrpc/$req?rkey=$rkey&repo=$did_yui&collection=ai.syui.game"
curl -sL $url|jq .
}
delete_game_user() {
rkey=$2
if [ -z "$1" ];then
col=ai.syui.game
else
col=$1
fi
req=com.atproto.repo.DeleteRecord
url=https://$pds/xrpc/$req
repo=$did_yui
json="{\"collection\":\"$col\", \"rkey\":\"$rkey\", \"repo\":\"$repo\"}"
echo $json
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url
}