1
0
This commit is contained in:
syui 2024-02-18 15:11:09 +09:00
parent 7aee2037fb
commit ae2b38f923
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
15 changed files with 50 additions and 66 deletions

View File

@ -422,7 +422,7 @@ function battle_raid(){
body=`echo "\n[card]\nid : $boss_card_win\ncp : 0"` body=`echo "\n[card]\nid : $boss_card_win\ncp : 0"`
sleep 3 sleep 3
tmp=`curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$boss_id,\"card\":$boss_card_win,\"status\":\"super\",\"cp\":0,\"password\":\"$pass\"}" -s $url/cards` tmp=`curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$boss_id,\"card\":$boss_card_win,\"status\":\"super\",\"cp\":0,\"password\":\"$pass\"}" -s $url/cards`
tmp=`$HOME/.cargo/bin/atr @ ${boss_user_bsky} -p "$body"` tmp=`ai @ ${boss_user_bsky} -p "$body"`
fi fi
if [ $raid_at -ge $d ];then if [ $raid_at -ge $d ];then
@ -462,7 +462,7 @@ function battle_raid(){
if [ "$skill" = "critical" ] && [ $ss -eq 1 ];then if [ "$skill" = "critical" ] && [ $ss -eq 1 ];then
echo "$cp_i vs $cp_b ---> $cp_bb" echo "$cp_i vs $cp_b ---> $cp_bb"
elif [ "$skill" = "post" ] && [ $sss -eq 1 ];then elif [ "$skill" = "post" ] && [ $sss -eq 1 ];then
cp_post=`$HOME/.cargo/bin/atr pro $1 -p` cp_post=`ai pro $1 -p`
cp_i=$((cp_i + cp_post)) cp_i=$((cp_i + cp_post))
cp_bb=$((cp_bb - cp_post)) cp_bb=$((cp_bb - cp_post))
echo "🔥 $cp_i vs $cp_b ---> $cp_bb" echo "🔥 $cp_i vs $cp_b ---> $cp_bb"
@ -501,10 +501,10 @@ function battle_raid(){
body=`echo "\n[card]\nid : $boss_card\ncp : 0"` body=`echo "\n[card]\nid : $boss_card\ncp : 0"`
sleep 1 sleep 1
tmp=`curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$boss_id,\"card\":$boss_card,\"status\":\"super\",\"cp\":0,\"password\":\"$pass\"}" -s $url/cards` tmp=`curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$boss_id,\"card\":$boss_card,\"status\":\"super\",\"cp\":0,\"password\":\"$pass\"}" -s $url/cards`
tmp=`$HOME/.cargo/bin/atr @ ${boss_user_bsky} -p "$body"` tmp=`ai @ ${boss_user_bsky} -p "$body"`
raid_end=`date +"%H:%M"` raid_end=`date +"%H:%M"`
raid_body=`echo "[raid status]\n${boss_user_bsky}\ncp : $raid_start_cp\nstart/$raid_start\nend/$raid_end\nlast : $raid_last"` raid_body=`echo "[raid status]\n${boss_user_bsky}\ncp : $raid_start_cp\nstart/$raid_start\nend/$raid_end\nlast : $raid_last"`
tmp=`$HOME/.cargo/bin/atr p "$raid_body"` tmp=`ai p "$raid_body"`
if [ "$raid_run" = "true" ];then if [ "$raid_run" = "true" ];then
rm $cfg rm $cfg
fi fi
@ -514,7 +514,7 @@ function battle_raid(){
else else
raid_end=`date +"%H:%M"` raid_end=`date +"%H:%M"`
raid_body=`echo "[raid status]\ncp : $raid_start_cp\nstart/$raid_start\nend/$raid_end\nlast : $raid_last"` raid_body=`echo "[raid status]\ncp : $raid_start_cp\nstart/$raid_start\nend/$raid_end\nlast : $raid_last"`
tmp=`$HOME/.cargo/bin/atr p "$raid_body"` tmp=`ai p "$raid_body"`
fi fi
else else
echo $cp_bb >! $f_raid echo $cp_bb >! $f_raid
@ -747,7 +747,7 @@ function battle_server(){
if [ "$skill" = "critical" ];then if [ "$skill" = "critical" ];then
echo "$cp_i ---> $cp_at" echo "$cp_i ---> $cp_at"
elif [ "$skill" = "post" ];then elif [ "$skill" = "post" ];then
cp_post=`$HOME/.cargo/bin/atr pro $1 -p` cp_post=`ai pro $1 -p`
cp_i=$((cp_i + cp_post)) cp_i=$((cp_i + cp_post))
cp_all=$((cp_i + cp_at)) cp_all=$((cp_i + cp_at))
echo "🔥 $cp_i ---> $cp_at" echo "🔥 $cp_i ---> $cp_at"
@ -803,7 +803,7 @@ function battle_server(){
echo "----" echo "----"
echo "time up!" echo "time up!"
body="${cp_all}/${a_team} vs ${cp_ap}/${b_team}" body="${cp_all}/${a_team} vs ${cp_ap}/${b_team}"
tmp=`$HOME/.cargo/bin/atr p "$body"` tmp=`ai p "$body"`
echo 1 >! $f_server echo 1 >! $f_server
rm $f_server_start_time rm $f_server_start_time
rm $f_server_at rm $f_server_at

View File

@ -6,7 +6,6 @@ case $OSTYPE in
;; ;;
esac esac
atr=$HOME/.cargo/bin/atr
host=https://api.syui.ai host=https://api.syui.ai
pass=`cat $HOME/.config/ai/api_card.json|jq -r .password` pass=`cat $HOME/.config/ai/api_card.json|jq -r .password`

View File

@ -822,7 +822,7 @@ function card_post() {
link="https://card.syui.ai/${username}" link="https://card.syui.ai/${username}"
text=`echo "$title +${cten}\n$body\nten : $ten_su\n$ten_kai : $old_ten_char ---> $ten_char $ten_yak_ok"` text=`echo "$title +${cten}\n$body\nten : $ten_su\n$ten_kai : $old_ten_char ---> $ten_char $ten_yak_ok"`
tmp_atr=`$atr reply-og "$text" --cid $cid --uri $uri --img $img --title "$title" --description "$desc" --link $link` tmp_atr=`ai reply-og "$text" --cid $cid --uri $uri --img $img --title "$title" --description "$desc" --link $link`
ten_shutdown ten_shutdown
} }

View File

@ -1,21 +0,0 @@
#!/bin/zsh
dir=${0:a:h}
f=$HOME/.config/ai/scpt/png/t.png
f_sleep=$HOME/.config/ai/scpt/png/sleep
cid=$1
uri=$2
if [ ! -f $f ];then
atr r "limit 1 day" -c $cid -u $uri
exit
fi
if [ -f $f_sleep ];then
link=bafkreidgp2cl4cvkn3i4gzqj6kfiwngjjh5ie2jwobh632jh4ejlbiwdhm
atr img-post "#nyancat" -l $link -c $cid -u $uri
rm $f_sleep
exit
fi
link=`atr img-upload $f|jq -r .blob.ref.'"$link"'`
atr img-post "#stablediffusion" -l $link -c $cid -u $uri

View File

@ -1,6 +1,5 @@
#!/bin/zsh #!/bin/zsh
atr=$HOME/.cargo/bin/atr
url_j=https://card.syui.ai/json/card.json url_j=https://card.syui.ai/json/card.json
tcid=$HOME/.config/ai/txt/tmp_notify_cid.txt tcid=$HOME/.config/ai/txt/tmp_notify_cid.txt
@ -33,10 +32,10 @@ fi
uid=`curl -sL "$url/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$username\")"|jq -r .id` uid=`curl -sL "$url/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$username\")"|jq -r .id`
if [ -z $uid ] || [ "$uid" = "null" ];then if [ -z $uid ] || [ "$uid" = "null" ];then
body=`$atr chat "$uranai" -c` body=`ai chat "$uranai"`
body=`echo "占いにはアイのカードが3枚以上必要です\n\n$body"` body=`echo "占いにはアイのカードが3枚以上必要です\n\n$body"`
if [ "`cat $tcid`" != "$cid" ];then if [ "`cat $tcid`" != "$cid" ];then
if $atr r "$body" -c $cid -u $uri;then if ai reply "$body" -c $cid -u $uri;then
echo $cid >! $tcid echo $cid >! $tcid
fi fi
fi fi
@ -52,9 +51,9 @@ day_at=`date +"%Y%m%d"`
nd=`date +"%Y%m%d" -d '1 days ago'` nd=`date +"%Y%m%d" -d '1 days ago'`
if [ "$luck_at" = "$day_at" ];then if [ "$luck_at" = "$day_at" ];then
body=`$atr chat "$uranai" -c` body=`ai chat "$uranai"`
if [ "`cat $tcid`" != "$cid" ];then if [ "`cat $tcid`" != "$cid" ];then
if $atr r "$body" -c $cid -u $uri;then if ai reply "$body" -c $cid -u $uri;then
echo $cid >! $tcid echo $cid >! $tcid
fi fi
fi fi
@ -65,10 +64,10 @@ cp_i=`echo $data_u |jq -r "sort_by(.cp) | reverse|.[].card"|sort|uniq|sed -e '1d
cp_n=`echo $cp_i|wc -l` cp_n=`echo $cp_i|wc -l`
if [ 3 -gt $cp_n ];then if [ 3 -gt $cp_n ];then
body=`$atr chat "$uranai" -c` body=`ai chat "$uranai"`
body=`echo "占いにはアイのカードが3枚以上必要です\n\n$body"` body=`echo "占いにはアイのカードが3枚以上必要です\n\n$body"`
if [ "`cat $tcid`" != "$cid" ];then if [ "`cat $tcid`" != "$cid" ];then
if $atr r "$body" -c $cid -u $uri;then if ai reply "$body" -c $cid -u $uri;then
echo $cid >! $tcid echo $cid >! $tcid
fi fi
fi fi
@ -97,13 +96,13 @@ test_ran=`echo $(($RANDOM % 3))`
#text="アイ・カード占い" #text="アイ・カード占い"
case $test_ran in case $test_ran in
1) 1)
text=`$atr chat "アイのカード占いを作ってやってみて。感じる答えを出して。できれば140文字以内でお願い。" -c` text=`ai chat "アイのカード占いを作ってやってみて。感じる答えを出して。できれば140文字以内でお願い。"`
;; ;;
2) 2)
text=`$atr chat "今、アイが自分で考えた占いやってみて。気分が乗らなかったらやらなくていいよ。できれば140文字以内で答えてね。" -c` text=`ai chat "今、アイが自分で考えた占いやってみて。気分が乗らなかったらやらなくていいよ。できれば140文字以内で答えてね。"`
;; ;;
*) *)
text=`$atr chat "今のアイの気分で適当に占ってみて。できれば140文字以内で答えてね。" -c` text=`ai chat "今のアイの気分で適当に占ってみて。できれば140文字以内で答えてね。"`
;; ;;
esac esac
@ -145,7 +144,7 @@ fi
desc=`echo "アイ数字は${luck}"` desc=`echo "アイ数字は${luck}"`
if [ "`cat $tcid`" != "$cid" ];then if [ "`cat $tcid`" != "$cid" ];then
if $atr reply-og "$text" --cid $cid --uri $uri --img $img --title "$title" --description "$desc" --link $link;then if ai reply-og "$text" --cid $cid --uri $uri --img $img --title "$title" --description "$desc" --link $link;then
echo $cid >! $tcid echo $cid >! $tcid
fi fi
fi fi

View File

@ -6,7 +6,6 @@ case $OSTYPE in
;; ;;
esac esac
atr=$HOME/.cargo/bin/atr
host=https://api.syui.ai host=https://api.syui.ai
host_card=https://card.syui.ai/json/card.json host_card=https://card.syui.ai/json/card.json
pass=`cat $HOME/.config/ai/api_card.json|jq -r .password` pass=`cat $HOME/.config/ai/api_card.json|jq -r .password`
@ -144,8 +143,6 @@ function card_pay(){
fi fi
tmp=`curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$uid,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -s $host/cards` tmp=`curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$uid,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -s $host/cards`
echo "$text" echo "$text"
#echo "$atr reply-og \"$text\" --cid $cid --uri $uri --img $img --title \"$title\" --description \"$desc\" --link $link"
#tmp_atr=`$atr reply-og "$text" --cid $cid --uri $uri --img $img --title "$title" --description "$desc" --link $link`
} }
card_d card_d

View File

@ -0,0 +1,10 @@
#!/bin/zsh
dir=${0:a:h}
f=$HOME/.config/ai/scpt/png/t.png
cid=$1
uri=$2
link=`ai img-upload $f|jq -r .blob.ref.'"$link"'`
ai img-post "#stablediffusion" -l $link -c $cid -u $uri

View File

@ -5,3 +5,4 @@ did=$2
curl -sL plc.directory/$did/log |jq ".[]|.alsoKnownAs|.[]?" | grep -n .| head -n 4 curl -sL plc.directory/$did/log |jq ".[]|.alsoKnownAs|.[]?" | grep -n .| head -n 4
dig -t TXT $txt|grep "did=did:plc:"|head -n 1 dig -t TXT $txt|grep "did=did:plc:"|head -n 1
#dig syui.ai +short

View File

@ -16,13 +16,13 @@ function page(){
echo $f echo $f
if [ -n "$cursor" ];then if [ -n "$cursor" ];then
if [ ! -f $f ];then if [ ! -f $f ];then
atr follow $opt -c $cursor| jq . >! $f ai follow $opt -c $cursor| jq . >! $f
else else
echo no download echo no download
fi fi
else else
if [ ! -f $f ];then if [ ! -f $f ];then
atr follow $opt| jq . >! $f ai follow $opt| jq . >! $f
else else
echo no download echo no download
fi fi
@ -45,16 +45,16 @@ function page(){
echo following echo following
echo $flb echo $flb
echo "follow : $handle" echo "follow : $handle"
echo "atr follow $did" echo "ai follow $did"
atr follow $did ai follow $did
fi fi
if [ "$flb" = "null" ];then if [ "$flb" = "null" ];then
rkey=${flg##*/} rkey=${flg##*/}
echo followedBy echo followedBy
echo $flg echo $flg
echo "unfollow : $handle" echo "unfollow : $handle"
echo "atr follow $did -d $rkey" echo "ai follow $did -d $rkey"
atr follow $did -d $rkey ai follow $did -d $rkey
fi fi
done done
} }

View File

@ -6,11 +6,10 @@ case $OSTYPE in
;; ;;
esac esac
atr=$HOME/.cargo/bin/atr
host=https://api.syui.ai host=https://api.syui.ai
host_card=https://card.syui.ai/json/card.json host_card=https://card.syui.ai/json/card.json
pass=`cat $HOME/.config/atr/api_card.json|jq -r .password` pass=`cat $HOME/.config/ai/api_card.json|jq -r .password`
token=`cat $HOME/.config/atr/api_card.json|jq -r .token` token=`cat $HOME/.config/ai/api_card.json|jq -r .token`
handle=$1 handle=$1
username=`echo $1|cut -d . -f 1` username=`echo $1|cut -d . -f 1`
did=$2 did=$2
@ -18,7 +17,7 @@ cid=$3
uri=$4 uri=$4
opt=$5 opt=$5
pay=100 pay=100
eat_file=$HOME/.config/atr/txt/nyancat_eat.txt eat_file=$HOME/.config/ai/txt/nyancat_eat.txt
ran=`echo $(($RANDOM % 15))` ran=`echo $(($RANDOM % 15))`
eat="🍺☕ 🍵 🍶 🍼🍻 🍸 🍹 🍷 🍴 🍕 🍔 🍟 🍗 🍖 🍝🍛 🍤 🍱 🍣 🍥 🍙 🍘 🍚 🍜 🍲 🍢🍡 🍳 🍞 🍩 🍮 🍦 🍨 🍧 🎂 🍰 🍪🍫 🍬 🍭 🍯 🍎 🍏 🍊 🍋 🍒 🍇 🍉🍓 🍑 🍈 🍌 🍐 🍍 🍠 🍆 🍅 🌽" eat="🍺☕ 🍵 🍶 🍼🍻 🍸 🍹 🍷 🍴 🍕 🍔 🍟 🍗 🍖 🍝🍛 🍤 🍱 🍣 🍥 🍙 🍘 🍚 🍜 🍲 🍢🍡 🍳 🍞 🍩 🍮 🍦 🍨 🍧 🎂 🍰 🍪🍫 🍬 🍭 🍯 🍎 🍏 🍊 🍋 🍒 🍇 🍉🍓 🍑 🍈 🍌 🍐 🍍 🍠 🍆 🍅 🌽"

View File

@ -6,11 +6,10 @@ case $OSTYPE in
;; ;;
esac esac
atr=$HOME/.cargo/bin/atr
host_card=https://card.syui.ai/json/card.json host_card=https://card.syui.ai/json/card.json
pass=`cat $HOME/.config/atr/api_card.json|jq -r .password` pass=`cat $HOME/.config/ai/api_card.json|jq -r .password`
token=`cat $HOME/.config/atr/api_card.json|jq -r .token` token=`cat $HOME/.config/ai/api_card.json|jq -r .token`
eat_file=$HOME/.config/atr/txt/nyancat_eat.txt eat_file=$HOME/.config/ai/txt/nyancat_eat.txt
eat=`cat $eat_file|awk "NR==1"` eat=`cat $eat_file|awk "NR==1"`
if [ -z "$eat" ];then if [ -z "$eat" ];then
@ -32,5 +31,5 @@ ran=$(($RANDOM % n - 1))
echo $ran echo $ran
user=`echo $tmp|jq -r ".[$ran].username"` user=`echo $tmp|jq -r ".[$ran].username"`
did=`echo $tmp|jq -r ".[$ran].did"` did=`echo $tmp|jq -r ".[$ran].did"`
echo $atr @ $did -p "`echo $body_d`" echo ai @ $did -p "`echo $body_d`"
$atr @ $did -p "`echo $body_d`" ai @ $did -p "`echo $body_d`"

2
.gitignore vendored
View File

@ -10,3 +10,5 @@ scpt/json/
.ssh/config .ssh/config
.ssh/*.key .ssh/*.key
.ssh/*.pub .ssh/*.pub
.config/ai/scpt/*.txt
.config/ai/scpt/png

0
.ssh/keep Normal file → Executable file
View File

View File

@ -4,5 +4,4 @@ services:
restart: always restart: always
volumes: volumes:
- ./.config:/root/.config - ./.config:/root/.config
- ./.ssh:/root/.ssh command: ai bot
command: zsh -c "ai bot"

View File

@ -120,15 +120,15 @@ pub fn c_bot(c: &Context) {
.arg(&prompt) .arg(&prompt)
.output() .output()
.expect("zsh"); .expect("zsh");
let _output = Command::new(data_scpt(&"at_img")) let _output = Command::new(data_scpt(&"diffusers_img"))
.arg(&cid) .arg(&cid)
.arg(&uri) .arg(&uri)
.output() .output()
.expect("zsh"); .expect("zsh");
w_cid(cid.to_string(), log_file(&"n1"), true); w_cid(cid.to_string(), log_file(&"n1"), true);
} else if prompt.contains("") == true } else if com.contains("") == true
|| prompt.contains("うらない") == true || com.contains("うらない") == true
|| prompt.contains("うらなって") == true || com.contains("うらなって") == true
{ {
let output = Command::new(data_scpt(&"card_fortune")) let output = Command::new(data_scpt(&"card_fortune"))
.arg(&handle) .arg(&handle)