Change message routing logic to be an implication instead of AND

Previously, a message wouldn't be admitted if it didn't have a prefix,
(logical) AND if the message was equal to the bot's nickname.

Now, a message with a blank prefix passes through, but if the prefix is
the bot's nickname, it does not.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-07-17 22:14:40 -07:00
parent b72071793b
commit d2a1cb541d

View File

@@ -77,7 +77,7 @@ defmodule Omnibot.Irc do
msg = Msg.parse(line)
# Send the message to the router
if msg.prefix && (msg.prefix.nick != State.cfg().nick) do
if (!msg.prefix) || (msg.prefix.nick != State.cfg().nick) do
route_msg(self(), msg)
end
{:noreply, socket}