Skip to content

Instantly share code, notes, and snippets.

@jdiez17
Created December 23, 2014 17:54
Show Gist options
  • Select an option

  • Save jdiez17/fbda3c09cf1bdd9ad3b0 to your computer and use it in GitHub Desktop.

Select an option

Save jdiez17/fbda3c09cf1bdd9ad3b0 to your computer and use it in GitHub Desktop.
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