Merge pull request #20 from iownall555/master

[WIP] Add an additional array of arguments to the simple command event infomap
This commit is contained in:
Daniel Oaks 2019-05-13 15:33:03 +10:00 committed by GitHub
commit c041b9aa6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -289,12 +289,22 @@ func (sc *ServerConnection) dispatchCommand(info eventmgr.InfoMap) {
for _, p := range sc.CommandPrefixes {
if strings.HasPrefix(params[0], p) {
if len(params) > 1 {
info["cmdparams"] = params[1:]
} else {
info["cmdparams"] = []string{}
}
sc.eventsIn.Dispatch("cmd_"+params[0][1:], info)
return
}
}
if (params[0] == sc.Nick || params[0] == sc.Nick+":") && len(params) > 1 {
if len(params) > 2 {
info["cmdparams"] = params[2:]
} else {
info["cmdparams"] = []string{}
}
sc.eventsIn.Dispatch("cmd_"+params[1], info)
}
}