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:
@@ -19,6 +19,11 @@ defmodule Omnibot.Plugin.Base do
|
||||
@impl true
|
||||
def on_init(_cfg), do: nil
|
||||
|
||||
@impl true
|
||||
def on_msg(irc, msg) do
|
||||
route_msg(irc, msg)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def default_config(), do: @default_config
|
||||
|
||||
@@ -33,11 +38,6 @@ defmodule Omnibot.Plugin.Base do
|
||||
|
||||
@behaviour Plugin.Base
|
||||
|
||||
@impl Plugin.Base
|
||||
def on_msg(irc, msg) do
|
||||
route_msg(irc, msg)
|
||||
end
|
||||
|
||||
defp route_msg(irc, %Irc.Msg {prefix: nil}), do: nil
|
||||
|
||||
defp route_msg(irc, msg) do
|
||||
|
||||
Reference in New Issue
Block a user