X-Git-Url: https://git.martlubbers.net/?p=cloogle-irc.git;a=blobdiff_plain;f=IRCBot.dcl;fp=IRCBot.dcl;h=7ecf7eab48057f5db78b1cc1932d35a56339b470;hp=0000000000000000000000000000000000000000;hb=3134ab7e61bcbc84560b4a5d613a92b1a48362c2;hpb=663ea3d6dfb6a70ddf1f3b6c41d4d39ed30c4440 diff --git a/IRCBot.dcl b/IRCBot.dcl new file mode 100644 index 0000000..7ecf7ea --- /dev/null +++ b/IRCBot.dcl @@ -0,0 +1,27 @@ +definition module IRCBot + +from IRC import :: IRCMessage +from Data.Maybe import :: Maybe +from Data.Error import :: MaybeErrorString, :: MaybeError + +/* + * Spawn an IRC Bot + * + * param: Hostname and port + * param: Startup commands that are sent initially. For example: + * [NICK "clooglebot" Nothing + * ,USER "cloogle" "0" "Cloogle bot" + * ,JOIN [("#cloogle",Nothing)]] + * param: Shutdown commands. For example + * [QUIT (Just "Bye")] + * param: Processing function + * param: command received by the server + * param: State + * param: World + * return: Maybe a response, the updated state and the updated world + * If the response is nothing the connection is closed + * All items in the list are sent back + * param: World + * return: Maybe the state together with the new world +*/ +bot :: (String, Int) [IRCMessage] [IRCMessage] a (IRCMessage a *World -> (Maybe [IRCMessage], a, *World)) *World -> (MaybeErrorString a, *World)