diff --git a/msg.go b/msg.go index 8e0f1b1..ef3966b 100644 --- a/msg.go +++ b/msg.go @@ -470,14 +470,22 @@ func parseSubTypeMessageShopMainAck(m *ChatWarsMessage, r *regexp.Regexp) (*Chat func parseSubTypeMessageGListAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGListAck, error) { cwm := ChatWarsMessageGListAck{} cwm.Msg = m + cwm.Members = make([]ChatWarsMembers, 0) log.Printf("parseSubTypeMessageGListAck : Guild : %s\n", r.ReplaceAllString(m.Text, "${GuildName}")) - log.Printf("parseSubTypeMessageGListAck : Members : %s\n", r.ReplaceAllString(m.Text, "${Members}")) + // log.Printf("parseSubTypeMessageGListAck : Members : %s\n", r.ReplaceAllString(m.Text, "${Members}")) re := regexp.MustCompile(`\n#(?P[0-9]+) (?P[โš’โš—๏ธ๐Ÿ“ฆ๐Ÿนโš”๏ธ๐Ÿ›ก])(?P[โš’โš—๏ธ๐Ÿ“ฆ๐Ÿนโš”๏ธ๐Ÿ›ก]{0,1})(?P[0-9]+) \[(?P.*)\] (?P[a-zA-z0-9 ]+)`) for _, l := range re.FindAllString(r.ReplaceAllString(m.Text, "${Members}"), -1) { - //log.Printf("parseSubTypeMessageGListAck : %d : %s/%s : %s [%d] => %s\n") - log.Printf("parseSubTypeMessageGListAck : %s\n", l) + m := ChatWarsGuildMember{} + m.Name = re.ReplaceAllString(l, "${Name}") + m.Class1 = re.ReplaceAllString(l, "${Class1}") + m.Class2 = re.ReplaceAllString(l, "${Class2}") + m.Status = re.ReplaceAllString(l, "${Status}") + i, _ := strconv.ParseInt(r.ReplaceAllString(l, "${Level}"), 10, 64) + cwm.Level = i + log.Printf("parseSubTypeMessageGListAck : %s : %s/%s [%d] => %s\n", m.Name, m.Class1, m.Class2, m.Level, m.Status) + //log.Printf("parseSubTypeMessageGListAck : %s\n", l) } return &cwm, nil