minor fixes for IsFromUser and IsFromChannel
This commit is contained in:
parent
090976be59
commit
3364fbdbe6
12
event.go
12
event.go
@ -250,29 +250,29 @@ func (e *Event) IsAction() bool {
|
|||||||
// IsFromChannel checks to see if a message was from a channel (rather than
|
// IsFromChannel checks to see if a message was from a channel (rather than
|
||||||
// a private message).
|
// a private message).
|
||||||
func (e *Event) IsFromChannel() bool {
|
func (e *Event) IsFromChannel() bool {
|
||||||
if len(e.Params) != 2 {
|
if len(e.Params) != 1 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.Params[0] != "PRIVMSG" {
|
if e.Command != "PRIVMSG" || !IsValidChannel(e.Params[0]) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return IsValidChannel(e.Params[1])
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsFromUser checks to see if a message was from a user (rather than a
|
// IsFromUser checks to see if a message was from a user (rather than a
|
||||||
// channel).
|
// channel).
|
||||||
func (e *Event) IsFromUser() bool {
|
func (e *Event) IsFromUser() bool {
|
||||||
if len(e.Params) != 2 {
|
if len(e.Params) != 1 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.Params[0] != "PRIVMSG" {
|
if e.Command != "PRIVMSG" || !IsValidNick(e.Params[0]) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return IsValidUser(e.Params[1])
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripAction strips the action encoding from a PRIVMSG ACTION (/me).
|
// StripAction strips the action encoding from a PRIVMSG ACTION (/me).
|
||||||
|
Loading…
Reference in New Issue
Block a user