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/Core.hs
2009-08-06 00:09:56 +02:00

36 lines
1.1 KiB
Haskell

module Hsbot.Core
( Bot(..)
, Config(..)
, IrcServer(..)
, newbot
) where
import qualified Data.Map as M
import System.IO (Handle)
-- | An IRC Bot server state (socket handles)
data Bot = Bot
{ joinedServers :: M.Map IrcServer Handle -- servers we are connected to
} deriving (Eq, Show)
-- | Configuration data type
data Config = Config {
commandPrefixes :: String, -- command prefixes, for example @[\'>\',\'@\',\'?\']@
ircServers :: [IrcServer] -- list of 'Server's to connect to
} deriving (Eq,Show)
-- | An IRC server
data IrcServer = IrcServer
{ address :: String -- the server's address
, port :: Int -- the server's port
, channels :: [String] -- a list of channels to join
, nickname :: String -- the hsbot's nickname
, password :: String -- the hsbot's password, optional
, realname :: String -- the hsbot's real name, optional
, administrators :: [String] -- bot admins nicknames
} deriving (Eq, Show)
-- | Returns a new, empty bot
newbot :: Bot
newbot = Bot (M.empty)