WIP: Supervisor-based plugin base
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
defmodule Omnibot.Contrib.OnConnect do
|
||||
use Omnibot.Plugin.GenServer
|
||||
use Omnibot.Plugin
|
||||
require Logger
|
||||
|
||||
@default_config [channels: :all, commands: []]
|
||||
|
||||
@impl true
|
||||
def on_msg(irc, msg) do
|
||||
if msg.command == "001" do
|
||||
Logger.debug("Got welcome message")
|
||||
cfg()[:commands]
|
||||
|> Enum.each(fn [cmd | params] -> Irc.send_msg(irc, cmd, params) end)
|
||||
end
|
||||
def on_msg(irc, %Irc.Msg {command: "001"}) do
|
||||
Logger.info("Running OnConnect commands")
|
||||
cfg()[:commands]
|
||||
|> Enum.each(fn [cmd | params] -> Irc.send_msg(irc, cmd, params) end)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user