test g roles

This commit is contained in:
shoopea 2019-08-12 16:30:06 +08:00
parent 7b3bf11db9
commit 6177e987a9

22
msg.go
View File

@ -119,34 +119,22 @@ func parseSubTypeMessageGRolesAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
TreasurerID64: getObjUserID(r.ReplaceAllString(m.Text, "${Treasurer}")),
*/
if strings.Compare(`[unassigned]`, r.ReplaceAllString(m.Text, "${Bartender}")) != 0 {
s := r.ReplaceAllString(m.Text, "${Bartender}")
_, i := utf8.DecodeRuneInString(s)
_, j := utf8.DecodeRuneInString(s[i:])
cwm.BartenderID64 = getObjUserID(s[i+j:])
cwm.BartenderID64 = getObjUserID(r.ReplaceAllString(m.Text, "${Bartender}"))
} else {
cwm.BartenderID64 = 0
}
if strings.Compare(`[unassigned]`, r.ReplaceAllString(m.Text, "${Commander}")) != 0 {
s := r.ReplaceAllString(m.Text, "${Commander}")
_, i := utf8.DecodeRuneInString(s)
_, j := utf8.DecodeRuneInString(s[i:])
cwm.CommanderID64 = getObjUserID(s[i+j:])
cwm.CommanderID64 = getObjUserID(r.ReplaceAllString(m.Text, "${Commander}"))
} else {
cwm.CommanderID64 = 0
}
if strings.Compare(`[unassigned]`, r.ReplaceAllString(m.Text, "${Squire}")) != 0 {
s := r.ReplaceAllString(m.Text, "${Squire}")
_, i := utf8.DecodeRuneInString(s)
_, j := utf8.DecodeRuneInString(s[i:])
cwm.SquireID64 = getObjUserID(s[i+j:])
cwm.SquireID64 = getObjUserID(r.ReplaceAllString(m.Text, "${Squire}"))
} else {
cwm.SquireID64 = 0
}
if strings.Compare(`[unassigned]`, r.ReplaceAllString(m.Text, "${Treasurer}")) != 0 {
s := r.ReplaceAllString(m.Text, "${Treasurer}")
_, i := utf8.DecodeRuneInString(s)
_, j := utf8.DecodeRuneInString(s[i:])
cwm.TreasurerID64 = getObjUserID(s[i+j:])
cwm.TreasurerID64 = getObjUserID(r.ReplaceAllString(m.Text, "${Treasurer}"))
} else {
cwm.TreasurerID64 = 0
}
@ -155,12 +143,10 @@ func parseSubTypeMessageGRolesAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
log.Printf("parseSubTypeMessageGRolesAck : Commander : %s\n", r.ReplaceAllString(m.Text, "${Commander}"))
log.Printf("parseSubTypeMessageGRolesAck : Squire : %s\n", r.ReplaceAllString(m.Text, "${Squire}"))
log.Printf("parseSubTypeMessageGRolesAck : Treasurer : %s\n", r.ReplaceAllString(m.Text, "${Treasurer}"))
/*
log.Printf("cwm.BartenderID64 : %d\n", cwm.BartenderID64)
log.Printf("cwm.CommanderID64 : %d\n", cwm.CommanderID64)
log.Printf("cwm.SquireID64 : %d\n", cwm.SquireID64)
log.Printf("cwm.TreasurerID64 : %d\n", cwm.TreasurerID64)
*/
return &cwm, nil
}