Finish migration to using a module to control core behavior
Previously, core behavior was handled in the Omnibot.Router module. However, since the module system is robust enough, this work has been delegated to the Omnibot.Core module. Additionally, the Omnibot.State module has been augmented to keep track of the modules that have been currently loaded, and methods that are used to get the list of loaded modules and routing information for those modules are coming from Omnibot.State as well (as opposed to Omnibot.Config). This is to avoid requiring the Omnibot.Core module be included in the config, plus avoiding modification of the runtime config after it has already been loaded. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
defmodule Omnibot.Core.Join do
|
||||
use Omnibot.Module
|
||||
alias Omnibot.State
|
||||
|
||||
def on_join(channel, nick) do
|
||||
cfg = State.cfg()
|
||||
if nick == cfg.nick do
|
||||
State.add_channel(channel)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
defmodule Omnibot.Core.Welcome do
|
||||
use Omnibot.Module
|
||||
|
||||
require Logger
|
||||
|
||||
@impl true
|
||||
def on_msg(irc, _) do
|
||||
Logger.info("Syncing channels")
|
||||
Irc.sync_channels(irc)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user