From b687078c1aa88a4263b91a19405bbb3c4ee231d6 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sun, 1 May 2016 16:56:58 -0400 Subject: [PATCH] Add Untappd photos --- plugins/beers/beers.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugins/beers/beers.go b/plugins/beers/beers.go index 653f343..b641e16 100644 --- a/plugins/beers/beers.go +++ b/plugins/beers/beers.go @@ -292,6 +292,15 @@ type checkin struct { Brewery map[string]interface{} Venue interface{} User mrUntappd + Media struct { + Count int + Items []struct { + Photo_id int + Photo struct { + Photo_img_og string + } + } + } } type mrUntappd struct { @@ -408,6 +417,11 @@ func (p *BeersPlugin) checkUntappd(channel string) { msg, checkin.Checkin_comment) } + msg2 := "" + if checkin.Media.Count > 0 { + msg2 = "Here's a photo: " + checkin.Media.Items[0].Photo.Photo_img_og + } + user.lastCheckin = checkin.Checkin_id _, err := p.db.Exec(`update untappd set lastCheckin = ? @@ -418,6 +432,9 @@ func (p *BeersPlugin) checkUntappd(channel string) { log.Println("checkin id:", checkin.Checkin_id, "Message:", msg) p.Bot.SendMessage(channel, msg) + if msg2 != "" { + p.Bot.SendMessage(channel, msg2) + } } }