From df58e25adc821a3680f366648687940c475cca17 Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Sat, 14 Oct 2017 17:06:54 +0400 Subject: [PATCH] Profile parser changes to reflect last bot's update --- lib/parsers/profile.go | 4 ++-- lib/router/router.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/parsers/profile.go b/lib/parsers/profile.go index 8370e64..89579b7 100644 --- a/lib/parsers/profile.go +++ b/lib/parsers/profile.go @@ -142,9 +142,9 @@ func (p *Parsers) ParseProfile(update tgbotapi.Update, player_raw dbmapping.Play crystalls_int = p.getPoints(crystalls) } - if strings.HasPrefix(current_string, "🔫Оружие") { + if strings.HasPrefix(current_string, "🔫") { // We need NEXT string! - weapon_type_string := string(profile_info_runed_strings[i + 1]) + weapon_type_string := strings.Replace(current_string, "🔫 ", "", 1) wnRx := regexp.MustCompile("(.+)(ита)") weapon = wnRx.FindString(weapon_type_string) } diff --git a/lib/router/router.go b/lib/router/router.go index 13d94e9..ea38e4c 100644 --- a/lib/router/router.go +++ b/lib/router/router.go @@ -43,7 +43,7 @@ func (r *Router) RouteRequest(update tgbotapi.Update) string { // Forwards var pokememeMsg = regexp.MustCompile("(Уровень)(.+)(Опыт)(.+)\n(Элементы:)(.+)\n(.+)(💙MP)") - var profileMsg = regexp.MustCompile("(Онлайн: )(\\d+)\n(Турнир Лиг через)(.+)\n\n(.*)\n(Элементы)(.+)\n\n(.+)(Уровень)(.+)\n") + var profileMsg = regexp.MustCompile(`(Онлайн: )(\d+)\n(Турнир через)(.+)\n\n(.*)\n(Элементы)(.+)\n(.*)\n\n(.+)(Уровень)(.+)\n`) if update.Message.ForwardFrom != nil { if update.Message.ForwardFrom.ID != 360402625 {