From d96f1e9004c1c6a7ee8e2ee98964d7d112ca8bfd Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Sat, 31 Mar 2018 23:07:05 +0400 Subject: [PATCH] Add error response on wrong profile parsing --- lib/users/parsers.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/users/parsers.go b/lib/users/parsers.go index 92fcb19..f48b910 100644 --- a/lib/users/parsers.go +++ b/lib/users/parsers.go @@ -4,13 +4,14 @@ package users import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "regexp" - "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" "time" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // Internal functions @@ -174,8 +175,11 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe pkAttack := "" if strings.Contains(pokememeString, "🔟") { pkAttack = pkPointsArray[0] - } else { + } else if strings.Contains(pokememeString, "⃣") { pkAttack = pkPointsArray[1] + } else { + // Something went wrong + return c.Talkers.BotError(update) } pkName := strings.Split(pokememeString, "+")[0] pkName = strings.Replace(pkName, " ⭐", "", 1)