move error checks to the front, as it's likely to not have a source

This commit is contained in:
Liam Stanley 2017-08-17 05:02:18 -04:00
parent d9ad35d42b
commit 6e1bd23a28

View File

@ -280,6 +280,10 @@ func (e *Event) Pretty() (out string, ok bool) {
return "", false
}
if e.Command == ERROR {
return fmt.Sprintf("[*] an error occurred: %s", e.Trailing), true
}
if e.Source == nil {
if e.Command != PRIVMSG && e.Command != NOTICE {
return "", false
@ -329,10 +333,6 @@ func (e *Event) Pretty() (out string, ok bool) {
return fmt.Sprintf("[*] %s (%s) has left %s (%s)", e.Source.Name, e.Source.Host, e.Params[0], e.Trailing), true
}
if e.Command == ERROR {
return fmt.Sprintf("[*] an error occurred: %s", e.Trailing), true
}
if e.Command == QUIT {
return fmt.Sprintf("[*] %s has quit (%s)", e.Source.Name, e.Trailing), true
}