diff options
author | Teddy Wing | 2017-09-15 22:42:55 +0200 |
---|---|---|
committer | Teddy Wing | 2017-09-15 23:10:47 +0200 |
commit | e689b4b8cbf1c73f04b1b348fd0d598d401085b1 (patch) | |
tree | a744706e12198e80a08b236d22416ab1497d7983 /src/Plugin.hs | |
parent | 1f9c9d43ef475167ac6e886a71a782cf41bd549e (diff) | |
download | sorbot-e689b4b8cbf1c73f04b1b348fd0d598d401085b1.tar.bz2 |
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`.
Diffstat (limited to 'src/Plugin.hs')
-rw-r--r-- | src/Plugin.hs | 5 |
1 files changed, 3 insertions, 2 deletions
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] |