summaryrefslogtreecommitdiff
path: root/Plugins/Core.hs
diff options
context:
space:
mode:
authorJulien Dessaux2010-04-22 19:42:53 +0200
committerJulien Dessaux2010-04-22 19:42:53 +0200
commit727adadc28a40fe8843a0727168684d3c2b3e114 (patch)
tree03af9d78502488676c74d1f55762c5c6b6de2116 /Plugins/Core.hs
parentWrote the list plugin command. (diff)
downloadhsbot-727adadc28a40fe8843a0727168684d3c2b3e114.tar.gz
hsbot-727adadc28a40fe8843a0727168684d3c2b3e114.tar.bz2
hsbot-727adadc28a40fe8843a0727168684d3c2b3e114.zip
Added an utility function to correctly answer a message we receive (aka /msg)
Diffstat (limited to 'Plugins/Core.hs')
-rw-r--r--Plugins/Core.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/Plugins/Core.hs b/Plugins/Core.hs
index 64e0bf7..f6bd4ef 100644
--- a/Plugins/Core.hs
+++ b/Plugins/Core.hs
@@ -28,9 +28,9 @@ run = forever $ do
where
eval :: BotMsg -> IrcPlugin ()
eval (InternalCmd intCmd) = do
+ let request = intCmdBotMsg intCmd
case intCmdCmd intCmd of
"RUN" -> let stuff = words $ intCmdMsg intCmd
- request = intCmdBotMsg intCmd
in case head stuff of
"list" -> listPlugins request
"load" -> loadPlugin $ tail stuff
@@ -38,9 +38,7 @@ run = forever $ do
"unload" -> unloadPlugin $ tail stuff
_ -> lift $ trace $ show intCmd -- TODO : help message
"ANSWER" -> let stuff = intCmdMsg intCmd
- request = intCmdBotMsg intCmd
- chanOrigin = head $ parameters (fromMaybe (IrcMsg Nothing "ARGH" []) request)
- in writeMsg $ OutputMsg $ IrcMsg Nothing "PRIVMSG" [chanOrigin, "Loaded plugins : " ++ stuff]
+ in answerMsg request ("Loaded plugins : " ++ stuff)
_ -> lift $ trace $ show intCmd
eval (InputMsg _) = return ()
eval _ = return ()