2020-07-06 17:01:29 -07:00
|
|
|
defmodule Omnibot.Contrib.OnConnect do
|
2020-07-12 12:19:14 -07:00
|
|
|
use Omnibot.Plugin
|
2020-07-06 17:01:29 -07:00
|
|
|
require Logger
|
|
|
|
|
|
|
|
|
|
@default_config [channels: :all, commands: []]
|
|
|
|
|
|
|
|
|
|
@impl true
|
2020-07-12 12:19:14 -07:00
|
|
|
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)
|
2020-07-06 17:01:29 -07:00
|
|
|
end
|
|
|
|
|
end
|