Archived
1

Move rarely changed data to datamappings, fix profile updating

As result of profile format change, introduced in game update yesterday we need to change profile regexp.

As result of some refactoring, rarely changed data removed from database and added to sources of bot.
This commit is contained in:
2018-03-31 08:34:27 +04:00
parent 8d78ef37f1
commit c9855116da
27 changed files with 460 additions and 237 deletions

View File

@@ -6,6 +6,7 @@ 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"
@@ -46,7 +47,7 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe
profileRunesArray = append(profileRunesArray, []rune(profileStringsArray[i]))
}
league := dbmapping.League{}
league := datamapping.League{}
telegramNickname := update.Message.From.UserName
nickname := ""

View File

@@ -117,10 +117,10 @@ func (u *Users) ProfileMessage(update *tgbotapi.Update, playerRaw *dbmapping.Pla
c.Log.Error(err.Error())
return c.Talkers.AnyMessageUnauthorized(update)
}
league := dbmapping.League{}
err = c.Db.Get(&league, c.Db.Rebind("SELECT * FROM leagues WHERE id=?"), playerRaw.LeagueID)
league, err := c.DataCache.GetLeagueByID(playerRaw.LeagueID)
if err != nil {
c.Log.Error(err)
c.Log.Error(err.Error())
return c.Talkers.BotError(update)
}
level := dbmapping.Level{}
err = c.Db.Get(&level, c.Db.Rebind("SELECT * FROM levels WHERE id=?"), profileRaw.LevelID)