6
1
mirror of https://git.mills.io/saltyim/saltyim.git synced 2024-06-25 16:28:20 +00:00
prologic-saltyim/echobot.sh
James Mills 332202551d Fix CI
2022-03-24 14:11:51 +10:00

18 lines
414 B
Bash
Executable File

#!/bin/sh
set -e
identity="~/.config/salty/echobot.key"
user="echo@mills.io"
tmpfile="$(mktemp -t "echobot-XXXXXX")"
trap 'rm $tmpfile' EXIT
cat > "$tmpfile"
sender="$(head -n 1 < "$tmpfile" | awk '{ print $2 }')"
sender="$(echo "$sender" | sed 's/[)(]//g')"
message="$(head -n 1 < "$tmpfile" | awk '{ $1 = ""; $2 = ""; print $0; }')"
echo "$message" | salty-chat -d -i "$identity" -u "$user" send "$sender"