dockerfiles--matrixorg-aler.../bin/bot

15 lines
342 B
Bash
Executable File

#!/bin/bash
if [[ ! -f /var/opt/mtx-alert-auth ]]; then
echo 'E| you must set the bot auth token on "/var/opt/mtx-alert-auth"'
exit 1
fi
IN=$1
if [[ $1 == '' ]]; then
IN=$(timeout 1 cat /dev/stdin)
fi
AUTH=$(cat /var/opt/mtx-alert-auth)
curl -X POST "http://localhost:8080/?auth=$AUTH" -d "message=$IN" 2>/dev/null