diff options
author | Jordan Bracco <href@random.sh> | 2022-12-17 13:47:11 +0000 |
---|---|---|
committer | Jordan Bracco <href@random.sh> | 2022-12-20 19:29:41 +0100 |
commit | fd4afd7c7acd9b5fda75b628a7e19d0149d8b889 (patch) | |
tree | df571d49fa9dc9c3cd58c94033b9fc81c7b7f8ec /lib/lsg_irc | |
parent | Rename to Nola, pt. 1. Refs T77 (diff) |
Nola rename cont. pt. 2. Refs T77.
`find lib -name "*.ex" -type f | xargs sed -i '' 's/LSG/Nola/g'`
Diffstat (limited to 'lib/lsg_irc')
43 files changed, 109 insertions, 109 deletions
diff --git a/lib/lsg_irc/admin_handler.ex b/lib/lsg_irc/admin_handler.ex index fab4dbc..9a5d557 100644 --- a/lib/lsg_irc/admin_handler.ex +++ b/lib/lsg_irc/admin_handler.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.AdminHandler do +defmodule Nola.IRC.AdminHandler do @moduledoc """ # admin diff --git a/lib/lsg_irc/alcolog_plugin.ex b/lib/lsg_irc/alcolog_plugin.ex index f61b237..145e4fc 100644 --- a/lib/lsg_irc/alcolog_plugin.ex +++ b/lib/lsg_irc/alcolog_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.AlcoologPlugin do +defmodule Nola.IRC.AlcoologPlugin do require Logger @moduledoc """ @@ -49,8 +49,8 @@ defmodule LSG.IRC.AlcoologPlugin do @default_user_meta %{weight: 77.4, sex: true, loss_factor: 15} def data_state() do - dets_filename = (LSG.data_path() <> "/" <> "alcoolisme.dets") |> String.to_charlist - dets_meta_filename = (LSG.data_path() <> "/" <> "alcoolisme_meta.dets") |> String.to_charlist + dets_filename = (Nola.data_path() <> "/" <> "alcoolisme.dets") |> String.to_charlist + dets_meta_filename = (Nola.data_path() <> "/" <> "alcoolisme_meta.dets") |> String.to_charlist %{dets: dets_filename, meta: dets_meta_filename, ets: __MODULE__.ETS} end @@ -59,10 +59,10 @@ defmodule LSG.IRC.AlcoologPlugin do for sub <- @pubsub ++ triggers do {:ok, _} = Registry.register(IRC.PubSub, sub, plugin: __MODULE__) end - dets_filename = (LSG.data_path() <> "/" <> "alcoolisme.dets") |> String.to_charlist + dets_filename = (Nola.data_path() <> "/" <> "alcoolisme.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, [{:type,:bag}]) ets = :ets.new(__MODULE__.ETS, [:ordered_set, :named_table, :protected, {:read_concurrency, true}]) - dets_meta_filename = (LSG.data_path() <> "/" <> "alcoolisme_meta.dets") |> String.to_charlist + dets_meta_filename = (Nola.data_path() <> "/" <> "alcoolisme_meta.dets") |> String.to_charlist {:ok, meta} = :dets.open_file(dets_meta_filename, [{:type,:set}]) traverse_fun = fn(obj, dets) -> case obj do @@ -102,7 +102,7 @@ defmodule LSG.IRC.AlcoologPlugin do @eau ["santo", "santeau"] def handle_info({:irc, :trigger, santeau, m = %IRC.Message{trigger: %IRC.Trigger{args: _, type: :bang}}}, state) when santeau in @eau do - LSG.IRC.TxtPlugin.reply_random(m, "alcoolog.santo") + Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.santo") {:noreply, state} end @@ -221,14 +221,14 @@ defmodule LSG.IRC.AlcoologPlugin do end def handle_info({:irc, :trigger, "alcoolog", m = %IRC.Message{trigger: %IRC.Trigger{args: [], type: :plus}}}, state) do - {:ok, token} = LSG.Token.new({:alcoolog, :index, m.sender.network, m.channel}) - url = LSGWeb.Router.Helpers.alcoolog_url(LSGWeb.Endpoint, :index, m.network, LSGWeb.format_chan(m.channel), token) + {:ok, token} = Nola.Token.new({:alcoolog, :index, m.sender.network, m.channel}) + url = NolaWeb.Router.Helpers.alcoolog_url(NolaWeb.Endpoint, :index, m.network, NolaWeb.format_chan(m.channel), token) m.replyfun.("-> #{url}") {:noreply, state} end def handle_info({:irc, :trigger, "alcoolog", m = %IRC.Message{trigger: %IRC.Trigger{args: [], type: :bang}}}, state) do - url = LSGWeb.Router.Helpers.alcoolog_url(LSGWeb.Endpoint, :index, m.network, LSGWeb.format_chan(m.channel)) + url = NolaWeb.Router.Helpers.alcoolog_url(NolaWeb.Endpoint, :index, m.network, NolaWeb.format_chan(m.channel)) m.replyfun.("-> #{url}") {:noreply, state} end @@ -330,9 +330,9 @@ defmodule LSG.IRC.AlcoologPlugin do cond do cl == nil -> m.replyfun.(cl_extra) deg == nil -> m.replyfun.(comment) - cl >= 500 || deg >= 100 -> LSG.IRC.TxtPlugin.reply_random(m, "alcoolog.drink_toohuge") - cl == 0 || deg == 0 -> LSG.IRC.TxtPlugin.reply_random(m, "alcoolog.drink_zero") - cl < 0 || deg < 0 -> LSG.IRC.TxtPlugin.reply_random(m, "alcoolog.drink_negative") + cl >= 500 || deg >= 100 -> Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.drink_toohuge") + cl == 0 || deg == 0 -> Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.drink_zero") + cl < 0 || deg < 0 -> Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.drink_negative") true -> points = Alcool.units(cl, deg) now = m.at || DateTime.utc_now() @@ -347,7 +347,7 @@ defmodule LSG.IRC.AlcoologPlugin do :ok = :dets.insert(state.dets, {m.account.id, now, points, if(old_stats, do: old_stats.active, else: 0), cl, deg, name, comment, meta}) true = :ets.insert(state.ets, {{m.account.id, now}, points, if(old_stats, do: old_stats.active, else: 0),cl, deg, name, comment, meta}) #sante = @santai |> Enum.map(fn(s) -> String.trim(String.upcase(s)) end) |> Enum.shuffle() |> Enum.random() - sante = LSG.IRC.TxtPlugin.random("alcoolog.santai") + sante = Nola.IRC.TxtPlugin.random("alcoolog.santai") k = if user_meta.sex, do: 0.7, else: 0.6 weight = user_meta.weight peak = Float.round((10*points||0.0)/(k*weight), 4) @@ -449,7 +449,7 @@ defmodule LSG.IRC.AlcoologPlugin do end if miss do - miss = LSG.IRC.TxtPlugin.random("alcoolog.#{to_string(miss)}") + miss = Nola.IRC.TxtPlugin.random("alcoolog.#{to_string(miss)}") if miss do for {net, chan} <- IRC.Membership.notify_channels(m.account) do user = IRC.UserTrack.find_by_account(net, m.account) @@ -532,7 +532,7 @@ defmodule LSG.IRC.AlcoologPlugin do rising_file_key = if rising, do: "_rising", else: "" txt_file = "alcoolog." <> "user_" <> to_string(user_state) <> rising_file_key - user_status = LSG.IRC.TxtPlugin.random(txt_file) + user_status = Nola.IRC.TxtPlugin.random(txt_file) meta = get_user_meta(state, nick) minutes_til_sober = h1/((meta.loss_factor/100)/60) @@ -831,11 +831,11 @@ defmodule LSG.IRC.AlcoologPlugin do put_user_meta(state, m.account.id, meta) cond do old_meta.weight < meta.weight -> - LSG.IRC.TxtPlugin.reply_random(m, "alcoolog.fatter") + Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.fatter") old_meta.weight == meta.weight -> m.replyfun.("aucun changement!") true -> - LSG.IRC.TxtPlugin.reply_random(m, "alcoolog.thinner") + Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.thinner") end end @@ -848,7 +848,7 @@ defmodule LSG.IRC.AlcoologPlugin do :dets.delete_object(state.dets, obj) :ets.delete(state.ets, {m.account.id, date}) m.replyfun.("supprimΓ©: #{m.sender.nick} #{points} #{type} #{descr}") - LSG.IRC.TxtPlugin.reply_random(m, "alcoolog.delete") + Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.delete") notify = IRC.Membership.notify_channels(m.account) -- [{m.network,m.channel}] for {net, chan} <- notify do user = IRC.UserTrack.find_by_account(net, m.account) diff --git a/lib/lsg_irc/alcoolog_announcer_plugin.ex b/lib/lsg_irc/alcoolog_announcer_plugin.ex index 3902d5f..f90dc42 100644 --- a/lib/lsg_irc/alcoolog_announcer_plugin.ex +++ b/lib/lsg_irc/alcoolog_announcer_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.AlcoologAnnouncerPlugin do +defmodule Nola.IRC.AlcoologAnnouncerPlugin do require Logger @moduledoc """ @@ -27,7 +27,7 @@ defmodule LSG.IRC.AlcoologAnnouncerPlugin do def start_link(), do: GenServer.start_link(__MODULE__, [], name: __MODULE__) def log(account) do - dets_filename = (LSG.data_path() <> "/" <> "alcoologlog.dets") |> String.to_charlist + dets_filename = (Nola.data_path() <> "/" <> "alcoologlog.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, [{:type,:bag}]) from = ~U[2020-08-23 19:41:40.524154Z] to = ~U[2020-08-24 19:41:40.524154Z] @@ -49,11 +49,11 @@ defmodule LSG.IRC.AlcoologAnnouncerPlugin do {:ok, _} = Registry.register(IRC.PubSub, "account", []) stats = get_stats() Process.send_after(self(), :stats, :timer.seconds(30)) - dets_filename = (LSG.data_path() <> "/" <> "alcoologlog.dets") |> String.to_charlist + dets_filename = (Nola.data_path() <> "/" <> "alcoologlog.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, [{:type,:bag}]) ets = nil # :ets.new(__MODULE__.ETS, [:ordered_set, :named_table, :protected, {:read_concurrency, true}]) - #:ok = LSG.IRC.SettingPlugin.declare("alcoolog.alerts", __MODULE__, true, :boolean) - #:ok = LSG.IRC.SettingPlugin.declare("alcoolog.aperoalert", __MODULE__, true, :boolean) + #:ok = Nola.IRC.SettingPlugin.declare("alcoolog.alerts", __MODULE__, true, :boolean) + #:ok = Nola.IRC.SettingPlugin.declare("alcoolog.aperoalert", __MODULE__, true, :boolean) # {:ok, {stats, now(), dets, ets}}#, {:continue, :traverse}} end @@ -262,7 +262,7 @@ defmodule LSG.IRC.AlcoologAnnouncerPlugin do end defp get_stats() do - Enum.into(LSG.IRC.AlcoologPlugin.get_all_stats(), %{}) + Enum.into(Nola.IRC.AlcoologPlugin.get_all_stats(), %{}) end defp timer() do diff --git a/lib/lsg_irc/base_plugin.ex b/lib/lsg_irc/base_plugin.ex index 7153c70..ee0352e 100644 --- a/lib/lsg_irc/base_plugin.ex +++ b/lib/lsg_irc/base_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.BasePlugin do +defmodule Nola.IRC.BasePlugin do def irc_doc, do: nil @@ -32,7 +32,7 @@ defmodule LSG.IRC.BasePlugin do end def handle_info({:irc, :trigger, "plugin", %{trigger: %{type: :query, args: [plugin]}} = m}, _) do - module = Module.concat([LSG.IRC, Macro.camelize(plugin<>"_plugin")]) + module = Module.concat([Nola.IRC, Macro.camelize(plugin<>"_plugin")]) with true <- Code.ensure_loaded?(module), pid when is_pid(pid) <- GenServer.whereis(module) do @@ -51,7 +51,7 @@ defmodule LSG.IRC.BasePlugin do end def handle_info({:irc, :trigger, "plugin", %{trigger: %{type: :plus, args: [plugin]}} = m}, _) do - module = Module.concat([LSG.IRC, Macro.camelize(plugin<>"_plugin")]) + module = Module.concat([Nola.IRC, Macro.camelize(plugin<>"_plugin")]) with true <- Code.ensure_loaded?(module), IRC.Plugin.switch(module, true), {:ok, pid} <- IRC.Plugin.start(module) @@ -66,7 +66,7 @@ defmodule LSG.IRC.BasePlugin do end def handle_info({:irc, :trigger, "plugin", %{trigger: %{type: :tilde, args: [plugin]}} = m}, _) do - module = Module.concat([LSG.IRC, Macro.camelize(plugin<>"_plugin")]) + module = Module.concat([Nola.IRC, Macro.camelize(plugin<>"_plugin")]) with true <- Code.ensure_loaded?(module), pid when is_pid(pid) <- GenServer.whereis(module), :ok <- GenServer.stop(pid), @@ -82,7 +82,7 @@ defmodule LSG.IRC.BasePlugin do def handle_info({:irc, :trigger, "plugin", %{trigger: %{type: :minus, args: [plugin]}} = m}, _) do - module = Module.concat([LSG.IRC, Macro.camelize(plugin<>"_plugin")]) + module = Module.concat([Nola.IRC, Macro.camelize(plugin<>"_plugin")]) with true <- Code.ensure_loaded?(module), pid when is_pid(pid) <- GenServer.whereis(module), :ok <- GenServer.stop(pid) @@ -103,7 +103,7 @@ defmodule LSG.IRC.BasePlugin do end def handle_info({:irc, :trigger, "help", m = %{trigger: %{type: :bang}}}, _) do - url = LSGWeb.Router.Helpers.irc_url(LSGWeb.Endpoint, :index, m.network, LSGWeb.format_chan(m.channel)) + url = NolaWeb.Router.Helpers.irc_url(NolaWeb.Endpoint, :index, m.network, NolaWeb.format_chan(m.channel)) m.replyfun.("-> #{url}") {:noreply, nil} end @@ -111,12 +111,12 @@ defmodule LSG.IRC.BasePlugin do def handle_info({:irc, :trigger, "version", message = %{trigger: %{type: :bang}}}, _) do {:ok, vsn} = :application.get_key(:lsg, :vsn) ver = List.to_string(vsn) - url = LSGWeb.Router.Helpers.irc_url(LSGWeb.Endpoint, :index) + url = NolaWeb.Router.Helpers.irc_url(NolaWeb.Endpoint, :index) elixir_ver = Application.started_applications() |> List.keyfind(:elixir, 0) |> elem(2) |> to_string() otp_ver = :erlang.system_info(:system_version) |> to_string() |> String.trim() system = :erlang.system_info(:system_architecture) |> to_string() message.replyfun.([ - <<"π€ I am a robot running", 2, "beautte, version #{ver}", 2, " β source: #{LSG.source_url()}">>, + <<"π€ I am a robot running", 2, "beautte, version #{ver}", 2, " β source: #{Nola.source_url()}">>, "π¦Ύ Elixir #{elixir_ver} #{otp_ver} on #{system}", "π·ββοΈ Owner: href <href@random.sh>", "π Web interface: #{url}" diff --git a/lib/lsg_irc/bourosama_plugin.ex b/lib/lsg_irc/bourosama_plugin.ex index ba63d81..dd05144 100644 --- a/lib/lsg_irc/bourosama_plugin.ex +++ b/lib/lsg_irc/bourosama_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.BoursoramaPlugin do +defmodule Nola.IRC.BoursoramaPlugin do def irc_doc() do """ diff --git a/lib/lsg_irc/buffer_plugin.ex b/lib/lsg_irc/buffer_plugin.ex index d278151..eece34e 100644 --- a/lib/lsg_irc/buffer_plugin.ex +++ b/lib/lsg_irc/buffer_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.BufferPlugin do +defmodule Nola.IRC.BufferPlugin do @table __MODULE__.ETS def irc_doc, do: nil diff --git a/lib/lsg_irc/calc_plugin.ex b/lib/lsg_irc/calc_plugin.ex index ca65675..264370c 100644 --- a/lib/lsg_irc/calc_plugin.ex +++ b/lib/lsg_irc/calc_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.CalcPlugin do +defmodule Nola.IRC.CalcPlugin do @moduledoc """ # calc diff --git a/lib/lsg_irc/coronavirus_plugin.ex b/lib/lsg_irc/coronavirus_plugin.ex index b9a9e40..d04d8f9 100644 --- a/lib/lsg_irc/coronavirus_plugin.ex +++ b/lib/lsg_irc/coronavirus_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.CoronavirusPlugin do +defmodule Nola.IRC.CoronavirusPlugin do require Logger NimbleCSV.define(CovidCsv, separator: ",", escape: "\"") @moduledoc """ diff --git a/lib/lsg_irc/correction_plugin.ex b/lib/lsg_irc/correction_plugin.ex index a77c4a2..5f9b278 100644 --- a/lib/lsg_irc/correction_plugin.ex +++ b/lib/lsg_irc/correction_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.CorrectionPlugin do +defmodule Nola.IRC.CorrectionPlugin do @moduledoc """ # correction diff --git a/lib/lsg_irc/dice_plugin.ex b/lib/lsg_irc/dice_plugin.ex index eafd88a..b5e7649 100644 --- a/lib/lsg_irc/dice_plugin.ex +++ b/lib/lsg_irc/dice_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.DicePlugin do +defmodule Nola.IRC.DicePlugin do require Logger @moduledoc """ diff --git a/lib/lsg_irc/finance_plugin.ex b/lib/lsg_irc/finance_plugin.ex index 51ec3f6..c1a1771 100644 --- a/lib/lsg_irc/finance_plugin.ex +++ b/lib/lsg_irc/finance_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.FinancePlugin do +defmodule Nola.IRC.FinancePlugin do require Logger @moduledoc """ diff --git a/lib/lsg_irc/gpt_plugin.ex b/lib/lsg_irc/gpt_plugin.ex index e3cefa7..2c8f182 100644 --- a/lib/lsg_irc/gpt_plugin.ex +++ b/lib/lsg_irc/gpt_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.GptPlugin do +defmodule Nola.IRC.GptPlugin do require Logger import Irc.Plugin.TempRef @@ -103,9 +103,9 @@ defmodule LSG.IRC.GptPlugin do def handle_info({:irc, :trigger, @trigger, m = %IRC.Message{trigger: %IRC.Trigger{type: :query, args: ["show", ref_or_id]}}}, state) do id = lookup_temp_ref(ref_or_id, state.temprefs, ref_or_id) url = if m.channel do - LSGWeb.Router.Helpers.gpt_url(LSGWeb.Endpoint, :result, m.network, LSGWeb.format_chan(m.channel), id) + NolaWeb.Router.Helpers.gpt_url(NolaWeb.Endpoint, :result, m.network, NolaWeb.format_chan(m.channel), id) else - LSGWeb.Router.Helpers.gpt_url(LSGWeb.Endpoint, :result, id) + NolaWeb.Router.Helpers.gpt_url(NolaWeb.Endpoint, :result, id) end m.replyfun.("β #{url}") {:noreply, state} @@ -113,9 +113,9 @@ defmodule LSG.IRC.GptPlugin do def handle_info({:irc, :trigger, @trigger, m = %IRC.Message{trigger: %IRC.Trigger{type: :query, args: [prompt]}}}, state) do url = if m.channel do - LSGWeb.Router.Helpers.gpt_url(LSGWeb.Endpoint, :prompt, m.network, LSGWeb.format_chan(m.channel), prompt) + NolaWeb.Router.Helpers.gpt_url(NolaWeb.Endpoint, :prompt, m.network, NolaWeb.format_chan(m.channel), prompt) else - LSGWeb.Router.Helpers.gpt_url(LSGWeb.Endpoint, :prompt, prompt) + NolaWeb.Router.Helpers.gpt_url(NolaWeb.Endpoint, :prompt, prompt) end m.replyfun.("β #{url}") {:noreply, state} diff --git a/lib/lsg_irc/kick_roulette_plugin.ex b/lib/lsg_irc/kick_roulette_plugin.ex index f810a74..55b7da4 100644 --- a/lib/lsg_irc/kick_roulette_plugin.ex +++ b/lib/lsg_irc/kick_roulette_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.KickRoulettePlugin do +defmodule Nola.IRC.KickRoulettePlugin do @moduledoc """ # kick roulette diff --git a/lib/lsg_irc/last_fm_plugin.ex b/lib/lsg_irc/last_fm_plugin.ex index 0c6b8a6..f29982c 100644 --- a/lib/lsg_irc/last_fm_plugin.ex +++ b/lib/lsg_irc/last_fm_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.LastFmPlugin do +defmodule Nola.IRC.LastFmPlugin do require Logger @moduledoc """ @@ -23,7 +23,7 @@ defmodule LSG.IRC.LastFmPlugin do def init([]) do regopts = [type: __MODULE__] for t <- @pubsub_topics, do: {:ok, _} = Registry.register(IRC.PubSub, t, type: __MODULE__) - dets_filename = (LSG.data_path() <> "/" <> "lastfm.dets") |> String.to_charlist + dets_filename = (Nola.data_path() <> "/" <> "lastfm.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, []) {:ok, %__MODULE__{dets: dets}} end diff --git a/lib/lsg_irc/link_plugin.ex b/lib/lsg_irc/link_plugin.ex index aaf6c6f..28e537a 100644 --- a/lib/lsg_irc/link_plugin.ex +++ b/lib/lsg_irc/link_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.LinkPlugin do +defmodule Nola.IRC.LinkPlugin do @moduledoc """ # Link Previewer @@ -15,13 +15,13 @@ defmodule LSG.IRC.LinkPlugin do ## Configuration: ``` - config :lsg, LSG.IRC.LinkPlugin, + config :lsg, Nola.IRC.LinkPlugin, handlers: [ - LSG.IRC.LinkPlugin.Youtube: [ + Nola.IRC.LinkPlugin.Youtube: [ invidious: true ], - LSG.IRC.LinkPlugin.Twitter: [], - LSG.IRC.LinkPlugin.Imgur: [], + Nola.IRC.LinkPlugin.Twitter: [], + Nola.IRC.LinkPlugin.Imgur: [], ] ``` diff --git a/lib/lsg_irc/link_plugin/github.ex b/lib/lsg_irc/link_plugin/github.ex index 19be89b..93e0892 100644 --- a/lib/lsg_irc/link_plugin/github.ex +++ b/lib/lsg_irc/link_plugin/github.ex @@ -1,5 +1,5 @@ -defmodule LSG.IRC.LinkPlugin.Github do - @behaviour LSG.IRC.LinkPlugin +defmodule Nola.IRC.LinkPlugin.Github do + @behaviour Nola.IRC.LinkPlugin @impl true def match(uri = %URI{host: "github.com", path: path}, _) do diff --git a/lib/lsg_irc/link_plugin/html.ex b/lib/lsg_irc/link_plugin/html.ex index e0e4229..56a8ceb 100644 --- a/lib/lsg_irc/link_plugin/html.ex +++ b/lib/lsg_irc/link_plugin/html.ex @@ -1,5 +1,5 @@ -defmodule LSG.IRC.LinkPlugin.HTML do - @behaviour LSG.IRC.LinkPlugin +defmodule Nola.IRC.LinkPlugin.HTML do + @behaviour Nola.IRC.LinkPlugin @impl true def match(_, _), do: false diff --git a/lib/lsg_irc/link_plugin/imgur.ex b/lib/lsg_irc/link_plugin/imgur.ex index 443afdb..af0b36a 100644 --- a/lib/lsg_irc/link_plugin/imgur.ex +++ b/lib/lsg_irc/link_plugin/imgur.ex @@ -1,5 +1,5 @@ -defmodule LSG.IRC.LinkPlugin.Imgur do - @behaviour LSG.IRC.LinkPlugin +defmodule Nola.IRC.LinkPlugin.Imgur do + @behaviour Nola.IRC.LinkPlugin @moduledoc """ # Imgur link preview diff --git a/lib/lsg_irc/link_plugin/pdf.ex b/lib/lsg_irc/link_plugin/pdf.ex index 8c4869c..5f72ef5 100644 --- a/lib/lsg_irc/link_plugin/pdf.ex +++ b/lib/lsg_irc/link_plugin/pdf.ex @@ -1,6 +1,6 @@ -defmodule LSG.IRC.LinkPlugin.PDF do +defmodule Nola.IRC.LinkPlugin.PDF do require Logger - @behaviour LSG.IRC.LinkPlugin + @behaviour Nola.IRC.LinkPlugin @impl true def match(_, _), do: false diff --git a/lib/lsg_irc/link_plugin/redacted.ex b/lib/lsg_irc/link_plugin/redacted.ex index 2e92b4a..7a6229d 100644 --- a/lib/lsg_irc/link_plugin/redacted.ex +++ b/lib/lsg_irc/link_plugin/redacted.ex @@ -1,5 +1,5 @@ -defmodule LSG.IRC.LinkPlugin.Redacted do - @behaviour LSG.IRC.LinkPlugin +defmodule Nola.IRC.LinkPlugin.Redacted do + @behaviour Nola.IRC.LinkPlugin @impl true def match(uri = %URI{host: "redacted.ch", path: "/torrent.php", query: query = "id="<>id}, _opts) do diff --git a/lib/lsg_irc/link_plugin/reddit.ex b/lib/lsg_irc/link_plugin/reddit.ex index 6fc1723..79102e0 100644 --- a/lib/lsg_irc/link_plugin/reddit.ex +++ b/lib/lsg_irc/link_plugin/reddit.ex @@ -1,5 +1,5 @@ -defmodule LSG.IRC.LinkPlugin.Reddit do - @behaviour LSG.IRC.LinkPlugin +defmodule Nola.IRC.LinkPlugin.Reddit do + @behaviour Nola.IRC.LinkPlugin @impl true def match(uri = %URI{host: "reddit.com", path: path}, _) do diff --git a/lib/lsg_irc/link_plugin/twitter.ex b/lib/lsg_irc/link_plugin/twitter.ex index 41e10ab..640b193 100644 --- a/lib/lsg_irc/link_plugin/twitter.ex +++ b/lib/lsg_irc/link_plugin/twitter.ex @@ -1,5 +1,5 @@ -defmodule LSG.IRC.LinkPlugin.Twitter do - @behaviour LSG.IRC.LinkPlugin +defmodule Nola.IRC.LinkPlugin.Twitter do + @behaviour Nola.IRC.LinkPlugin @moduledoc """ # Twitter Link Preview diff --git a/lib/lsg_irc/link_plugin/youtube.ex b/lib/lsg_irc/link_plugin/youtube.ex index f38eca3..1e3a0de 100644 --- a/lib/lsg_irc/link_plugin/youtube.ex +++ b/lib/lsg_irc/link_plugin/youtube.ex @@ -1,5 +1,5 @@ -defmodule LSG.IRC.LinkPlugin.YouTube do - @behaviour LSG.IRC.LinkPlugin +defmodule Nola.IRC.LinkPlugin.YouTube do + @behaviour Nola.IRC.LinkPlugin @moduledoc """ # YouTube link preview diff --git a/lib/lsg_irc/logger_plugin.ex b/lib/lsg_irc/logger_plugin.ex index de601a6..b13f33a 100644 --- a/lib/lsg_irc/logger_plugin.ex +++ b/lib/lsg_irc/logger_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.LoggerPlugin do +defmodule Nola.IRC.LoggerPlugin do require Logger @couch_db "bot-logs" diff --git a/lib/lsg_irc/lsg_irc.ex b/lib/lsg_irc/lsg_irc.ex index a50abed..f64978a 100644 --- a/lib/lsg_irc/lsg_irc.ex +++ b/lib/lsg_irc/lsg_irc.ex @@ -1,7 +1,7 @@ -defmodule LSG.IRC do +defmodule Nola.IRC do require Logger - def env(), do: LSG.env(:irc) + def env(), do: Nola.env(:irc) def env(key, default \\ nil), do: Keyword.get(env(), key, default) def application_childs do diff --git a/lib/lsg_irc/outline_plugin.ex b/lib/lsg_irc/outline_plugin.ex index 47fa6fa..820500e 100644 --- a/lib/lsg_irc/outline_plugin.ex +++ b/lib/lsg_irc/outline_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.OutlinePlugin do +defmodule Nola.IRC.OutlinePlugin do @moduledoc """ # outline auto-link @@ -22,7 +22,7 @@ defmodule LSG.IRC.OutlinePlugin do regopts = [plugin: __MODULE__] {:ok, _} = Registry.register(IRC.PubSub, "trigger:outline", regopts) {:ok, _} = Registry.register(IRC.PubSub, "messages", regopts) - file = Path.join(LSG.data_path, "/outline.txt") + file = Path.join(Nola.data_path, "/outline.txt") hosts = case File.read(file) do {:error, :enoent} -> [] diff --git a/lib/lsg_irc/preums_plugin.ex b/lib/lsg_irc/preums_plugin.ex index 68257f0..9344ce9 100644 --- a/lib/lsg_irc/preums_plugin.ex +++ b/lib/lsg_irc/preums_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.PreumsPlugin do +defmodule Nola.IRC.PreumsPlugin do @moduledoc """ # preums !!! @@ -81,7 +81,7 @@ defmodule LSG.IRC.PreumsPlugin do end def dets do - (LSG.data_path() <> "/preums.dets") |> String.to_charlist() + (Nola.data_path() <> "/preums.dets") |> String.to_charlist() end def init([]) do @@ -229,7 +229,7 @@ defmodule LSG.IRC.PreumsPlugin do end defp timezone(channel) do - env = Application.get_env(:lsg, LSG.IRC.PreumsPlugin, []) + env = Application.get_env(:lsg, Nola.IRC.PreumsPlugin, []) channels = Keyword.get(env, :channels, %{}) channel_settings = Map.get(channels, channel, []) default = Keyword.get(env, :default_tz, "Europe/Paris") diff --git a/lib/lsg_irc/quatre_cent_vingt_plugin.ex b/lib/lsg_irc/quatre_cent_vingt_plugin.ex index fff7e4f..8953ea3 100644 --- a/lib/lsg_irc/quatre_cent_vingt_plugin.ex +++ b/lib/lsg_irc/quatre_cent_vingt_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.QuatreCentVingtPlugin do +defmodule Nola.IRC.QuatreCentVingtPlugin do require Logger @moduledoc """ @@ -37,7 +37,7 @@ defmodule LSG.IRC.QuatreCentVingtPlugin do {:ok, _} = Registry.register(IRC.PubSub, "trigger:#{420*coeff}", [plugin: __MODULE__]) end {:ok, _} = Registry.register(IRC.PubSub, "account", [plugin: __MODULE__]) - dets_filename = (LSG.data_path() <> "/420.dets") |> String.to_charlist + dets_filename = (Nola.data_path() <> "/420.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, [{:type,:bag},{:repair,:force}]) {:ok, dets} :ignore diff --git a/lib/lsg_irc/radio_france_plugin.ex b/lib/lsg_irc/radio_france_plugin.ex index 34935ca..c2e966f 100644 --- a/lib/lsg_irc/radio_france_plugin.ex +++ b/lib/lsg_irc/radio_france_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.RadioFrancePlugin do +defmodule Nola.IRC.RadioFrancePlugin do require Logger def irc_doc() do diff --git a/lib/lsg_irc/say_plugin.ex b/lib/lsg_irc/say_plugin.ex index 8e93ec2..915b0f6 100644 --- a/lib/lsg_irc/say_plugin.ex +++ b/lib/lsg_irc/say_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.SayPlugin do +defmodule Nola.IRC.SayPlugin do def irc_doc do """ diff --git a/lib/lsg_irc/script_plugin.ex b/lib/lsg_irc/script_plugin.ex index bae6f3f..94d4edf 100644 --- a/lib/lsg_irc/script_plugin.ex +++ b/lib/lsg_irc/script_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.ScriptPlugin do +defmodule Nola.IRC.ScriptPlugin do require Logger @moduledoc """ @@ -24,7 +24,7 @@ defmodule LSG.IRC.ScriptPlugin do def init([]) do {:ok, _} = Registry.register(IRC.PubSub, "trigger:script", [plugin: __MODULE__]) - dets_filename = (LSG.data_path() <> "/" <> "scripts.dets") |> String.to_charlist + dets_filename = (Nola.data_path() <> "/" <> "scripts.dets") |> String.to_charlist {:ok, dets} = :dets.open_file(dets_filename, []) {:ok, %{dets: dets}} end diff --git a/lib/lsg_irc/seen_plugin.ex b/lib/lsg_irc/seen_plugin.ex index 405c372..2a4d0dd 100644 --- a/lib/lsg_irc/seen_plugin.ex +++ b/lib/lsg_irc/seen_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.SeenPlugin do +defmodule Nola.IRC.SeenPlugin do @moduledoc """ # seen @@ -14,7 +14,7 @@ defmodule LSG.IRC.SeenPlugin do regopts = [plugin: __MODULE__] {:ok, _} = Registry.register(IRC.PubSub, "triggers", regopts) {:ok, _} = Registry.register(IRC.PubSub, "messages", regopts) - dets_filename = (LSG.data_path() <> "/seen.dets") |> String.to_charlist() + dets_filename = (Nola.data_path() <> "/seen.dets") |> String.to_charlist() {:ok, dets} = :dets.open_file(dets_filename, []) {:ok, %{dets: dets}} end diff --git a/lib/lsg_irc/sms_plugin.ex b/lib/lsg_irc/sms_plugin.ex index be1611f..2bbf13e 100644 --- a/lib/lsg_irc/sms_plugin.ex +++ b/lib/lsg_irc/sms_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.SmsPlugin do +defmodule Nola.IRC.SmsPlugin do @moduledoc """ ## sms @@ -126,9 +126,9 @@ defmodule LSG.IRC.SmsPlugin do defp register_ovh_callback() do url = path() body = %{ - "callBack" =>LSGWeb.Router.Helpers.sms_url(LSGWeb.Endpoint, :ovh_callback), + "callBack" =>NolaWeb.Router.Helpers.sms_url(NolaWeb.Endpoint, :ovh_callback), "smsResponse" => %{ - "cgiUrl" => LSGWeb.Router.Helpers.sms_url(LSGWeb.Endpoint, :ovh_callback), + "cgiUrl" => NolaWeb.Router.Helpers.sms_url(NolaWeb.Endpoint, :ovh_callback), "responseType" => "cgi" } } |> Poison.encode!() diff --git a/lib/lsg_irc/tell_plugin.ex b/lib/lsg_irc/tell_plugin.ex index baaa0c5..ecc98df 100644 --- a/lib/lsg_irc/tell_plugin.ex +++ b/lib/lsg_irc/tell_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.TellPlugin do +defmodule Nola.IRC.TellPlugin do use GenServer @moduledoc """ @@ -13,7 +13,7 @@ defmodule LSG.IRC.TellPlugin do end def dets do - (LSG.data_path() <> "/tell.dets") |> String.to_charlist() + (Nola.data_path() <> "/tell.dets") |> String.to_charlist() end def tell(m, target, message) do diff --git a/lib/lsg_irc/txt_plugin.ex b/lib/lsg_irc/txt_plugin.ex index 2c9dfca..d2bb627 100644 --- a/lib/lsg_irc/txt_plugin.ex +++ b/lib/lsg_irc/txt_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.TxtPlugin do +defmodule Nola.IRC.TxtPlugin do alias IRC.UserTrack require Logger @@ -53,9 +53,9 @@ defmodule LSG.IRC.TxtPlugin do end def init([]) do - dets_locks_filename = (LSG.data_path() <> "/" <> "txtlocks.dets") |> String.to_charlist + dets_locks_filename = (Nola.data_path() <> "/" <> "txtlocks.dets") |> String.to_charlist {:ok, locks} = :dets.open_file(dets_locks_filename, []) - markov_handler = Keyword.get(Application.get_env(:lsg, __MODULE__, []), :markov_handler, LSG.IRC.TxtPlugin.Markov.Native) + markov_handler = Keyword.get(Application.get_env(:lsg, __MODULE__, []), :markov_handler, Nola.IRC.TxtPlugin.Markov.Native) {:ok, markov} = markov_handler.start_link() {:ok, _} = Registry.register(IRC.PubSub, "triggers", [plugin: __MODULE__]) {:ok, %__MODULE__{locks: locks, markov_handler: markov_handler, markov: markov, triggers: load()}} @@ -303,9 +303,9 @@ defmodule LSG.IRC.TxtPlugin do {trigger, _} = clean_trigger(trigger) if Map.get(state.triggers, trigger) do url = if m.channel do - LSGWeb.Router.Helpers.irc_url(LSGWeb.Endpoint, :txt, m.network, LSGWeb.format_chan(m.channel), trigger) + NolaWeb.Router.Helpers.irc_url(NolaWeb.Endpoint, :txt, m.network, NolaWeb.format_chan(m.channel), trigger) else - LSGWeb.Router.Helpers.irc_url(LSGWeb.Endpoint, :txt, trigger) + NolaWeb.Router.Helpers.irc_url(NolaWeb.Endpoint, :txt, trigger) end m.replyfun.("-> #{url}") end diff --git a/lib/lsg_irc/txt_plugin/markov.ex b/lib/lsg_irc/txt_plugin/markov.ex index 311138c..2e30dfa 100644 --- a/lib/lsg_irc/txt_plugin/markov.ex +++ b/lib/lsg_irc/txt_plugin/markov.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.TxtPlugin.Markov do +defmodule Nola.IRC.TxtPlugin.Markov do @type state :: any() @callback start_link() :: {:ok, state()} diff --git a/lib/lsg_irc/txt_plugin/markov_native.ex b/lib/lsg_irc/txt_plugin/markov_native.ex index 524e860..4c403c2 100644 --- a/lib/lsg_irc/txt_plugin/markov_native.ex +++ b/lib/lsg_irc/txt_plugin/markov_native.ex @@ -1,5 +1,5 @@ -defmodule LSG.IRC.TxtPlugin.MarkovNative do - @behaviour LSG.IRC.TxtPlugin.Markov +defmodule Nola.IRC.TxtPlugin.MarkovNative do + @behaviour Nola.IRC.TxtPlugin.Markov def start_link() do ExChain.MarkovModel.start_link() diff --git a/lib/lsg_irc/txt_plugin/markov_py_markovify.ex b/lib/lsg_irc/txt_plugin/markov_py_markovify.ex index a3838cd..cda7853 100644 --- a/lib/lsg_irc/txt_plugin/markov_py_markovify.ex +++ b/lib/lsg_irc/txt_plugin/markov_py_markovify.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.TxtPlugin.MarkovPyMarkovify do +defmodule Nola.IRC.TxtPlugin.MarkovPyMarkovify do def start_link() do {:ok, nil} @@ -18,7 +18,7 @@ defmodule LSG.IRC.TxtPlugin.MarkovPyMarkovify do defp run(args \\ []) do {binary, script} = script() - args = [script, Path.expand(LSG.IRC.TxtPlugin.directory()) | args] + args = [script, Path.expand(Nola.IRC.TxtPlugin.directory()) | args] IO.puts "Args #{inspect args}" case MuonTrap.cmd(binary, args) do {response, 0} -> response @@ -28,7 +28,7 @@ defmodule LSG.IRC.TxtPlugin.MarkovPyMarkovify do defp script() do default_script = to_string(:code.priv_dir(:lsg)) <> "/irc/txt/markovify.py" - env = Application.get_env(:lsg, LSG.IRC.TxtPlugin, []) + env = Application.get_env(:lsg, Nola.IRC.TxtPlugin, []) |> Keyword.get(:py_markovify, []) {Keyword.get(env, :python, "python3"), Keyword.get(env, :script, default_script)} diff --git a/lib/lsg_irc/untappd_plugin.ex b/lib/lsg_irc/untappd_plugin.ex index 69e4be6..50b0c4d 100644 --- a/lib/lsg_irc/untappd_plugin.ex +++ b/lib/lsg_irc/untappd_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.UntappdPlugin do +defmodule Nola.IRC.UntappdPlugin do def irc_doc() do """ diff --git a/lib/lsg_irc/user_mention_plugin.ex b/lib/lsg_irc/user_mention_plugin.ex index ca743c4..eb230fd 100644 --- a/lib/lsg_irc/user_mention_plugin.ex +++ b/lib/lsg_irc/user_mention_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.UserMentionPlugin do +defmodule Nola.IRC.UserMentionPlugin do @moduledoc """ # mention @@ -31,13 +31,13 @@ defmodule LSG.IRC.UserMentionPlugin do cond do telegram -> - LSG.Telegram.send_message(telegram, "`#{channel}` <**#{sender.nick}**> #{Enum.join(content, " ")}") + Nola.Telegram.send_message(telegram, "`#{channel}` <**#{sender.nick}**> #{Enum.join(content, " ")}") sms -> - case LSG.IRC.SmsPlugin.send_sms(sms, text) do + case Nola.IRC.SmsPlugin.send_sms(sms, text) do {:error, code} -> message.replyfun("#{sender.nick}: erreur #{code} (sms)") end true -> - LSG.IRC.TellPlugin.tell(message, nick, content) + Nola.IRC.TellPlugin.tell(message, nick, content) end else message.replyfun.("#{nick} m'est inconnu") diff --git a/lib/lsg_irc/wikipedia_plugin.ex b/lib/lsg_irc/wikipedia_plugin.ex index 618eb66..3202e13 100644 --- a/lib/lsg_irc/wikipedia_plugin.ex +++ b/lib/lsg_irc/wikipedia_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.WikipediaPlugin do +defmodule Nola.IRC.WikipediaPlugin do require Logger @moduledoc """ diff --git a/lib/lsg_irc/wolfram_alpha_plugin.ex b/lib/lsg_irc/wolfram_alpha_plugin.ex index c07f659..b553e63 100644 --- a/lib/lsg_irc/wolfram_alpha_plugin.ex +++ b/lib/lsg_irc/wolfram_alpha_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.WolframAlphaPlugin do +defmodule Nola.IRC.WolframAlphaPlugin do use GenServer require Logger diff --git a/lib/lsg_irc/youtube_plugin.ex b/lib/lsg_irc/youtube_plugin.ex index 49fc31c..3d2acfb 100644 --- a/lib/lsg_irc/youtube_plugin.ex +++ b/lib/lsg_irc/youtube_plugin.ex @@ -1,4 +1,4 @@ -defmodule LSG.IRC.YouTubePlugin do +defmodule Nola.IRC.YouTubePlugin do require Logger @moduledoc """ |