add RegisterCommand

This commit is contained in:
Andrew 2019-05-08 10:07:13 +10:00
parent 2fa95f607d
commit 9159419f76

@ -228,6 +228,11 @@ func (sc *ServerConnection) RegisterEvent(direction string, name string, handler
}
}
// RegisterCommand registers a command to be called via the configured prefix or the client's nickname (e.g !help, "GoshuBot: help")
func (sc *ServerConnection) RegisterCommand(name string, handler eventmgr.HandlerFn, priority int) {
sc.eventsIn.Attach("cmd_"+name, handler, priority)
}
// Shutdown closes the connection to the server.
func (sc *ServerConnection) Shutdown(message string) {
sc.Send(nil, "", "QUIT", message)