forked from TarushS/discord-webhook-bash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.sh
More file actions
25 lines (23 loc) · 671 Bytes
/
script.sh
File metadata and controls
25 lines (23 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
if [ -f "config" ]; then
usrname=`sed '1q;d' config`
if [[ $usrname == "" ]]
then
echo "Please enter details in config file or remove the empty config file"
exit 1
fi
echo "Hello "$usrname
webhk=`sed '2q;d' config`
echo "Message:"; read mesg
else
echo "[TIP]You can create a file named config and put your name in the first line and webhook in the second line"
echo "Username:"; read usrname
echo "Message:"; read mesg
echo "Webhook:"; read webhk
fi
if [[ $(curl $webhk) ]] 2>/dev/null;
then
curl -H "Content-Type: application/json" -X POST -d '{"username": "'$usrname'", "content": "'$mesg'"}' $webhk
else
echo "WebHook URL is invalid"
fi