lambdabot-core-5.1: Lambdabot core functionality

Safe HaskellNone
LanguageHaskell98

Lambdabot.Module

Synopsis

Documentation

data Module st Source

The Module type class.

Constructors

Module 

Fields

moduleSerialize :: !(Maybe (Serial st))

If the module wants its state to be saved, this function should return a Serial.

The default implementation returns Nothing.

moduleDefState :: !(LB st)

If the module maintains state, this method specifies the default state (for example in case the state can't be read from a state).

The default implementation returns an error and assumes the state is never accessed.

moduleSticky :: !Bool

Is the module sticky? Sticky modules (as well as static ones) can't be unloaded. By default, modules are not sticky.

moduleCmds :: !(ModuleT st LB [Command (ModuleT st LB)])

The commands the module listenes to.

moduleInit :: !(ModuleT st LB ())

Initialize the module. The default implementation does nothing.

moduleExit :: !(ModuleT st LB ())

Finalize the module. The default implementation does nothing.

contextual :: !(String -> Cmd (ModuleT st LB) ())

Process contextual input. A plugin that implements contextual is able to respond to text not part of a normal command.

data ModuleInfo st Source

Info about a running module.

Constructors

ModuleInfo 

Fields

moduleName :: !String
 
moduleID :: !(ModuleID st)
 
theModule :: !(Module st)
 
moduleState :: !(MVar st)
 

Instances

data ModuleT st m a Source

This transformer encodes the additional information a module might need to access its name or its state.

runModuleT :: ModuleT st m a -> ModuleInfo st -> m a Source