diff options
-rw-r--r-- | src/IRC.hs | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -59,7 +59,8 @@ privmsgHandler :: (Text -> Maybe a) -> (a -> Text -> IO [Text]) -> EventHandler privmsgHandler commandDetect msgFun = EventHandler (\ev -> case ev ^. message of Privmsg _ (Right text) - | Just s <- commandDetect text -> Just (ev ^. source, text, s) + | sendingUser (ev ^. source) `notElem` map Just excludedNicks + , Just s <- commandDetect text -> Just (ev ^. source, text, s) _ -> Nothing) (\_ (src, text, s) -> do msgs <- liftIO $ msgFun s text @@ -71,6 +72,14 @@ privmsgHandler commandDetect msgFun = EventHandler forM_ msgs $ \msg -> send $ Privmsg target (Right msg)) +sendingUser :: Source a -> Maybe a +sendingUser (User n) = Just n +sendingUser (Channel _ n) = Just n +sendingUser (Server _) = Nothing + +excludedNicks :: [Text] +excludedNicks = [T.pack "lambdabot"] + -- stdoutLogger :: Origin -> ByteString -> IO () -- stdoutLogger origin x = do -- putStrLn $ unwords |