diff --git a/.config/ai/scpt/api_card.zsh b/.config/ai/scpt/api_card.zsh index 0145ebf..3276905 100755 --- a/.config/ai/scpt/api_card.zsh +++ b/.config/ai/scpt/api_card.zsh @@ -422,7 +422,7 @@ function battle_raid(){ body=`echo "\n[card]\nid : $boss_card_win\ncp : 0"` 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=`$HOME/.cargo/bin/atr @ ${boss_user_bsky} -p "$body"` + tmp=`ai @ ${boss_user_bsky} -p "$body"` fi if [ $raid_at -ge $d ];then @@ -462,7 +462,7 @@ function battle_raid(){ if [ "$skill" = "critical" ] && [ $ss -eq 1 ];then echo "โšก $cp_i vs $cp_b ---> $cp_bb" 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_bb=$((cp_bb - cp_post)) echo "๐Ÿ”ฅ $cp_i vs $cp_b ---> $cp_bb" @@ -501,10 +501,10 @@ function battle_raid(){ body=`echo "\n[card]\nid : $boss_card\ncp : 0"` 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=`$HOME/.cargo/bin/atr @ ${boss_user_bsky} -p "$body"` + tmp=`ai @ ${boss_user_bsky} -p "$body"` 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"` - tmp=`$HOME/.cargo/bin/atr p "$raid_body"` + tmp=`ai p "$raid_body"` if [ "$raid_run" = "true" ];then rm $cfg fi @@ -514,7 +514,7 @@ function battle_raid(){ else raid_end=`date +"%H:%M"` 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 else echo $cp_bb >! $f_raid @@ -747,7 +747,7 @@ function battle_server(){ if [ "$skill" = "critical" ];then echo "โšก $cp_i ---> $cp_at" 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_all=$((cp_i + cp_at)) echo "๐Ÿ”ฅ $cp_i ---> $cp_at" @@ -803,7 +803,7 @@ function battle_server(){ echo "----" echo "time up!" 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 rm $f_server_start_time rm $f_server_at diff --git a/.config/ai/scpt/api_egg.zsh b/.config/ai/scpt/api_egg.zsh index 732a775..b431927 100755 --- a/.config/ai/scpt/api_egg.zsh +++ b/.config/ai/scpt/api_egg.zsh @@ -6,7 +6,6 @@ case $OSTYPE in ;; esac -atr=$HOME/.cargo/bin/atr host=https://api.syui.ai pass=`cat $HOME/.config/ai/api_card.json|jq -r .password` diff --git a/.config/ai/scpt/api_ten.zsh b/.config/ai/scpt/api_ten.zsh index 0d9cd46..bf95292 100755 --- a/.config/ai/scpt/api_ten.zsh +++ b/.config/ai/scpt/api_ten.zsh @@ -822,7 +822,7 @@ function card_post() { 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"` - 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 } diff --git a/.config/ai/scpt/at_img.zsh b/.config/ai/scpt/at_img.zsh deleted file mode 100755 index adb51e2..0000000 --- a/.config/ai/scpt/at_img.zsh +++ /dev/null @@ -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 diff --git a/.config/ai/scpt/card_fortune.zsh b/.config/ai/scpt/card_fortune.zsh index 3f1d70f..ee67276 100755 --- a/.config/ai/scpt/card_fortune.zsh +++ b/.config/ai/scpt/card_fortune.zsh @@ -1,6 +1,5 @@ #!/bin/zsh -atr=$HOME/.cargo/bin/atr url_j=https://card.syui.ai/json/card.json 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` if [ -z $uid ] || [ "$uid" = "null" ];then - body=`$atr chat "$uranai" -c` + body=`ai chat "$uranai"` body=`echo "ๅ ใ„ใซใฏใ‚ขใ‚คใฎใ‚ซใƒผใƒ‰ใŒ3ๆžšไปฅไธŠๅฟ…่ฆใงใ™\n\n$body"` 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 fi fi @@ -52,9 +51,9 @@ day_at=`date +"%Y%m%d"` nd=`date +"%Y%m%d" -d '1 days ago'` if [ "$luck_at" = "$day_at" ];then - body=`$atr chat "$uranai" -c` + body=`ai chat "$uranai"` 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 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` if [ 3 -gt $cp_n ];then - body=`$atr chat "$uranai" -c` + body=`ai chat "$uranai"` body=`echo "ๅ ใ„ใซใฏใ‚ขใ‚คใฎใ‚ซใƒผใƒ‰ใŒ3ๆžšไปฅไธŠๅฟ…่ฆใงใ™\n\n$body"` 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 fi fi @@ -97,13 +96,13 @@ test_ran=`echo $(($RANDOM % 3))` #text="ใ‚ขใ‚คใƒปใ‚ซใƒผใƒ‰ๅ ใ„" case $test_ran in 1) - text=`$atr chat "ใ‚ขใ‚คใฎใ‚ซใƒผใƒ‰ๅ ใ„ใ‚’ไฝœใฃใฆใ‚„ใฃใฆใฟใฆใ€‚ๆ„Ÿใ˜ใ‚‹็ญ”ใˆใ‚’ๅ‡บใ—ใฆใ€‚ใงใใ‚Œใฐ140ๆ–‡ๅญ—ไปฅๅ†…ใงใŠ้ก˜ใ„ใ€‚" -c` + text=`ai chat "ใ‚ขใ‚คใฎใ‚ซใƒผใƒ‰ๅ ใ„ใ‚’ไฝœใฃใฆใ‚„ใฃใฆใฟใฆใ€‚ๆ„Ÿใ˜ใ‚‹็ญ”ใˆใ‚’ๅ‡บใ—ใฆใ€‚ใงใใ‚Œใฐ140ๆ–‡ๅญ—ไปฅๅ†…ใงใŠ้ก˜ใ„ใ€‚"` ;; 2) - text=`$atr chat "ไปŠใ€ใ‚ขใ‚คใŒ่‡ชๅˆ†ใง่€ƒใˆใŸๅ ใ„ใ‚„ใฃใฆใฟใฆใ€‚ๆฐ—ๅˆ†ใŒไน—ใ‚‰ใชใ‹ใฃใŸใ‚‰ใ‚„ใ‚‰ใชใใฆใ„ใ„ใ‚ˆใ€‚ใงใใ‚Œใฐ140ๆ–‡ๅญ—ไปฅๅ†…ใง็ญ”ใˆใฆใญใ€‚" -c` + text=`ai chat "ไปŠใ€ใ‚ขใ‚คใŒ่‡ชๅˆ†ใง่€ƒใˆใŸๅ ใ„ใ‚„ใฃใฆใฟใฆใ€‚ๆฐ—ๅˆ†ใŒไน—ใ‚‰ใชใ‹ใฃใŸใ‚‰ใ‚„ใ‚‰ใชใใฆใ„ใ„ใ‚ˆใ€‚ใงใใ‚Œใฐ140ๆ–‡ๅญ—ไปฅๅ†…ใง็ญ”ใˆใฆใญใ€‚"` ;; *) - text=`$atr chat "ไปŠใฎใ‚ขใ‚คใฎๆฐ—ๅˆ†ใง้ฉๅฝ“ใซๅ ใฃใฆใฟใฆใ€‚ใงใใ‚Œใฐ140ๆ–‡ๅญ—ไปฅๅ†…ใง็ญ”ใˆใฆใญใ€‚" -c` + text=`ai chat "ไปŠใฎใ‚ขใ‚คใฎๆฐ—ๅˆ†ใง้ฉๅฝ“ใซๅ ใฃใฆใฟใฆใ€‚ใงใใ‚Œใฐ140ๆ–‡ๅญ—ไปฅๅ†…ใง็ญ”ใˆใฆใญใ€‚"` ;; esac @@ -145,7 +144,7 @@ fi desc=`echo "ใ‚ขใ‚คๆ•ฐๅญ—ใฏ${luck}"` 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 fi fi diff --git a/.config/ai/scpt/card_pay.zsh b/.config/ai/scpt/card_pay.zsh index c5080f5..68d68ac 100755 --- a/.config/ai/scpt/card_pay.zsh +++ b/.config/ai/scpt/card_pay.zsh @@ -6,7 +6,6 @@ case $OSTYPE in ;; esac -atr=$HOME/.cargo/bin/atr host=https://api.syui.ai host_card=https://card.syui.ai/json/card.json pass=`cat $HOME/.config/ai/api_card.json|jq -r .password` @@ -144,8 +143,6 @@ function card_pay(){ 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` 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 diff --git a/.config/ai/scpt/diffusers_img.zsh b/.config/ai/scpt/diffusers_img.zsh new file mode 100755 index 0000000..f054f7d --- /dev/null +++ b/.config/ai/scpt/diffusers_img.zsh @@ -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 diff --git a/.config/ai/scpt/dig.zsh b/.config/ai/scpt/dig.zsh index c3cbe71..ce21d77 100755 --- a/.config/ai/scpt/dig.zsh +++ b/.config/ai/scpt/dig.zsh @@ -5,3 +5,4 @@ did=$2 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 syui.ai +short diff --git a/.config/ai/scpt/follow_all.zsh b/.config/ai/scpt/follow_all.zsh index 794123d..4b0685f 100755 --- a/.config/ai/scpt/follow_all.zsh +++ b/.config/ai/scpt/follow_all.zsh @@ -16,13 +16,13 @@ function page(){ echo $f if [ -n "$cursor" ];then if [ ! -f $f ];then - atr follow $opt -c $cursor| jq . >! $f + ai follow $opt -c $cursor| jq . >! $f else echo no download fi else if [ ! -f $f ];then - atr follow $opt| jq . >! $f + ai follow $opt| jq . >! $f else echo no download fi @@ -45,16 +45,16 @@ function page(){ echo following echo $flb echo "follow : $handle" - echo "atr follow $did" - atr follow $did + echo "ai follow $did" + ai follow $did fi if [ "$flb" = "null" ];then rkey=${flg##*/} echo followedBy echo $flg echo "unfollow : $handle" - echo "atr follow $did -d $rkey" - atr follow $did -d $rkey + echo "ai follow $did -d $rkey" + ai follow $did -d $rkey fi done } diff --git a/.config/ai/scpt/nyancat.zsh b/.config/ai/scpt/nyancat.zsh index f1befdc..6965b12 100755 --- a/.config/ai/scpt/nyancat.zsh +++ b/.config/ai/scpt/nyancat.zsh @@ -6,11 +6,10 @@ case $OSTYPE in ;; esac -atr=$HOME/.cargo/bin/atr host=https://api.syui.ai host_card=https://card.syui.ai/json/card.json -pass=`cat $HOME/.config/atr/api_card.json|jq -r .password` -token=`cat $HOME/.config/atr/api_card.json|jq -r .token` +pass=`cat $HOME/.config/ai/api_card.json|jq -r .password` +token=`cat $HOME/.config/ai/api_card.json|jq -r .token` handle=$1 username=`echo $1|cut -d . -f 1` did=$2 @@ -18,7 +17,7 @@ cid=$3 uri=$4 opt=$5 pay=100 -eat_file=$HOME/.config/atr/txt/nyancat_eat.txt +eat_file=$HOME/.config/ai/txt/nyancat_eat.txt ran=`echo $(($RANDOM % 15))` eat="๐Ÿบโ˜• ๐Ÿต ๐Ÿถ ๐Ÿผ๐Ÿป ๐Ÿธ ๐Ÿน ๐Ÿท ๐Ÿด ๐Ÿ• ๐Ÿ” ๐ŸŸ ๐Ÿ— ๐Ÿ– ๐Ÿ๐Ÿ› ๐Ÿค ๐Ÿฑ ๐Ÿฃ ๐Ÿฅ ๐Ÿ™ ๐Ÿ˜ ๐Ÿš ๐Ÿœ ๐Ÿฒ ๐Ÿข๐Ÿก ๐Ÿณ ๐Ÿž ๐Ÿฉ ๐Ÿฎ ๐Ÿฆ ๐Ÿจ ๐Ÿง ๐ŸŽ‚ ๐Ÿฐ ๐Ÿช๐Ÿซ ๐Ÿฌ ๐Ÿญ ๐Ÿฏ ๐ŸŽ ๐Ÿ ๐ŸŠ ๐Ÿ‹ ๐Ÿ’ ๐Ÿ‡ ๐Ÿ‰๐Ÿ“ ๐Ÿ‘ ๐Ÿˆ ๐ŸŒ ๐Ÿ ๐Ÿ ๐Ÿ  ๐Ÿ† ๐Ÿ… ๐ŸŒฝ" diff --git a/.config/ai/scpt/nyancat_post.zsh b/.config/ai/scpt/nyancat_post.zsh index 9d75b0d..8641ff3 100755 --- a/.config/ai/scpt/nyancat_post.zsh +++ b/.config/ai/scpt/nyancat_post.zsh @@ -6,11 +6,10 @@ case $OSTYPE in ;; esac -atr=$HOME/.cargo/bin/atr host_card=https://card.syui.ai/json/card.json -pass=`cat $HOME/.config/atr/api_card.json|jq -r .password` -token=`cat $HOME/.config/atr/api_card.json|jq -r .token` -eat_file=$HOME/.config/atr/txt/nyancat_eat.txt +pass=`cat $HOME/.config/ai/api_card.json|jq -r .password` +token=`cat $HOME/.config/ai/api_card.json|jq -r .token` +eat_file=$HOME/.config/ai/txt/nyancat_eat.txt eat=`cat $eat_file|awk "NR==1"` if [ -z "$eat" ];then @@ -32,5 +31,5 @@ ran=$(($RANDOM % n - 1)) echo $ran user=`echo $tmp|jq -r ".[$ran].username"` did=`echo $tmp|jq -r ".[$ran].did"` -echo $atr @ $did -p "`echo $body_d`" -$atr @ $did -p "`echo $body_d`" +echo ai @ $did -p "`echo $body_d`" +ai @ $did -p "`echo $body_d`" diff --git a/.gitignore b/.gitignore index 006b371..a087a25 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ scpt/json/ .ssh/config .ssh/*.key .ssh/*.pub +.config/ai/scpt/*.txt +.config/ai/scpt/png diff --git a/.ssh/keep b/.ssh/keep old mode 100644 new mode 100755 diff --git a/compose.yml b/compose.yml index a97056a..7577e6c 100644 --- a/compose.yml +++ b/compose.yml @@ -4,5 +4,4 @@ services: restart: always volumes: - ./.config:/root/.config - - ./.ssh:/root/.ssh - command: zsh -c "ai bot" + command: ai bot diff --git a/src/bot.rs b/src/bot.rs index 3d29cba..b521946 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -120,15 +120,15 @@ pub fn c_bot(c: &Context) { .arg(&prompt) .output() .expect("zsh"); - let _output = Command::new(data_scpt(&"at_img")) + let _output = Command::new(data_scpt(&"diffusers_img")) .arg(&cid) .arg(&uri) .output() .expect("zsh"); w_cid(cid.to_string(), log_file(&"n1"), true); - } else if prompt.contains("ๅ ") == true - || prompt.contains("ใ†ใ‚‰ใชใ„") == true - || prompt.contains("ใ†ใ‚‰ใชใฃใฆ") == true + } else if com.contains("ๅ ") == true + || com.contains("ใ†ใ‚‰ใชใ„") == true + || com.contains("ใ†ใ‚‰ใชใฃใฆ") == true { let output = Command::new(data_scpt(&"card_fortune")) .arg(&handle)