diff --git a/src/slack b/src/slack index e309d95..f84a624 100755 --- a/src/slack +++ b/src/slack @@ -80,6 +80,8 @@ while (( "$#" )); do --page|-pg*) page=${2} ; shift ; shift ;; --pretext=*) pretext=${1/--pretext=/''} ; shift ;; --pretext*|-pt*) pretext=${2} ; shift ; shift ;; + --query=*) query=${1/--query=/''} ; shift ;; + --query*|-q*) query=${2} ; shift ; shift ;; --reminder=*) reminder=${1/--reminder=/''} ; shift ;; --reminder|-rm*) reminder=${2} ; shift ; shift ;; --text=*) text=${1/--text=/''} ; shift ;; @@ -211,6 +213,9 @@ case "${cmd}${sub}" in remindercomplete|reminderdelete|reminderinfo) [ -z "${reminder}" ] && read -e -p 'Enter reminder (e.g. RmCT7QGVBF): ' reminder ;; + search) + [ -z "${query}" ] && read -e -p 'Enter search query: ' query + ;; snoozestart) [ -z "${minutes}" ] && read -e -p 'Enter minutes (e.g. 60): ' minutes ;; @@ -611,6 +616,15 @@ function reminderlist() { jqify "${msg}" } +function search() { + local msg=$(\ + curl -s -X POST https://slack.com/api/search.messages \ + --data-urlencode "query=${query}" \ + --data-urlencode "token=${token}") + + jqify "${msg}" +} + function snoozeend() { local msg=$(\ curl -s -X POST https://slack.com/api/dnd.endSnooze \ @@ -668,7 +682,7 @@ case "${cmd}${sub}" in filedelete|fileinfo|filelist|fileupload|\ presenceactive|presenceaway|\ reminderadd|remindercomplete|reminderdelete|reminderinfo|reminderlist|\ - snoozeend|snoozeinfo|snoozestart|\ + search|snoozeend|snoozeinfo|snoozestart|\ statusclear|statusedit) if [ -z "${token}" ]; then echo '{"ok": false, "error": "not_inited"}' |