list nostr events, like and repost from bash

dependencies:

usage:

./noscmd.sh <npub> <limit>

script:

rm commands.tmp
privkarg="-p $(cat ~/.config/nostr/config.json | jq -r .privatekey)"
relaysarg=$(noscl relay | grep -oP "^wss://[^:]+" | while read r; do echo -n -r "$r "; done)

res=$(nostr-tool $relaysarg list-events -a $(key-convertr --to-hex $1) --timeout 5)

i=0
echo "$res" | jq -c '.[] | del(.tags)' | head -n $2 |jq -r '"== note " + .id + " ==\n" + (.content | gsub("\n";" ")) + "\n\n''like:\n>nostr-tool '"$privkarg $relaysarg"'react -a " + .pubkey + " -e " + .id + " -r \"+\"\n\n''repost:\n>noscl publish nostr:$(key-convertr --kind note " + .id + ")\n"' | while read line
do
  match=$(echo "$line" | grep "^>")
  if [ "$match" != "" ]
  then
     let i++
     echo "$line" | perl -pe "s/^>//" >> commands.tmp
     line=$(echo "$line" | perl -pe "s/^>/[command $i]: /")
  fi

  echo $line
done

echo "type command number"
read c

if [ "$c" != "" ]
then
  eval "$(cat commands.tmp | head -n $c | tail -n 1)"
fi
Edit

Pub: 01 Oct 2023 15:37 UTC

Edit: 01 Oct 2023 15:52 UTC

Views: 85