diff options
Diffstat (limited to 'Hsbot/Message.hs')
-rw-r--r-- | Hsbot/Message.hs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Hsbot/Message.hs b/Hsbot/Message.hs index f38438f..933394b 100644 --- a/Hsbot/Message.hs +++ b/Hsbot/Message.hs @@ -1,5 +1,7 @@ module Hsbot.Message ( processInternalMessage + , processRebootMessage + , processExitMessage ) where import Control.Monad.State @@ -9,16 +11,15 @@ import Hsbot.PluginUtils import Hsbot.Types -- | Processes an internal message -processInternalMessage :: BotMsg -> Bot (BotStatus) -processInternalMessage (IntMsg msg) +processInternalMessage :: Msg -> Bot (BotStatus) +processInternalMessage msg | msgTo msg == "CORE" = processCoreMessage msg | otherwise = do plugins <- gets botPlugins case M.lookup (msgTo msg) plugins of - Just (plugin, _) -> sendToPlugin (IntMsg msg) plugin + Just (plugin, _, _) -> sendToPlugin (IntMsg msg) plugin Nothing -> return () return BotContinue -processInternalMessage _ = return BotContinue processCoreMessage :: Msg -> Bot (BotStatus) processCoreMessage msg = do @@ -26,3 +27,9 @@ processCoreMessage msg = do "REBOOT" -> return BotReboot _ -> return BotContinue +processRebootMessage :: RebootMsg -> Bot (BotStatus) +processRebootMessage _ = return BotReboot -- TODO : check who is sending that to us + +processExitMessage :: ExitMsg -> Bot (BotStatus) +processExitMessage _ = return BotExit -- TODO : check who is sending that to us + |