From e689b4b8cbf1c73f04b1b348fd0d598d401085b1 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 15 Sep 2017 22:42:55 +0200 Subject: Plugin: Update plugin list with new wrapped `Bot` type Since our plugins are now wrapped in the `Bot` monad, the plugin list's type needs to change. Also update `matchPlugin` to return a `Bot Plugin`. --- src/Plugin.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Plugin.hs b/src/Plugin.hs index 34ad60e..a79e815 100644 --- a/src/Plugin.hs +++ b/src/Plugin.hs @@ -8,13 +8,14 @@ import qualified Data.Text as T import Text.Regex.TDFA +import Bot (Bot) import qualified Message as M import Plugin.Base import qualified PluginList as PL (plugins) import Plugin.Help (help) -- | Get the first plugin that matches the given message text. -matchPlugin :: M.Message -> Maybe Plugin +matchPlugin :: M.Message -> Maybe (Bot Plugin) matchPlugin message = firstPlugin $ matchPlugins message plugins where firstPlugin [] = Nothing @@ -29,5 +30,5 @@ matchPlugins message plugins = performPlugin :: Plugin -> PluginAction performPlugin p message = perform p $ message -plugins :: [Plugin] +plugins :: [Bot Plugin] plugins = PL.plugins ++ [help] -- cgit v1.2.3