Update to latest clean-selectloop master
[cloogle-irc.git] / IRCBot.dcl
1 definition module IRCBot
2
3 from IRC import :: IRCMessage
4 from Data.Maybe import :: Maybe
5 from Data.Error import :: MaybeErrorString, :: MaybeError
6
7 /*
8 * Spawn an IRC Bot
9 *
10 * param: Hostname and port
11 * param: Startup commands that are sent initially. For example:
12 * [NICK "clooglebot" Nothing
13 * ,USER "cloogle" "0" "Cloogle bot"
14 * ,JOIN [("#cloogle",Nothing)]]
15 * param: Shutdown commands. For example
16 * [QUIT (Just "Bye")]
17 * param: Processing function
18 * param: command received by the server
19 * param: State
20 * param: World
21 * return: Maybe a response, the updated state and the updated world
22 * If the response is nothing the connection is closed
23 * All items in the list are sent back
24 * param: World
25 * return: Maybe an error, the state and the new world
26 */
27 bot :: (String, Int) [IRCMessage] [IRCMessage] .a (IRCMessage -> (.a -> *(*World -> *(Maybe [IRCMessage], .a, *World)))) !*World -> *(Maybe String, .a, !*World)