Announcement post scripts
This commit is contained in:
parent
4c3176b297
commit
1a43d029c9
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env -S bash -e
|
||||
[[ -z "$1" ]] && {
|
||||
printf "Usage: %s message\n" "$0"
|
||||
exit 1
|
||||
}
|
||||
instance="https://fedi.vern.cc"
|
||||
curl "${instance}"/api/v1/statuses -H 'Authorization: Bearer '"$(</root/priv/vernannouncetoken)" -F 'status='"${1}"
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/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
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env -S bash -e
|
||||
[[ -z "$1" ]] && {
|
||||
printf "Usage: %s message\n" "$0"
|
||||
exit 1
|
||||
}
|
||||
TxnId() { # Random chars. Needed for sending messages. I am not using tr on /dev/urandom for speed reasons
|
||||
CharRange='1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
for ((i = 0; i <= 32; i++)); do
|
||||
printf '%s' "${CharRange:$((RANDOM % ${#CharRange})):1}"
|
||||
done
|
||||
}
|
||||
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)"
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env -S bash -e
|
||||
[[ -z "$1" ]] && {
|
||||
printf "Usage: %s message\n" "$0"
|
||||
exit 1
|
||||
}
|
||||
echo "${1}" | hsendxmpp -u announcements -p "$(</root/priv/xmppannouncepasswd)" -j vern.cc -c announcements@muc.vern.cc -r announcementsbot
|
Loading…
Reference in New Issue