summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2011-05-08 14:57:12 +0200
committerJulien Dessaux2011-05-08 14:57:12 +0200
commitfa0bf06c910cd71c91d6b3fc50c7394dae668956 (patch)
tree2493cb7c34db776a46f9aaf92d18882b3c93e138
parentAdded duck spawning capabilities, ready to be shot! (diff)
downloadhsbot-fa0bf06c910cd71c91d6b3fc50c7394dae668956.tar.gz
hsbot-fa0bf06c910cd71c91d6b3fc50c7394dae668956.tar.bz2
hsbot-fa0bf06c910cd71c91d6b3fc50c7394dae668956.zip
Added the ability to directly answer /msg.
-rw-r--r--Hsbot/Message.hs9
-rw-r--r--hsbot.cabal2
2 files changed, 6 insertions, 5 deletions
diff --git a/Hsbot/Message.hs b/Hsbot/Message.hs
index d6697cd..825a649 100644
--- a/Hsbot/Message.hs
+++ b/Hsbot/Message.hs
@@ -18,8 +18,9 @@ writeMsg :: Message -> Plugin (Env IO) ()
writeMsg msg = asks pluginMaster >>= liftIO . flip writeChan msg
answerMsg :: IRC.Message -> String -> Plugin (Env IO) ()
-answerMsg request msg =
- case IRC.msg_params request of
- sender:_ -> writeMsg . OutgoingMsg $ IRC.Message Nothing "PRIVMSG" [sender, msg]
- [] -> return ()
+answerMsg _ [] = return ()
+answerMsg (IRC.Message (Just (IRC.NickName nick _ _)) _ (channel:_)) msg
+ | head channel == '#' = writeMsg . OutgoingMsg $ IRC.Message Nothing "PRIVMSG" [channel, msg]
+ | otherwise = writeMsg . OutgoingMsg $ IRC.Message Nothing "PRIVMSG" [nick, msg]
+answerMsg _ _ = return ()
diff --git a/hsbot.cabal b/hsbot.cabal
index ecbffe1..b2a9119 100644
--- a/hsbot.cabal
+++ b/hsbot.cabal
@@ -1,5 +1,5 @@
Name: hsbot
-Version: 0.4.10
+Version: 0.4.11
Cabal-version: >=1.2
Synopsis: A multipurposes IRC bot
Description: