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.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Plugin/Help.hs b/src/Plugin/Help.hs
new file mode 100644
index 0000000..57e106d
--- /dev/null
+++ b/src/Plugin/Help.hs
@@ -0,0 +1,25 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module Plugin.Help
+ ( help
+ ) where
+
+import qualified Data.Text as T
+
+import qualified Plugin.PluginList as PL (plugins)
+import Plugin.Base
+
+help = Plugin
+ { matchRegex = "^help$"
+ , perform = helpAction
+ , command = "help"
+ , description = "Show a list of available bot commands."
+ }
+
+helpAction :: PluginAction
+helpAction _ = do
+ return $ Right $ T.concat
+ [command p `T.append` "\t" `T.append` description p | p <- plugins]
+
+plugins :: [Plugin]
+plugins = PL.plugins ++ [help]