Fix routing bug in IRC and base plugin

Previously, messages were only routed from IRC if they were *not* for
the current user. This should only be happening for privmsg messages,
since a plugin is generally aware of what it's sending out.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-07-18 14:09:17 -07:00
parent d2a1cb541d
commit ec1dd42ca1
2 changed files with 11 additions and 11 deletions

View File

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

View File

@@ -44,6 +44,7 @@ defmodule Omnibot.Plugin.Base do
nick = msg.prefix.nick
case String.upcase(msg.command) do
"PRIVMSG" ->
if (!msg.prefix) || (msg.prefix.nick != Omnibot.State.cfg().nick) do
[channel | params] = msg.params
line = Enum.join(params, " ")
@@ -53,7 +54,7 @@ defmodule Omnibot.Plugin.Base do
else: on_channel_msg(irc, channel, nick, line)
_ -> on_channel_msg(irc, channel, nick, line)
end
end
"JOIN" ->
[channel | _] = msg.params
on_join(irc, channel, nick)