From 631a0c2b0cafbcddf99352622a42ddd6edcf198d Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sat, 28 Sep 2019 14:24:45 -0400 Subject: [PATCH] untappd: switch text line for image descriptions Checking out a reorder of the args too. --- plugins/beers/beers.go | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/plugins/beers/beers.go b/plugins/beers/beers.go index 2644dc8..f821c9e 100644 --- a/plugins/beers/beers.go +++ b/plugins/beers/beers.go @@ -419,17 +419,19 @@ func (p *BeersPlugin) checkUntappd(c bot.Connector, channel string) { msg = fmt.Sprintf("%s -- %s", msg, checkin.Checkin_comment) } - 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 := []interface{}{ channel, msg, } + if checkin.Badges.Count > 0 { + for _, b := range checkin.Badges.Items { + args = append(args, bot.ImageAttachment{ + URL: b.BadgeImage.Sm, + AltTxt: b.BadgeName, + }) + } + } if checkin.Media.Count > 0 { if strings.Contains(checkin.Media.Items[0].Photo.Photo_img_lg, "photos-processing") { continue @@ -439,14 +441,6 @@ func (p *BeersPlugin) checkUntappd(c bot.Connector, channel string) { AltTxt: "Here's a photo", }) } - if checkin.Badges.Count > 0 { - for _, b := range checkin.Badges.Items { - args = append(args, bot.ImageAttachment{ - URL: b.BadgeImage.Lg, - AltTxt: b.BadgeDescription, - }) - } - } user.lastCheckin = checkin.Checkin_id _, err := p.db.Exec(`update untappd set