Skip to content

Instantly share code, notes, and snippets.

@blizzarddreams
Created December 24, 2015 01:36
Show Gist options
  • Select an option

  • Save blizzarddreams/4d3cf8d8ecdd78a7423c to your computer and use it in GitHub Desktop.

Select an option

Save blizzarddreams/4d3cf8d8ecdd78a7423c to your computer and use it in GitHub Desktop.
channels = ["#test", "#world"]
main = do
conn <- connectTo (server bot) $ PortNumber $ fromIntegral $ 6667
hSetBuffering conn NoBuffering
write conn "USER" $ nick bot ++ " 8 * :" ++ nick bot
write conn "NICK" "haskelbottt"
write conn "JOIN" "#botwars" -- instead I want to loop through channels and pass it AND conn to `write`
listen conn
write :: Handle -> String -> String -> IO ()
write h s t = do
hPrintf h "%s %s\r\n" s t
joinChannel :: Handle -> String -> IO ()
joinChannel c channel =
write c "JOIN" channel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment