diff --git a/lib/pokedexer/getters.go b/lib/pokedexer/getters.go index 8353fcf..54a36d7 100644 --- a/lib/pokedexer/getters.go +++ b/lib/pokedexer/getters.go @@ -105,10 +105,18 @@ func (p *Pokedexer) getBestPokememes(playerID int) ([]dbmapping.PokememeFull, bo // TODO: make it more complicated pokememes := []dbmapping.Pokememe{} - err := c.Db.Select(&pokememes, c.Db.Rebind("SELECT p.* FROM pokememes p, pokememes_elements pe, elements e WHERE e.league_id = ? AND p.grade = ? AND pe.element_id = e.id AND pe.pokememe_id = p.id ORDER BY p.attack DESC"), playerRaw.LeagueID, profileRaw.LevelID+1) - if err != nil { - c.Log.Error(err) - return pokememesArray, false + if profileRaw.LevelID < 4 { + err := c.Db.Select(&pokememes, c.Db.Rebind("SELECT * FROM pokememes WHERE grade = ? ORDER BY attack DESC"), profileRaw.LevelID+1) + if err != nil { + c.Log.Error(err) + return pokememesArray, false + } + } else { + err := c.Db.Select(&pokememes, c.Db.Rebind("SELECT p.* FROM pokememes p, pokememes_elements pe, elements e WHERE e.league_id = ? AND p.grade = ? AND pe.element_id = e.id AND pe.pokememe_id = p.id ORDER BY p.attack DESC"), playerRaw.LeagueID, profileRaw.LevelID+1) + if err != nil { + c.Log.Error(err) + return pokememesArray, false + } } pokememesArray, ok = p.formFullPokememes(pokememes) diff --git a/lib/squader/squader.go b/lib/squader/squader.go index 4fa8243..98bd6c7 100644 --- a/lib/squader/squader.go +++ b/lib/squader/squader.go @@ -477,12 +477,12 @@ func (s *Squader) ProcessMessage(update *tgbotapi.Update, chatRaw *dbmapping.Cha } if !isChatValid { - switch newUsers[i].UserName { + switch strings.ToLower(newUsers[i].UserName) { case "gantz_yaka": messageProcessed = true - case "@agentpb": + case "agentpb": messageProcessed = true - case "@pbhelp": + case "pbhelp": messageProcessed = true default: s.kickUserFromSquadChat(&newUsers[i], chatRaw)