Archived
1
0
Fork 0
This repository has been archived on 2025-03-10. You can view files and clone it, but cannot push or open issues or pull requests.
hsbot/Hsbot/Main.hs

36 lines
768 B
Haskell

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
liftIO $ putStrLn "Starting plugins..."
loadPlugin "Ping" mainPing
loadPlugin "Core" mainCore
loadPlugin "Quote" mainQuote
runServer