diff options
| -rw-r--r-- | src/IRC.hs | 6 | ||||
| -rw-r--r-- | src/Plugin.hs | 6 | 
2 files changed, 8 insertions, 4 deletions
| @@ -13,6 +13,7 @@ import qualified Data.Text as T  import qualified Network.IRC.Client as IRC +import Bot (Bot)  import Message  import Plugin (matchPlugin, performPlugin)  import Plugin.Base (queryOnly) @@ -61,10 +62,11 @@ handlePrivmsg = IRC.EventHandler                      Nothing -> return ()                      Just r  -> sequence_ r -privmsgFromPlugin :: Message -> MaybeT IO [IRC.StatefulIRC s ()] +privmsgFromPlugin :: Message -> MaybeT Bot [IRC.StatefulIRC s ()]  privmsgFromPlugin message = do      plugin <- liftMaybe $ matchPlugin message -    response <- liftIO $ performPlugin plugin message +    response <- lift $ performPlugin plugin message +    -- plugin' <- liftMaybe plugin      return $ case response of          Left err -> [IRC.send $ IRC.Privmsg              (toChannel plugin message) diff --git a/src/Plugin.hs b/src/Plugin.hs index 04a8054..d4aa6f9 100644 --- a/src/Plugin.hs +++ b/src/Plugin.hs @@ -67,8 +67,10 @@ matchPlugins message plugins =  --     [return p | p <- plugins', M.textStr message =~ matchRegex p]  -- | Run the action belonging to the plugin, stored in its `perform` field. -performPlugin :: Plugin -> PluginAction -performPlugin p message = perform p $ message +performPlugin :: Bot Plugin -> PluginAction +performPlugin p message = do +    plugin <- p +    perform plugin $ message  plugins :: [Bot Plugin]  plugins = PL.plugins ++ [help] | 
