-
-
Save Licenser/382010 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(defn answer-with [irc-data reply] | |
(let [{:keys [irc channel nick]} irc-data] | |
(ircb/send-message irc channel | |
(str nick ": " reply))) | |
(defplugin | |
(:dict | |
"Takes a word and look's up it's definition via the Wordnik dictionary API." | |
["dict"] | |
[{:keys [irc channel nick args] :as data}] | |
(answer-with data | |
(let [[text part] (lookup-def (first args))] | |
(if (seq text) (str part ": " text) "Word not found."))))) | |
(defn answer-to [irc-data f] | |
(let [{:keys [irc channel nick]} irc-data] | |
(ircb/send-message irc channel | |
(str nick ": " (f irc-data)))) | |
(defplugin | |
(:dict | |
"Takes a word and look's up it's definition via the Wordnik dictionary API." | |
["dict"] | |
[{:keys [irc channel nick args] :as data}] | |
(answer-to data (fn [{:keys [args]}] | |
(let [[text part] (lookup-def (first args))] | |
(if (seq text) (str part ": " text) "Word not found.")))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment