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>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
defmodule Omnibot.Contrib.Fortune do
|
defmodule Omnibot.Contrib.Fortune do
|
||||||
use Omnibot.Plugin
|
use Omnibot.Plugin.GenServer
|
||||||
|
|
||||||
@fortunes [
|
@fortunes [
|
||||||
"Reply hazy, try again",
|
"Reply hazy, try again",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
defmodule Omnibot.Contrib.Linkbot do
|
defmodule Omnibot.Contrib.Linkbot do
|
||||||
use Omnibot.Plugin
|
use Omnibot.Plugin.GenServer
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@default_config timeout: 30_000
|
@default_config timeout: 30_000
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ defmodule Omnibot.Contrib.Markov do
|
|||||||
@default_config path: "markov", order: 2, save_every: 5 * 60
|
@default_config path: "markov", order: 2, save_every: 5 * 60
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def children(_cfg, _state) do
|
def children(cfg, _state) do
|
||||||
[{Task, fn ->
|
[{Task, fn ->
|
||||||
Stream.timer(1000)
|
Stream.timer(cfg[:save_every] * 1000)
|
||||||
|> Stream.cycle()
|
|> Stream.cycle()
|
||||||
|> Stream.each(fn _ -> save_chains() end)
|
|> Stream.each(fn _ -> save_chains() end)
|
||||||
|> Stream.run()
|
|> Stream.run()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
defmodule Omnibot.Contrib.OnConnect do
|
defmodule Omnibot.Contrib.OnConnect do
|
||||||
use Omnibot.Plugin
|
use Omnibot.Plugin.GenServer
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@default_config [channels: :all, commands: []]
|
@default_config [channels: :all, commands: []]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
defmodule Omnibot.Core do
|
defmodule Omnibot.Core do
|
||||||
use Omnibot.Plugin
|
use Omnibot.Plugin.GenServer
|
||||||
alias Omnibot.State
|
alias Omnibot.State
|
||||||
|
|
||||||
@default_config [channels: :all]
|
@default_config [channels: :all]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
defmodule Omnibot.Plugin.GenServer do
|
defmodule Omnibot.Plugin.GenServer do
|
||||||
defmacro __using__([]) do
|
defmacro __using__([]) do
|
||||||
quote do
|
quote do
|
||||||
alias Omnibot.Plugin
|
use Omnibot.Plugin.Base
|
||||||
use GenServer
|
use GenServer
|
||||||
|
|
||||||
def start_link(opts) do
|
def start_link(opts) do
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
defmodule Omnibot.Plugin do
|
|
||||||
defmacro __using__([]) do
|
|
||||||
quote do
|
|
||||||
use Omnibot.Plugin.Base
|
|
||||||
use Omnibot.Plugin.GenServer
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user