This commit is contained in:
shoopea 2020-10-17 18:07:46 +02:00
parent 5d1e019425
commit cd5b0321fd
3 changed files with 25 additions and 4 deletions

View File

@ -130,7 +130,7 @@
{
"prio": 5000,
"descn": "Guild list members ack",
"rule": "^([🐉🦅🐺🦈🦌🥔🌑])(.*)(\\n#[0-9]+ [⚒⚗️📦🏹⚔️🛡]+[0-9]+ \\[.*\\] [a-zA-z0-9 ]+)+$",
"rule": "^([🐉🦅🐺🦈🦌🥔🌑])(?P<GuildName>.*)(?P<Members>(\\n#[0-9]+ [⚒⚗️📦🏹⚔️🛡]+[0-9]+ \\[.*\\] [a-zA-z0-9 ]+)+)$",
"msg_type": "msg_g_list_ack",
"chat_id": 0,
"user_id": 0

19
def.go
View File

@ -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 {

8
msg.go
View File

@ -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<Id>[0-9]+) (?P<Class1>[⚒⚗️📦🏹⚔️🛡])(?P<Class2>[⚒⚗️📦🏹⚔️🛡]{0,1})(?P<Level>[0-9]+) \\[(?P<Status>.*)\\] (?P<Name>[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
}