Skip to content

Commit

Permalink
Added an example of the on-error handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynes committed Aug 24, 2010
1 parent 0e0b14e commit f9cb091
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/testirclj.clj
Expand Up @@ -22,7 +22,9 @@
(send-message irc channel (str nick " parted. Reason: " reason)))
:on-action (fn [{:keys [nick message reason channel irc]}]
(send-message irc channel (str "you said " message)))
:on-connect (fn [_] (println "\n\nON-CONNECT TRIGGERED.\n\n"))})
:on-connect (fn [_] (println "\n\nON-CONNECT TRIGGERED.\n\n"))
:on-error (fn [{:keys [irc channel error doing]}]
(send-message irc channel (str "While executing the " doing " handler, an error occurred: " (.getMessage error))))})

(def bot (connect (create-irc {:name "ircljbot" :server "irc.freenode.net" :fnmap fnmap})
:channels ["#()" "#irclj" ["#keyed" "secret"]]))
Expand Down

0 comments on commit f9cb091

Please sign in to comment.