WIP: Supervisor-based plugin base
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
defmodule Omnibot.Contrib.Fortune do
|
||||
use Omnibot.Plugin.GenServer
|
||||
use Omnibot.Plugin
|
||||
|
||||
@fortunes [
|
||||
"Reply hazy, try again",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
defmodule Omnibot.Contrib.Linkbot do
|
||||
use Omnibot.Plugin.GenServer
|
||||
use Omnibot.Plugin
|
||||
require Logger
|
||||
|
||||
@default_config timeout: 30_000
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
defmodule Omnibot.Contrib.Markov do
|
||||
use Omnibot.Plugin.Supervisor
|
||||
use Omnibot.Plugin
|
||||
alias Omnibot.Contrib.Markov.Chain
|
||||
require Logger
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
defmodule Omnibot.Contrib.Wordbot do
|
||||
use Omnibot.Plugin.Supervisor
|
||||
use Omnibot.Plugin
|
||||
alias Omnibot.{Contrib.Wordbot, State, Util}
|
||||
require Logger
|
||||
|
||||
|
||||
Reference in New Issue
Block a user