blob: 1ef4cd2903140859a595790e824a32005db83446 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
{-# LANGUAGE OverloadedStrings #-}
module Plugin.Base
( PluginAction
, Plugin(..)
, defaultPlugin
) where
import Control.Monad.Trans.Class (lift)
import qualified Data.Text as T
import Database.SQLite.Simple
-- import Config (Config)
import Bot (Bot(Bot))
import Message
type PluginAction = Message -> Bot (Either T.Text T.Text)
-- newtype Foo = Config Plugin
data Plugin = Plugin
{ matchRegex :: String
, perform :: PluginAction
, command :: T.Text
, description :: T.Text
, queryOnly :: Bool
}
instance Show Plugin where
show (Plugin r _ _ _ _) = "matchRegex = " ++ r
defaultPlugin :: Plugin
defaultPlugin = Plugin
{ matchRegex = ""
, perform = \m -> return (Left "")
, command = ""
, description = ""
, queryOnly = False
}
|