diff options
-rw-r--r-- | miaowe.hs | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -202,23 +202,24 @@ getFortune = readCreateProcess ((shell "fortune | cowsay -b")) "" processCommand :: IrcChannel -> MircString -> IO () processCommand channel command | length (words command) < 5 = sendToChannel channel "You need to specify a command." - | (words command)!!4 == "Quit" = exitSuccess - | (words command)!!4 == "List" = listDirectory "." - >>= sendToChannel channel . - intercalate "\n" - | (words command)!!4 == "Code" = sendToChannel channel codeUrl - | (words command)!!4 == "Help" = sendToChannel channel helpString + | otherwise = case (words command)!!4 of + "quit" -> exitSuccess + "list" -> listDirectory "." + >>= sendToChannel channel . + intercalate "\n" + "code" -> sendToChannel channel codeUrl + "help" -> sendToChannel channel helpString #ifdef FORTUNE - | (words command)!!4 == "Fortune" = getFortune - >>= sendToChannel channel + "fortune" -> getFortune + >>= sendToChannel channel #endif - | otherwise = (if isInfixOf "/" ((words command)!!4) - then - sendToChannel channel - "Only PWD please." - else - trySendFile channel - ((words command)!!4)) + _ -> (if isInfixOf "/" ((words command)!!4) + then + sendToChannel channel + "Only PWD please." + else + trySendFile channel + ((words command)!!4)) mainLoop :: IrcChannel -> IO () mainLoop channel = waitForCommand |