make the post scripts have desc support
This commit is contained in:
parent
bc9464f0ed
commit
e032dcf06c
|
@ -1,8 +1,11 @@
|
|||
#!/usr/bin/env -S bash -e
|
||||
[[ -z "$1" ]] && {
|
||||
printf "Usage: %s message\n" "$0"
|
||||
printf "Usage: %s message [description]\n" "$0"
|
||||
exit 1
|
||||
}
|
||||
instance="https://fedi.vern.cc"
|
||||
curl "${instance}"/api/v1/statuses -H 'Authorization: Bearer '"$(</root/priv/vernannouncetoken)" -F 'status='"${1}"
|
||||
|
||||
if [[ -z ${2} ]]; then
|
||||
curl "${instance}"/api/v1/statuses -H 'Authorization: Bearer '"$(</root/priv/vernannouncetoken)" -F "status=${1}"
|
||||
else
|
||||
curl "${instance}"/api/v1/statuses -H 'Authorization: Bearer '"$(</root/priv/vernannouncetoken)" -F "status=${2}" -F "spoiler_text=${1}"
|
||||
fi
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#!/usr/bin/env -S bash -e
|
||||
|
||||
[[ -z "$1" ]] && {
|
||||
printf "Usage: %s message\n" "$0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
{
|
||||
cat << EOF
|
||||
NICK vern
|
||||
PASS $(</root/priv/sojupass)
|
||||
USER vern bnc.vern.cc bnc.vern.cc vern
|
||||
EOF
|
||||
cat << EOF
|
||||
JOIN #vern-announcements
|
||||
EOF
|
||||
} | openssl s_client -connect irc.tilde.chat:6697 -quiet
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env -S bash -e
|
||||
[[ -z "$1" ]] && {
|
||||
printf "Usage: %s message\n" "$0"
|
||||
printf "Usage: %s message [description]\n" "$0"
|
||||
exit 1
|
||||
}
|
||||
TxnId() { # Random chars. Needed for sending messages. I am not using tr on /dev/urandom for speed reasons
|
||||
|
@ -11,9 +11,18 @@ TxnId() { # Random chars. Needed for sending messages. I am not using tr on /dev
|
|||
}
|
||||
instance='https://mtrx.vern.cc'
|
||||
RoomId='!DbQXembCUWglXOcHRx:vern.cc'
|
||||
curl -s \
|
||||
-X PUT \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer '"$(<root/priv/root-access-token)" \
|
||||
-d '{"msgtype":"m.text", "body":"'"${1}"'"}' \
|
||||
"$instance"'/_matrix/client/r0/rooms/'"$RoomId"'/send/m.room.message/'"$(TxnId)"
|
||||
if [[ -z ${2} ]]; then
|
||||
curl -s \
|
||||
-X PUT \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer '"$(</root/priv/root-access-token)" \
|
||||
-d '{"msgtype":"m.text", "body":"'"${1}"'"}' \
|
||||
"$instance"'/_matrix/client/r0/rooms/'"$RoomId"'/send/m.room.message/'"$(TxnId)"
|
||||
else
|
||||
curl -s \
|
||||
-X PUT \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer '"$(</root/priv/root-access-token)" \
|
||||
-d '{"msgtype":"m.text", "body":"'"SUBJECT: ${1}\n${2}"'"}' \
|
||||
"$instance"'/_matrix/client/r0/rooms/'"$RoomId"'/send/m.room.message/'"$(TxnId)"
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#!/usr/bin/env -S bash -e
|
||||
[[ -z "$1" ]] && {
|
||||
printf "Usage: %s message\n" "$0"
|
||||
printf "Usage: %s message [description]\n" "$0"
|
||||
exit 1
|
||||
}
|
||||
echo "${1}" | hsendxmpp -u announcements -p "$(</root/priv/xmppannouncepasswd)" -j vern.cc -c announcements@muc.vern.cc -r announcementsbot
|
||||
if [[ -z ${2} ]]; then
|
||||
echo "${1}" | hsendxmpp -u announcements -p "$(</root/priv/xmppannouncepasswd)" -j vern.cc -c announcements@muc.vern.cc -r announcementsbot
|
||||
else
|
||||
printf "SUBJECT: ${1}\n${2}" | hsendxmpp -u announcements -p "$(</root/priv/xmppannouncepasswd)" -j vern.cc -c announcements@muc.vern.cc -r announcementsbot
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue