nostril

A C cli tool for creating nostr events
git clone git://jb55.com/nostril
Log | Files | Refs | README

commit 7a01bc0cf793e7ef441160353b6c5e421541693a
parent 19f90b4e22b4227fb2e7aa6e334873ec7d5bfa2d
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 23 Apr 2022 07:52:41 -0700

add some handy script

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Ascripts/nostr-contact | 2++
Ascripts/nostr-post | 29+++++++++++++++++++++++++++++
Ascripts/nostr-query | 2++
Ascripts/nostr-relay-note | 3+++
4 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/scripts/nostr-contact b/scripts/nostr-contact @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo '["REQ","",{"kinds":[0],"authors":["'$1'"]}]' diff --git a/scripts/nostr-post b/scripts/nostr-post @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -e + +TMP=$(mktemp) + +$EDITOR "$TMP" + +if [ ! -f "$TMP" ]; then + printf "could not create temporary file\n" >&2 + exit 1 +fi + +content="$(cat $TMP)" + +re="^[[:space:]]*$" +if [[ "$content" =~ $re ]]; then + printf "note empty. aborting.\n" >&2 + exit 2 +fi + +note=$(nostril "$@" --content "$content") + +printf "relaying:\n" >&2 +printf "$note\n" +<<<"$note" nostr-relay-note +printf "done.\n" >&2 + +rm -f "$TMP" diff --git a/scripts/nostr-query b/scripts/nostr-query @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +websocat "$@" wss://nostr-pub.wellorder.net diff --git a/scripts/nostr-relay-note b/scripts/nostr-relay-note @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +jq -c '["EVENT",.]' | websocat wss://nostr-pub.wellorder.net