2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-23 02:47:14 +00:00
hacker-scripts/clojure/hangover.clj
Sam Adams 166cae8079 Clojure implementation (#174)
* clojure implementation

* gf --> boss

* newlines
2019-04-23 13:16:28 +04:00

29 lines
728 B
Clojure

(ns hacker-scripts.hangover
(:import
(com.twilio Twilio)
(com.twilio.rest.api.v2010.account Message)
(com.twilio.type PhoneNumber)))
(def acc-sid "my twilio account SID")
(def acc-tkn "my twilio secret token")
(def my-num (PhoneNumber. "+10001112222"))
(def boss-num (PhoneNumber. "+19998887777"))
(def reasons ["Receiving delivery"
"Waiting for repairman"
"Nasty cold"])
(defn twilio-init []
(Twilio/init acc-sid acc-tkn))
(defn send-sms [to-num from-num message]
(.. Message (creator to-num from-num message) create))
(def send-sms-boss (partial send-sms boss-num my-num))
(defn hangover []
(twilio-init)
(let [message (rand-nth reasons)]
(send-sms-boss message)))