-- Copyright (c) 2005-6 Don Stewart - http://www.cse.unsw.edu.au/~dons
-- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html)

-- | Lambdabot version information
module Lambdabot.Plugin.Core.Version (versionPlugin) where

import Lambdabot.Plugin
import Data.Version (showVersion)

versionPlugin :: Module ()
versionPlugin :: Module ()
versionPlugin = Module ()
forall st. Module st
newModule
    { moduleCmds :: ModuleT () LB [Command (ModuleT () LB)]
moduleCmds = [Command (ModuleT () LB)]
-> ModuleT () LB [Command (ModuleT () LB)]
forall (m :: * -> *) a. Monad m => a -> m a
return
        [ (String -> Command Identity
command String
"version")
            { help :: Cmd (ModuleT () LB) ()
help = String -> Cmd (ModuleT () LB) ()
forall (m :: * -> *). Monad m => String -> Cmd m ()
say (String -> Cmd (ModuleT () LB) ())
-> String -> Cmd (ModuleT () LB) ()
forall a b. (a -> b) -> a -> b
$
                String
"version/source. Report the version " String -> String -> String
forall a. [a] -> [a] -> [a]
++
                String
"and git repo of this bot"
            , process :: String -> Cmd (ModuleT () LB) ()
process = Cmd (ModuleT () LB) () -> String -> Cmd (ModuleT () LB) ()
forall a b. a -> b -> a
const (Cmd (ModuleT () LB) () -> String -> Cmd (ModuleT () LB) ())
-> Cmd (ModuleT () LB) () -> String -> Cmd (ModuleT () LB) ()
forall a b. (a -> b) -> a -> b
$ do
                Version
ver <- Config Version -> Cmd (ModuleT () LB) Version
forall (m :: * -> *) a. MonadConfig m => Config a -> m a
getConfig Config Version
lbVersion
                String -> Cmd (ModuleT () LB) ()
forall (m :: * -> *). Monad m => String -> Cmd m ()
say (String -> Cmd (ModuleT () LB) ())
-> String -> Cmd (ModuleT () LB) ()
forall a b. (a -> b) -> a -> b
$ String
"lambdabot " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Version -> String
showVersion Version
ver
                String -> Cmd (ModuleT () LB) ()
forall (m :: * -> *). Monad m => String -> Cmd m ()
say String
"git clone https://github.com/lambdabot/lambdabot"
            }
        ]
    }