aboutsummaryrefslogtreecommitdiffstats
path: root/src/Plugin/Help.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Plugin/Help.hs')
-rw-r--r--src/Plugin/Help.hs32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/Plugin/Help.hs b/src/Plugin/Help.hs
index 63143b1..b29d1b9 100644
--- a/src/Plugin/Help.hs
+++ b/src/Plugin/Help.hs
@@ -4,28 +4,36 @@ module Plugin.Help
( help
) where
+import Control.Monad (sequence)
import qualified Data.Text as T
+import Bot (Bot)
import qualified PluginList as PL (plugins)
import Plugin.Base
-help = defaultPlugin
- { matchRegex = "^help$"
- , perform = helpAction
- , command = "help"
- , description = "Show a list of available bot commands."
- , queryOnly = True
- }
+help :: Bot Plugin
+help = do
+ return defaultPlugin
+ { matchRegex = "^help$"
+ , perform = helpAction
+ , command = "help"
+ , description = "Show a list of available bot commands."
+ , queryOnly = True
+ }
helpAction :: PluginAction
helpAction _ = do
return $ Right $ T.intercalate "\n"
- [T.justifyRight longestCommandLen ' ' (command p)
- `T.append` " – "
- `T.append` description p
- | p <- plugins]
+ -- [T.justifyRight longestCommandLen ' ' (command p)
+ -- `T.append` " – "
+ -- `T.append` description p
+ -- | p <- plugins']
where
longestCommandLen = foldr (max) 0 (map (T.length . command) plugins)
-plugins :: [Plugin]
+ helpText plugin = T.justifyRight longestCommandLen ' ' (command plugin)
+ `T.append` " – "
+ `T.append` description plugin
+
+plugins :: [Bot Plugin]
plugins = PL.plugins ++ [help]