Igor v0.3.0 Igor.Responder.GenServerHelper behaviour 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.

Link to this section Summary

Link to this section Functions

Link to this macro

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

View Source (macro)
Link to this macro

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

View Source (macro)

Link to this section Callbacks

Link to this callback

help(responder, cmdprefix)

View Source
help(responder :: Igor.Responder.Proto.t(), cmdprefix :: String.t()) :: [
  String.t()
]
Link to this callback

help(responder, cmdprefix, cmd)

View Source
help(
  responder :: Igor.Responder.Proto.t(),
  cmdprefix :: String.t(),
  cmd :: String.t()
) :: String.t() | nil