Finish plugin and routing overhaul, there's a new model in town:

* Plugins all derive from Omnibot.Plugin. There still is a base plugin,
  in case we want to have another plugin backend instead of a GenServer
* All plugins are monitored by a unique Plugin.Supervisor, which is in
  turn started by the PluginSupervisor (yes this is confusing, yes it
  needs to be renamed)
* Any other auxiliary child processes may be started through the
  Plugin.children/1 function.
* By default, plugins have a CfgState process which is an Agent that
  keeps track of the plugin's configuration and state
* Plugin API is now called through the GenServer backend for better
  synchronicity.
* Very few changes to the front-facing Plugin API, which is nice

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-07-14 15:05:00 -07:00
parent 9679c46e15
commit 522c62a55c
6 changed files with 67 additions and 43 deletions

View File

@@ -6,7 +6,7 @@ defmodule Omnibot.Contrib.Markov do
@default_config path: "markov", order: 2, save_every: 5 * 60
@impl true
def children(cfg, _state) do
def children(cfg) do
[{Task, fn ->
Stream.timer(cfg[:save_every] * 1000)
|> Stream.cycle()