Polish off wordbot implementation, add Omnibot.Module.GenServer
Wordbot implementation now uses the new Omnibot.Module.GenServer module, which uses a GenServer instead of an Agent. This way, the module can receive messages and makes storage a little easier. Beyond that, minor changes all around. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
defmodule Omnibot.Module.Agent do
|
||||
defmacro __using__([]) do
|
||||
quote do
|
||||
import Omnibot.Module.Agent
|
||||
alias Omnibot.Module
|
||||
use Agent
|
||||
|
||||
def start_link(opts) do
|
||||
cfg = opts[:cfg]
|
||||
state = opts[:state] || on_init(cfg)
|
||||
|
||||
IO.inspect({__MODULE__, state})
|
||||
Module.Agent.start_link(cfg, state, opts)
|
||||
end
|
||||
|
||||
@@ -18,7 +15,7 @@ defmodule Omnibot.Module.Agent do
|
||||
|
||||
def update_state(update, timeout \\ 5000),
|
||||
do: Module.Agent.update_state(__MODULE__, update, timeout)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def start_link(cfg, state, opts) do
|
||||
|
||||
Reference in New Issue
Block a user