diff --git a/client/dispatch.go b/client/dispatch.go index 3369cd4..4157e4a 100644 --- a/client/dispatch.go +++ b/client/dispatch.go @@ -224,6 +224,9 @@ func (conn *Conn) dispatch(line *Line) { conn.handlers.dispatch(conn, line) } -func (conn *Conn) command(line *Line) Handler { - return conn.commands.match(line.Message()) +func (conn *Conn) command(line *Line) { + command := conn.commands.match(line.Message()) + if command != nil { + go command.Handle(conn, line) + } } diff --git a/client/handlers.go b/client/handlers.go index 14774d3..f22f88d 100644 --- a/client/handlers.go +++ b/client/handlers.go @@ -111,9 +111,5 @@ func (conn *Conn) h_PRIVMSG(line *Line) { line = line.Copy() line.Args[1] = text } - cmd := conn.command(line) - if cmd == nil { - return - } - cmd.Handle(conn, line) + conn.command(line) }