diff --git a/Admin.md b/Admin.md
--- a/Admin.md
+++ b/Admin.md
@@ -1,6 +1,6 @@
-# ircbot admin bot
+# nola bot admin
-Everything is supposed to be ran inside a remote IEx console: `./bin/lsg remote`.
+Everything is supposed to be ran inside a remote IEx console: `./bin/nola remote`.
## Connection management
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# ircbot
+# nola
Some stupid and badly coded IRC bot. Can be spotted as "bavaria" on irc.random.sh, but is multi-connections and also elsewhere (poor channels).
@@ -24,7 +24,7 @@
Build a release using `MIX_ENV=prod mix release`.
-# bot
+# nola
## ideas
diff --git a/config/config.exs b/config/config.exs
--- a/config/config.exs
+++ b/config/config.exs
@@ -13,12 +13,12 @@
config :phoenix, :json_library, Jason
# General application configuration
-config :lsg,
- namespace: LSG
+config :nola,
+ namespace: Nola
-config :lsg, :data_path, "priv"
+config :nola, :data_path, "priv"
-config :lsg, :brand,
+config :nola, :brand,
name: "Nola",
source_url: "https://phab.random.sh/source/Bot/"
@@ -32,22 +32,22 @@
]
# Configures the endpoint
-config :lsg, LSGWeb.Endpoint,
+config :nola, NolaWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "cAFb7x2p/D7PdV8/C6Os18uygoD0FVQh3efNEFc5+5L529q3dofZtZye/BG12MRZ",
- render_errors: [view: LSGWeb.ErrorView, accepts: ~w(html json)],
+ render_errors: [view: NolaWeb.ErrorView, accepts: ~w(html json)],
server: true,
live_view: [signing_salt: "CHANGE_ME_FFS"],
- pubsub: [name: LSG.PubSub,
+ pubsub: [name: Nola.PubSub,
adapter: Phoenix.PubSub.PG2]
config :mime, :types, %{"text/event-stream" => ["sse"]}
-config :lsg, LSG.IRC.LastFmHandler,
+config :nola, Nola.IRC.LastFmHandler,
api_key: "x",
api_secret: "x"
-config :lsg, LSG.IRC.YouTubeHandler,
+config :nola, Nola.IRC.YouTubeHandler,
api_key: "x",
invidious: "yewtu.be"
diff --git a/config/dev.exs b/config/dev.exs
--- a/config/dev.exs
+++ b/config/dev.exs
@@ -6,7 +6,7 @@
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
-config :lsg, LSGWeb.Endpoint,
+config :nola, NolaWeb.Endpoint,
http: [port: 4012, ip: {0,0,0,0}],
debug_errors: true,
code_reloader: true,
@@ -29,14 +29,14 @@
# different ports.
# Watch static and templates for browser reloading.
-config :lsg, LSGWeb.Endpoint,
+config :nola, NolaWeb.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{priv/gettext/.*(po)$},
- ~r{lib/lsg_web/controllers/.*(ex)$},
- ~r{lib/lsg_web/views/.*(ex)$},
- ~r{lib/lsg_web/templates/.*(eex)$}
+ ~r{lib/nola_web/controllers/.*(ex)$},
+ ~r{lib/nola_web/views/.*(ex)$},
+ ~r{lib/nola_web/templates/.*(eex)$}
]
],
watchers: [
diff --git a/config/prod.exs b/config/prod.exs
--- a/config/prod.exs
+++ b/config/prod.exs
@@ -1,6 +1,6 @@
use Mix.Config
-config :lsg, LSGWeb.Endpoint,
+config :nola, NolaWeb.Endpoint,
http: [ip: {0,0,0,0}, port: 4000]
config :logger_json, :backend,
diff --git a/config/test.exs b/config/test.exs
--- a/config/test.exs
+++ b/config/test.exs
@@ -2,7 +2,7 @@
# We don't run a server during test. If one is required,
# you can enable the server option below.
-config :lsg, LSGWeb.Endpoint,
+config :nola, NolaWeb.Endpoint,
http: [port: 4001],
server: false
diff --git a/lib/couch.ex b/lib/couch.ex
--- a/lib/couch.ex
+++ b/lib/couch.ex
@@ -70,7 +70,7 @@
end
defp prepare_request(path, headers \\ [], params \\ [], options \\ []) do
- config = Application.get_env(:lsg, :couch)
+ config = Application.get_env(:nola, :couch)
base_url = Keyword.get(config, :url, "http://localhost:5984")
url = URI.merge(base_url, Path.join(path)) |> to_string()
diff --git a/lib/lsg/application.ex b/lib/lsg/application.ex
--- a/lib/lsg/application.ex
+++ b/lib/lsg/application.ex
@@ -45,9 +45,9 @@
end
defp start_telegram() do
- token = Keyword.get(Application.get_env(:lsg, :telegram, []), :key)
+ token = Keyword.get(Application.get_env(:nola, :telegram, []), :key)
options = [
- username: Keyword.get(Application.get_env(:lsg, :telegram, []), :nick, "beauttebot"),
+ username: Keyword.get(Application.get_env(:nola, :telegram, []), :nick, "beauttebot"),
purge: false
]
telegram = Telegram.Bot.ChatBot.Supervisor.start_link({Nola.Telegram, token, options})
diff --git a/lib/lsg/icecast.ex b/lib/lsg/icecast.ex
--- a/lib/lsg/icecast.ex
+++ b/lib/lsg/icecast.ex
@@ -41,7 +41,7 @@
Logger.error "Icecast HTTP Error: #{inspect error}"
state
end
- interval = Application.get_env(:lsg, :icecast_poll_interval, 60_000)
+ interval = Application.get_env(:nola, :icecast_poll_interval, 60_000)
:timer.send_after(interval, :poll)
state
end
diff --git a/lib/lsg/lsg.ex b/lib/lsg/lsg.ex
--- a/lib/lsg/lsg.ex
+++ b/lib/lsg/lsg.ex
@@ -7,8 +7,8 @@
owner_email: "contact@my.nola.bot"
]
- def env(), do: Application.get_env(:lsg)
- def env(key, default \\ nil), do: Application.get_env(:lsg, key, default)
+ def env(), do: Application.get_env(:nola)
+ def env(key, default \\ nil), do: Application.get_env(:nola, key, default)
def brand(), do: env(:brand, @default_brand)
def brand(key), do: Keyword.get(brand(), key)
@@ -20,11 +20,11 @@
end
def data_path do
- Application.get_env(:lsg, :data_path)
+ Application.get_env(:nola, :data_path)
end
def version do
- Application.spec(:lsg)[:vsn]
+ Application.spec(:nola)[:vsn]
end
end
diff --git a/lib/lsg_irc/base_plugin.ex b/lib/lsg_irc/base_plugin.ex
--- a/lib/lsg_irc/base_plugin.ex
+++ b/lib/lsg_irc/base_plugin.ex
@@ -109,7 +109,7 @@
end
def handle_info({:irc, :trigger, "version", message = %{trigger: %{type: :bang}}}, _) do
- {:ok, vsn} = :application.get_key(:lsg, :vsn)
+ {:ok, vsn} = :application.get_key(:nola, :vsn)
ver = List.to_string(vsn)
url = NolaWeb.Router.Helpers.irc_url(NolaWeb.Endpoint, :index)
elixir_ver = Application.started_applications() |> List.keyfind(:elixir, 0) |> elem(2) |> to_string()
diff --git a/lib/lsg_irc/finance_plugin.ex b/lib/lsg_irc/finance_plugin.ex
--- a/lib/lsg_irc/finance_plugin.ex
+++ b/lib/lsg_irc/finance_plugin.ex
@@ -183,7 +183,7 @@
end
defp api_key() do
- Application.get_env(:lsg, :alphavantage, [])
+ Application.get_env(:nola, :alphavantage, [])
|> Keyword.get(:api_key, "demo")
end
diff --git a/lib/lsg_irc/last_fm_plugin.ex b/lib/lsg_irc/last_fm_plugin.ex
--- a/lib/lsg_irc/last_fm_plugin.ex
+++ b/lib/lsg_irc/last_fm_plugin.ex
@@ -124,7 +124,7 @@
end
defp now_playing(user) do
- api = Application.get_env(:lsg, :lastfm)[:api_key]
+ api = Application.get_env(:nola, :lastfm)[:api_key]
url = "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&format=json&limit=1&extended=1" <> "&api_key=" <> api <> "&user="<> user
case HTTPoison.get(url) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} -> Jason.decode(body)
@@ -136,7 +136,7 @@
end
end
defp fetch_track(user, %{"recenttracks" => %{"track" => [ t = %{"name" => name, "artist" => %{"name" => artist}} | _]}}) do
- api = Application.get_env(:lsg, :lastfm)[:api_key]
+ api = Application.get_env(:nola, :lastfm)[:api_key]
url = "http://ws.audioscrobbler.com/2.0/?method=track.getInfo&format=json" <> "&api_key=" <> api <> "&username="<> user <> "&artist="<>URI.encode(artist)<>"&track="<>URI.encode(name)
case HTTPoison.get(url) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
diff --git a/lib/lsg_irc/link_plugin.ex b/lib/lsg_irc/link_plugin.ex
--- a/lib/lsg_irc/link_plugin.ex
+++ b/lib/lsg_irc/link_plugin.ex
@@ -15,7 +15,7 @@
## Configuration:
```
- config :lsg, Nola.IRC.LinkPlugin,
+ config :nola, Nola.IRC.LinkPlugin,
handlers: [
Nola.IRC.LinkPlugin.Youtube: [
invidious: true
@@ -112,7 +112,7 @@
def expand_link(acc=[uri | _]) do
Logger.debug("link: expanding: #{inspect uri}")
- handlers = Keyword.get(Application.get_env(:lsg, __MODULE__, [handlers: []]), :handlers)
+ handlers = Keyword.get(Application.get_env(:nola, __MODULE__, [handlers: []]), :handlers)
handler = Enum.reduce_while(handlers, nil, fn({module, opts}, acc) ->
Logger.debug("link: attempt expanding: #{inspect module} for #{inspect uri}")
module = Module.concat([module])
@@ -162,7 +162,7 @@
length = Map.get(headers, "content-length", "0")
{length, _} = Integer.parse(length)
- handlers = Keyword.get(Application.get_env(:lsg, __MODULE__, [handlers: []]), :handlers)
+ handlers = Keyword.get(Application.get_env(:nola, __MODULE__, [handlers: []]), :handlers)
handler = Enum.reduce_while(handlers, false, fn({module, opts}, acc) ->
module = Module.concat([module])
try do
diff --git a/lib/lsg_irc/link_plugin/imgur.ex b/lib/lsg_irc/link_plugin/imgur.ex
--- a/lib/lsg_irc/link_plugin/imgur.ex
+++ b/lib/lsg_irc/link_plugin/imgur.ex
@@ -9,7 +9,7 @@
Needs to have a Imgur API key configured:
```
- config :lsg, :imgur,
+ config :nola, :imgur,
client_id: "xxxxxxxx",
client_secret: "xxxxxxxxxxxxxxxxxxxx"
```
@@ -46,7 +46,7 @@
end
def expand_imgur_image(image_id, opts) do
- client_id = Keyword.get(Application.get_env(:lsg, :imgur, []), :client_id, "42")
+ client_id = Keyword.get(Application.get_env(:nola, :imgur, []), :client_id, "42")
headers = [{"Authorization", "Client-ID #{client_id}"}]
options = []
case HTTPoison.get("https://api.imgur.com/3/image/#{image_id}", headers, options) do
@@ -65,7 +65,7 @@
end
def expand_imgur_album(album_id, opts) do
- client_id = Keyword.get(Application.get_env(:lsg, :imgur, []), :client_id, "42")
+ client_id = Keyword.get(Application.get_env(:nola, :imgur, []), :client_id, "42")
headers = [{"Authorization", "Client-ID #{client_id}"}]
options = []
case HTTPoison.get("https://api.imgur.com/3/album/#{album_id}", headers, options) do
diff --git a/lib/lsg_irc/link_plugin/youtube.ex b/lib/lsg_irc/link_plugin/youtube.ex
--- a/lib/lsg_irc/link_plugin/youtube.ex
+++ b/lib/lsg_irc/link_plugin/youtube.ex
@@ -7,7 +7,7 @@
needs an API key:
```
- config :lsg, :youtube,
+ config :nola, :youtube,
api_key: "xxxxxxxxxxxxx"
```
@@ -32,7 +32,7 @@
@impl true
def expand(uri, %{video_id: video_id}, opts) do
- key = Application.get_env(:lsg, :youtube)[:api_key]
+ key = Application.get_env(:nola, :youtube)[:api_key]
params = %{
"part" => "snippet,contentDetails,statistics",
"id" => video_id,
diff --git a/lib/lsg_irc/preums_plugin.ex b/lib/lsg_irc/preums_plugin.ex
--- a/lib/lsg_irc/preums_plugin.ex
+++ b/lib/lsg_irc/preums_plugin.ex
@@ -229,7 +229,7 @@
end
defp timezone(channel) do
- env = Application.get_env(:lsg, Nola.IRC.PreumsPlugin, [])
+ env = Application.get_env(:nola, 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/sms_plugin.ex b/lib/lsg_irc/sms_plugin.ex
--- a/lib/lsg_irc/sms_plugin.ex
+++ b/lib/lsg_irc/sms_plugin.ex
@@ -51,7 +51,7 @@
end
def my_number() do
- Keyword.get(Application.get_env(:lsg, :sms, []), :number, "+33000000000")
+ Keyword.get(Application.get_env(:nola, :sms, []), :number, "+33000000000")
end
def start_link() do
@@ -59,7 +59,7 @@
end
def path() do
- account = Keyword.get(Application.get_env(:lsg, :sms), :account)
+ account = Keyword.get(Application.get_env(:nola, :sms), :account)
"https://eu.api.ovh.com/1.0/sms/#{account}"
end
@@ -156,7 +156,7 @@
end
defp env() do
- Application.get_env(:lsg, :sms)
+ Application.get_env(:nola, :sms)
end
defp env(key) do
diff --git a/lib/lsg_irc/txt_plugin.ex b/lib/lsg_irc/txt_plugin.ex
--- a/lib/lsg_irc/txt_plugin.ex
+++ b/lib/lsg_irc/txt_plugin.ex
@@ -55,7 +55,7 @@
def init([]) do
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, Nola.IRC.TxtPlugin.Markov.Native)
+ markov_handler = Keyword.get(Application.get_env(:nola, __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()}}
@@ -516,7 +516,7 @@
end
def directory() do
- Application.get_env(:lsg, :data_path) <> "/irc.txt/"
+ Application.get_env(:nola, :data_path) <> "/irc.txt/"
end
defp can_write?(%{rw: rw?, locks: locks}, msg = %{channel: nil, sender: sender}, trigger) do
diff --git a/lib/lsg_irc/txt_plugin/markov_py_markovify.ex b/lib/lsg_irc/txt_plugin/markov_py_markovify.ex
--- a/lib/lsg_irc/txt_plugin/markov_py_markovify.ex
+++ b/lib/lsg_irc/txt_plugin/markov_py_markovify.ex
@@ -27,8 +27,8 @@
end
defp script() do
- default_script = to_string(:code.priv_dir(:lsg)) <> "/irc/txt/markovify.py"
- env = Application.get_env(:lsg, Nola.IRC.TxtPlugin, [])
+ default_script = to_string(:code.priv_dir(:nola)) <> "/irc/txt/markovify.py"
+ env = Application.get_env(:nola, Nola.IRC.TxtPlugin, [])
|> Keyword.get(:py_markovify, [])
{Keyword.get(env, :python, "python3"), Keyword.get(env, :script, default_script)}
diff --git a/lib/lsg_irc/wolfram_alpha_plugin.ex b/lib/lsg_irc/wolfram_alpha_plugin.ex
--- a/lib/lsg_irc/wolfram_alpha_plugin.ex
+++ b/lib/lsg_irc/wolfram_alpha_plugin.ex
@@ -22,7 +22,7 @@
def handle_info({:irc, :trigger, _, m = %IRC.Message{trigger: %IRC.Trigger{type: :bang, args: query}}}, state) do
query = Enum.join(query, " ")
params = %{
- "appid" => Keyword.get(Application.get_env(:lsg, :wolframalpha, []), :app_id, "NO_APP_ID"),
+ "appid" => Keyword.get(Application.get_env(:nola, :wolframalpha, []), :app_id, "NO_APP_ID"),
"units" => "metric",
"i" => query
}
diff --git a/lib/lsg_irc/youtube_plugin.ex b/lib/lsg_irc/youtube_plugin.ex
--- a/lib/lsg_irc/youtube_plugin.ex
+++ b/lib/lsg_irc/youtube_plugin.ex
@@ -56,7 +56,7 @@
defp search(query) do
query = query
|> String.strip
- key = Application.get_env(:lsg, :youtube)[:api_key]
+ key = Application.get_env(:nola, :youtube)[:api_key]
params = %{
"key" => key,
"maxResults" => 1,
diff --git a/lib/lsg_telegram/room.ex b/lib/lsg_telegram/room.ex
--- a/lib/lsg_telegram/room.ex
+++ b/lib/lsg_telegram/room.ex
@@ -37,7 +37,7 @@
@impl Telegram.ChatBot
def init(id) when is_integer(id) and id < 0 do
- token = Keyword.get(Application.get_env(:lsg, :telegram, []), :key)
+ token = Keyword.get(Application.get_env(:nola, :telegram, []), :key)
{:ok, chat} = Api.request(token, "getChat", chat_id: id)
Logger.metadata(transport: :telegram, id: id, telegram_room_id: id)
tg_room = case room(id) do
@@ -164,7 +164,7 @@
{:ok, %HTTPoison.Response{status_code: 200, body: body}} <- HTTPoison.get(path),
<
@@ -131,7 +131,7 @@ <% date = DateTime.from_unix!(date, :millisecond) %>