From 3364fbdbe64a41e7e05a216e868fa1aa836bbaf0 Mon Sep 17 00:00:00 2001 From: Liam Stanley Date: Fri, 23 Dec 2016 20:01:40 -0500 Subject: [PATCH] minor fixes for IsFromUser and IsFromChannel --- event.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/event.go b/event.go index ea70dc5..1b6beb9 100644 --- a/event.go +++ b/event.go @@ -250,29 +250,29 @@ func (e *Event) IsAction() bool { // IsFromChannel checks to see if a message was from a channel (rather than // a private message). func (e *Event) IsFromChannel() bool { - if len(e.Params) != 2 { + if len(e.Params) != 1 { return false } - if e.Params[0] != "PRIVMSG" { + if e.Command != "PRIVMSG" || !IsValidChannel(e.Params[0]) { return false } - return IsValidChannel(e.Params[1]) + return true } // IsFromUser checks to see if a message was from a user (rather than a // channel). func (e *Event) IsFromUser() bool { - if len(e.Params) != 2 { + if len(e.Params) != 1 { return false } - if e.Params[0] != "PRIVMSG" { + if e.Command != "PRIVMSG" || !IsValidNick(e.Params[0]) { return false } - return IsValidUser(e.Params[1]) + return true } // StripAction strips the action encoding from a PRIVMSG ACTION (/me).