Merge branch 'dev-boris'
This commit is contained in:
commit
5a1207b298
|
@ -26,7 +26,7 @@ ssbpub=$(cat ~/.ssb/secret | grep public\" | cut -d ' ' -f 4 | cut -d '.' -f 1 |
|
||||||
#### CHECK LIKE AND SEND LOVE
|
#### CHECK LIKE AND SEND LOVE
|
||||||
# Let's get G1 account balance
|
# Let's get G1 account balance
|
||||||
echo ""
|
echo ""
|
||||||
echo "Welcome to the G1 SSB "
|
echo "Welcome to the G1 SSB like microdonation system!"
|
||||||
echo "
|
echo "
|
||||||
MMMMMMMMMMMMMNk;'cdxxd:,c0WMMMMMMMMMMMMM
|
MMMMMMMMMMMMMNk;'cdxxd:,c0WMMMMMMMMMMMMM
|
||||||
MMMMMMMMMMMMMNx,. .;kWMMMMMMMMMMMMM
|
MMMMMMMMMMMMMNx,. .;kWMMMMMMMMMMMMM
|
||||||
|
@ -108,11 +108,16 @@ process_msg() {
|
||||||
target_id=$(printf %s "$msg" | jq -r '.value?.content?.vote?.link') || return 1
|
target_id=$(printf %s "$msg" | jq -r '.value?.content?.vote?.link') || return 1
|
||||||
target_msg=$(sbotc -e get "$target_id") || return 1
|
target_msg=$(sbotc -e get "$target_id") || return 1
|
||||||
target_author=$(printf %s "$target_msg" | jq -r .author) || return 1
|
target_author=$(printf %s "$target_msg" | jq -r .author) || return 1
|
||||||
|
author_s_name=$(sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$target_author"'", "content":{"type":"about", "about": "'"$target_author"'"}}}}]}' | jq .value?.content?.name | grep -v null | tail -n 1)
|
||||||
root_id=$(printf %s "$target_msg" | jq -r .content?.root) || return 1
|
root_id=$(printf %s "$target_msg" | jq -r .content?.root) || return 1
|
||||||
[[ $root_id == "null" ]] && root_id=$target_id
|
[[ $root_id == "null" ]] && root_id=$target_id
|
||||||
g1_author=$(echo $target_author | cut -d '.' -f 1 | cut -d '@' -f2 | base64 -d | base58)
|
g1_author=$(echo $target_author | cut -d '.' -f 1 | cut -d '@' -f2 | base64 -d | base58)
|
||||||
|
msg_excerpt=$(printf %s "$target_msg" | jq -r .content?.text | head -n 10) || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bold=$(tput bold)
|
||||||
|
normal=$(tput sgr0)
|
||||||
|
|
||||||
sbotc query.read '{"query":[{"$filter":{"value":{"author":"'"$self"'","content":{"type":"vote", "vote":{"expression":"Like"}},"timestamp":{"$gt":'"$last_ts"'}}}}]}' | while read -r msg
|
sbotc query.read '{"query":[{"$filter":{"value":{"author":"'"$self"'","content":{"type":"vote", "vote":{"expression":"Like"}},"timestamp":{"$gt":'"$last_ts"'}}}}]}' | while read -r msg
|
||||||
do
|
do
|
||||||
if ! ts=$(printf %s "$msg" | jq -r .value.timestamp)
|
if ! ts=$(printf %s "$msg" | jq -r .value.timestamp)
|
||||||
|
@ -133,14 +138,26 @@ do
|
||||||
printf 'Unable to process message %s\n' "$msg_id" >&2
|
printf 'Unable to process message %s\n' "$msg_id" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
printf 'Message: %s ( Author: %s )\n' "$target_id" "$target_author"
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "================================================================"
|
||||||
|
printf "Let's thank ${bold}%s ${normal}for their message: \n" "$author_s_name"
|
||||||
|
echo "================================================================"
|
||||||
|
printf "%s" "$msg_excerpt"
|
||||||
|
echo ""
|
||||||
|
echo "----------------------------------------------------------------"
|
||||||
|
|
||||||
if [[ $g1_author != $g1pub ]]; then
|
if [[ $g1_author != $g1pub ]]; then
|
||||||
sleep 3
|
|
||||||
#printf '%s\n' "silkaj -af --file ~/.ssb/secret.dunikey tx --output $g1_author --amountUD 0.1 --comment _SSB:LIKE:$target_id"
|
#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
|
#### 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
|
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
|
#### 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
|
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
|
||||||
|
|
||||||
|
|
||||||
|
printf "0.1 G1UD sent to %s!\n" "$author_s_name"
|
||||||
|
echo "----------------------------------------------------------------"
|
||||||
sleep 20 # DO NOT OVER CHARGE DUNITER
|
sleep 20 # DO NOT OVER CHARGE DUNITER
|
||||||
else
|
else
|
||||||
echo "I LIKE MY MESSAGE $target_id"
|
echo "I LIKE MY MESSAGE $target_id"
|
||||||
|
|
Loading…
Reference in New Issue