blob: 82b643f9940fe1484859d607902a46a1a7e58aa5 (
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
|
module Hsbot.Main
( imain
) where
import Control.Exception
import Control.Monad.State
import Prelude hiding (catch)
import System.IO()
import Config
import Hsbot.Core
import Hsbot.IRC
import Hsbot.Plugin
import Hsbot.Types
import Plugins.Core(mainCore)
import Plugins.Ping(mainPing)
import Plugins.Quote(mainQuote)
-- | Bot's main entry point
imain :: IO ()
imain = do
bot <- connectServer $ ircServer config
bot' <- (execStateT run bot) `catch` (\(_ :: IOException) -> return bot)
evalStateT disconnectServer bot'
-- | The Bot monad main function
run :: IrcBot ()
run = do
initServer
loadPlugin "Ping" mainPing
loadPlugin "Core" mainCore
loadPlugin "Quote" mainQuote
runServer
|