Created
December 23, 2014 17:54
-
-
Save jdiez17/fbda3c09cf1bdd9ad3b0 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
| respond' :: Config -> Message -> String -> (String, String) | |
| respond' cfg m reply = (sendTo, text) | |
| where | |
| senderNick = (IRC.Parser.nick (sender m)) | |
| sendTo = if location m == (Config.nick cfg) | |
| then senderNick | |
| else location m | |
| text = if location m == (Config.nick cfg) | |
| then reply | |
| else senderNick ++ ": " ++ reply | |
| respond :: Message -> String -> Bot () | |
| respond m r = asks config >>= \cfg -> uncurry privmsg $ respond' cfg m r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment