diff options
author | Jordan Bracco <href@random.sh> | 2022-12-20 02:32:12 +0000 |
---|---|---|
committer | Jordan Bracco <href@random.sh> | 2022-12-20 19:29:41 +0100 |
commit | 9aecb2bf2c4210d8b6b6976f749902b23ade83d6 (patch) | |
tree | 9547fdefe13f8c7695a8dea389ffd9d4ddbaf83c | |
parent | Actually do not prefix folders with nola_ refs T77 (diff) |
IRC.PubSub -> Nola.PubSub, refs T77
39 files changed, 65 insertions, 75 deletions
diff --git a/lib/irc/connection.ex b/lib/irc/connection.ex index 86d8279..4472466 100644 --- a/lib/irc/connection.ex +++ b/lib/irc/connection.ex @@ -423,7 +423,7 @@ defmodule IRC.Connection do dispatch("#{net}/#{chan}:events", {:irc, :event, event}) end - def dispatch(keys, content, sub \\ IRC.PubSub) + def dispatch(keys, content, sub \\ Nola.PubSub) def dispatch(key, content, sub) when is_binary(key), do: dispatch([key], content, sub) def dispatch(keys, content, sub) when is_list(keys) do diff --git a/lib/irc/irc.ex b/lib/irc/irc.ex index 71d6d93..7cd9dc8 100644 --- a/lib/irc/irc.ex +++ b/lib/irc/irc.ex @@ -32,7 +32,7 @@ defmodule IRC do end def register(key) do - case Registry.register(IRC.PubSub, key, []) do + case Registry.register(Nola.PubSub, key, []) do {:ok, _} -> :ok error -> error end diff --git a/lib/irc/nola_irc.ex b/lib/irc/nola_irc.ex index 870b99d..dde99af 100644 --- a/lib/irc/nola_irc.ex +++ b/lib/irc/nola_irc.ex @@ -12,7 +12,6 @@ defmodule Nola.IRC do [ worker(Registry, [[keys: :duplicate, name: IRC.ConnectionPubSub]], id: :registr_irc_conn), - worker(Registry, [[keys: :duplicate, name: IRC.PubSub]], id: :registry_irc), worker(IRC.Membership, []), worker(IRC.Account, []), worker(IRC.UserTrack.Storage, []), diff --git a/lib/matrix/room.ex b/lib/matrix/room.ex index c790760..12fabc8 100644 --- a/lib/matrix/room.ex +++ b/lib/matrix/room.ex @@ -64,9 +64,9 @@ defmodule Nola.Matrix.Room do {:ok, state} -> Logger.metadata(matrix_room: room_id) - {:ok, _} = Registry.register(IRC.PubSub, "#{state.network}:events", plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, "#{state.network}:events", plugin: __MODULE__) for t <- ["messages", "triggers", "outputs", "events"] do - {:ok, _} = Registry.register(IRC.PubSub, "#{state.network}/#{state.channel}:#{t}", plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, "#{state.network}/#{state.channel}:#{t}", plugin: __MODULE__) end state = state diff --git a/lib/nola/application.ex b/lib/nola/application.ex index 4f3d1da..53ca439 100644 --- a/lib/nola/application.ex +++ b/lib/nola/application.ex @@ -1,8 +1,6 @@ defmodule Nola.Application do use Application - # See https://hexdocs.pm/elixir/Application.html - # for more information on OTP Applications def start(_type, _args) do import Supervisor.Spec @@ -12,22 +10,17 @@ defmodule Nola.Application do # Define workers and child supervisors to be supervised children = [ - # Start the endpoint when the application starts supervisor(NolaWeb.Endpoint, []), - # Start your own worker by calling: Nola.Worker.start_link(arg1, arg2, arg3) - # worker(Nola.Worker, [arg1, arg2, arg3]), worker(Registry, [[keys: :duplicate, name: Nola.BroadcastRegistry]], id: :registry_broadcast), worker(Nola.IcecastAgent, []), worker(Nola.Token, []), worker(Nola.AuthToken, []), Nola.Subnet, {GenMagic.Pool, [name: Nola.GenMagic, pool_size: 2]}, - #worker(Nola.Icecast, []), + worker(Registry, [[keys: :duplicate, name: Nola.PubSub]], id: :registry_nola_pubsub), ] ++ Nola.IRC.application_childs ++ Nola.Matrix.application_childs - # See https://hexdocs.pm/elixir/Supervisor.html - # for other strategies and supported options opts = [strategy: :one_for_one, name: Nola.Supervisor] sup = Supervisor.start_link(children, opts) start_telegram() @@ -37,8 +30,6 @@ defmodule Nola.Application do sup end - # Tell Phoenix to update the endpoint configuration - # whenever the application is updated. def config_change(changed, _new, removed) do NolaWeb.Endpoint.config_change(changed, removed) :ok diff --git a/lib/plugins/account.ex b/lib/plugins/account.ex index c11d077..245710a 100644 --- a/lib/plugins/account.ex +++ b/lib/plugins/account.ex @@ -17,7 +17,7 @@ defmodule Nola.Plugins.Account do def irc_doc, do: @moduledoc def start_link(), do: GenServer.start_link(__MODULE__, [], name: __MODULE__) def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "messages:private", []) + {:ok, _} = Registry.register(Nola.PubSub, "messages:private", []) {:ok, nil} end diff --git a/lib/plugins/alcoolog.ex b/lib/plugins/alcoolog.ex index 7f44ca2..8ef83fa 100644 --- a/lib/plugins/alcoolog.ex +++ b/lib/plugins/alcoolog.ex @@ -57,7 +57,7 @@ defmodule Nola.Plugins.Alcoolog do def init(_) do triggers = for(t <- @pubsub_triggers, do: "trigger:"<>t) for sub <- @pubsub ++ triggers do - {:ok, _} = Registry.register(IRC.PubSub, sub, plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, sub, plugin: __MODULE__) end dets_filename = (Nola.data_path() <> "/" <> "alcoolisme.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, [{:type,:bag}]) diff --git a/lib/plugins/alcoolog_announcer.ex b/lib/plugins/alcoolog_announcer.ex index 674f19b..167fc01 100644 --- a/lib/plugins/alcoolog_announcer.ex +++ b/lib/plugins/alcoolog_announcer.ex @@ -46,7 +46,7 @@ defmodule Nola.Plugins.AlcoologAnnouncer do end def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "account", []) + {:ok, _} = Registry.register(Nola.PubSub, "account", []) stats = get_stats() Process.send_after(self(), :stats, :timer.seconds(30)) dets_filename = (Nola.data_path() <> "/" <> "alcoologlog.dets") |> String.to_charlist diff --git a/lib/plugins/base.ex b/lib/plugins/base.ex index b7b5e16..3188495 100644 --- a/lib/plugins/base.ex +++ b/lib/plugins/base.ex @@ -8,11 +8,11 @@ defmodule Nola.Plugins.Base do def init([]) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "trigger:version", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:help", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:liquidrender", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:plugin", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:plugins", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:version", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:help", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:liquidrender", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:plugin", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:plugins", regopts) {:ok, nil} end diff --git a/lib/plugins/boursorama.ex b/lib/plugins/boursorama.ex index f872584..77977a5 100644 --- a/lib/plugins/boursorama.ex +++ b/lib/plugins/boursorama.ex @@ -20,8 +20,8 @@ defmodule Nola.Plugins.Boursorama do def init(_) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "trigger:cac40", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:caca40", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:cac40", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:caca40", regopts) {:ok, nil} end diff --git a/lib/plugins/buffer.ex b/lib/plugins/buffer.ex index 67aea35..42a435e 100644 --- a/lib/plugins/buffer.ex +++ b/lib/plugins/buffer.ex @@ -16,7 +16,7 @@ defmodule Nola.Plugins.Buffer do def init(_) do for e <- ~w(messages triggers events outputs) do - {:ok, _} = Registry.register(IRC.PubSub, e, plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, e, plugin: __MODULE__) end {:ok, :ets.new(@table, [:named_table, :ordered_set, :protected])} end diff --git a/lib/plugins/calc.ex b/lib/plugins/calc.ex index 91fbbae..e58e1b1 100644 --- a/lib/plugins/calc.ex +++ b/lib/plugins/calc.ex @@ -12,7 +12,7 @@ defmodule Nola.Plugins.Calc do end def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:calc", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:calc", [plugin: __MODULE__]) {:ok, nil} end diff --git a/lib/plugins/coronavirus.ex b/lib/plugins/coronavirus.ex index 624bae7..31483aa 100644 --- a/lib/plugins/coronavirus.ex +++ b/lib/plugins/coronavirus.ex @@ -19,7 +19,7 @@ defmodule Nola.Plugins.Coronavirus do end def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:coronavirus", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:coronavirus", [plugin: __MODULE__]) {:ok, nil, {:continue, :init}} :ignore end diff --git a/lib/plugins/correction.ex b/lib/plugins/correction.ex index 03968c8..067f468 100644 --- a/lib/plugins/correction.ex +++ b/lib/plugins/correction.ex @@ -11,8 +11,8 @@ defmodule Nola.Plugins.Correction do end def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "messages", [plugin: __MODULE__]) - {:ok, _} = Registry.register(IRC.PubSub, "triggers", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "messages", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "triggers", [plugin: __MODULE__]) {:ok, %{}} end diff --git a/lib/plugins/dice.ex b/lib/plugins/dice.ex index 2c1515b..dcf7d0b 100644 --- a/lib/plugins/dice.ex +++ b/lib/plugins/dice.ex @@ -21,7 +21,7 @@ defmodule Nola.Plugins.Dice do end def init([]) do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:dice", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:dice", [plugin: __MODULE__]) {:ok, %__MODULE__{}} end diff --git a/lib/plugins/finance.ex b/lib/plugins/finance.ex index d6f890a..3ecc2fb 100644 --- a/lib/plugins/finance.ex +++ b/lib/plugins/finance.ex @@ -52,9 +52,9 @@ defmodule Nola.Plugins.Finance do def init([]) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "trigger:forex", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:currency", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:stocks", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:forex", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:currency", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:stocks", regopts) {:ok, nil} end diff --git a/lib/plugins/gpt.ex b/lib/plugins/gpt.ex index 3d2a66d..1171d19 100644 --- a/lib/plugins/gpt.ex +++ b/lib/plugins/gpt.ex @@ -42,7 +42,7 @@ defmodule Nola.Plugins.Gpt do def init(_) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "trigger:#{@trigger}", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:#{@trigger}", regopts) {:ok, %__MODULE__{temprefs: new_temp_refs()}} end diff --git a/lib/plugins/kick_roulette.ex b/lib/plugins/kick_roulette.ex index f6d2ba2..b25b46d 100644 --- a/lib/plugins/kick_roulette.ex +++ b/lib/plugins/kick_roulette.ex @@ -11,7 +11,7 @@ defmodule Nola.Plugins.KickRoulette do end def init([]) do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:kick", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:kick", [plugin: __MODULE__]) {:ok, nil} end diff --git a/lib/plugins/last_fm.ex b/lib/plugins/last_fm.ex index 1a9b7dd..ae4b1ee 100644 --- a/lib/plugins/last_fm.ex +++ b/lib/plugins/last_fm.ex @@ -22,7 +22,7 @@ defmodule Nola.Plugins.LastFm do def init([]) do regopts = [type: __MODULE__] - for t <- @pubsub_topics, do: {:ok, _} = Registry.register(IRC.PubSub, t, type: __MODULE__) + for t <- @pubsub_topics, do: {:ok, _} = Registry.register(Nola.PubSub, t, type: __MODULE__) dets_filename = (Nola.data_path() <> "/" <> "lastfm.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, []) {:ok, %__MODULE__{dets: dets}} diff --git a/lib/plugins/link.ex b/lib/plugins/link.ex index 381bdab..4c4261f 100644 --- a/lib/plugins/link.ex +++ b/lib/plugins/link.ex @@ -52,8 +52,8 @@ defmodule Nola.Plugins.Link do defstruct [:client] def init([]) do - {:ok, _} = Registry.register(IRC.PubSub, "messages", [plugin: __MODULE__]) - #{:ok, _} = Registry.register(IRC.PubSub, "messages:telegram", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "messages", [plugin: __MODULE__]) + #{:ok, _} = Registry.register(Nola.PubSub, "messages:telegram", [plugin: __MODULE__]) Logger.info("Link handler started") {:ok, %__MODULE__{}} end diff --git a/lib/plugins/logger.ex b/lib/plugins/logger.ex index 69cac66..77bee8b 100644 --- a/lib/plugins/logger.ex +++ b/lib/plugins/logger.ex @@ -11,11 +11,11 @@ defmodule Nola.Plugins.Logger do def init([]) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "triggers", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "messages", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "messages:telegram", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "irc:outputs", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "messages:private", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "triggers", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "messages", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "messages:telegram", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "irc:outputs", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "messages:private", regopts) {:ok, nil} end diff --git a/lib/plugins/outline.ex b/lib/plugins/outline.ex index f0ccfd2..1f1c1e1 100644 --- a/lib/plugins/outline.ex +++ b/lib/plugins/outline.ex @@ -20,8 +20,8 @@ defmodule Nola.Plugins.Outline do def init([]) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "trigger:outline", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "messages", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:outline", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "messages", regopts) file = Path.join(Nola.data_path, "/outline.txt") hosts = case File.read(file) do {:error, :enoent} -> diff --git a/lib/plugins/preums.ex b/lib/plugins/preums.ex index 80c5af0..f7738ad 100644 --- a/lib/plugins/preums.ex +++ b/lib/plugins/preums.ex @@ -86,9 +86,9 @@ defmodule Nola.Plugins.Preums do def init([]) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "account", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "messages", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "triggers", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "account", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "messages", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "triggers", regopts) {:ok, dets} = :dets.open_file(dets(), [{:repair, :force}]) Util.ets_mutate_select_each(:dets, dets, [{:"$1", [], [:"$1"]}], fn(table, obj) -> {key, nick, now, perfect, text} = obj diff --git a/lib/plugins/quatre_cent_vingt.ex b/lib/plugins/quatre_cent_vingt.ex index 3331625..59b2dea 100644 --- a/lib/plugins/quatre_cent_vingt.ex +++ b/lib/plugins/quatre_cent_vingt.ex @@ -34,9 +34,9 @@ defmodule Nola.Plugins.QuatreCentVingt do def init(_) do for coeff <- @coeffs do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:#{420*coeff}", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:#{420*coeff}", [plugin: __MODULE__]) end - {:ok, _} = Registry.register(IRC.PubSub, "account", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "account", [plugin: __MODULE__]) dets_filename = (Nola.data_path() <> "/420.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, [{:type,:bag},{:repair,:force}]) {:ok, dets} diff --git a/lib/plugins/radio_france.ex b/lib/plugins/radio_france.ex index 2096de8..a2a1c7b 100644 --- a/lib/plugins/radio_france.ex +++ b/lib/plugins/radio_france.ex @@ -21,10 +21,10 @@ defmodule Nola.Plugins.RadioFrance do def init(_) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "trigger:radiofrance", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:rf", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:radiofrance", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:rf", regopts) for s <- @shortcuts do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:#{s}", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:#{s}", regopts) end {:ok, nil} end diff --git a/lib/plugins/say.ex b/lib/plugins/say.ex index 91ffacc..e036bd4 100644 --- a/lib/plugins/say.ex +++ b/lib/plugins/say.ex @@ -19,9 +19,9 @@ defmodule Nola.Plugins.Say do def init([]) do regopts = [type: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "trigger:say", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:asay", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "messages:private", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:say", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:asay", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "messages:private", regopts) {:ok, nil} end diff --git a/lib/plugins/script.ex b/lib/plugins/script.ex index d383abb..c8d00a9 100644 --- a/lib/plugins/script.ex +++ b/lib/plugins/script.ex @@ -23,7 +23,7 @@ defmodule Nola.Plugins.Script do end def init([]) do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:script", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:script", [plugin: __MODULE__]) dets_filename = (Nola.data_path() <> "/" <> "scripts.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, []) {:ok, %{dets: dets}} diff --git a/lib/plugins/seen.ex b/lib/plugins/seen.ex index 65af0c1..cdebd59 100644 --- a/lib/plugins/seen.ex +++ b/lib/plugins/seen.ex @@ -12,8 +12,8 @@ defmodule Nola.Plugins.Seen do def init([]) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "triggers", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "messages", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "triggers", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "messages", regopts) dets_filename = (Nola.data_path() <> "/seen.dets") |> String.to_charlist() {:ok, dets} = :dets.open_file(dets_filename, []) {:ok, %{dets: dets}} diff --git a/lib/plugins/sms.ex b/lib/plugins/sms.ex index ad16f78..bc666b2 100644 --- a/lib/plugins/sms.ex +++ b/lib/plugins/sms.ex @@ -89,7 +89,7 @@ defmodule Nola.Plugins.Sms do end def init([]) do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:sms", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:sms", [plugin: __MODULE__]) :ok = register_ovh_callback() {:ok, %{}} :ignore diff --git a/lib/plugins/tell.ex b/lib/plugins/tell.ex index 8978c82..34e9f94 100644 --- a/lib/plugins/tell.ex +++ b/lib/plugins/tell.ex @@ -22,8 +22,8 @@ defmodule Nola.Plugins.Tell do def init([]) do regopts = [plugin: __MODULE__] - {:ok, _} = Registry.register(IRC.PubSub, "account", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "trigger:tell", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "account", regopts) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:tell", regopts) {:ok, dets} = :dets.open_file(dets(), [type: :bag]) {:ok, %{dets: dets}} end diff --git a/lib/plugins/txt.ex b/lib/plugins/txt.ex index f6e71a3..f33aab0 100644 --- a/lib/plugins/txt.ex +++ b/lib/plugins/txt.ex @@ -57,7 +57,7 @@ defmodule Nola.Plugins.Txt do {:ok, locks} = :dets.open_file(dets_locks_filename, []) markov_handler = Keyword.get(Application.get_env(:nola, __MODULE__, []), :markov_handler, Nola.Plugins.Txt.Markov.Native) {:ok, markov} = markov_handler.start_link() - {:ok, _} = Registry.register(IRC.PubSub, "triggers", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "triggers", [plugin: __MODULE__]) {:ok, %__MODULE__{locks: locks, markov_handler: markov_handler, markov: markov, triggers: load()}} end diff --git a/lib/plugins/untappd.ex b/lib/plugins/untappd.ex index cf5c694..e1731bd 100644 --- a/lib/plugins/untappd.ex +++ b/lib/plugins/untappd.ex @@ -18,7 +18,7 @@ defmodule Nola.Plugins.Untappd do end def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:beer", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:beer", [plugin: __MODULE__]) {:ok, %{}} end diff --git a/lib/plugins/user_mention.ex b/lib/plugins/user_mention.ex index c4dd719..a9a2d24 100644 --- a/lib/plugins/user_mention.ex +++ b/lib/plugins/user_mention.ex @@ -15,7 +15,7 @@ defmodule Nola.Plugins.UserMention do end def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "triggers", plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, "triggers", plugin: __MODULE__) {:ok, nil} end diff --git a/lib/plugins/wikipedia.ex b/lib/plugins/wikipedia.ex index dcd1874..caef306 100644 --- a/lib/plugins/wikipedia.ex +++ b/lib/plugins/wikipedia.ex @@ -15,7 +15,7 @@ defmodule Nola.Plugins.Wikipedia do end def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:wp", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:wp", [plugin: __MODULE__]) {:ok, nil} end diff --git a/lib/plugins/wolfram_alpha.ex b/lib/plugins/wolfram_alpha.ex index c2f106e..02c1c51 100644 --- a/lib/plugins/wolfram_alpha.ex +++ b/lib/plugins/wolfram_alpha.ex @@ -15,7 +15,7 @@ defmodule Nola.Plugins.WolframAlpha do end def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "trigger:wa", [plugin: __MODULE__]) + {:ok, _} = Registry.register(Nola.PubSub, "trigger:wa", [plugin: __MODULE__]) {:ok, nil} end diff --git a/lib/plugins/youtube.ex b/lib/plugins/youtube.ex index c62f73c..e23fd45 100644 --- a/lib/plugins/youtube.ex +++ b/lib/plugins/youtube.ex @@ -16,7 +16,7 @@ defmodule Nola.Plugins.YouTube do end def init([]) do - for t <- ["trigger:yt", "trigger:youtube"], do: {:ok, _} = Registry.register(IRC.PubSub, t, [plugin: __MODULE__]) + for t <- ["trigger:yt", "trigger:youtube"], do: {:ok, _} = Registry.register(Nola.PubSub, t, [plugin: __MODULE__]) {:ok, %__MODULE__{}} end diff --git a/lib/telegram/room.ex b/lib/telegram/room.ex index ca8a437..49fc06d 100644 --- a/lib/telegram/room.ex +++ b/lib/telegram/room.ex @@ -55,9 +55,9 @@ defmodule Nola.TelegramRoom do %{"network" => net, "channel" => chan} = tg_room Logger.info("Starting ChatBot for room #{id} \"#{chat["title"]}\" #{inspect tg_room}") irc_plumbed = if net && chan do - {:ok, _} = Registry.register(IRC.PubSub, "#{net}/#{chan}:messages", plugin: __MODULE__) - {:ok, _} = Registry.register(IRC.PubSub, "#{net}/#{chan}:triggers", plugin: __MODULE__) - {:ok, _} = Registry.register(IRC.PubSub, "#{net}/#{chan}:outputs", plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, "#{net}/#{chan}:messages", plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, "#{net}/#{chan}:triggers", plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, "#{net}/#{chan}:outputs", plugin: __MODULE__) true else Logger.warn("Did not found telegram match for #{id} \"#{chat["title"]}\"") diff --git a/lib/web/controllers/irc_auth_sse_controller.ex b/lib/web/controllers/irc_auth_sse_controller.ex index 62ee2b5..01c840b 100644 --- a/lib/web/controllers/irc_auth_sse_controller.ex +++ b/lib/web/controllers/irc_auth_sse_controller.ex @@ -26,7 +26,7 @@ defmodule NolaWeb.IrcAuthSseController do def subscribe(conn) do :timer.send_interval(@ping_interval, {:event, :ping}) :timer.send_after(@expire_delay, {:event, :expire}) - {:ok, _} = Registry.register(IRC.PubSub, "messages:private", []) + {:ok, _} = Registry.register(Nola.PubSub, "messages:private", []) conn end diff --git a/lib/web/live/chat_live.ex b/lib/web/live/chat_live.ex index 678ea36..88afa0b 100644 --- a/lib/web/live/chat_live.ex +++ b/lib/web/live/chat_live.ex @@ -9,9 +9,9 @@ defmodule NolaWeb.ChatLive do account = IRC.Account.get(account_id) membership = IRC.Membership.of_account(IRC.Account.get("DRgpD4fLf8PDJMLp8Dtb")) if account && connection && Enum.member?(membership, {connection.network, chan}) do - {:ok, _} = Registry.register(IRC.PubSub, "#{connection.network}:events", plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, "#{connection.network}:events", plugin: __MODULE__) for t <- ["messages", "triggers", "outputs", "events"] do - {:ok, _} = Registry.register(IRC.PubSub, "#{connection.network}/#{chan}:#{t}", plugin: __MODULE__) + {:ok, _} = Registry.register(Nola.PubSub, "#{connection.network}/#{chan}:#{t}", plugin: __MODULE__) end IRC.PuppetConnection.start(account, connection) |