[#159] Housekeeping

This commit is contained in:
Peter Taoussanis 2016-03-29 01:23:18 +07:00
parent 495dd453ed
commit 59895afcba
2 changed files with 18 additions and 15 deletions

View File

@ -34,7 +34,8 @@
[com.taoensso/carmine "2.12.2"]
[com.draines/postal "1.11.4"]
[irclj "0.5.0-alpha4"]
[org.graylog2/gelfclient "1.3.1"]]}
[org.graylog2/gelfclient "1.3.1"]
[org.julienxx/clj-slack "0.5.3"]]}
:dev
[:1.7 :test
{:dependencies [[org.clojure/clojurescript "1.7.28"]]

View File

@ -1,28 +1,30 @@
(ns taoensso.timbre.appenders.3rd-party.slack
"Requires https://github.com/julienXX/clj-slack"
{:author "Simon Belak (@sbelak)"}
(:require (taoensso [timbre :as timbre]
[encore :as encore])
(clj-slack [chat :as slack.chat]
[core :as slack])))
(:require
[taoensso.timbre :as timbre]
[taoensso.encore :as enc]
[clj-slack.chat :as slack.chat]
[clj-slack.core :as slack]))
(defn slack-appender
"Return Slack appender.
Required params:
`token` - Slack API token. See: Browse apps > Custom Integrations > Bots
`channel` - Channel ID.
"Returns Slack appender. Required params:
`token` - Slack API token. See: Browse apps > Custom Integrations > Bots
`channel` - Channel ID
Optional params: same as clj-slack.chat/post-message `optionals`. See: http://julienblanchard.com/clj-slack/clj-slack.chat.html"
Optional params: same as `clj-slack.chat/post-message` `optionals`,
Ref. http://julienblanchard.com/clj-slack/clj-slack.chat.html"
[& [opts]]
(let [{:keys [token channel]} opts
conn {:api-url "https://slack.com/api"
:token token}]
{:enabled? true
:async? true
{:enabled? true
:async? true
:min-level nil
:rate-limit [[1 (encore/ms :secs 1)]]
:output-fn :inherit
:rate-limit [[1 (enc/ms :secs 1)]]
:output-fn :inherit
:fn
(fn [data]
(let [{:keys [output-fn]} data]
(slack.chat/post-message conn channel (output-fn data)
(dissoc opts :token :channel))))}))
(dissoc opts :token :channel))))}))