diff options
author | Jordan Bracco <href@random.sh> | 2022-12-20 02:13:47 +0000 |
---|---|---|
committer | Jordan Bracco <href@random.sh> | 2022-12-20 19:29:41 +0100 |
commit | 70b9bba56f5319361ce5a7df5c489b9c0d6905ce (patch) | |
tree | f9b4438965f4c5e3e1f3a6129904cbb9a37047f2 /lib/nola_web/controllers | |
parent | Update repo URL, refs T77. (diff) |
Rename to Nola
Summary:
Nola rename cont. pt. 2. Refs T77.
`find lib -name "*.ex" -type f | xargs sed -i '' 's/LSG/Nola/g'`
Nola rename, cont. pt. 3. Refs T77.
`s/:lsg/:nola/g`
Nola rename, cont. pt. 4. Refs T77.
Nola rename, cont. pt. 5. Refs T77. Configs.
find config -type f | xargs sed -i '' 's/LSG/Nola/g'
find config -type f | xargs sed -i '' 's/lsg/nola/g'
BREAKING CHANGE: Config keys switch from `:lsg` to `:nola`
Nola rename, the end. pt 6. Refs T77.
Nola rename: The Big Move, Refs T77
Update repo URL, refs T77.
Nola rename: Nola.Plugins, refs T77
Maniphest Tasks: T77
Differential Revision: https://phab.random.sh/D3
Diffstat (limited to '')
-rw-r--r-- | lib/nola_web/controllers/alcoolog_controller.ex | 28 | ||||
-rw-r--r-- | lib/nola_web/controllers/gpt_controller.ex | 4 | ||||
-rw-r--r-- | lib/nola_web/controllers/irc_controller.ex | 6 | ||||
-rw-r--r-- | lib/nola_web/controllers/sms_controller.ex | 2 |
4 files changed, 20 insertions, 20 deletions
diff --git a/lib/nola_web/controllers/alcoolog_controller.ex b/lib/nola_web/controllers/alcoolog_controller.ex index 3081762..3c812c5 100644 --- a/lib/nola_web/controllers/alcoolog_controller.ex +++ b/lib/nola_web/controllers/alcoolog_controller.ex @@ -21,8 +21,8 @@ defmodule NolaWeb.AlcoologController do days = String.to_integer(Map.get(params, "days", "180")) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) if friend? do - stats = Nola.IRC.AlcoologPlugin.get_full_statistics(profile_account.id) - history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- Nola.IRC.AlcoologPlugin.nick_history(profile_account) do + stats = Nola.Plugins.Alcoolog.get_full_statistics(profile_account.id) + history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- Nola.Plugins.Alcoolog.nick_history(profile_account) do %{ at: ts |> DateTime.from_unix!(:millisecond), points: points, @@ -50,7 +50,7 @@ defmodule NolaWeb.AlcoologController do profile_account = IRC.Account.find_always_by_nick(network, nick, nick) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) if friend? do - stats = Nola.IRC.AlcoologPlugin.get_full_statistics(profile_account.id) + stats = Nola.Plugins.Alcoolog.get_full_statistics(profile_account.id) conn |> put_resp_content_type("application/json") @@ -67,7 +67,7 @@ defmodule NolaWeb.AlcoologController do friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) count = String.to_integer(Map.get(params, "days", "180")) if friend? do - data = Nola.IRC.AlcoologPlugin.user_over_time_gl(profile_account, count) + data = Nola.Plugins.Alcoolog.user_over_time_gl(profile_account, count) delay = count*((24 * 60)*60) now = DateTime.utc_now() start_date = DateTime.utc_now() @@ -101,7 +101,7 @@ defmodule NolaWeb.AlcoologController do friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) count = String.to_integer(Map.get(params, "days", "180")) if friend? do - data = Nola.IRC.AlcoologPlugin.user_over_time(profile_account, count) + data = Nola.Plugins.Alcoolog.user_over_time(profile_account, count) delay = count*((24 * 60)*60) now = DateTime.utc_now() start_date = DateTime.utc_now() @@ -132,7 +132,7 @@ defmodule NolaWeb.AlcoologController do profile_account = IRC.Account.find_always_by_nick(network, nick, nick) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) if friend? do - history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- Nola.IRC.AlcoologPlugin.nick_history(profile_account) do + history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- Nola.Plugins.Alcoolog.nick_history(profile_account) do %{ at: ts |> DateTime.from_unix!(:millisecond) |> DateTime.to_iso8601(), points: points, @@ -145,7 +145,7 @@ defmodule NolaWeb.AlcoologController do } end last = List.last(history) - {_, active} = Nola.IRC.AlcoologPlugin.user_stats(profile_account) + {_, active} = Nola.Plugins.Alcoolog.user_stats(profile_account) last = %{last | active: active, at: DateTime.utc_now() |> DateTime.to_iso8601()} history = history ++ [last] @@ -163,7 +163,7 @@ defmodule NolaWeb.AlcoologController do profile_account = IRC.Account.find_always_by_nick(network, nick, nick) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) if friend? do - history = for {_, date, value} <- Nola.IRC.AlcoologAnnouncerPlugin.log(profile_account) do + history = for {_, date, value} <- Nola.Plugs.AlcoologAnnouncer.log(profile_account) do %{date: DateTime.to_iso8601(date), value: value} end conn @@ -223,12 +223,12 @@ defmodule NolaWeb.AlcoologController do members = IRC.Membership.expanded_members_or_friends(account, network, channel) members_ids = Enum.map(members, fn({account, _, nick}) -> account.id end) member_names = Enum.reduce(members, %{}, fn({account, _, nick}, acc) -> Map.put(acc, account.id, nick) end) - drinks = :ets.select(Nola.IRC.AlcoologPlugin.ETS, match) + drinks = :ets.select(Nola.Plugins.Alcoolog.ETS, match) |> Enum.filter(fn({{account, _}, _vol, _cur, _cl, _deg, _name, _cmt, _meta}) -> Enum.member?(members_ids, account) end) |> Enum.map(fn({{account, _}, _, _, _, _, _, _, _} = object) -> {object, Map.get(member_names, account)} end) |> Enum.sort_by(fn({{{_, ts}, _, _, _, _, _, _, _}, _}) -> ts end, &>/2) - stats = Nola.IRC.AlcoologPlugin.get_channel_statistics(account, network, channel) + stats = Nola.Plugins.Alcoolog.get_channel_statistics(account, network, channel) top = Enum.reduce(drinks, %{}, fn({{{account_id, _}, vol, _, _, _, _, _, _}, _}, acc) -> nick = Map.get(member_names, account_id) @@ -266,7 +266,7 @@ defmodule NolaWeb.AlcoologController do |> Enum.into(Map.new) gls = Enum.reduce(members, filled, fn({account, _, _}, gls) -> - Enum.reduce(Nola.IRC.AlcoologPlugin.user_over_time_gl(account, count), gls, fn({date, gl}, gls) -> + Enum.reduce(Nola.Plugins.Alcoolog.user_over_time_gl(account, count), gls, fn({date, gl}, gls) -> u = Map.get(gls, date, %{}) |> Map.put(Map.get(member_names, account.id, account.id), gl) Map.put(gls, date, u) @@ -302,12 +302,12 @@ defmodule NolaWeb.AlcoologController do def minisync(conn, %{"user_id" => user_id, "key" => key, "value" => value}) do account = IRC.Account.get(user_id) if account do - ds = Nola.IRC.AlcoologPlugin.data_state() - meta = Nola.IRC.AlcoologPlugin.get_user_meta(ds, account.id) + ds = Nola.Plugins.Alcoolog.data_state() + meta = Nola.Plugins.Alcoolog.get_user_meta(ds, account.id) case Float.parse(value) do {val, _} -> new_meta = Map.put(meta, String.to_existing_atom(key), val) - Nola.IRC.AlcoologPlugin.put_user_meta(ds, account.id, new_meta) + Nola.Plugins.Alcoolog.put_user_meta(ds, account.id, new_meta) _ -> conn |> put_status(:unprocessable_entity) diff --git a/lib/nola_web/controllers/gpt_controller.ex b/lib/nola_web/controllers/gpt_controller.ex index 038b235..810a875 100644 --- a/lib/nola_web/controllers/gpt_controller.ex +++ b/lib/nola_web/controllers/gpt_controller.ex @@ -5,7 +5,7 @@ defmodule NolaWeb.GptController do plug NolaWeb.ContextPlug def result(conn, params = %{"id" => result_id}) do - case Nola.IRC.GptPlugin.get_result(result_id) do + case Nola.Plugins.Gpt.get_result(result_id) do {:ok, result} -> network = Map.get(params, "network") channel = if c = Map.get(params, "chan"), do: NolaWeb.reformat_chan(c) @@ -18,7 +18,7 @@ defmodule NolaWeb.GptController do end def prompt(conn, params = %{"id" => prompt_id}) do - case Nola.IRC.GptPlugin.get_prompt(prompt_id) do + case Nola.Plugins.Gpt.get_prompt(prompt_id) do {:ok, prompt} -> network = Map.get(params, "network") channel = if c = Map.get(params, "chan"), do: NolaWeb.reformat_chan(c) diff --git a/lib/nola_web/controllers/irc_controller.ex b/lib/nola_web/controllers/irc_controller.ex index c617e78..d6114e6 100644 --- a/lib/nola_web/controllers/irc_controller.ex +++ b/lib/nola_web/controllers/irc_controller.ex @@ -6,9 +6,9 @@ defmodule NolaWeb.IrcController do def index(conn, params) do network = Map.get(params, "network") channel = if c = Map.get(params, "chan"), do: NolaWeb.reformat_chan(c) - commands = for mod <- Enum.uniq([IRC.Account.AccountPlugin] ++ IRC.Plugin.enabled()) do + commands = for mod <- Enum.uniq([Nola.Plugins.Account] ++ Nola.Plugins.enabled()) do if is_atom(mod) do - identifier = Module.split(mod) |> List.last |> String.replace("Plugin", "") |> Macro.underscore + identifier = Module.split(mod) |> List.last |> Macro.underscore {identifier, mod.irc_doc()} end end @@ -42,7 +42,7 @@ defmodule NolaWeb.IrcController do defp do_txt(conn, nil) do - doc = Nola.IRC.TxtPlugin.irc_doc() + doc = Nola.IRC.Txt.irc_doc() data = data() main = Enum.filter(data, fn({trigger, _}) -> !String.contains?(trigger, ".") end) |> Enum.into(Map.new) system = Enum.filter(data, fn({trigger, _}) -> String.contains?(trigger, ".") end) |> Enum.into(Map.new) diff --git a/lib/nola_web/controllers/sms_controller.ex b/lib/nola_web/controllers/sms_controller.ex index 575655c..0fffa23 100644 --- a/lib/nola_web/controllers/sms_controller.ex +++ b/lib/nola_web/controllers/sms_controller.ex @@ -3,7 +3,7 @@ defmodule NolaWeb.SmsController do require Logger def ovh_callback(conn, %{"senderid" => from, "message" => message}) do - spawn(fn() -> Nola.IRC.SmsPlugin.incoming(from, String.trim(message)) end) + spawn(fn() -> Nola.Plugins.Sms.incoming(from, String.trim(message)) end) text(conn, "") end |