diff --git a/src/slack b/src/slack index e309d95..8b85e3e 100755 --- a/src/slack +++ b/src/slack @@ -34,6 +34,8 @@ case "${cmd}${sub}" in esac # ARGUMENT AND OPTION PARSING ##################################################################### +as_user=true + while (( "$#" )); do case "${1}" in --actions=*) actions=${1/--actions=/''} ; shift ;; @@ -44,6 +46,7 @@ while (( "$#" )); do --author-link*|-al*) titlelink=${2} ; shift ; shift ;; --author=*) author=${1/--author=/''} ; shift ;; --author*|-at*) author=${2} ; shift ; shift ;; + --bot|-b) as_user=false ; shift ;; --channels=*) channels=${1/--channels=/''} ; shift ;; --channels*|-chs*) channels=${2} ; shift ; shift ;; --channel=*) channel=${1/--channel=/''} ; shift ;; @@ -283,7 +286,7 @@ function luser() { function chatdelete() { local msg=$(\ curl -s -X POST https://slack.com/api/chat.delete \ - --data-urlencode "as_user=true" \ + --data-urlencode "as_user=${as_user}" \ --data-urlencode "channel=$(lchannel)" \ --data-urlencode "ts=${timestamp}" \ --data-urlencode "token=${token}") @@ -296,7 +299,7 @@ function chatsend() { local msg=$(\ curl -s -X POST https://slack.com/api/chat.postMessage \ - --data-urlencode "as_user=true" \ + --data-urlencode "as_user=${as_user}" \ --data-urlencode "attachments=$(attachify)" \ --data-urlencode "channel=$(lchannel)" \ --data-urlencode "token=${token}") @@ -309,7 +312,7 @@ function chatupdate() { local msg=$(\ curl -s -X POST https://slack.com/api/chat.update \ - --data-urlencode "as_user=true" \ + --data-urlencode "as_user=${as_user}" \ --data-urlencode "attachments=$(attachify)" \ --data-urlencode "channel=$(lchannel)" \ --data-urlencode "ts=${timestamp}" \ @@ -324,12 +327,12 @@ function help() { echo 'Usage:' echo " ${bin} chat delete [ [channel]]" - echo ' [--channel|-ch ] [--compact|-c] [--filter|-f ] [--monochrome|-m]' + echo ' [--bot|-b] [--channel|-ch ] [--compact|-c] [--filter|-f ] [--monochrome|-m]' echo ' [--timestamp|-ts ] [--trace|-x]' echo echo " ${bin} chat send [ [channel]]" echo ' [--author|-at ] [--author-icon|-ai ]' - echo ' [--author-link|-al ] [--channel|-ch ] [--color|-cl ]' + echo ' [--author-link|-al ] [--bot|-b] [--channel|-ch ] [--color|-cl ]' echo ' [--compact|-cp] [--fields|-flds ] [--filter|-f ] [--footer|-ft