Fix small bug where plugins that don't override on_msg/2 would report errors
Since route_msg expects msg.prefix to be present, every plugin that calls route_msg when no prefix is specified in the message (e.g. with PING messages) would cause a crash of the process. Now, it just calls a no-op function, since all behavior covered by route_message requires information in the prefix at some point. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -42,6 +42,8 @@ defmodule Omnibot.Plugin.Base do
|
|||||||
route_msg(irc, msg)
|
route_msg(irc, msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp route_msg(irc, %Irc.Msg {prefix: nil}), do: nil
|
||||||
|
|
||||||
defp route_msg(irc, msg) do
|
defp route_msg(irc, msg) do
|
||||||
nick = msg.prefix.nick
|
nick = msg.prefix.nick
|
||||||
case String.upcase(msg.command) do
|
case String.upcase(msg.command) do
|
||||||
|
|||||||
Reference in New Issue
Block a user