From 049fdd7235321eb78615ad57b66abda434e06fd4 Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Sat, 31 Mar 2018 14:51:32 +0400 Subject: [PATCH] Fix pokememes attack parsing in 10th grade profiles --- lib/users/parsers.go | 7 ++++++- lib/users/responders.go | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/users/parsers.go b/lib/users/parsers.go index 83d0fd8..92fcb19 100644 --- a/lib/users/parsers.go +++ b/lib/users/parsers.go @@ -171,7 +171,12 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe pokememeString := string(profileRunesArray[i+1+pi]) attackRx := regexp.MustCompile("(\\d|\\.|K|M)+") pkPointsArray := attackRx.FindAllString(pokememeString, -1) - pkAttack := pkPointsArray[1] + pkAttack := "" + if strings.Contains(pokememeString, "🔟") { + pkAttack = pkPointsArray[0] + } else { + pkAttack = pkPointsArray[1] + } pkName := strings.Split(pokememeString, "+")[0] pkName = strings.Replace(pkName, " ⭐", "", 1) pkName = strings.TrimSuffix(pkName, " ") diff --git a/lib/users/responders.go b/lib/users/responders.go index f282376..989aede 100644 --- a/lib/users/responders.go +++ b/lib/users/responders.go @@ -179,8 +179,8 @@ func (u *Users) ProfileMessage(update *tgbotapi.Update, playerRaw *dbmapping.Pla for i := range profilePokememes { for j := range pokememes { if profilePokememes[i].PokememeID == pokememes[j].ID { - message += "\n" + strconv.Itoa(pokememes[j].Grade) - message += "⃣ " + pokememes[j].Name + message += "\n *[" + strconv.Itoa(pokememes[j].Grade) + message += "]* " + pokememes[j].Name message += " +" + c.Statistics.GetPrintablePoints(profilePokememes[i].PokememeAttack) + "⚔" } }