Update calls of Enum.member?/1 to be 'x in y' instead

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-08-11 16:00:09 -07:00
parent 1f574dd0eb
commit 906a20bda1
2 changed files with 3 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ defmodule Omnibot.Core do
if nick == cfg.nick do if nick == cfg.nick do
add_channel(channel) add_channel(channel)
# Sync if we join a channel we shouldn't be in # Sync if we join a channel we shouldn't be in
if !Enum.member?(Config.all_channels(cfg), channel), if channel in Config.all_channels(cfg),
do: sync_channels(irc) do: sync_channels(irc)
end end
end end
@@ -21,7 +21,7 @@ defmodule Omnibot.Core do
if nick == cfg.nick do if nick == cfg.nick do
remove_channel(channel) remove_channel(channel)
# Sync if we join a channel we forcibly part a channel we shouldn't leave # Sync if we join a channel we forcibly part a channel we shouldn't leave
if Enum.member?(Config.all_channels(cfg), channel), if channel in Config.all_channels(cfg),
do: sync_channels(irc) do: sync_channels(irc)
end end
end end

View File

@@ -50,7 +50,7 @@ defmodule Omnibot.Plugin.Base do
line = Enum.join(params, " ") line = Enum.join(params, " ")
case String.split(line, " ") do case String.split(line, " ") do
[cmd | params] -> if Enum.member?(commands(), cmd), [cmd | params] -> if cmd in commands(),
do: on_channel_msg(irc, channel, nick, cmd, params), do: on_channel_msg(irc, channel, nick, cmd, params),
else: on_channel_msg(irc, channel, nick, line) else: on_channel_msg(irc, channel, nick, line)
_ -> on_channel_msg(irc, channel, nick, line) _ -> on_channel_msg(irc, channel, nick, line)