diff options
Diffstat (limited to 'lib/lsg_irc')
-rw-r--r-- | lib/lsg_irc/correction_plugin.ex | 2 | ||||
-rw-r--r-- | lib/lsg_irc/last_fm_plugin.ex | 5 | ||||
-rw-r--r-- | lib/lsg_irc/link_plugin.ex | 4 | ||||
-rw-r--r-- | lib/lsg_irc/link_plugin/youtube.ex | 4 | ||||
-rw-r--r-- | lib/lsg_irc/outline_plugin.ex | 2 | ||||
-rw-r--r-- | lib/lsg_irc/preums_plugin.ex | 2 | ||||
-rw-r--r-- | lib/lsg_irc/say_plugin.ex | 2 | ||||
-rw-r--r-- | lib/lsg_irc/seen_plugin.ex | 2 | ||||
-rw-r--r-- | lib/lsg_irc/sms_plugin.ex | 2 |
9 files changed, 12 insertions, 13 deletions
diff --git a/lib/lsg_irc/correction_plugin.ex b/lib/lsg_irc/correction_plugin.ex index f370cf8..a77c4a2 100644 --- a/lib/lsg_irc/correction_plugin.ex +++ b/lib/lsg_irc/correction_plugin.ex @@ -11,7 +11,7 @@ defmodule LSG.IRC.CorrectionPlugin do end def init(_) do - {:ok, _} = Registry.register(IRC.PubSub, "message", [plugin: __MODULE__]) + {:ok, _} = Registry.register(IRC.PubSub, "messages", [plugin: __MODULE__]) {:ok, _} = Registry.register(IRC.PubSub, "triggers", [plugin: __MODULE__]) {:ok, %{}} end diff --git a/lib/lsg_irc/last_fm_plugin.ex b/lib/lsg_irc/last_fm_plugin.ex index 04f887c..0c6b8a6 100644 --- a/lib/lsg_irc/last_fm_plugin.ex +++ b/lib/lsg_irc/last_fm_plugin.ex @@ -98,8 +98,7 @@ defmodule LSG.IRC.LastFmPlugin do username = case :dets.lookup(state.dets, id_or_user) do [{_, username}] -> username - _ -> - id_or_user + _ -> id_or_user end case now_playing(username) do @@ -108,7 +107,7 @@ defmodule LSG.IRC.LastFmPlugin do {:ok, map} when is_map(map) -> track = fetch_track(username, map) text = format_now_playing(map, track) - user = if account = IRC.Account.get(username) do + user = if account = IRC.Account.get(id_or_user) do user = IRC.UserTrack.find_by_account(message.network, account) if(user, do: user.nick, else: account.name) else diff --git a/lib/lsg_irc/link_plugin.ex b/lib/lsg_irc/link_plugin.ex index 0c785a0..3d657ad 100644 --- a/lib/lsg_irc/link_plugin.ex +++ b/lib/lsg_irc/link_plugin.ex @@ -52,8 +52,8 @@ defmodule LSG.IRC.LinkPlugin do defstruct [:client] def init([]) do - {:ok, _} = Registry.register(IRC.PubSub, "message", [plugin: __MODULE__]) - #{:ok, _} = Registry.register(IRC.PubSub, "message:telegram", [plugin: __MODULE__]) + {:ok, _} = Registry.register(IRC.PubSub, "messages", [plugin: __MODULE__]) + #{:ok, _} = Registry.register(IRC.PubSub, "messages:telegram", [plugin: __MODULE__]) Logger.info("Link handler started") {:ok, %__MODULE__{}} end diff --git a/lib/lsg_irc/link_plugin/youtube.ex b/lib/lsg_irc/link_plugin/youtube.ex index fd0f1b4..536cab6 100644 --- a/lib/lsg_irc/link_plugin/youtube.ex +++ b/lib/lsg_irc/link_plugin/youtube.ex @@ -54,8 +54,8 @@ defmodule LSG.IRC.LinkPlugin.YouTube do |> Timex.format("{relative}", :relative) |> elem(1) - line = if Keyword.get(opts, :invidious, "yewtu.be") do - ["-> https://#{}host}/watch?v=#{video_id}"] + line = if host = Keyword.get(opts, :invidious, "yewtu.be") do + ["-> https://#{host}/watch?v=#{video_id}"] else [] end diff --git a/lib/lsg_irc/outline_plugin.ex b/lib/lsg_irc/outline_plugin.ex index d28d0d0..47fa6fa 100644 --- a/lib/lsg_irc/outline_plugin.ex +++ b/lib/lsg_irc/outline_plugin.ex @@ -21,7 +21,7 @@ defmodule LSG.IRC.OutlinePlugin do def init([]) do regopts = [plugin: __MODULE__] {:ok, _} = Registry.register(IRC.PubSub, "trigger:outline", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "message", regopts) + {:ok, _} = Registry.register(IRC.PubSub, "messages", regopts) file = Path.join(LSG.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 7bb2c78..68257f0 100644 --- a/lib/lsg_irc/preums_plugin.ex +++ b/lib/lsg_irc/preums_plugin.ex @@ -87,7 +87,7 @@ defmodule LSG.IRC.PreumsPlugin do def init([]) do regopts = [plugin: __MODULE__] {:ok, _} = Registry.register(IRC.PubSub, "account", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "message", regopts) + {:ok, _} = Registry.register(IRC.PubSub, "messages", regopts) {:ok, _} = Registry.register(IRC.PubSub, "triggers", regopts) {:ok, dets} = :dets.open_file(dets(), [{:repair, :force}]) Util.ets_mutate_select_each(:dets, dets, [{:"$1", [], [:"$1"]}], fn(table, obj) -> diff --git a/lib/lsg_irc/say_plugin.ex b/lib/lsg_irc/say_plugin.ex index 085ca92..8e93ec2 100644 --- a/lib/lsg_irc/say_plugin.ex +++ b/lib/lsg_irc/say_plugin.ex @@ -21,7 +21,7 @@ defmodule LSG.IRC.SayPlugin do regopts = [type: __MODULE__] {:ok, _} = Registry.register(IRC.PubSub, "trigger:say", regopts) {:ok, _} = Registry.register(IRC.PubSub, "trigger:asay", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "message:private", regopts) + {:ok, _} = Registry.register(IRC.PubSub, "messages:private", regopts) {:ok, nil} end diff --git a/lib/lsg_irc/seen_plugin.ex b/lib/lsg_irc/seen_plugin.ex index f1a5473..405c372 100644 --- a/lib/lsg_irc/seen_plugin.ex +++ b/lib/lsg_irc/seen_plugin.ex @@ -13,7 +13,7 @@ defmodule LSG.IRC.SeenPlugin do def init([]) do regopts = [plugin: __MODULE__] {:ok, _} = Registry.register(IRC.PubSub, "triggers", regopts) - {:ok, _} = Registry.register(IRC.PubSub, "message", regopts) + {:ok, _} = Registry.register(IRC.PubSub, "messages", regopts) dets_filename = (LSG.data_path() <> "/seen.dets") |> String.to_charlist() {:ok, dets} = :dets.open_file(dets_filename, []) {:ok, %{dets: dets}} diff --git a/lib/lsg_irc/sms_plugin.ex b/lib/lsg_irc/sms_plugin.ex index a37fb4e..b183f7d 100644 --- a/lib/lsg_irc/sms_plugin.ex +++ b/lib/lsg_irc/sms_plugin.ex @@ -44,7 +44,7 @@ defmodule LSG.IRC.SmsPlugin do trigger: IRC.Connection.extract_trigger(trigger_text) } IO.puts("converted sms to message: #{inspect message}") - IRC.Connection.publish(message, ["message:sms"]) + IRC.Connection.publish(message, ["messages:sms"]) message end end |