From 0a3308487b3831e0d4d8dbf28290cc791daf9e86 Mon Sep 17 00:00:00 2001 From: Jeena Paradies Date: Tue, 28 Jun 2011 13:56:41 +0200 Subject: [PATCH] added sanitazion of words --- cnb.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cnb.hs b/cnb.hs index 32932f1..bb8dd5d 100644 --- a/cnb.hs +++ b/cnb.hs @@ -2,6 +2,7 @@ import Network import System.IO import Text.Printf import Data.List +import Data.Char import System.Exit import Control.Monad.State import Text.Regex.Posix @@ -153,7 +154,13 @@ action "cleanup" (Message n _ _) = cleanup n action s (Message n _ _) = do case (length s) of 0 -> privmsg "What?!" - _ -> privmsg ("Fuck you " ++ n ++ "! " ++ s ++ " your self!") + _ -> privmsg ("Fuck you " ++ n ++ "! " ++ + sanit (capitalize s) ++ " yourself!") + where + capitalize (x:xs) = toUpper x : xs + sanit xs = case [(last xs)] `isInfixOf` ".:!?" of + True -> take (length xs - 1) xs + False -> xs rest :: String -> String -> String rest k s = drop (length k + 1) s @@ -234,7 +241,7 @@ startStore = [ ("^jump$", "The quick brown clynx jumps over the lazy oak."), ("^ok$", "ok"), ("(J|j)eena,? arbeitest du", "Jeena, sag doch mal."), - (nick, "Keine ungefragten queries!"), + -- (nick, "Keine ungefragten queries!"), ("(php|PHP)", "'PHP' <- Ha ha!"), ("(E|e)rlang", "Oh yeah!"), ("(H|h)askell", "Ich bin in Haskell geschrieben."),