summaryrefslogtreecommitdiff
path: root/lib/lsg_irc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/lsg_irc/base_plugin.ex2
-rw-r--r--lib/lsg_irc/finance_plugin.ex2
-rw-r--r--lib/lsg_irc/last_fm_plugin.ex4
-rw-r--r--lib/lsg_irc/link_plugin.ex6
-rw-r--r--lib/lsg_irc/link_plugin/imgur.ex6
-rw-r--r--lib/lsg_irc/link_plugin/youtube.ex4
-rw-r--r--lib/lsg_irc/preums_plugin.ex2
-rw-r--r--lib/lsg_irc/sms_plugin.ex6
-rw-r--r--lib/lsg_irc/txt_plugin.ex4
-rw-r--r--lib/lsg_irc/txt_plugin/markov_py_markovify.ex4
-rw-r--r--lib/lsg_irc/wolfram_alpha_plugin.ex2
-rw-r--r--lib/lsg_irc/youtube_plugin.ex2
12 files changed, 22 insertions, 22 deletions
diff --git a/lib/lsg_irc/base_plugin.ex b/lib/lsg_irc/base_plugin.ex
index ee0352e..a2b9ffb 100644
--- a/lib/lsg_irc/base_plugin.ex
+++ b/lib/lsg_irc/base_plugin.ex
@@ -109,7 +109,7 @@ defmodule Nola.IRC.BasePlugin do
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
index c1a1771..16d06ee 100644
--- a/lib/lsg_irc/finance_plugin.ex
+++ b/lib/lsg_irc/finance_plugin.ex
@@ -183,7 +183,7 @@ defmodule Nola.IRC.FinancePlugin do
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
index f29982c..03df675 100644
--- a/lib/lsg_irc/last_fm_plugin.ex
+++ b/lib/lsg_irc/last_fm_plugin.ex
@@ -124,7 +124,7 @@ defmodule Nola.IRC.LastFmPlugin do
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 @@ defmodule Nola.IRC.LastFmPlugin do
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
index 28e537a..dee78e8 100644
--- a/lib/lsg_irc/link_plugin.ex
+++ b/lib/lsg_irc/link_plugin.ex
@@ -15,7 +15,7 @@ defmodule Nola.IRC.LinkPlugin do
## Configuration:
```
- config :lsg, Nola.IRC.LinkPlugin,
+ config :nola, Nola.IRC.LinkPlugin,
handlers: [
Nola.IRC.LinkPlugin.Youtube: [
invidious: true
@@ -112,7 +112,7 @@ defmodule Nola.IRC.LinkPlugin do
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 @@ defmodule Nola.IRC.LinkPlugin do
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
index af0b36a..5d74956 100644
--- a/lib/lsg_irc/link_plugin/imgur.ex
+++ b/lib/lsg_irc/link_plugin/imgur.ex
@@ -9,7 +9,7 @@ defmodule Nola.IRC.LinkPlugin.Imgur do
Needs to have a Imgur API key configured:
```
- config :lsg, :imgur,
+ config :nola, :imgur,
client_id: "xxxxxxxx",
client_secret: "xxxxxxxxxxxxxxxxxxxx"
```
@@ -46,7 +46,7 @@ defmodule Nola.IRC.LinkPlugin.Imgur do
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 @@ defmodule Nola.IRC.LinkPlugin.Imgur do
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
index 1e3a0de..f7c7541 100644
--- a/lib/lsg_irc/link_plugin/youtube.ex
+++ b/lib/lsg_irc/link_plugin/youtube.ex
@@ -7,7 +7,7 @@ defmodule Nola.IRC.LinkPlugin.YouTube do
needs an API key:
```
- config :lsg, :youtube,
+ config :nola, :youtube,
api_key: "xxxxxxxxxxxxx"
```
@@ -32,7 +32,7 @@ defmodule Nola.IRC.LinkPlugin.YouTube do
@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
index 9344ce9..f250e85 100644
--- a/lib/lsg_irc/preums_plugin.ex
+++ b/lib/lsg_irc/preums_plugin.ex
@@ -229,7 +229,7 @@ defmodule Nola.IRC.PreumsPlugin do
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
index 2bbf13e..d8f7387 100644
--- a/lib/lsg_irc/sms_plugin.ex
+++ b/lib/lsg_irc/sms_plugin.ex
@@ -51,7 +51,7 @@ defmodule Nola.IRC.SmsPlugin do
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 @@ defmodule Nola.IRC.SmsPlugin do
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 @@ defmodule Nola.IRC.SmsPlugin do
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
index d2bb627..cab912a 100644
--- a/lib/lsg_irc/txt_plugin.ex
+++ b/lib/lsg_irc/txt_plugin.ex
@@ -55,7 +55,7 @@ defmodule Nola.IRC.TxtPlugin do
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 @@ defmodule Nola.IRC.TxtPlugin do
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
index cda7853..b610ea8 100644
--- a/lib/lsg_irc/txt_plugin/markov_py_markovify.ex
+++ b/lib/lsg_irc/txt_plugin/markov_py_markovify.ex
@@ -27,8 +27,8 @@ defmodule Nola.IRC.TxtPlugin.MarkovPyMarkovify do
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
index b553e63..6ee06f0 100644
--- a/lib/lsg_irc/wolfram_alpha_plugin.ex
+++ b/lib/lsg_irc/wolfram_alpha_plugin.ex
@@ -22,7 +22,7 @@ defmodule Nola.IRC.WolframAlphaPlugin do
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
index 3d2acfb..fb9bea2 100644
--- a/lib/lsg_irc/youtube_plugin.ex
+++ b/lib/lsg_irc/youtube_plugin.ex
@@ -56,7 +56,7 @@ defmodule Nola.IRC.YouTubePlugin do
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,