Archived
1

Add profile updates via statistics

After nerf update there is machine-readable command /me in PokememBroBot. It can be used for gathering useful information about users.
This commit is contained in:
2018-05-02 08:48:22 +04:00
parent 86afa52a56
commit ca51648110
9 changed files with 201 additions and 211 deletions

View File

@@ -42,10 +42,10 @@ func (p *Pokedexer) getAdvicePokememes(playerID int, adviceType string) ([]*data
allPokememes := c.DataCache.GetAllPokememes()
neededGrade := 0
if profileRaw.LevelID < 10 {
if profileRaw.LevelID < 19 {
neededGrade = profileRaw.LevelID + 1
} else {
neededGrade = 10
neededGrade = 19
}
c.Log.Debug("This player will search for grade: " + strconv.Itoa(neededGrade))
@@ -90,13 +90,9 @@ func (p *Pokedexer) getAdvicePokememes(playerID int, adviceType string) ([]*data
switch adviceType {
case "best", "advice", "best_nofilter":
if len(pokememesArray) > 5 {
idx := 0
pokememesArrayShorted := make([]*datamapping.PokememeFull, 0)
for i := range pokememesArray {
if idx < 5 {
pokememesArrayShorted = append(pokememesArrayShorted, pokememesArray[i])
}
idx++
for i := 0; i < 5; i++ {
pokememesArrayShorted = append(pokememesArrayShorted, pokememesArray[i])
}
pokememesArray = pokememesArrayShorted

View File

@@ -197,7 +197,6 @@ func (p *Pokedexer) PokememeInfo(update *tgbotapi.Update, playerRaw *dbmapping.P
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
keyboard := tgbotapi.InlineKeyboardMarkup{}
for i := range pokememe.Locations {
c.Log.Info("wow, location")
var row []tgbotapi.InlineKeyboardButton
btn := tgbotapi.NewInlineKeyboardButtonSwitch(pokememe.Locations[i].Symbol+pokememe.Locations[i].Name, pokememe.Locations[i].Symbol+pokememe.Locations[i].Name)
row = append(row, btn)