From 21651679546dfa58092cb41ee143922bfd4e035a Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Tue, 11 Aug 2020 13:30:32 -0700 Subject: [PATCH] Remove usage of State.all_channels/0 Deprecating Omnibot.State: Config.all_channels/1 has the same logic as this, and is better documented anyway. Signed-off-by: Alek Ratzloff --- lib/core/core.ex | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/core/core.ex b/lib/core/core.ex index 565b2c0..bfb3cd0 100644 --- a/lib/core/core.ex +++ b/lib/core/core.ex @@ -1,6 +1,6 @@ defmodule Omnibot.Core do use Omnibot.Plugin - alias Omnibot.{Irc, State} + alias Omnibot.{Config, Irc} @default_config channels: :all @@ -10,7 +10,7 @@ defmodule Omnibot.Core do if nick == cfg.nick do add_channel(channel) # Sync if we join a channel we shouldn't be in - if !Enum.member?(State.all_channels(), channel), + if !Enum.member?(Config.all_channels(cfg), channel), do: sync_channels(irc) end end @@ -21,7 +21,7 @@ defmodule Omnibot.Core do if nick == cfg.nick do remove_channel(channel) # Sync if we join a channel we forcibly part a channel we shouldn't leave - if Enum.member?(State.all_channels(), channel), + if Enum.member?(Config.all_channels(cfg), channel), do: sync_channels(irc) end end @@ -51,7 +51,8 @@ defmodule Omnibot.Core do end defp sync_channels(irc) do - desired = MapSet.new(State.all_channels()) + cfg = Irc.cfg(irc) + desired = MapSet.new(Config.all_channels(cfg)) present = state() to_join = MapSet.difference(desired, present)