Archived
1
0
Fork 0

Rationalized the way bot configs are handled.

This commit is contained in:
Julien Dessaux 2010-05-29 16:59:41 +02:00
parent daea135424
commit 57bec4921b
5 changed files with 24 additions and 31 deletions

View file

@ -17,18 +17,18 @@ import Hsbot.Plugin
import Hsbot.Types
-- | Bot's main entry point
hsbot :: Config -> IO ()
hsbot :: [BotConfig] -> IO ()
hsbot config = do
startTime <- getCurrentTime
putStrLn "[Hsbot] Opening communication channel... "
chan <- newChan :: IO (Chan BotMsg)
mvar <- newMVar M.empty :: IO (MVar BotResumeData)
putStrLn "[Hsbot] Spawning IrcBot plugins... "
botState <- execStateT spawnIrcPlugins BotState { botStartTime = startTime
, botPlugins = M.empty
, botChan = chan
, botConfig = config
, botResumeData = mvar }
botState <- execStateT spawnPlugins BotState { botStartTime = startTime
, botPlugins = M.empty
, botChan = chan
, botConfig = config
, botResumeData = mvar }
putStrLn "[Hsbot] Entering main loop... "
(status, botState') <- runLoop botState
putStrLn "[Hsbot] Killing active plugins... "