diff --git a/process-likes-g1tx.sh b/process-likes-g1tx.sh index edd3f05..9fa3f03 100755 --- a/process-likes-g1tx.sh +++ b/process-likes-g1tx.sh @@ -136,7 +136,7 @@ do echo "" echo "================================================================" - printf "Let's thank ${bold}%s ${normal}for their message: \n" "$author_s_name" + printf "Let's thank ${bold}@%s ${normal}for their message: \n" "${author_s_name:1:-1}" echo "================================================================" printf "%s" "$msg_excerpt" echo "" @@ -146,8 +146,20 @@ do #printf '%s\n' "silkaj -af --file ~/.ssb/secret.dunikey tx --output $g1_author --amountUD 0.1 --comment _SSB:LIKE:$target_id" #### SEND 10 LOVE = 0.1 DU to $g1_author wallet silkaj -p "$duniter_server" -af --file ~/.ssb/secret.dunikey tx --output $g1_author --amountUD 0.1 --comment "_SSB:LIKE:$target_id" -y 2>/dev/null + #### WRITE RESPONSE MESSAGE - sbotc publish '{"type":"post","text":"Thanks for this post ; I have just sent you G1 libre money. Use it with [Cesium](https://cesium.app). Get it from [https://git.p2p.legal/Axiom-Team/ssb-g1like](https://git.p2p.legal/Axiom-Team/ssb-g1like) ", "branch": "'"$target_id"'", "root": "'"$root_id"'"}' 2>&1>/dev/null + if [ ! -f ~/.ssb/db/g1likes ]; then + touch ~/.ssb/db/g1likes + fi + + if ! grep -Fxq $target_author ~/.ssb/db/g1likes; then + echo $target_author >> ~/.ssb/db/g1likes + thank_you_msg=$(printf '[@%s](%s) > Thanks for this post ; I have just sent you G1 libre money. Use it with [Cesium](https://cesium.app). Get it from [https://git.p2p.legal/Axiom-Team/ssb-g1like](https://git.p2p.legal/Axiom-Team/ssb-g1like)' "${author_s_name:1:-1}" "$target_author") + sbotc publish '{"type":"post","text":"'"$thank_you_msg"'", "branch": "'"$target_id"'", "root": "'"$root_id"'"}' 2>&1>/dev/null + echo "----------------------------------------------------------------" + printf "Since it's the first time you sent G1 to %s, he was sent this message: \n\n%s \n" "$author_s_name" "$thank_you_msg" + echo "----------------------------------------------------------------" + fi #printf "0.1 G1UD sent to %s!\n" "$author_s_name" #echo "----------------------------------------------------------------"