aboutsummaryrefslogtreecommitdiffstats
path: root/src/Plugin/Help.hs
blob: 57e106de3836af208141b02d9a2b99c9518d4f8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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]