fix
This commit is contained in:
parent
d990a50541
commit
a4e7520431
10
scpt/at.zsh
10
scpt/at.zsh
@ -45,10 +45,18 @@ case $1 in
|
||||
source $d/src/ai/syui/game/character.zsh
|
||||
create_game_character
|
||||
;;
|
||||
ai-create-user)
|
||||
create-game-user)
|
||||
source $d/src/ai/syui/game/character.zsh
|
||||
ai_create_user $2
|
||||
;;
|
||||
get-game-user)
|
||||
source $d/src/ai/syui/game/character.zsh
|
||||
get_game_user $2
|
||||
;;
|
||||
delete-game-user)
|
||||
source $d/src/ai/syui/game/character.zsh
|
||||
delete_game_user $2 $3
|
||||
;;
|
||||
*)
|
||||
echo "${help[@]}"
|
||||
echo "${host[@]}"
|
||||
|
@ -1,4 +1,3 @@
|
||||
echo $token
|
||||
character=(
|
||||
ai
|
||||
manny
|
||||
@ -191,7 +190,7 @@ json="{
|
||||
}
|
||||
|
||||
function ai_create_user() {
|
||||
col=ai.syui.game.user
|
||||
col=ai.syui.game
|
||||
rkey=$1
|
||||
did=$did_yui
|
||||
handle=$handle_yui
|
||||
@ -211,6 +210,8 @@ function ai_create_user() {
|
||||
fi
|
||||
if [ "$rkey" = "syui" ];then
|
||||
cname=chinese
|
||||
did=$did_syui
|
||||
handle=syui.ai
|
||||
cid=bafkreidlealfybajqzwv5eoz4jshnsijc2vnktlhpw4ph47krwj6aigqby
|
||||
gender=male
|
||||
fi
|
||||
@ -271,6 +272,8 @@ function ai_create_user() {
|
||||
\"rkey\": \"$rkey\",
|
||||
\"record\": {
|
||||
\"version\": 2,
|
||||
\"did\": \"$did\",
|
||||
\"handle\": \"$handle\",
|
||||
\"player\": {
|
||||
\"did\": \"$did\",
|
||||
\"handle\": \"$handle\",
|
||||
@ -296,29 +299,54 @@ if echo $json|jq . ;then
|
||||
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\"
|
||||
#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
|
||||
}
|
||||
}"
|
||||
|
||||
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
|
||||
get_game_user() {
|
||||
rkey=$did.$pds
|
||||
pds=bsky.social
|
||||
if [ "$1" = "syui" ] || [ "$1" = "ai" ];then
|
||||
rkey=$1
|
||||
fi
|
||||
fi
|
||||
req=com.atproto.repo.getRecord
|
||||
url="https://$pds/xrpc/$req?rkey=$rkey&repo=$did_yui&collection=ai.syui.game.user"
|
||||
curl -sL $url|jq .
|
||||
}
|
||||
|
||||
delete_game_user() {
|
||||
rkey=$1
|
||||
if [ -z "$2" ];then
|
||||
col=ai.syui.game.user
|
||||
else
|
||||
col=$2
|
||||
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
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
function at-env() {
|
||||
pds=bsky.social
|
||||
host=https://bsky.social
|
||||
handle_syui=syui.ai
|
||||
handle_yui=yui.syui.ai
|
||||
|
Loading…
x
Reference in New Issue
Block a user