Archived
1

Returned duplicate pokememe error

This commit is contained in:
Vladimir Hodakov 2018-01-30 00:03:02 +04:00
parent b8226d8aa8
commit 4a90e0ffd7

View File

@ -134,6 +134,13 @@ func (p *Pokedexer) ParsePokememe(update *tgbotapi.Update, playerRaw *dbmapping.
return "fail" return "fail"
} }
_, err = c.DataCache.GetPokememeByName(pokememeData["name"])
if err == nil {
// There is already a pokememe with such name
p.pokememeAddDuplicateMessage(update)
return "fail"
}
newPokememeID, err := c.DataCache.AddPokememe(pokememeData, pokememeLocations, pokememeElements) newPokememeID, err := c.DataCache.AddPokememe(pokememeData, pokememeLocations, pokememeElements)
if err != nil { if err != nil {
c.Log.Error(err.Error()) c.Log.Error(err.Error())