Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
26 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
(ns clj-slack.core) | ||
(ns clj-slack.core | ||
(:use [cheshire.core]) | ||
(:require [org.httpkit.client :as http])) | ||
|
||
(defn foo | ||
"I don't do a whole lot." | ||
[x] | ||
(println x "Hello, World!")) | ||
(defn remove-nil [& params] | ||
(let [map (apply hash-map params)] | ||
(into {} (filter second map)))) | ||
|
||
(defn create-link | ||
[link text] | ||
(format "<%s|%s>" link text)) | ||
|
||
(defn send-msg [url text & {:keys [username icon_url icon_emoji]}] | ||
(let [map (remove-nil :text text :username username :icon_url icon_url :icon_emoji icon_emoji)] | ||
(let [options {:timeout 15000 | ||
:body (generate-string map)}] | ||
(= (:status @(http/post url options)) 200)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters