diff options
-rw-r--r-- | hirc.hs | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -63,18 +63,18 @@ run = do Config{..} <- asks config write "NICK" nick write "USER" (nick++" 0 * :hirc bot") - asks socket >>= listen + ask >>= listen -- Process each line from the server -listen :: Handle -> Net () -listen h = forever $ do - c@Config{..} <- asks config - let filename = server <> (':' : show port) +listen :: Bot -> Net () +listen Bot{config=c@Config{..},socket=h} = forever $ do s <- init `fmap` io (hGetLine h) io (putStrLn s) case parse P.message filename s of Right m -> eval m x -> io $ putStrLn $ show x + where + filename = server <> (':' : show port) -- Dispatch a command eval :: Message -> Net () |