Igor.Responder.GenServerHelper behaviour (Igor v0.3.1)

View Source

Helper for writing responders based on GenServer.

This is similar to Igor.Responder.ModuleHelper, but allows for the responder to be in its own process.

To use this helper, the module must define a struct that has a :pid field, which must store the process ID of the GenServer. It is recommended that it also provide a function that will start the server and return a struct.

The module must also define an init/1 function as required by GenServer.

This helper provides command and listen macros, like Igor.Responder.ModuleHelper, but with an extra argument at the end, which is the current state of the GenServer. The return value must the same as what would be returned by a handle_cast/2 method for a GenServer.

An example of a responder using this is Igor.Responder.Slap.

Summary

Functions

command(pattern, msg, bot, state, list)

(macro)

listen(regexp, matches, msg, bot, list)

(macro)