Commit Graph

11 Commits

Author SHA1 Message Date
a3e4a088b3 Add Omnibot.Plugin.Base.on_connect/1 callback
This new callback gets called immediately upon connecting to the server.
It is automatically implemented as a no-op by default.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-08-12 15:31:40 -07:00
906a20bda1 Update calls of Enum.member?/1 to be 'x in y' instead
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-08-11 16:00:09 -07:00
2dc7bbd94d Replace all other State.cfg/0 in favor of Irc.cfg/1
State.cfg/0 should be removed from the codebase by this point. Should be
safe to remove.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-08-11 12:52:37 -07:00
ec1dd42ca1 Fix routing bug in IRC and base plugin
Previously, messages were only routed from IRC if they were *not* for
the current user. This should only be happening for privmsg messages,
since a plugin is generally aware of what it's sending out.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-07-18 14:09:17 -07:00
522c62a55c 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>
2020-07-14 15:05:00 -07:00
9679c46e15 WIP: Supervisor-based plugin base
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-07-12 12:19:14 -07:00
9a8c6f2472 Finish up Plugin.Supervisor, replace markov and wordbot implementations with it
Both markov and wordbot have some auxiliary processes that run to keep
track of things. Previously, they both had custom supervisors grafted on
to the Plugin.Base - now, this grafting is automated with
Plugin.Supervisor.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-07-11 15:43:07 -07:00
010d60f4f9 Actually remove Hooks from Plugin.Base - forgot to add this two commits
ago oopz

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-07-09 14:50:49 -07:00
b12a7d76f8 Fix small bug where plugins that don't override on_msg/2 would report errors
Since route_msg expects msg.prefix to be present, every plugin that
calls route_msg when no prefix is specified in the message (e.g. with
PING messages) would cause a crash of the process.

Now, it just calls a no-op function, since all behavior covered by
route_message requires information in the prefix at some point.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-07-06 17:02:41 -07:00
8f112487c1 Update the instance of "module" with "plugin" and "mod" with "plug" where appropriate
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-07-02 18:30:46 -07:00
f004b0ed01 Add lib/plugin that was removed in the last commit, whoops
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-07-02 18:23:55 -07:00