summaryrefslogtreecommitdiff
path: root/Hsbot/Command.hs
diff options
context:
space:
mode:
authorJulien Dessaux2010-04-25 16:43:01 +0200
committerJulien Dessaux2010-04-25 16:43:01 +0200
commitb6d119cf5b14fd7198552e939d8f49b15307e74e (patch)
tree1f2188a89b159d6800ff89ed3346437aebfb2782 /Hsbot/Command.hs
parentAdded an utility function to correctly answer a message we receive (aka /msg) (diff)
downloadhsbot-b6d119cf5b14fd7198552e939d8f49b15307e74e.tar.gz
hsbot-b6d119cf5b14fd7198552e939d8f49b15307e74e.tar.bz2
hsbot-b6d119cf5b14fd7198552e939d8f49b15307e74e.zip
Some refactoring + cosmetics.
Diffstat (limited to 'Hsbot/Command.hs')
-rw-r--r--Hsbot/Command.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Hsbot/Command.hs b/Hsbot/Command.hs
index 711aa32..4653618 100644
--- a/Hsbot/Command.hs
+++ b/Hsbot/Command.hs
@@ -42,7 +42,7 @@ dispatchMessage (InputMsg inputMsg)
| isPluginCommand = do
plugins <- gets botPlugins
cmds <- gets botCommands
- let key = tail $ head $ words getMsgContent
+ let key = tail . head $ words getMsgContent
pluginNames = fromMaybe [] $ M.lookup key cmds
plugins' = fromMaybe [] $ mapM (flip M.lookup plugins) pluginNames
mapM_ (sendRunCommand $ tail getMsgContent) plugins'
@@ -56,7 +56,7 @@ dispatchMessage (InputMsg inputMsg)
, (head getMsgContent) == (commandPrefix config) ]
sendRunCommand :: String -> Plugin -> IrcBot ()
sendRunCommand cmd plugin = do
- sendToPlugin (InternalCmd $ IntCmd "RUN" "CORE" (pluginName plugin) cmd (Just inputMsg)) plugin
+ sendToPlugin (InternalCmd $ IntCmd "RUN" "CORE" (pluginName plugin) cmd inputMsg) plugin
getMsgContent :: String
getMsgContent = unwords . tail $ parameters inputMsg
dispatchMessage _ = return ()