Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 12th, 2012  |  syntax: None  |  size: 0.64 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. {-# LANGUAGE OverloadedStrings #-}
  2.  
  3. import Data.ByteString.Char8 hiding (putStrLn)
  4. import Network.SimpleIRC
  5. import System.IO.Error
  6.  
  7. joinEvent :: EventFunc
  8. joinEvent m msg = case mNick msg of
  9.                     Just "gawelBot" -> sendCmd m $ MQuit "Bye !"
  10.                     _ -> return ()
  11.  
  12. config :: IrcConfig
  13. config = defaultConfig {
  14.            cNick = "gawelBot",
  15.            cAddr = "irc.epiknet.org",
  16.            cChannels = ["#c2s"],
  17.            cEvents = [Join joinEvent]
  18.          }
  19.  
  20. main :: IO ()
  21. main = do
  22.   r <- connect config False True
  23.   case r of
  24.     Left err -> putStrLn ("Error: " ++ ioeGetErrorString err)
  25.     Right conn -> return ()