From 1e6f0474d31966d09f432a56f908aab9eacf91f9 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sun, 24 Apr 2016 20:07:01 -0400 Subject: [PATCH] Add rating score into untappd checkin comments --- plugins/beers/beers.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/beers/beers.go b/plugins/beers/beers.go index 31022a2..653f343 100644 --- a/plugins/beers/beers.go +++ b/plugins/beers/beers.go @@ -287,11 +287,11 @@ type checkin struct { Checkin_id int Created_at string Checkin_comment string - // Rating_score int // Apparently Untappd makes this a string when not present. :( - Beer map[string]interface{} - Brewery map[string]interface{} - Venue interface{} - User mrUntappd + Rating_score float64 + Beer map[string]interface{} + Brewery map[string]interface{} + Venue interface{} + User mrUntappd } type mrUntappd struct { @@ -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", 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 != "" { msg = fmt.Sprintf("%s -- %s", msg, checkin.Checkin_comment)