This commit is contained in:
shoopea 2019-05-30 17:09:55 +08:00
parent d069f6b223
commit d879f832fb

13
msg.go
View File

@ -7,6 +7,7 @@ import (
"strconv"
"strings"
"time"
"unicode/utf8"
)
func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageReportAck, error) {
@ -69,25 +70,29 @@ func parseSubTypeMessageGRolesAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
*/
if strings.Compare(`[unassigned]`, r.ReplaceAllString(m.Text, "${Bartender}")) != 0 {
s := r.ReplaceAllString(m.Text, "${Bartender}")
cwm.BartenderID64 = getObjUserID(s[1:])
_, i := utf8.DecodeRunInString(s)
cwm.BartenderID64 = getObjUserID(s[i:])
} else {
cwm.BartenderID64 = 0
}
if strings.Compare(`[unassigned]`, r.ReplaceAllString(m.Text, "${Commander}")) != 0 {
s := r.ReplaceAllString(m.Text, "${Commander}")
cwm.CommanderID64 = getObjUserID(s[1:])
_, i := utf8.DecodeRunInString(s)
cwm.CommanderID64 = getObjUserID(s[i:])
} else {
cwm.CommanderID64 = 0
}
if strings.Compare(`[unassigned]`, r.ReplaceAllString(m.Text, "${Squire}")) != 0 {
s := r.ReplaceAllString(m.Text, "${Bartender}")
cwm.SquireID64 = getObjUserID(s[1:])
_, i := utf8.DecodeRunInString(s)
cwm.SquireID64 = getObjUserID(s[i:])
} else {
cwm.SquireID64 = 0
}
if strings.Compare(`[unassigned]`, r.ReplaceAllString(m.Text, "${Treasurer}")) != 0 {
s := r.ReplaceAllString(m.Text, "${Bartender}")
cwm.TreasurerID64 = getObjUserID(s[1:])
_, i := utf8.DecodeRunInString(s)
cwm.TreasurerID64 = getObjUserID(s[i:])
} else {
cwm.TreasurerID64 = 0
}