You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
754 B

; (set _G.modem-spew io.stderr)
(local server (require :server))
(local webhook (require :webhook))
(local json (require :dkjson))
(local {: smsc : number : device }
(let [filename (assert (. arg 1) "missing argument")
text (with-open [config ( filename :r)]
(config:read "*a"))]
(match (json.decode text)
a a
(nil pos err) (error (.. "reading " filename ": " err)))))
(local { : view} (require :fennel))
(local sms ((. (require :sms) :new) { :smsc smsc :device device }))
(doto (
(fn handle [body]
(let [message (webhook.parse body)]
(sms:send number message)
(: :listen)
(print "server ready")
(: :loop))