aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/IRC.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/IRC.hs b/src/IRC.hs
index 8a956d1..ca4e0d5 100644
--- a/src/IRC.hs
+++ b/src/IRC.hs
@@ -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