Add rating score into untappd checkin comments

This commit is contained in:
Chris Sexton 2016-04-24 20:07:01 -04:00
parent 9bff7bf79a
commit 1e6f0474d3
1 changed files with 8 additions and 5 deletions

View File

@ -287,7 +287,7 @@ type checkin struct {
Checkin_id int Checkin_id int
Created_at string Created_at string
Checkin_comment string Checkin_comment string
// Rating_score int // Apparently Untappd makes this a string when not present. :( Rating_score float64
Beer map[string]interface{} Beer map[string]interface{}
Brewery map[string]interface{} Brewery map[string]interface{}
Venue interface{} Venue interface{}
@ -400,6 +400,9 @@ func (p *BeersPlugin) checkUntappd(channel string) {
msg := fmt.Sprintf("%s just drank %s by %s%s, bringing his drunkeness to %d", msg := fmt.Sprintf("%s just drank %s by %s%s, bringing his drunkeness to %d",
user.chanNick, beerName, breweryName, venue, drunken) user.chanNick, beerName, breweryName, venue, drunken)
if checkin.Rating_score > 0 {
msg = fmt.Sprintf("%s. Rating: %.2f", msg, checkin.Rating_score)
}
if checkin.Checkin_comment != "" { if checkin.Checkin_comment != "" {
msg = fmt.Sprintf("%s -- %s", msg = fmt.Sprintf("%s -- %s",
msg, checkin.Checkin_comment) msg, checkin.Checkin_comment)