1
0
api/scpt/card_add.zsh

26 lines
569 B
Bash
Raw Normal View History

2023-05-21 06:45:18 +00:00
#!/bin/zsh
2023-07-10 03:43:09 +00:00
2023-05-21 06:45:18 +00:00
host=https://api.syui.ai
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
2023-08-03 03:32:44 +00:00
echo username card cp
read
2023-05-21 06:45:18 +00:00
if [ -z "$1" ];then
exit
fi
if [ -z "$2" ];then
exit
fi
if [ -z "$3" ];then
exit
fi
2023-08-03 03:32:44 +00:00
2023-05-24 09:36:44 +00:00
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
2023-05-21 06:45:18 +00:00
card=$2
cp=$3
2023-08-03 03:32:44 +00:00
s=normal
2023-09-10 08:53:30 +00:00
skill=normal
count=1
author=ai
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\",\"count\":$count,\"author\":\"$author\"}" -sL $host/cards