summaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
authorpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-28 10:34:23 +0000
committerpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-28 10:34:23 +0000
commit561aa6d45ed2c7dc6cd177bab5c31f6d8fccde66 (patch)
treecf8d5419a8b94dc7617103eb51a26fefd3d97871 /Main.hs
parentd30b3a0cde8bbe4a58fafc39e2f1d50197f16710 (diff)
git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@44 9f8f72e9-4bf4-416e-b76e-7d4203597157
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs55
1 files changed, 0 insertions, 55 deletions
diff --git a/Main.hs b/Main.hs
deleted file mode 100644
index 4bd88dc..0000000
--- a/Main.hs
+++ /dev/null
@@ -1,55 +0,0 @@
-module Main where
-
-import System
-
-import AI
-import Cmd
-import Conf
-import Env
-import IRC
-import State
-import Tools
-
-main :: IO ()
-main = do
- let conf = makeConf
- databaseFile <- get "databaseFile" conf
- let state = stateLoad databaseFile
- state' <- state -- Extract State from the IO Monad
- ircStart (DispatchEnv state' conf dispatch)
-
--- Shortcut
-r :: IO ()
-r = main
-
-dispatch :: Dispatch
-dispatch msg sendMessage env@(Env state conf) = dispatch' msg
- where
- dispatch' ('!':_) =
- case cmdGet msg commands of
- Just (Cmd _ _ cmdAction) -> do
- cmdAction state
- return (env)
- Nothing -> return (env)
- dispatch' _ = aiRun msg env
- commands = [
- Cmd "!h" "Prints help" printHelp,
- Cmd "!i" "Prints infos" printInfos,
- Cmd "!p" "Prints current state" printState,
- Cmd "!s" "Stores current state to file" storeState,
- Cmd "!q" "quits" quit
- ]
- printHelp _ = printHelp' commands
- where printHelp' = sendMessage . concat . showL
- printInfos _ = do
- sendMessage $ (envGet "name" env)
- ++ " " ++ (envGet "version" env)
- ++ " (try !h)"
- printState = sendMessage . show
- storeState state = do
- sendMessage "Storing current state"
- stateSave (envGet "databaseFile" env) state
- quit state = do
- sendMessage "Good bye"
- stateSave (envGet "databaseFile" env) state
- exitWith ExitSuccess