goals: fix register bug

This commit is contained in:
Chris Sexton 2020-05-26 12:06:35 -04:00 committed by Chris Sexton
parent ccfdb5a715
commit c68ca70964
1 changed files with 11 additions and 11 deletions

View File

@ -62,26 +62,26 @@ func (p *GoalsPlugin) message(conn bot.Connector, kind bot.Kind, message msg.Mes
who := message.User.Name who := message.User.Name
ch := message.Channel ch := message.Channel
if registerSelf.MatchString(body) { if registerOther.MatchString(body) {
c := parseCmd(registerOther, body)
amount, _ := strconv.Atoi(c["amount"])
p.register(conn, ch, c["type"], c["what"], c["who"], amount)
} else if registerSelf.MatchString(body) {
c := parseCmd(registerSelf, body) c := parseCmd(registerSelf, body)
amount, _ := strconv.Atoi(c["amount"]) amount, _ := strconv.Atoi(c["amount"])
p.register(conn, ch, c["type"], c["what"], who, amount) p.register(conn, ch, c["type"], c["what"], who, amount)
} else if registerOther.MatchString(body) {
c := parseCmd(registerSelf, body)
amount, _ := strconv.Atoi(c["amount"])
p.register(conn, ch, c["type"], c["what"], c["who"], amount)
} else if deRegisterSelf.MatchString(body) {
c := parseCmd(deRegisterSelf, body)
p.deregister(conn, ch, c["type"], c["what"], who)
} else if deRegisterOther.MatchString(body) { } else if deRegisterOther.MatchString(body) {
c := parseCmd(deRegisterOther, body) c := parseCmd(deRegisterOther, body)
p.deregister(conn, ch, c["type"], c["what"], c["who"]) p.deregister(conn, ch, c["type"], c["what"], c["who"])
} else if checkSelf.MatchString(body) { } else if deRegisterSelf.MatchString(body) {
c := parseCmd(checkSelf, body) c := parseCmd(deRegisterSelf, body)
p.check(conn, ch, c["type"], c["what"], who) p.deregister(conn, ch, c["type"], c["what"], who)
} else if checkOther.MatchString(body) { } else if checkOther.MatchString(body) {
c := parseCmd(checkOther, body) c := parseCmd(checkOther, body)
p.check(conn, ch, c["type"], c["what"], c["who"]) p.check(conn, ch, c["type"], c["what"], c["who"])
} else if checkSelf.MatchString(body) {
c := parseCmd(checkSelf, body)
p.check(conn, ch, c["type"], c["what"], who)
} else { } else {
return false return false
} }