summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2022-12-17 13:47:11 +0000
committerJordan Bracco <href@random.sh>2022-12-20 19:29:41 +0100
commitfd4afd7c7acd9b5fda75b628a7e19d0149d8b889 (patch)
treedf571d49fa9dc9c3cd58c94033b9fc81c7b7f8ec
parentRename 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'`
-rw-r--r--lib/irc/account.ex10
-rw-r--r--lib/irc/connection.ex2
-rw-r--r--lib/irc/irc.ex2
-rw-r--r--lib/irc/membership.ex2
-rw-r--r--lib/irc/plugin_supervisor.ex2
-rw-r--r--lib/irc/puppet_connection.ex2
-rw-r--r--lib/lsg/application.ex42
-rw-r--r--lib/lsg/auth_token.ex6
-rw-r--r--lib/lsg/icecast.ex8
-rw-r--r--lib/lsg/icecast_agent.ex2
-rw-r--r--lib/lsg/lsg.ex2
-rw-r--r--lib/lsg/subnet.ex4
-rw-r--r--lib/lsg/token.ex2
-rw-r--r--lib/lsg_irc/admin_handler.ex2
-rw-r--r--lib/lsg_irc/alcolog_plugin.ex36
-rw-r--r--lib/lsg_irc/alcoolog_announcer_plugin.ex12
-rw-r--r--lib/lsg_irc/base_plugin.ex16
-rw-r--r--lib/lsg_irc/bourosama_plugin.ex2
-rw-r--r--lib/lsg_irc/buffer_plugin.ex2
-rw-r--r--lib/lsg_irc/calc_plugin.ex2
-rw-r--r--lib/lsg_irc/coronavirus_plugin.ex2
-rw-r--r--lib/lsg_irc/correction_plugin.ex2
-rw-r--r--lib/lsg_irc/dice_plugin.ex2
-rw-r--r--lib/lsg_irc/finance_plugin.ex2
-rw-r--r--lib/lsg_irc/gpt_plugin.ex10
-rw-r--r--lib/lsg_irc/kick_roulette_plugin.ex2
-rw-r--r--lib/lsg_irc/last_fm_plugin.ex4
-rw-r--r--lib/lsg_irc/link_plugin.ex10
-rw-r--r--lib/lsg_irc/link_plugin/github.ex4
-rw-r--r--lib/lsg_irc/link_plugin/html.ex4
-rw-r--r--lib/lsg_irc/link_plugin/imgur.ex4
-rw-r--r--lib/lsg_irc/link_plugin/pdf.ex4
-rw-r--r--lib/lsg_irc/link_plugin/redacted.ex4
-rw-r--r--lib/lsg_irc/link_plugin/reddit.ex4
-rw-r--r--lib/lsg_irc/link_plugin/twitter.ex4
-rw-r--r--lib/lsg_irc/link_plugin/youtube.ex4
-rw-r--r--lib/lsg_irc/logger_plugin.ex2
-rw-r--r--lib/lsg_irc/lsg_irc.ex4
-rw-r--r--lib/lsg_irc/outline_plugin.ex4
-rw-r--r--lib/lsg_irc/preums_plugin.ex6
-rw-r--r--lib/lsg_irc/quatre_cent_vingt_plugin.ex4
-rw-r--r--lib/lsg_irc/radio_france_plugin.ex2
-rw-r--r--lib/lsg_irc/say_plugin.ex2
-rw-r--r--lib/lsg_irc/script_plugin.ex4
-rw-r--r--lib/lsg_irc/seen_plugin.ex4
-rw-r--r--lib/lsg_irc/sms_plugin.ex6
-rw-r--r--lib/lsg_irc/tell_plugin.ex4
-rw-r--r--lib/lsg_irc/txt_plugin.ex10
-rw-r--r--lib/lsg_irc/txt_plugin/markov.ex2
-rw-r--r--lib/lsg_irc/txt_plugin/markov_native.ex4
-rw-r--r--lib/lsg_irc/txt_plugin/markov_py_markovify.ex6
-rw-r--r--lib/lsg_irc/untappd_plugin.ex2
-rw-r--r--lib/lsg_irc/user_mention_plugin.ex8
-rw-r--r--lib/lsg_irc/wikipedia_plugin.ex2
-rw-r--r--lib/lsg_irc/wolfram_alpha_plugin.ex2
-rw-r--r--lib/lsg_irc/youtube_plugin.ex2
-rw-r--r--lib/lsg_matrix/matrix.ex12
-rw-r--r--lib/lsg_matrix/plug.ex2
-rw-r--r--lib/lsg_matrix/room.ex6
-rw-r--r--lib/lsg_telegram/room.ex10
-rw-r--r--lib/lsg_telegram/telegram.ex14
-rw-r--r--lib/lsg_web/channels/user_socket.ex6
-rw-r--r--lib/lsg_web/components/component.ex2
-rw-r--r--lib/lsg_web/components/event_component.ex10
-rw-r--r--lib/lsg_web/components/message_component.ex4
-rw-r--r--lib/lsg_web/context_plug.ex6
-rw-r--r--lib/lsg_web/controllers/alcoolog_controller.ex44
-rw-r--r--lib/lsg_web/controllers/gpt_controller.ex14
-rw-r--r--lib/lsg_web/controllers/icecast_see_controller.ex8
-rw-r--r--lib/lsg_web/controllers/irc_auth_sse_controller.ex6
-rw-r--r--lib/lsg_web/controllers/irc_controller.ex12
-rw-r--r--lib/lsg_web/controllers/network_controller.ex6
-rw-r--r--lib/lsg_web/controllers/open_id_controller.ex8
-rw-r--r--lib/lsg_web/controllers/page_controller.ex12
-rw-r--r--lib/lsg_web/controllers/sms_controller.ex6
-rw-r--r--lib/lsg_web/controllers/untappd_controller.ex4
-rw-r--r--lib/lsg_web/endpoint.ex4
-rw-r--r--lib/lsg_web/gettext.ex4
-rw-r--r--lib/lsg_web/live/chat_live.ex6
-rw-r--r--lib/lsg_web/lsg_web.ex26
-rw-r--r--lib/lsg_web/router.ex14
-rw-r--r--lib/lsg_web/views/alcoolog_view.ex4
-rw-r--r--lib/lsg_web/views/error_helpers.ex6
-rw-r--r--lib/lsg_web/views/error_view.ex4
-rw-r--r--lib/lsg_web/views/irc_view.ex4
-rw-r--r--lib/lsg_web/views/layout_view.ex8
-rw-r--r--lib/lsg_web/views/network_view.ex4
-rw-r--r--lib/lsg_web/views/open_id_view.ex4
-rw-r--r--lib/lsg_web/views/page_view.ex4
-rw-r--r--lib/untappd.ex4
90 files changed, 296 insertions, 296 deletions
diff --git a/lib/irc/account.ex b/lib/irc/account.ex
index 46c7f6e..45680f8 100644
--- a/lib/irc/account.ex
+++ b/lib/irc/account.ex
@@ -32,7 +32,7 @@ defmodule IRC.Account do
end
def file(base) do
- to_charlist(LSG.data_path() <> "/account_#{base}.dets")
+ to_charlist(Nola.data_path() <> "/account_#{base}.dets")
end
defp from_struct(%__MODULE__{id: id, name: name, token: token}) do
@@ -355,7 +355,7 @@ defmodule IRC.Account do
def handle_info({:irc, :text, m = %IRC.Message{text: "web"}}, state) do
auth_url = Untappd.auth_url()
- login_url = LSG.AuthToken.new_url(m.account.id, nil)
+ login_url = Nola.AuthToken.new_url(m.account.id, nil)
m.replyfun.("-> " <> login_url)
{:noreply, state}
end
@@ -364,7 +364,7 @@ defmodule IRC.Account do
code = String.downcase(EntropyString.small_id())
IRC.Account.put_meta(m.account, "sms-validation-code", code)
IRC.Account.put_meta(m.account, "sms-validation-target", m.network)
- number = LSG.IRC.SmsPlugin.my_number()
+ number = Nola.IRC.SmsPlugin.my_number()
text = "To enable or change your number for SMS messaging, please send:"
<> " \"enable #{code}\" to #{number}"
m.replyfun.(text)
@@ -376,7 +376,7 @@ defmodule IRC.Account do
IRC.Account.delete_meta(m.account, "telegram-id")
IRC.Account.put_meta(m.account, "telegram-validation-code", code)
IRC.Account.put_meta(m.account, "telegram-validation-target", m.network)
- text = "To enable or change your number for telegram messaging, please open #{LSG.Telegram.my_path()} and send:"
+ text = "To enable or change your number for telegram messaging, please open #{Nola.Telegram.my_path()} and send:"
<> " \"/enable #{code}\""
m.replyfun.(text)
{:noreply, state}
@@ -384,7 +384,7 @@ defmodule IRC.Account do
def handle_info({:irc, :text, m = %IRC.Message{text: "enable-untappd"}}, state) do
auth_url = Untappd.auth_url()
- login_url = LSG.AuthToken.new_url(m.account.id, {:external_redirect, auth_url})
+ login_url = Nola.AuthToken.new_url(m.account.id, {:external_redirect, auth_url})
m.replyfun.(["To link your Untappd account, open this URL:", login_url])
{:noreply, state}
end
diff --git a/lib/irc/connection.ex b/lib/irc/connection.ex
index 9382714..86d8279 100644
--- a/lib/irc/connection.ex
+++ b/lib/irc/connection.ex
@@ -92,7 +92,7 @@ defmodule IRC.Connection do
:dets.open_file(dets(), [])
end
- def dets(), do: to_charlist(LSG.data_path("/connections.dets"))
+ def dets(), do: to_charlist(Nola.data_path("/connections.dets"))
def lookup(id) do
case :dets.lookup(dets(), id) do
diff --git a/lib/irc/irc.ex b/lib/irc/irc.ex
index d9fdfb5..71d6d93 100644
--- a/lib/irc/irc.ex
+++ b/lib/irc/irc.ex
@@ -41,7 +41,7 @@ defmodule IRC do
def admin?(%Message{sender: sender}), do: admin?(sender)
def admin?(%{nick: nick, user: user, host: host}) do
- for {n, u, h} <- LSG.IRC.env(:admins, []) do
+ for {n, u, h} <- Nola.IRC.env(:admins, []) do
admin_part_match?(n, nick) && admin_part_match?(u, user) && admin_part_match?(h, host)
end
|> Enum.any?
diff --git a/lib/irc/membership.ex b/lib/irc/membership.ex
index 74ed1b4..b727dfd 100644
--- a/lib/irc/membership.ex
+++ b/lib/irc/membership.ex
@@ -7,7 +7,7 @@ defmodule IRC.Membership do
# Format: {key, last_seen}
defp dets() do
- to_charlist(LSG.data_path <> "/memberships.dets")
+ to_charlist(Nola.data_path <> "/memberships.dets")
end
def start_link() do
diff --git a/lib/irc/plugin_supervisor.ex b/lib/irc/plugin_supervisor.ex
index 24ac683..a65ad09 100644
--- a/lib/irc/plugin_supervisor.ex
+++ b/lib/irc/plugin_supervisor.ex
@@ -33,7 +33,7 @@ defmodule IRC.Plugin do
end
end
- def dets(), do: to_charlist(LSG.data_path("/plugins.dets"))
+ def dets(), do: to_charlist(Nola.data_path("/plugins.dets"))
def setup() do
:dets.open_file(dets(), [])
diff --git a/lib/irc/puppet_connection.ex b/lib/irc/puppet_connection.ex
index f12cbf7..91a26b3 100644
--- a/lib/irc/puppet_connection.ex
+++ b/lib/irc/puppet_connection.ex
@@ -77,7 +77,7 @@ defmodule IRC.PuppetConnection do
def handle_continue(:connect, state) do
#ipv6 = if @env == :prod do
- # subnet = LSG.Subnet.assign(state.account_id)
+ # subnet = Nola.Subnet.assign(state.account_id)
# IRC.Account.put_meta(IRC.Account.get(state.account_id), "subnet", subnet)
# ip = Pfx.host(subnet, 1)
# {:ok, ipv6} = :inet_parse.ipv6_address(to_charlist(ip))
diff --git a/lib/lsg/application.ex b/lib/lsg/application.ex
index 0d29668..1782053 100644
--- a/lib/lsg/application.ex
+++ b/lib/lsg/application.ex
@@ -1,4 +1,4 @@
-defmodule LSG.Application do
+defmodule Nola.Application do
use Application
# See https://hexdocs.pm/elixir/Application.html
@@ -7,40 +7,40 @@ defmodule LSG.Application do
import Supervisor.Spec
Logger.add_backend(Sentry.LoggerBackend)
- :ok = LSG.Matrix.setup()
- :ok = LSG.TelegramRoom.setup()
+ :ok = Nola.Matrix.setup()
+ :ok = Nola.TelegramRoom.setup()
# Define workers and child supervisors to be supervised
children = [
# Start the endpoint when the application starts
- supervisor(LSGWeb.Endpoint, []),
- # Start your own worker by calling: LSG.Worker.start_link(arg1, arg2, arg3)
- # worker(LSG.Worker, [arg1, arg2, arg3]),
- worker(Registry, [[keys: :duplicate, name: LSG.BroadcastRegistry]], id: :registry_broadcast),
- worker(LSG.IcecastAgent, []),
- worker(LSG.Token, []),
- worker(LSG.AuthToken, []),
- LSG.Subnet,
- {GenMagic.Pool, [name: LSG.GenMagic, pool_size: 2]},
- #worker(LSG.Icecast, []),
- ] ++ LSG.IRC.application_childs
- ++ LSG.Matrix.application_childs
+ 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, []),
+ ] ++ 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: LSG.Supervisor]
+ opts = [strategy: :one_for_one, name: Nola.Supervisor]
sup = Supervisor.start_link(children, opts)
start_telegram()
- spawn_link(fn() -> LSG.IRC.after_start() end)
- spawn_link(fn() -> LSG.Matrix.after_start() end)
- spawn_link(fn() -> LSG.TelegramRoom.after_start() end)
+ spawn_link(fn() -> Nola.IRC.after_start() end)
+ spawn_link(fn() -> Nola.Matrix.after_start() end)
+ spawn_link(fn() -> Nola.TelegramRoom.after_start() end)
sup
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
- LSGWeb.Endpoint.config_change(changed, removed)
+ NolaWeb.Endpoint.config_change(changed, removed)
:ok
end
@@ -50,7 +50,7 @@ defmodule LSG.Application do
username: Keyword.get(Application.get_env(:lsg, :telegram, []), :nick, "beauttebot"),
purge: false
]
- telegram = Telegram.Bot.ChatBot.Supervisor.start_link({LSG.Telegram, token, options})
+ telegram = Telegram.Bot.ChatBot.Supervisor.start_link({Nola.Telegram, token, options})
end
end
diff --git a/lib/lsg/auth_token.ex b/lib/lsg/auth_token.ex
index 0c5ba58..d125ea4 100644
--- a/lib/lsg/auth_token.ex
+++ b/lib/lsg/auth_token.ex
@@ -1,4 +1,4 @@
-defmodule LSG.AuthToken do
+defmodule Nola.AuthToken do
use GenServer
def start_link() do
@@ -12,7 +12,7 @@ defmodule LSG.AuthToken do
def new_path(account, perks \\ nil) do
case new(account, perks) do
{:ok, id} ->
- LSGWeb.Router.Helpers.login_path(LSGWeb.Endpoint, :token, id)
+ NolaWeb.Router.Helpers.login_path(NolaWeb.Endpoint, :token, id)
error ->
error
end
@@ -21,7 +21,7 @@ defmodule LSG.AuthToken do
def new_url(account, perks \\ nil) do
case new(account, perks) do
{:ok, id} ->
- LSGWeb.Router.Helpers.login_url(LSGWeb.Endpoint, :token, id)
+ NolaWeb.Router.Helpers.login_url(NolaWeb.Endpoint, :token, id)
error ->
error
end
diff --git a/lib/lsg/icecast.ex b/lib/lsg/icecast.ex
index 07dd4fc..60fb45a 100644
--- a/lib/lsg/icecast.ex
+++ b/lib/lsg/icecast.ex
@@ -1,4 +1,4 @@
-defmodule LSG.Icecast do
+defmodule Nola.Icecast do
use GenServer
require Logger
@hackney_pool :default
@@ -29,8 +29,8 @@ defmodule LSG.Icecast do
stats = update_stats(body)
if state != stats do
Logger.info "Icecast Update: " <> inspect(stats)
- LSG.IcecastAgent.update(stats)
- Registry.dispatch(LSG.BroadcastRegistry, "icecast", fn ws ->
+ Nola.IcecastAgent.update(stats)
+ Registry.dispatch(Nola.BroadcastRegistry, "icecast", fn ws ->
for {pid, _} <- ws, do: send(pid, {:icecast, stats})
end)
stats
@@ -83,7 +83,7 @@ defmodule LSG.Icecast do
end
defp request(uri, method, body \\ [], headers \\ []) do
- headers = [{"user-agent", "LSG-API[115ans.net, sys.115ans.net] href@random.sh"}] ++ headers
+ headers = [{"user-agent", "Nola-API[115ans.net, sys.115ans.net] href@random.sh"}] ++ headers
options = @httpoison_opts
case :ok do #:fuse.ask(@fuse, :sync) do
:ok -> run_request(method, uri, body, headers, options)
diff --git a/lib/lsg/icecast_agent.ex b/lib/lsg/icecast_agent.ex
index 8f8a86a..8a3a72b 100644
--- a/lib/lsg/icecast_agent.ex
+++ b/lib/lsg/icecast_agent.ex
@@ -1,4 +1,4 @@
-defmodule LSG.IcecastAgent do
+defmodule Nola.IcecastAgent do
use Agent
def start_link() do
diff --git a/lib/lsg/lsg.ex b/lib/lsg/lsg.ex
index b5da5e0..11d0e24 100644
--- a/lib/lsg/lsg.ex
+++ b/lib/lsg/lsg.ex
@@ -1,4 +1,4 @@
-defmodule LSG do
+defmodule Nola do
@default_brand [
name: "Nola,
diff --git a/lib/lsg/subnet.ex b/lib/lsg/subnet.ex
index 81bd862..ac9d8e6 100644
--- a/lib/lsg/subnet.ex
+++ b/lib/lsg/subnet.ex
@@ -1,4 +1,4 @@
-defmodule LSG.Subnet do
+defmodule Nola.Subnet do
use Agent
def start_link(_) do
@@ -64,7 +64,7 @@ defmodule LSG.Subnet do
@doc false
def dets() do
- (LSG.data_path() <> "/subnets.dets") |> String.to_charlist()
+ (Nola.data_path() <> "/subnets.dets") |> String.to_charlist()
end
@doc false
diff --git a/lib/lsg/token.ex b/lib/lsg/token.ex
index 33946d4..563ac72 100644
--- a/lib/lsg/token.ex
+++ b/lib/lsg/token.ex
@@ -1,4 +1,4 @@
-defmodule LSG.Token do
+defmodule Nola.Token do
use GenServer
def start_link() do
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 """
diff --git a/lib/lsg_matrix/matrix.ex b/lib/lsg_matrix/matrix.ex
index 49da6b2..9334816 100644
--- a/lib/lsg_matrix/matrix.ex
+++ b/lib/lsg_matrix/matrix.ex
@@ -1,4 +1,4 @@
-defmodule LSG.Matrix do
+defmodule Nola.Matrix do
require Logger
alias Polyjuice.Client
@@ -8,7 +8,7 @@ defmodule LSG.Matrix do
@env Mix.env
def dets(part) do
- (LSG.data_path() <> "/matrix-#{to_string(part)}.dets") |> String.to_charlist()
+ (Nola.data_path() <> "/matrix-#{to_string(part)}.dets") |> String.to_charlist()
end
def setup() do
@@ -62,13 +62,13 @@ defmodule LSG.Matrix do
def application_childs() do
import Supervisor.Spec
[
- supervisor(LSG.Matrix.Room.Supervisor, [], [name: IRC.PuppetConnection.Supervisor]),
+ supervisor(Nola.Matrix.Room.Supervisor, [], [name: IRC.PuppetConnection.Supervisor]),
]
end
def after_start() do
rooms = :dets.foldl(fn({id, _, _, _}, acc) -> [id | acc] end, [], dets(:rooms))
- for room <- rooms, do: LSG.Matrix.Room.start(room)
+ for room <- rooms, do: Nola.Matrix.Room.start(room)
end
def lookup_room(room) do
@@ -130,7 +130,7 @@ defmodule LSG.Matrix do
def query_alias(room_alias) do
case lookup_or_create_room(room_alias) do
{:ok, room_id} ->
- LSG.Matrix.Room.start(room_id)
+ Nola.Matrix.Room.start(room_id)
:ok
error -> error
end
@@ -140,7 +140,7 @@ defmodule LSG.Matrix do
def new_event(event = %MatrixAppService.Event{}) do
Logger.debug("New matrix event: #{inspect event}")
if event.room_id do
- LSG.Matrix.Room.start_and_send_matrix_event(event.room_id, event)
+ Nola.Matrix.Room.start_and_send_matrix_event(event.room_id, event)
end
:noop
end
diff --git a/lib/lsg_matrix/plug.ex b/lib/lsg_matrix/plug.ex
index c0c027f..c64ed11 100644
--- a/lib/lsg_matrix/plug.ex
+++ b/lib/lsg_matrix/plug.ex
@@ -1,4 +1,4 @@
-defmodule LSG.Matrix.Plug do
+defmodule Nola.Matrix.Plug do
defmodule Auth do
def init(state) do
diff --git a/lib/lsg_matrix/room.ex b/lib/lsg_matrix/room.ex
index 72b02c4..c790760 100644
--- a/lib/lsg_matrix/room.ex
+++ b/lib/lsg_matrix/room.ex
@@ -1,6 +1,6 @@
-defmodule LSG.Matrix.Room do
+defmodule Nola.Matrix.Room do
require Logger
- alias LSG.Matrix
+ alias Nola.Matrix
alias Polyjuice.Client
import Matrix, only: [client: 0, client: 1, user_name: 1, myself?: 1]
@@ -12,7 +12,7 @@ defmodule LSG.Matrix.Room do
end
def start_child(room_id) do
- spec = %{id: room_id, start: {LSG.Matrix.Room, :start_link, [room_id]}, restart: :transient}
+ spec = %{id: room_id, start: {Nola.Matrix.Room, :start_link, [room_id]}, restart: :transient}
DynamicSupervisor.start_child(__MODULE__, spec)
end
diff --git a/lib/lsg_telegram/room.ex b/lib/lsg_telegram/room.ex
index 4e86382..794cca3 100644
--- a/lib/lsg_telegram/room.ex
+++ b/lib/lsg_telegram/room.ex
@@ -1,4 +1,4 @@
-defmodule LSG.TelegramRoom do
+defmodule Nola.TelegramRoom do
require Logger
@behaviour Telegram.ChatBot
alias Telegram.Api
@@ -32,7 +32,7 @@ defmodule LSG.TelegramRoom do
end
def after_start() do
- for id <- room(:ids), do: Telegram.Bot.ChatBot.Chat.Session.Supervisor.start_child(LSG.Telegram, Integer.parse(id) |> elem(0))
+ for id <- room(:ids), do: Telegram.Bot.ChatBot.Chat.Session.Supervisor.start_child(Nola.Telegram, Integer.parse(id) |> elem(0))
end
@impl Telegram.ChatBot
@@ -125,7 +125,7 @@ defmodule LSG.TelegramRoom do
if Map.get(message.meta, :from) == self() do
else
body = if Map.get(message.meta, :self), do: text, else: "<#{nick}> #{text}"
- LSG.Telegram.send_message(state.id, body)
+ Nola.Telegram.send_message(state.id, body)
end
{:ok, state}
end
@@ -163,14 +163,14 @@ defmodule LSG.TelegramRoom do
path = "https://api.telegram.org/file/bot#{token}/#{file["file_path"]}",
{:ok, %HTTPoison.Response{status_code: 200, body: body}} <- HTTPoison.get(path),
<<smol_body::binary-size(20), _::binary>> = body,
- {:ok, magic} <- GenMagic.Pool.perform(LSG.GenMagic, {:bytes, smol_body}),
+ {:ok, magic} <- GenMagic.Pool.perform(Nola.GenMagic, {:bytes, smol_body}),
bucket = Application.get_env(:lsg, :s3, []) |> Keyword.get(:bucket),
ext = Path.extname(file["file_path"]),
s3path = "#{account.id}/#{file_unique_id}#{ext}",
s3req = ExAws.S3.put_object(bucket, s3path, body, acl: :public_read, content_type: magic.mime_type),
{:ok, _} <- ExAws.request(s3req)
do
- path = LSGWeb.Router.Helpers.url(LSGWeb.Endpoint) <> "/files/#{s3path}"
+ path = NolaWeb.Router.Helpers.url(NolaWeb.Endpoint) <> "/files/#{s3path}"
txt = "#{type}: #{text}#{path}"
connection = IRC.Connection.get_network(state.net)
IRC.send_message_as(account, state.net, state.chan, txt, true)
diff --git a/lib/lsg_telegram/telegram.ex b/lib/lsg_telegram/telegram.ex
index 748a456..ef5c3b8 100644
--- a/lib/lsg_telegram/telegram.ex
+++ b/lib/lsg_telegram/telegram.ex
@@ -1,4 +1,4 @@
-defmodule LSG.Telegram do
+defmodule Nola.Telegram do
require Logger
@behaviour Telegram.ChatBot
@@ -9,13 +9,13 @@ defmodule LSG.Telegram do
def send_message(id, text, md2 \\ false) do
md = if md2, do: "MarkdownV2", else: "Markdown"
token = Keyword.get(Application.get_env(:lsg, :telegram, []), :key)
- Telegram.Bot.ChatBot.Chat.Session.Supervisor.start_child(LSG.Telegram, id)
+ Telegram.Bot.ChatBot.Chat.Session.Supervisor.start_child(Nola.Telegram, id)
Telegram.Api.request(token, "sendMessage", chat_id: id, text: text, parse_mode: "Markdown")
end
@impl Telegram.ChatBot
def init(chat_id) when chat_id < 0 do
- {:ok, state} = LSG.TelegramRoom.init(chat_id)
+ {:ok, state} = Nola.TelegramRoom.init(chat_id)
{:ok, %{room_state: state}}
end
def init(chat_id) do
@@ -27,7 +27,7 @@ defmodule LSG.Telegram do
@impl Telegram.ChatBot
def handle_update(update, token, %{room_state: room_state}) do
- {:ok, room_state} = LSG.TelegramRoom.handle_update(update, token, room_state)
+ {:ok, room_state} = Nola.TelegramRoom.handle_update(update, token, room_state)
{:ok, %{room_state: room_state}}
end
@@ -134,7 +134,7 @@ defmodule LSG.Telegram do
path = "https://api.telegram.org/file/bot#{t}/#{file["file_path"]}",
{:ok, %HTTPoison.Response{status_code: 200, body: body}} <- HTTPoison.get(path),
<<smol_body::binary-size(20), _::binary>> = body,
- {:ok, magic} <- GenMagic.Pool.perform(LSG.GenMagic, {:bytes, smol_body}),
+ {:ok, magic} <- GenMagic.Pool.perform(Nola.GenMagic, {:bytes, smol_body}),
bucket = Application.get_env(:lsg, :s3, []) |> Keyword.get(:bucket),
ext = Path.extname(file["file_path"]),
s3path = "#{account.id}/#{file_unique_id}#{ext}",
@@ -142,7 +142,7 @@ defmodule LSG.Telegram do
s3req = ExAws.S3.put_object(bucket, s3path, body, acl: :public_read, content_type: magic.mime_type),
{:ok, _} <- ExAws.request(s3req)
do
- path = LSGWeb.Router.Helpers.url(LSGWeb.Endpoint) <> "/files/#{s3path}"
+ path = NolaWeb.Router.Helpers.url(NolaWeb.Endpoint) <> "/files/#{s3path}"
sent = for {net, chan} <- target do
txt = "sent#{type}#{text} #{path}"
IRC.send_message_as(account, net, chan, txt)
@@ -176,7 +176,7 @@ defmodule LSG.Telegram do
@impl Telegram.ChatBot
def handle_info(info, %{room_state: room_state}) do
- {:ok, room_state} = LSG.TelegramRoom.handle_info(info, room_state)
+ {:ok, room_state} = Nola.TelegramRoom.handle_info(info, room_state)
{:ok, %{room_state: room_state}}
end
diff --git a/lib/lsg_web/channels/user_socket.ex b/lib/lsg_web/channels/user_socket.ex
index 691a26c..eadd4e0 100644
--- a/lib/lsg_web/channels/user_socket.ex
+++ b/lib/lsg_web/channels/user_socket.ex
@@ -1,8 +1,8 @@
-defmodule LSGWeb.UserSocket do
+defmodule NolaWeb.UserSocket do
use Phoenix.Socket
## Channels
- # channel "room:*", LSGWeb.RoomChannel
+ # channel "room:*", NolaWeb.RoomChannel
## Transports
#transport :websocket, Phoenix.Transports.WebSocket
@@ -30,7 +30,7 @@ defmodule LSGWeb.UserSocket do
# Would allow you to broadcast a "disconnect" event and terminate
# all active sockets and channels for a given user:
#
- # LSGWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
+ # NolaWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
#
# Returning `nil` makes this socket anonymous.
def id(_socket), do: nil
diff --git a/lib/lsg_web/components/component.ex b/lib/lsg_web/components/component.ex
index d504129..fff8263 100644
--- a/lib/lsg_web/components/component.ex
+++ b/lib/lsg_web/components/component.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.Component do
+defmodule NolaWeb.Component do
use Phoenix.Component
@date_time_default_format "%F %H:%M"
diff --git a/lib/lsg_web/components/event_component.ex b/lib/lsg_web/components/event_component.ex
index fa81d19..8af3c67 100644
--- a/lib/lsg_web/components/event_component.ex
+++ b/lib/lsg_web/components/event_component.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.EventComponent do
+defmodule NolaWeb.EventComponent do
use Phoenix.Component
def content(assigns = %{event: %{type: :day_changed}}) do
@@ -10,7 +10,7 @@ defmodule LSGWeb.EventComponent do
def content(assigns = %{event: %{type: :quit}}) do
~H"""
- <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
+ <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
has quit:
<span class="reason"><%= @reason %></span>
"""
@@ -18,7 +18,7 @@ defmodule LSGWeb.EventComponent do
def content(assigns = %{event: %{type: :part}}) do
~H"""
- <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
+ <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
has left:
<span class="reason"><%= @reason %></span>
"""
@@ -28,13 +28,13 @@ defmodule LSGWeb.EventComponent do
~H"""
<span class="old-nick"><%= @old_nick %></span>
is now known as
- <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
+ <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
"""
end
def content(assigns = %{event: %{type: :join}}) do
~H"""
- <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
+ <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
joined
"""
end
diff --git a/lib/lsg_web/components/message_component.ex b/lib/lsg_web/components/message_component.ex
index 5997754..5d0386b 100644
--- a/lib/lsg_web/components/message_component.ex
+++ b/lib/lsg_web/components/message_component.ex
@@ -1,9 +1,9 @@
-defmodule LSGWeb.MessageComponent do
+defmodule NolaWeb.MessageComponent do
use Phoenix.Component
def content(assigns) do
~H"""
- <LSGWeb.Component.naive_date_time_utc datetime={@message.at} format="time-24-with-seconds" />
+ <NolaWeb.Component.naive_date_time_utc datetime={@message.at} format="time-24-with-seconds" />
<div class="inline-block font-bold flex-none cursor-default"><%= @message.sender.nick %></div>
<div class="inline-block flex-grow cursor-default"><%= @text %></div>
"""
diff --git a/lib/lsg_web/context_plug.ex b/lib/lsg_web/context_plug.ex
index aaf851e..ebededa 100644
--- a/lib/lsg_web/context_plug.ex
+++ b/lib/lsg_web/context_plug.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.ContextPlug do
+defmodule NolaWeb.ContextPlug do
import Plug.Conn
import Phoenix.Controller
@@ -31,7 +31,7 @@ defmodule LSGWeb.ContextPlug do
conns = IRC.Connection.get_network(network)
chan = if c = Map.get(conn.params, "chan") do
- LSGWeb.reformat_chan(c)
+ NolaWeb.reformat_chan(c)
end
chan_conn = IRC.Connection.get_network(network, chan)
@@ -66,7 +66,7 @@ defmodule LSGWeb.ContextPlug do
auth_required ->
conn
|> put_status(403)
- |> render(LSGWeb.AlcoologView, "auth.html", bot: bot, no_header: true, network: network)
+ |> render(NolaWeb.AlcoologView, "auth.html", bot: bot, no_header: true, network: network)
|> halt()
(network && !conns) ->
conn
diff --git a/lib/lsg_web/controllers/alcoolog_controller.ex b/lib/lsg_web/controllers/alcoolog_controller.ex
index 6542f15..3081762 100644
--- a/lib/lsg_web/controllers/alcoolog_controller.ex
+++ b/lib/lsg_web/controllers/alcoolog_controller.ex
@@ -1,12 +1,12 @@
-defmodule LSGWeb.AlcoologController do
- use LSGWeb, :controller
+defmodule NolaWeb.AlcoologController do
+ use NolaWeb, :controller
require Logger
- plug LSGWeb.ContextPlug when action not in [:token]
- plug LSGWeb.ContextPlug, [restrict: :public] when action in [:token]
+ plug NolaWeb.ContextPlug when action not in [:token]
+ plug NolaWeb.ContextPlug, [restrict: :public] when action in [:token]
def token(conn, %{"token" => token}) do
- case LSG.Token.lookup(token) do
+ case Nola.Token.lookup(token) do
{:ok, {:alcoolog, :index, network, channel}} -> index(conn, nil, network, channel)
err ->
Logger.debug("AlcoologControler: token #{inspect err} invalid")
@@ -21,8 +21,8 @@ defmodule LSGWeb.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 = LSG.IRC.AlcoologPlugin.get_full_statistics(profile_account.id)
- history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- LSG.IRC.AlcoologPlugin.nick_history(profile_account) 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
%{
at: ts |> DateTime.from_unix!(:millisecond),
points: points,
@@ -50,7 +50,7 @@ defmodule LSGWeb.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 = LSG.IRC.AlcoologPlugin.get_full_statistics(profile_account.id)
+ stats = Nola.IRC.AlcoologPlugin.get_full_statistics(profile_account.id)
conn
|> put_resp_content_type("application/json")
@@ -67,7 +67,7 @@ defmodule LSGWeb.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 = LSG.IRC.AlcoologPlugin.user_over_time_gl(profile_account, count)
+ data = Nola.IRC.AlcoologPlugin.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 LSGWeb.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 = LSG.IRC.AlcoologPlugin.user_over_time(profile_account, count)
+ data = Nola.IRC.AlcoologPlugin.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 LSGWeb.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} <- LSG.IRC.AlcoologPlugin.nick_history(profile_account) do
+ history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- Nola.IRC.AlcoologPlugin.nick_history(profile_account) do
%{
at: ts |> DateTime.from_unix!(:millisecond) |> DateTime.to_iso8601(),
points: points,
@@ -145,7 +145,7 @@ defmodule LSGWeb.AlcoologController do
}
end
last = List.last(history)
- {_, active} = LSG.IRC.AlcoologPlugin.user_stats(profile_account)
+ {_, active} = Nola.IRC.AlcoologPlugin.user_stats(profile_account)
last = %{last | active: active, at: DateTime.utc_now() |> DateTime.to_iso8601()}
history = history ++ [last]
@@ -163,7 +163,7 @@ defmodule LSGWeb.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} <- LSG.IRC.AlcoologAnnouncerPlugin.log(profile_account) do
+ history = for {_, date, value} <- Nola.IRC.AlcoologAnnouncerPlugin.log(profile_account) do
%{date: DateTime.to_iso8601(date), value: value}
end
conn
@@ -177,7 +177,7 @@ defmodule LSGWeb.AlcoologController do
end
def index(conn = %{assigns: %{account: account}}, %{"network" => network, "chan" => channel}) do
- index(conn, account, network, LSGWeb.reformat_chan(channel))
+ index(conn, account, network, NolaWeb.reformat_chan(channel))
end
def index(conn = %{assigns: %{account: account}}, _) do
@@ -187,7 +187,7 @@ defmodule LSGWeb.AlcoologController do
#def index(conn, params) do
# network = Map.get(params, "network")
# chan = if c = Map.get(params, "chan") do
- # LSGWeb.reformat_chan(c)
+ # NolaWeb.reformat_chan(c)
# end
# irc_conn = if network do
# IRC.Connection.get_network(network, chan)
@@ -223,12 +223,12 @@ defmodule LSGWeb.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(LSG.IRC.AlcoologPlugin.ETS, match)
+ drinks = :ets.select(Nola.IRC.AlcoologPlugin.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 = LSG.IRC.AlcoologPlugin.get_channel_statistics(account, network, channel)
+ stats = Nola.IRC.AlcoologPlugin.get_channel_statistics(account, network, channel)
top = Enum.reduce(drinks, %{}, fn({{{account_id, _}, vol, _, _, _, _, _, _}, _}, acc) ->
nick = Map.get(member_names, account_id)
@@ -245,7 +245,7 @@ defmodule LSGWeb.AlcoologController do
def index_gls_json(conn = %{assigns: %{account: account}}, %{"network" => network, "chan" => channel}) do
count = 30
- channel = LSGWeb.reformat_chan(channel)
+ channel = NolaWeb.reformat_chan(channel)
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)
@@ -266,7 +266,7 @@ defmodule LSGWeb.AlcoologController do
|> Enum.into(Map.new)
gls = Enum.reduce(members, filled, fn({account, _, _}, gls) ->
- Enum.reduce(LSG.IRC.AlcoologPlugin.user_over_time_gl(account, count), gls, fn({date, gl}, gls) ->
+ Enum.reduce(Nola.IRC.AlcoologPlugin.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 LSGWeb.AlcoologController do
def minisync(conn, %{"user_id" => user_id, "key" => key, "value" => value}) do
account = IRC.Account.get(user_id)
if account do
- ds = LSG.IRC.AlcoologPlugin.data_state()
- meta = LSG.IRC.AlcoologPlugin.get_user_meta(ds, account.id)
+ ds = Nola.IRC.AlcoologPlugin.data_state()
+ meta = Nola.IRC.AlcoologPlugin.get_user_meta(ds, account.id)
case Float.parse(value) do
{val, _} ->
new_meta = Map.put(meta, String.to_existing_atom(key), val)
- LSG.IRC.AlcoologPlugin.put_user_meta(ds, account.id, new_meta)
+ Nola.IRC.AlcoologPlugin.put_user_meta(ds, account.id, new_meta)
_ ->
conn
|> put_status(:unprocessable_entity)
diff --git a/lib/lsg_web/controllers/gpt_controller.ex b/lib/lsg_web/controllers/gpt_controller.ex
index acf9b27..038b235 100644
--- a/lib/lsg_web/controllers/gpt_controller.ex
+++ b/lib/lsg_web/controllers/gpt_controller.ex
@@ -1,14 +1,14 @@
-defmodule LSGWeb.GptController do
- use LSGWeb, :controller
+defmodule NolaWeb.GptController do
+ use NolaWeb, :controller
require Logger
- plug LSGWeb.ContextPlug
+ plug NolaWeb.ContextPlug
def result(conn, params = %{"id" => result_id}) do
- case LSG.IRC.GptPlugin.get_result(result_id) do
+ case Nola.IRC.GptPlugin.get_result(result_id) do
{:ok, result} ->
network = Map.get(params, "network")
- channel = if c = Map.get(params, "chan"), do: LSGWeb.reformat_chan(c)
+ channel = if c = Map.get(params, "chan"), do: NolaWeb.reformat_chan(c)
render(conn, "result.html", network: network, channel: channel, result: result)
{:error, :not_found} ->
conn
@@ -18,10 +18,10 @@ defmodule LSGWeb.GptController do
end
def prompt(conn, params = %{"id" => prompt_id}) do
- case LSG.IRC.GptPlugin.get_prompt(prompt_id) do
+ case Nola.IRC.GptPlugin.get_prompt(prompt_id) do
{:ok, prompt} ->
network = Map.get(params, "network")
- channel = if c = Map.get(params, "chan"), do: LSGWeb.reformat_chan(c)
+ channel = if c = Map.get(params, "chan"), do: NolaWeb.reformat_chan(c)
render(conn, "prompt.html", network: network, channel: channel, prompt: prompt)
{:error, :not_found} ->
conn
diff --git a/lib/lsg_web/controllers/icecast_see_controller.ex b/lib/lsg_web/controllers/icecast_see_controller.ex
index 1eecca1..877ad4e 100644
--- a/lib/lsg_web/controllers/icecast_see_controller.ex
+++ b/lib/lsg_web/controllers/icecast_see_controller.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.IcecastSseController do
- use LSGWeb, :controller
+defmodule NolaWeb.IcecastSseController do
+ use NolaWeb, :controller
require Logger
@ping_interval 20_000
@@ -11,13 +11,13 @@ defmodule LSGWeb.IcecastSseController do
|> send_chunked(200)
|> subscribe
|> send_sse_message("ping", "ping")
- |> send_sse_message("icecast", LSG.IcecastAgent.get)
+ |> send_sse_message("icecast", Nola.IcecastAgent.get)
|> sse_loop
end
def subscribe(conn) do
:timer.send_interval(@ping_interval, {:event, :ping})
- {:ok, _} = Registry.register(LSG.BroadcastRegistry, "icecast", [])
+ {:ok, _} = Registry.register(Nola.BroadcastRegistry, "icecast", [])
conn
end
diff --git a/lib/lsg_web/controllers/irc_auth_sse_controller.ex b/lib/lsg_web/controllers/irc_auth_sse_controller.ex
index f370d97..62ee2b5 100644
--- a/lib/lsg_web/controllers/irc_auth_sse_controller.ex
+++ b/lib/lsg_web/controllers/irc_auth_sse_controller.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.IrcAuthSseController do
- use LSGWeb, :controller
+defmodule NolaWeb.IrcAuthSseController do
+ use NolaWeb, :controller
require Logger
@ping_interval 20_000
@@ -36,7 +36,7 @@ defmodule LSGWeb.IrcAuthSseController do
{:event, :expire} -> {"expire", "expire", true}
{:irc, :text, %{account: account, text: token} = m} ->
if String.downcase(String.trim(token)) == conn.assigns.token do
- path = LSG.AuthToken.new_path(account.id, conn.assigns.perks)
+ path = Nola.AuthToken.new_path(account.id, conn.assigns.perks)
m.replyfun.("ok!")
{"authenticated", path, true}
else
diff --git a/lib/lsg_web/controllers/irc_controller.ex b/lib/lsg_web/controllers/irc_controller.ex
index d518481..90d9853 100644
--- a/lib/lsg_web/controllers/irc_controller.ex
+++ b/lib/lsg_web/controllers/irc_controller.ex
@@ -1,11 +1,11 @@
-defmodule LSGWeb.IrcController do
- use LSGWeb, :controller
+defmodule NolaWeb.IrcController do
+ use NolaWeb, :controller
- plug LSGWeb.ContextPlug
+ plug NolaWeb.ContextPlug
def index(conn, params) do
network = Map.get(params, "network")
- channel = if c = Map.get(params, "chan"), do: LSGWeb.reformat_chan(c)
+ channel = if c = Map.get(params, "chan"), do: NolaWeb.reformat_chan(c)
commands = for mod <- Enum.uniq([IRC.Account.AccountPlugin] ++ IRC.Plugin.enabled()) do
if is_atom(mod) do
identifier = Module.split(mod) |> List.last |> String.replace("Plugin", "") |> Macro.underscore
@@ -42,7 +42,7 @@ defmodule LSGWeb.IrcController do
defp do_txt(conn, nil) do
- doc = LSG.IRC.TxtPlugin.irc_doc()
+ doc = Nola.IRC.TxtPlugin.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)
@@ -55,7 +55,7 @@ defmodule LSGWeb.IrcController do
defp do_txt(conn, txt) do
data = data()
base_url = cond do
- conn.assigns[:chan] -> "/#{conn.assigns.network}/#{LSGWeb.format_chan(conn.assigns.chan)}"
+ conn.assigns[:chan] -> "/#{conn.assigns.network}/#{NolaWeb.format_chan(conn.assigns.chan)}"
true -> "/-"
end
if lines = Map.get(data, txt) do
diff --git a/lib/lsg_web/controllers/network_controller.ex b/lib/lsg_web/controllers/network_controller.ex
index 537c2f6..800294f 100644
--- a/lib/lsg_web/controllers/network_controller.ex
+++ b/lib/lsg_web/controllers/network_controller.ex
@@ -1,6 +1,6 @@
-defmodule LSGWeb.NetworkController do
- use LSGWeb, :controller
- plug LSGWeb.ContextPlug
+defmodule NolaWeb.NetworkController do
+ use NolaWeb, :controller
+ plug NolaWeb.ContextPlug
def index(conn, %{"network" => network}) do
conn
diff --git a/lib/lsg_web/controllers/open_id_controller.ex b/lib/lsg_web/controllers/open_id_controller.ex
index d5af318..94166eb 100644
--- a/lib/lsg_web/controllers/open_id_controller.ex
+++ b/lib/lsg_web/controllers/open_id_controller.ex
@@ -1,6 +1,6 @@
-defmodule LSGWeb.OpenIdController do
- use LSGWeb, :controller
- plug LSGWeb.ContextPlug, restrict: :public
+defmodule NolaWeb.OpenIdController do
+ use NolaWeb, :controller
+ plug NolaWeb.ContextPlug, restrict: :public
require Logger
def login(conn, _) do
@@ -58,7 +58,7 @@ defmodule LSGWeb.OpenIdController do
site: config[:base_url],
authorize_url: config[:authorize_url],
token_url: config[:token_url],
- redirect_uri: Routes.open_id_url(LSGWeb.Endpoint, :callback)
+ redirect_uri: Routes.open_id_url(NolaWeb.Endpoint, :callback)
])
end
end
diff --git a/lib/lsg_web/controllers/page_controller.ex b/lib/lsg_web/controllers/page_controller.ex
index 94c9c70..2ac4d0a 100644
--- a/lib/lsg_web/controllers/page_controller.ex
+++ b/lib/lsg_web/controllers/page_controller.ex
@@ -1,12 +1,12 @@
-defmodule LSGWeb.PageController do
- use LSGWeb, :controller
+defmodule NolaWeb.PageController do
+ use NolaWeb, :controller
- plug LSGWeb.ContextPlug when action not in [:token]
- plug LSGWeb.ContextPlug, [restrict: :public] when action in [:token]
+ plug NolaWeb.ContextPlug when action not in [:token]
+ plug NolaWeb.ContextPlug, [restrict: :public] when action in [:token]
def token(conn, %{"token" => token}) do
with \
- {:ok, account, perks} <- LSG.AuthToken.lookup(token)
+ {:ok, account, perks} <- Nola.AuthToken.lookup(token)
do
IO.puts("Authenticated account #{inspect account}")
conn = put_session(conn, :account, account)
@@ -33,7 +33,7 @@ defmodule LSGWeb.PageController do
end
def irc(conn, _) do
- bot_helps = for mod <- LSG.IRC.env(:handlers) do
+ bot_helps = for mod <- Nola.IRC.env(:handlers) do
mod.irc_doc()
end
render conn, "irc.html", bot_helps: bot_helps
diff --git a/lib/lsg_web/controllers/sms_controller.ex b/lib/lsg_web/controllers/sms_controller.ex
index 00c6352..575655c 100644
--- a/lib/lsg_web/controllers/sms_controller.ex
+++ b/lib/lsg_web/controllers/sms_controller.ex
@@ -1,9 +1,9 @@
-defmodule LSGWeb.SmsController do
- use LSGWeb, :controller
+defmodule NolaWeb.SmsController do
+ use NolaWeb, :controller
require Logger
def ovh_callback(conn, %{"senderid" => from, "message" => message}) do
- spawn(fn() -> LSG.IRC.SmsPlugin.incoming(from, String.trim(message)) end)
+ spawn(fn() -> Nola.IRC.SmsPlugin.incoming(from, String.trim(message)) end)
text(conn, "")
end
diff --git a/lib/lsg_web/controllers/untappd_controller.ex b/lib/lsg_web/controllers/untappd_controller.ex
index 1c3ceb1..d3a540d 100644
--- a/lib/lsg_web/controllers/untappd_controller.ex
+++ b/lib/lsg_web/controllers/untappd_controller.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.UntappdController do
- use LSGWeb, :controller
+defmodule NolaWeb.UntappdController do
+ use NolaWeb, :controller
def callback(conn, %{"code" => code}) do
with \
diff --git a/lib/lsg_web/endpoint.ex b/lib/lsg_web/endpoint.ex
index bfd53c8..d8bf962 100644
--- a/lib/lsg_web/endpoint.ex
+++ b/lib/lsg_web/endpoint.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.Endpoint do
+defmodule NolaWeb.Endpoint do
use Sentry.PlugCapture
use Phoenix.Endpoint, otp_app: :lsg
@@ -43,7 +43,7 @@ defmodule LSGWeb.Endpoint do
# Set :encryption_salt if you would also like to encrypt it.
plug Plug.Session, @session_options
- plug LSGWeb.Router
+ plug NolaWeb.Router
@doc """
Callback invoked for dynamically configuring the endpoint.
diff --git a/lib/lsg_web/gettext.ex b/lib/lsg_web/gettext.ex
index f38a57d..e9a46e9 100644
--- a/lib/lsg_web/gettext.ex
+++ b/lib/lsg_web/gettext.ex
@@ -1,11 +1,11 @@
-defmodule LSGWeb.Gettext do
+defmodule NolaWeb.Gettext do
@moduledoc """
A module providing Internationalization with a gettext-based API.
By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example:
- import LSGWeb.Gettext
+ import NolaWeb.Gettext
# Simple translation
gettext "Here is the string to translate"
diff --git a/lib/lsg_web/live/chat_live.ex b/lib/lsg_web/live/chat_live.ex
index e84d880..276b362 100644
--- a/lib/lsg_web/live/chat_live.ex
+++ b/lib/lsg_web/live/chat_live.ex
@@ -1,10 +1,10 @@
-defmodule LSGWeb.ChatLive do
+defmodule NolaWeb.ChatLive do
use Phoenix.LiveView
use Phoenix.HTML
require Logger
def mount(%{"network" => network, "chan" => chan}, %{"account" => account_id}, socket) do
- chan = LSGWeb.reformat_chan(chan)
+ chan = NolaWeb.reformat_chan(chan)
connection = IRC.Connection.get_network(network, chan)
account = IRC.Account.get(account_id)
membership = IRC.Membership.of_account(IRC.Account.get("DRgpD4fLf8PDJMLp8Dtb"))
@@ -22,7 +22,7 @@ defmodule LSGWeb.ChatLive do
Map.put(acc, id, user)
end)
- backlog = case LSG.IRC.BufferPlugin.select_buffer(connection.network, chan) do
+ backlog = case Nola.IRC.BufferPlugin.select_buffer(connection.network, chan) do
{backlog, _} ->
{backlog, _} = Enum.reduce(backlog, {backlog, nil}, &reduce_contextual_event/2)
Enum.reverse(backlog)
diff --git a/lib/lsg_web/lsg_web.ex b/lib/lsg_web/lsg_web.ex
index 3d9ab9a..da622c7 100644
--- a/lib/lsg_web/lsg_web.ex
+++ b/lib/lsg_web/lsg_web.ex
@@ -1,12 +1,12 @@
-defmodule LSGWeb do
+defmodule NolaWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, views, channels and so on.
This can be used in your application as:
- use LSGWeb, :controller
- use LSGWeb, :view
+ use NolaWeb, :controller
+ use NolaWeb, :view
The definitions below will be executed for every view,
controller, etc, so keep them short and clean, focused
@@ -45,18 +45,18 @@ defmodule LSGWeb do
def controller do
quote do
- use Phoenix.Controller, namespace: LSGWeb
+ use Phoenix.Controller, namespace: NolaWeb
import Plug.Conn
- import LSGWeb.Router.Helpers
- import LSGWeb.Gettext
- alias LSGWeb.Router.Helpers, as: Routes
+ import NolaWeb.Router.Helpers
+ import NolaWeb.Gettext
+ alias NolaWeb.Router.Helpers, as: Routes
end
end
def view do
quote do
use Phoenix.View, root: "lib/lsg_web/templates",
- namespace: LSGWeb
+ namespace: NolaWeb
# Import convenience functions from controllers
import Phoenix.Controller, only: [get_flash: 2, view_module: 1]
@@ -64,13 +64,13 @@ defmodule LSGWeb do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
- import LSGWeb.Router.Helpers
- import LSGWeb.ErrorHelpers
- import LSGWeb.Gettext
+ import NolaWeb.Router.Helpers
+ import NolaWeb.ErrorHelpers
+ import NolaWeb.Gettext
import Phoenix.LiveView.Helpers
- alias LSGWeb.Router.Helpers, as: Routes
+ alias NolaWeb.Router.Helpers, as: Routes
end
end
@@ -86,7 +86,7 @@ defmodule LSGWeb do
def channel do
quote do
use Phoenix.Channel
- import LSGWeb.Gettext
+ import NolaWeb.Gettext
end
end
diff --git a/lib/lsg_web/router.ex b/lib/lsg_web/router.ex
index 5cc0d4a..5658fda 100644
--- a/lib/lsg_web/router.ex
+++ b/lib/lsg_web/router.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.Router do
- use LSGWeb, :router
+defmodule NolaWeb.Router do
+ use NolaWeb, :router
pipeline :browser do
plug :accepts, ["html", "txt"]
@@ -8,7 +8,7 @@ defmodule LSGWeb.Router do
plug :fetch_live_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
- plug :put_root_layout, {LSGWeb.LayoutView, :root}
+ plug :put_root_layout, {NolaWeb.LayoutView, :root}
end
pipeline :api do
@@ -17,17 +17,17 @@ defmodule LSGWeb.Router do
pipeline :matrix_app_service do
plug :accepts, ["json"]
- plug LSG.Matrix.Plug.Auth
- plug LSG.Matrix.Plug.SetConfig
+ plug Nola.Matrix.Plug.Auth
+ plug Nola.Matrix.Plug.SetConfig
end
- scope "/api", LSGWeb do
+ scope "/api", NolaWeb do
pipe_through :api
get "/irc-auth.sse", IrcAuthSseController, :sse
post "/sms/callback/Ovh", SmsController, :ovh_callback, as: :sms
end
- scope "/", LSGWeb do
+ scope "/", NolaWeb do
pipe_through :browser
get "/", PageController, :index
diff --git a/lib/lsg_web/views/alcoolog_view.ex b/lib/lsg_web/views/alcoolog_view.ex
index ed3c9b4..ad52472 100644
--- a/lib/lsg_web/views/alcoolog_view.ex
+++ b/lib/lsg_web/views/alcoolog_view.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.AlcoologView do
- use LSGWeb, :view
+defmodule NolaWeb.AlcoologView do
+ use NolaWeb, :view
require Integer
end
diff --git a/lib/lsg_web/views/error_helpers.ex b/lib/lsg_web/views/error_helpers.ex
index 47906f2..25214bd 100644
--- a/lib/lsg_web/views/error_helpers.ex
+++ b/lib/lsg_web/views/error_helpers.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.ErrorHelpers do
+defmodule NolaWeb.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
@@ -32,9 +32,9 @@ defmodule LSGWeb.ErrorHelpers do
# dgettext "errors", "is invalid"
#
if count = opts[:count] do
- Gettext.dngettext(LSGWeb.Gettext, "errors", msg, msg, count, opts)
+ Gettext.dngettext(NolaWeb.Gettext, "errors", msg, msg, count, opts)
else
- Gettext.dgettext(LSGWeb.Gettext, "errors", msg, opts)
+ Gettext.dgettext(NolaWeb.Gettext, "errors", msg, opts)
end
end
end
diff --git a/lib/lsg_web/views/error_view.ex b/lib/lsg_web/views/error_view.ex
index 1a7a92d..5cad939 100644
--- a/lib/lsg_web/views/error_view.ex
+++ b/lib/lsg_web/views/error_view.ex
@@ -1,5 +1,5 @@
-defmodule LSGWeb.ErrorView do
- use LSGWeb, :view
+defmodule NolaWeb.ErrorView do
+ use NolaWeb, :view
def render("404.html", _assigns) do
"Page not found"
diff --git a/lib/lsg_web/views/irc_view.ex b/lib/lsg_web/views/irc_view.ex
index 36a9bc4..331d91f 100644
--- a/lib/lsg_web/views/irc_view.ex
+++ b/lib/lsg_web/views/irc_view.ex
@@ -1,3 +1,3 @@
-defmodule LSGWeb.IrcView do
- use LSGWeb, :view
+defmodule NolaWeb.IrcView do
+ use NolaWeb, :view
end
diff --git a/lib/lsg_web/views/layout_view.ex b/lib/lsg_web/views/layout_view.ex
index 720281d..2bffc6f 100644
--- a/lib/lsg_web/views/layout_view.ex
+++ b/lib/lsg_web/views/layout_view.ex
@@ -1,9 +1,9 @@
-defmodule LSGWeb.LayoutView do
- use LSGWeb, :view
+defmodule NolaWeb.LayoutView do
+ use NolaWeb, :view
def liquid_markdown(conn, text) do
context_path = cond do
- conn.assigns[:chan] -> "/#{conn.assigns[:network]}/#{LSGWeb.format_chan(conn.assigns[:chan])}"
+ conn.assigns[:chan] -> "/#{conn.assigns[:network]}/#{NolaWeb.format_chan(conn.assigns[:chan])}"
conn.assigns[:network] -> "/#{conn.assigns[:network]}/-"
true -> "/-"
end
@@ -24,7 +24,7 @@ defmodule LSGWeb.LayoutView do
conn.assigns[:chan] ->
"#{conn.assigns.chan} @ #{conn.assigns.network}"
conn.assigns[:network] -> conn.assigns.network
- true -> Keyword.get(LSG.name())
+ true -> Keyword.get(Nola.name())
end
breadcrumb_title = Enum.map(Map.get(conn.assigns, :breadcrumbs)||[], fn({title, _href}) -> title end)
diff --git a/lib/lsg_web/views/network_view.ex b/lib/lsg_web/views/network_view.ex
index c369ce6..7a24db1 100644
--- a/lib/lsg_web/views/network_view.ex
+++ b/lib/lsg_web/views/network_view.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.NetworkView do
- use LSGWeb, :view
+defmodule NolaWeb.NetworkView do
+ use NolaWeb, :view
end
diff --git a/lib/lsg_web/views/open_id_view.ex b/lib/lsg_web/views/open_id_view.ex
index 64d4430..bd8089b 100644
--- a/lib/lsg_web/views/open_id_view.ex
+++ b/lib/lsg_web/views/open_id_view.ex
@@ -1,4 +1,4 @@
-defmodule LSGWeb.OpenIdView do
- use LSGWeb, :view
+defmodule NolaWeb.OpenIdView do
+ use NolaWeb, :view
end
diff --git a/lib/lsg_web/views/page_view.ex b/lib/lsg_web/views/page_view.ex
index 90c384c..1bfaadd 100644
--- a/lib/lsg_web/views/page_view.ex
+++ b/lib/lsg_web/views/page_view.ex
@@ -1,3 +1,3 @@
-defmodule LSGWeb.PageView do
- use LSGWeb, :view
+defmodule NolaWeb.PageView do
+ use NolaWeb, :view
end
diff --git a/lib/untappd.ex b/lib/untappd.ex
index 1f78376..d5ac904 100644
--- a/lib/untappd.ex
+++ b/lib/untappd.ex
@@ -6,14 +6,14 @@ defmodule Untappd do
def auth_url() do
client_id = Keyword.get(env(), :client_id)
- url = LSGWeb.Router.Helpers.untappd_callback_url(LSGWeb.Endpoint, :callback)
+ url = NolaWeb.Router.Helpers.untappd_callback_url(NolaWeb.Endpoint, :callback)
"https://untappd.com/oauth/authenticate/?client_id=#{client_id}&response_type=code&redirect_url=#{URI.encode(url)}"
end
def auth_callback(code) do
client_id = Keyword.get(env(), :client_id)
client_secret = Keyword.get(env(), :client_secret)
- url = LSGWeb.Router.Helpers.untappd_callback_url(LSGWeb.Endpoint, :callback)
+ url = NolaWeb.Router.Helpers.untappd_callback_url(NolaWeb.Endpoint, :callback)
params = %{
"client_id" => client_id,
"client_secret" => client_secret,