Files
omnibot/lib/contrib/on_connect.ex
Alek Ratzloff e2a746709d Update Plugin.GenServer to match the same pattern that Plugin.Supervisor does, remove Omnibot.Plugin
* using Plugin.GenServer now uses Plugin.Base so that is not required
* Remove Omnibot.Plugin because all it did was include Plugin.GenServer
  and Plugin.Base

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-07-11 16:01:57 -07:00

16 lines
367 B
Elixir

defmodule Omnibot.Contrib.OnConnect do
use Omnibot.Plugin.GenServer
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
end
end