Created
July 4, 2012 12:05
-
-
Save gdeest/3046997 to your computer and use it in GitHub Desktop.
This file contains 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
{-# 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