From 273e5c43b74f26281f196dfb72114f3a1ec5d4fe Mon Sep 17 00:00:00 2001 From: thomaspcole Date: Thu, 4 Apr 2019 16:54:08 -0400 Subject: [PATCH] Discord message sender. --- discordBot.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 discordBot.sh diff --git a/discordBot.sh b/discordBot.sh new file mode 100755 index 0000000..bd89dec --- /dev/null +++ b/discordBot.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +################################################################################ +# A simple script to send a message to a discord server. # +# # +# # +################################################################################ + +PARAMS="" + +while (( "$#" )); do + case "$1" in + -u|--mention) + mention="<@$2>" + shift 2 + ;; + -m|--message) + message="$2" + shift 2 + ;; + --) + shift + break + ;; + -*|--*=) + echo "Error: Unknown Flag $1" >&2 + exit 1 + ;; + *) + PARAMS="$PARAMS $1" + shift + ;; + esac +done + +url="https://discordapp.com/api/webhooks/URL" +curl -H "Content-Tyep: application/json" -X POST -d '{"content": "'$mention' '$message'"}' $url +echo ""