Skip to content

Commit 2db41fb

Browse files
committed
update README
1 parent e50060c commit 2db41fb

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ Hacky Slack was inspired by the following resources:
217217
* https://github.com/course-hero/slacktee
218218
* https://github.com/rockymadden/slack-cli
219219
* https://api.slack.com/community
220+
* Icons courtesy of http://iconmonstr.com and AWS
220221

221222

222223
# License

slack.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,32 @@
66

77
# Default WEBHOOK to post messages
88
if [[ -n ${WEBHOOK} ]]; then
9+
910
echo "INFO: The Slack API WEBHOOK was passed via the command line (-w)"
11+
1012
elif [[ -n ${SLACK_WEBHOOK} ]]; then
13+
1114
echo "INFO: The Slack API TOKEN was set as a system variable"
1215
TOKEN=${SLACK_WEBHOOK}
16+
1317
else
18+
1419
echo "INFO: Using default Slack API endpoint to POST messages..."
1520
WEBHOOK=${WEBHOOK-'https://hooks.slack.com/services/'}
21+
1622
fi
1723

1824
echo "${SLACK_TOKEN}"
1925
# Default TOKEN to post messages
2026
if [[ -n ${TOKEN} ]]; then
27+
2128
echo "INFO: The Slack API TOKEN was passed via the command line (-k)"
29+
2230
elif [[ -n ${SLACK_TOKEN} ]]; then
31+
2332
echo "INFO: The Slack API TOKEN was set as a system variable"
2433
TOKEN=${SLACK_TOKEN}
34+
2535
else
2636
echo "ERROR: No Slack API TOKEN was found. Can not proceed with posting messages to the API without one."
2737
exit 1
@@ -46,17 +56,23 @@ if test "${PRIORITY}" = "OK"; then echo "INFO: STATUS (-s) was set to OK..."; IC
4656

4757
# Check for the IP address every 2 hours. Use cache for anything < 2 hours
4858
if [[ ! -f "${IPCONFIG}" ]]; then
59+
4960
echo "${IPCONFIG} does not exist"
5061
IP=$(curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
5162
echo "IP=${IP}" > ${IPCONFIG}
52-
else
5363

54-
if test "find '${IPCONFIG}' -mmin +120"; then
55-
echo "${IPCONFIG} is less than 2 hours old."
5664
else
57-
IP=$(curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
58-
echo "IP=${IP}" > ${IPCONFIG}
59-
fi
65+
66+
if test "find '${IPCONFIG}' -mmin +120"; then
67+
68+
echo "${IPCONFIG} is less than 2 hours old."
69+
70+
else
71+
72+
IP=$(curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
73+
echo "IP=${IP}" > ${IPCONFIG}
74+
75+
fi
6076
fi
6177

6278
source ${IPCONFIG}
@@ -101,6 +117,7 @@ exit 1
101117
else
102118

103119
while getopts "aA:b:B:c:Chi:I:m:N:p:s:t:T:L:k:u:w" opt; do
120+
104121
case ${opt} in
105122
a) ATTACHMENT="true" ;;
106123
A) AUTHOR="${OPTARG}" ;;
@@ -224,6 +241,7 @@ PAYLOAD="payload={ \
224241
\"mrkdwn\": \"true\" \
225242
}"
226243
fi
244+
227245
# Send the payload to the Slack API
228246
POST=$(curl -s -S -X POST --data-urlencode "${PAYLOAD}" "${WEBHOOK}${TOKEN}");
229247

0 commit comments

Comments
 (0)