COMMENTARY ON LAMBDABOT ------------------------ Authors: Don Stewart ------------------------------------------------------------------------ Current module tree. (Lambdabot : static) +- Boot -+- hs-plugins -+- Shared -+- Map (plugins : dynamic) +-- Main IRC Shared Config DeepSeq ErrorUtils ExceptionError MonadException Map Util Modules -+ SystemModule BaseModule DynamicModule ...... [*Module.o plugins] +Set +MiniHTTP ... The static binary only contains hs-plugins. ------------------------------------------------------------------------ Plugins live in Plugins/ and inhabit the Plugins.* namespace. ------------------------------------------------------------------------ INVOKING COMMANDS Each plugin lists the commands it will provide in its Module instance. Commands to Lambdabot are prefixed with certain magic characters, described in Plugins/Base.hs. ONLINE/OFFLINE MODES Lambdabot can run in an offline mode. This is in fact the default mode now, and invoking Lambdabot with --online is the way to connect to an IRC server. Otherwise you just get a prompt, and a chance to interact with the plugins. DEVELOPMENT When testing out a new plugin, 0) test out the plugin in GHCi in isolation. don't both linking the rest of the bot. then try: b) don't go online, just use offline mode GHCI: You can quickly develop Lambdabot inside GHCi. See the build details in README. It works best if you've already compiled the objects once, then you can quickly reload (interpreted) just the modules you're developing. ADDING A NEW PLUGIN * Just create the module in Plugins/* * add a PLUGIN Foo tag * implements the Module class (see Hello.hs for the bare minimum). * import Plugin to get most common functions * Add your plugin's canonical name to Modules.hs PLUGIN STATE Plugins may have local state. If a plugin provides an Serialiser (via the moduleSerialize method), this state will be automatically read and written to disk on module load/unload, respectively. A default state may be provided via the `moduleDefState` method. LIBRARIES Libraries of common functions are in Lib, they include code for: * munging strings * getting random elements * serialising data * doing regexes on packed strings read the Lib/README for more info Most of these libs are available when you import Plugin, some require explicit imports.