summaryrefslogtreecommitdiff
path: root/Hsbot/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Hsbot/Types.hs')
-rw-r--r--Hsbot/Types.hs21
1 files changed, 18 insertions, 3 deletions
diff --git a/Hsbot/Types.hs b/Hsbot/Types.hs
index 9ea7ff6..49e8e6b 100644
--- a/Hsbot/Types.hs
+++ b/Hsbot/Types.hs
@@ -1,10 +1,14 @@
module Hsbot.Types
( Bot
, BotMsg (..)
+ , BotResumeData
, BotState (..)
+ , BotStatus (..)
, Msg (..)
, Plugin
, PluginState (..)
+ , ResumeData
+ , ResumeMsg (..)
) where
import Control.Concurrent
@@ -24,10 +28,16 @@ data BotState = BotState
, botPlugins :: M.Map String (PluginState, ThreadId) -- Loaded plugins
, botChan :: Chan BotMsg -- the bot's communication channel
, botConfig :: Config -- the bot's starting config
- , botMVar :: MVar String -- the place where to put resume data
- , botResumeData :: M.Map String String -- the necessary data to resume the bot's operations on reboot
+ , botResumeData :: MVar BotResumeData -- the necessary data to resume the bot's operations on reboot
}
+-- | how we exit from the botLoop
+data BotStatus = BotExit | BotReboot | BotContinue deriving (Eq)
+
+-- | Types to factorise resume data
+type ResumeData = M.Map String String
+type BotResumeData = M.Map String ResumeData
+
-- | The Plugin monad
type Plugin = StateT PluginState IO
@@ -46,5 +56,10 @@ data Msg = Msg
, msgStuff :: String -- the message to be transfered
} deriving (Show)
-data BotMsg = InMsg Msg | OutMsg Msg | IntMsg Msg deriving (Show)
+data ResumeMsg = ResMsg
+ { resMsgFrom :: String
+ , resMsgData :: ResumeData
+ } deriving (Show)
+
+data BotMsg = InMsg Msg | OutMsg Msg | IntMsg Msg | UpdMsg ResumeMsg deriving (Show)