This commit is contained in:
niten 2024-03-23 11:33:12 -07:00
parent 9269eb1a7e
commit 40dcb126a9
1 changed files with 9 additions and 8 deletions

View File

@ -192,18 +192,19 @@
bebot-auth-token-file bebot-auth-token-file
bebot-channel-id bebot-channel-id
notify-user]} (get-args required-keys args) notify-user]} (get-args required-keys args)
logger (bebot-log/make-logger bebot-url logger (bebot-log/make-logger bebot-url
(-> bebot-auth-token-file slurp str/trim-newline) (-> bebot-auth-token-file slurp str/trim-newline)
bebot-channel-id bebot-channel-id
notify-user) notify-user)
checks (create-checks logger) checks (create-checks logger)
bot (reify-bot exchange-host bot (reify-bot exchange-host
(-> currency str/lower-case keyword) (-> currency str/lower-case keyword)
checks) checks)
shutdown (chan)] shutdown (chan)]
(.addShutdownHook (Runtime/getRuntime) (.addShutdownHook (Runtime/getRuntime)
(Thread. (fn [] (Thread. (fn []
(println "Stopping pricebot...") (println "Stopping pricebot...")
(log/notify! logger (str "Shutting down pricebot for " (name currency) "."))
(stop! bot) (stop! bot)
(>!! shutdown true)))) (>!! shutdown true))))
(log/notify! logger (str "Hi! I'm going to start watching the price of " (name currency) " for you.")) (log/notify! logger (str "Hi! I'm going to start watching the price of " (name currency) " for you."))