summaryrefslogtreecommitdiff
path: root/lib/plugins
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2023-03-05 10:14:31 +0100
committerJordan Bracco <href@random.sh>2023-03-05 10:14:31 +0100
commit53b9b921987e5e61a6149f46ef98671da7907043 (patch)
treece23bf045ed78e981c39a77589bca572965e0ad9 /lib/plugins
parentlink/image with pyerlai (tbc) (diff)
Diffstat (limited to 'lib/plugins')
-rw-r--r--lib/plugins/base.ex22
-rw-r--r--lib/plugins/last_fm.ex4
-rw-r--r--lib/plugins/link/youtube.ex2
3 files changed, 18 insertions, 10 deletions
diff --git a/lib/plugins/base.ex b/lib/plugins/base.ex
index 1baf066..97aaa05 100644
--- a/lib/plugins/base.ex
+++ b/lib/plugins/base.ex
@@ -120,16 +120,24 @@ defmodule Nola.Plugins.Base do
system = :erlang.system_info(:system_architecture) |> to_string()
brand = Nola.brand(:name)
owner = "#{Nola.brand(:owner)} <#{Nola.brand(:owner_email)}>"
- message.replyfun.([
- <<"🤖 I am a robot running", 2, "#{brand}, version #{ver}", 2, " — source: #{Nola.source_url()}">>,
- "🦾 Elixir #{elixir_ver} #{otp_ver} on #{system}",
- "👷‍♀️ Owner: h#{owner}",
- "🌍 Web interface: #{url}"
- ])
+
+ if message.channel do
+ message.replyfun.([
+ <<"🤖 ", 2, "#{brand}", 2, " v", 2, "#{ver}", 2, "! My owner is #{Nola.brand(:owner)} and help is at #{url}">>,
+ ])
+ else
+ message.replyfun.([
+ <<"🤖 I am a robot running ", 2, "#{brand}", 2, " version ", 2, "#{ver}", 2, " — source: #{Nola.source_url()}">>,
+ "Source code: #{Nola.source_url()}",
+ "🦾 Elixir #{elixir_ver} #{otp_ver} on #{system}",
+ "🙋🏻 Owner: #{owner}",
+ "🌍 Web interface: #{url}"
+ ])
+ end
{:noreply, nil}
end
- def handle_info(msg, _) do
+ def handle_info(_msg, _) do
{:noreply, nil}
end
diff --git a/lib/plugins/last_fm.ex b/lib/plugins/last_fm.ex
index 8e872ea..b7d0a92 100644
--- a/lib/plugins/last_fm.ex
+++ b/lib/plugins/last_fm.ex
@@ -21,8 +21,8 @@ defmodule Nola.Plugins.LastFm do
end
def init([]) do
- regopts = [type: __MODULE__]
- for t <- @pubsub_topics, do: {:ok, _} = Registry.register(Nola.PubSub, t, type: __MODULE__)
+ regopts = [plugin: __MODULE__]
+ for t <- @pubsub_topics, do: {:ok, _} = Registry.register(Nola.PubSub, t, regopts)
dets_filename = (Nola.data_path() <> "/" <> "lastfm.dets") |> String.to_charlist
{:ok, dets} = :dets.open_file(dets_filename, [])
{:ok, %__MODULE__{dets: dets}}
diff --git a/lib/plugins/link/youtube.ex b/lib/plugins/link/youtube.ex
index 1b14221..0114940 100644
--- a/lib/plugins/link/youtube.ex
+++ b/lib/plugins/link/youtube.ex
@@ -31,7 +31,7 @@ defmodule Nola.Plugins.Link.YouTube do
def post_match(_, _, _, _), do: false
@impl true
- def expand(uri, %{video_id: video_id}, opts) do
+ def expand(_uri, %{video_id: video_id}, opts) do
key = Application.get_env(:nola, :youtube)[:api_key]
params = %{
"part" => "snippet,contentDetails,statistics",