diff --git a/data/msg_rules.json b/data/msg_rules.json index 2617bae..3ab22d5 100644 --- a/data/msg_rules.json +++ b/data/msg_rules.json @@ -130,7 +130,7 @@ { "prio": 5000, "descn": "Guild list members ack", - "rule": "^([πŸ‰πŸ¦…πŸΊπŸ¦ˆπŸ¦ŒπŸ₯”πŸŒ‘])(.*)(\\n#[0-9]+ [βš’βš—οΈπŸ“¦πŸΉβš”οΈπŸ›‘]+[0-9]+ \\[.*\\] [a-zA-z0-9 ]+)+$", + "rule": "^([πŸ‰πŸ¦…πŸΊπŸ¦ˆπŸ¦ŒπŸ₯”πŸŒ‘])(?P.*)(?P(\\n#[0-9]+ [βš’βš—οΈπŸ“¦πŸΉβš”οΈπŸ›‘]+[0-9]+ \\[.*\\] [a-zA-z0-9 ]+)+)$", "msg_type": "msg_g_list_ack", "chat_id": 0, "user_id": 0 diff --git a/def.go b/def.go index c58c0be..252192c 100644 --- a/def.go +++ b/def.go @@ -416,16 +416,29 @@ type ChatWarsMessageShopMainReq struct { Link string `json:"link"` } +type ChatWarsGuildMember struct { + Name string `json:"name"` + Level int `json:"level"` + Atk int `json:"atk"` + Def int `json:"def"` + Class1 string `json:"class1"` + Class2 string `json:"class2"` + Status string `json:"status"` +} + type ChatWarsMessageGListAck struct { - Msg *ChatWarsMessage `json:"msg"` + Msg *ChatWarsMessage `json:"msg"` + Members []ChatWarsGuildMember `json:"members"` } type ChatWarsMessageGDefListAck struct { - Msg *ChatWarsMessage `json:"msg"` + Msg *ChatWarsMessage `json:"msg"` + Members []ChatWarsGuildMember `json:"members"` } type ChatWarsMessageGAtkListAck struct { - Msg *ChatWarsMessage `json:"msg"` + Msg *ChatWarsMessage `json:"msg"` + Members []ChatWarsGuildMember `json:"members"` } type ChatWarsMessageShopMainAck struct { diff --git a/msg.go b/msg.go index 3f7b74f..b0de82e 100644 --- a/msg.go +++ b/msg.go @@ -470,6 +470,14 @@ func parseSubTypeMessageShopMainAck(m *ChatWarsMessage, r *regexp.Regexp) (*Chat func parseSubTypeMessageGListAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGListAck, error) { cwm := ChatWarsMessageGListAck{} cwm.Msg = m + + log.Printf("parseSubTypeMessageGListAck : Guild : %s\n", r.ReplaceAllString(m.Text, "${GuildName}")) + + 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") + } + return &cwm, nil }