Add Untappd photos

This commit is contained in:
Chris Sexton 2016-05-01 16:56:58 -04:00
parent 1e6f0474d3
commit b687078c1a
1 changed files with 17 additions and 0 deletions

View File

@ -292,6 +292,15 @@ type checkin struct {
Brewery map[string]interface{} Brewery map[string]interface{}
Venue interface{} Venue interface{}
User mrUntappd User mrUntappd
Media struct {
Count int
Items []struct {
Photo_id int
Photo struct {
Photo_img_og string
}
}
}
} }
type mrUntappd struct { type mrUntappd struct {
@ -408,6 +417,11 @@ func (p *BeersPlugin) checkUntappd(channel string) {
msg, checkin.Checkin_comment) 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 user.lastCheckin = checkin.Checkin_id
_, err := p.db.Exec(`update untappd set _, err := p.db.Exec(`update untappd set
lastCheckin = ? lastCheckin = ?
@ -418,6 +432,9 @@ func (p *BeersPlugin) checkUntappd(channel string) {
log.Println("checkin id:", checkin.Checkin_id, "Message:", msg) log.Println("checkin id:", checkin.Checkin_id, "Message:", msg)
p.Bot.SendMessage(channel, msg) p.Bot.SendMessage(channel, msg)
if msg2 != "" {
p.Bot.SendMessage(channel, msg2)
}
} }
} }