astrXbian/zen/tools/sbotc_check_invite.sh

27 lines
644 B
Bash
Executable File

#!/bin/bash
# Author @f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519
invite="${1?invite}"
code="${invite##*~}"
addr="${invite%%~*}"
feed="${addr##*:}"
hostname="${addr%:*}"
host="${hostname%:*}"
port="${hostname##*:}"
out="$(sbotc -s "$host" -p "$port" -k "$feed" -K "$code" -t async invite.use {} 2>&1)"
if echo "$out" | grep -q 'feed to follow is missing'
then
echo success
elif echo "$out" | grep -q 'method:invite,use is not in list of allowed methods'
then
echo invalid/expired
exit 1
else
echo fail
echo "$out"
echo trying another method:
sbotc -s "$host" -p "$port" -k "$feed" -K "$code" -t source blobs.get ''
exit 1
fi