Added help and image flags for the bot.

This commit is contained in:
thomaspcole 2019-04-05 13:13:20 -04:00
parent 6e0861bd08
commit 714d98a66e

View File

@ -22,12 +22,29 @@ while (( "$#" )); do
botname="$2"
shift 2
;;
-i|--image)
profileImage="$2"
shift 2
;;
-h|--help)
echo "Simple Discord Bot help"
echo "Usage: ./discordBot.sh -m MESSAGE"
echo ""
echo "Flags:
-u --mention: Mention a specific user (Userid)
-m --message: The message you wish to send
-b --botname: The name you want the bot to display
-i --image: The profile image you want the bot to display (URL link)
-h --help: Display help information"
exit 1
;;
--)
shift
break
;;
-*|--*=)
echo "Error: Unknown Flag $1" >&2
echo "Use -h or --help for more information"
exit 1
;;
*)
@ -38,6 +55,5 @@ while (( "$#" )); do
done
url="https://discordapp.com/api/webhooks/URL"
curl -H "Content-Tyep: application/json" -X POST -d '{"username": "'$botname'", "content": "'$mention' '$message'"}' $url
curl -H "Content-Tyep: application/json" -X POST -d '{"username": "'$botname'", "avatar_url": "'$profileImage'", "content": "'$mention' '$message'"}' $url
echo ""