fix
This commit is contained in:
parent
dc7df561c3
commit
b6b1e341f2
@ -47,7 +47,7 @@ case $1 in
|
||||
;;
|
||||
create-game-user)
|
||||
source $d/src/ai/syui/game/character.zsh
|
||||
ai_create_user $2
|
||||
create_game_user $2
|
||||
;;
|
||||
get-game-user)
|
||||
source $d/src/ai/syui/game/character.zsh
|
||||
|
@ -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
|
||||
rkey=$1
|
||||
did=$did_yui
|
||||
@ -306,59 +332,9 @@ if echo $json|jq . ;then
|
||||
echo $t|jq .
|
||||
f=~/ai/ue/json/v${version}_${rkey}.json
|
||||
if [ -f $f ];then
|
||||
echo $t|jq . >! $f
|
||||
get_game_user $rkey >! $f
|
||||
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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user