Skip to content

Instantly share code, notes, and snippets.

@gdeest
Created July 4, 2012 12:05
Show Gist options
  • Save gdeest/3046997 to your computer and use it in GitHub Desktop.
Save gdeest/3046997 to your computer and use it in GitHub Desktop.
{-# LANGUAGE OverloadedStrings #-}
import Data.ByteString.Char8 hiding (putStrLn)
import Network.SimpleIRC
import System.IO.Error
joinEvent :: EventFunc
joinEvent m msg = case mNick msg of
Just "gawelBot" -> sendCmd m $ MQuit "Bye !"
_ -> return ()
config :: IrcConfig
config = defaultConfig {
cNick = "gawelBot",
cAddr = "irc.epiknet.org",
cChannels = ["#c2s"],
cEvents = [Join joinEvent]
}
main :: IO ()
main = do
r <- connect config False True
case r of
Left err -> putStrLn ("Error: " ++ ioeGetErrorString err)
Right conn -> return ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment