Archived
1
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues or pull requests.
i2_bot/lib/getters/profile.go

24 lines
577 B
Go
Raw Normal View History

// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package getters
import (
2017-10-18 07:03:34 +04:00
// stdlib
"log"
// local
2017-10-26 18:17:58 +04:00
"lab.pztrn.name/fat0troll/i2_bot/lib/dbmapping"
)
// GetProfile returns last saved profile of player
func (g *Getters) GetProfile(playerID int) (dbmapping.Profile, bool) {
profileRaw := dbmapping.Profile{}
err := c.Db.Get(&profileRaw, c.Db.Rebind("SELECT * FROM profiles WHERE player_id=? ORDER BY created_at DESC LIMIT 1"), playerID)
2017-10-18 07:03:34 +04:00
if err != nil {
log.Println(err)
return profileRaw, false
2017-10-18 07:03:34 +04:00
}
return profileRaw, true
}