mirror of https://github.com/velour/catbase.git
untappd: add badge support
Note: this may not work on the first try. I'm not going to sit around waiting for a badged checkin in #test.
This commit is contained in:
parent
258a3370d7
commit
5cb6f9ad7e
|
@ -287,6 +287,14 @@ type checkin struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Badges struct {
|
||||||
|
Count int
|
||||||
|
Items []struct {
|
||||||
|
BadgeName string `json:"badge_name"`
|
||||||
|
BadgeDescription string `json:"badge_description"`
|
||||||
|
BadgeImage string `json:"badge_image"`
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type mrUntappd struct {
|
type mrUntappd struct {
|
||||||
|
@ -421,6 +429,16 @@ func (p *BeersPlugin) checkUntappd(c bot.Connector, channel string) {
|
||||||
AltTxt: "Here's a photo",
|
AltTxt: "Here's a photo",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if checkin.Badges.Count > 0 {
|
||||||
|
msg = msg + "\nThis checkin earned the following badge(s): "
|
||||||
|
for _, b := range checkin.Badges.Items {
|
||||||
|
msg = msg + b.BadgeName
|
||||||
|
args = append(args, bot.ImageAttachment{
|
||||||
|
URL: b.BadgeImage,
|
||||||
|
AltTxt: b.BadgeDescription,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
user.lastCheckin = checkin.Checkin_id
|
user.lastCheckin = checkin.Checkin_id
|
||||||
_, err := p.db.Exec(`update untappd set
|
_, err := p.db.Exec(`update untappd set
|
||||||
|
|
Loading…
Reference in New Issue