Archived
1

Fix pokememes attack parsing in 10th grade profiles

This commit is contained in:
Vladimir Hodakov 2018-03-31 14:51:32 +04:00
parent 3db79300af
commit 049fdd7235
2 changed files with 8 additions and 3 deletions

View File

@ -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, " ")

View File

@ -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) + "⚔"
}
}