From af5717e9c16c0b151af7a284f9c3e47538d5e0a1 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sat, 24 Oct 2020 13:36:51 -0400 Subject: [PATCH] meme: maybe fix the bully meme --- plugins/meme/meme.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/meme/meme.go b/plugins/meme/meme.go index 71c8d97..9f0f1fa 100644 --- a/plugins/meme/meme.go +++ b/plugins/meme/meme.go @@ -102,7 +102,7 @@ func (p *MemePlugin) help(c bot.Connector, kind bot.Kind, message msg.Message, a return true } -func (p *MemePlugin) bully(c bot.Connector, format, id string) image.Image { +func (p *MemePlugin) bully(c bot.Connector, format, id string) (image.Image, string) { bullyIcon := "" for _, bully := range p.c.GetArray("meme.bully", []string{}) { @@ -114,13 +114,14 @@ func (p *MemePlugin) bully(c bot.Connector, format, id string) image.Image { } formats := p.c.GetMap("meme.memes", defaultFormats) format = randEntry(formats) + log.Debug().Msgf("After bullying:\nFormat: %s", format) break } } if u, err := c.Profile(id); bullyIcon == "" && err == nil { if u.IconImg != nil { - return u.IconImg + return u.IconImg, format } bullyIcon = u.Icon } @@ -133,7 +134,7 @@ func (p *MemePlugin) bully(c bot.Connector, format, id string) image.Image { if err != nil { log.Error().Err(err).Msg("error downloading bully icon") } - return bullyImg + return bullyImg, format } func (p *MemePlugin) sendMeme(c bot.Connector, channel, channelName, msgID string, from *user.User, text string) { @@ -191,7 +192,7 @@ func (p *MemePlugin) sendMeme(c bot.Connector, channel, channelName, msgID strin } } - bullyImg := p.bully(c, format, from.ID) + bullyImg, format := p.bully(c, format, from.ID) id, w, h, err := p.genMeme(format, bullyImg, config) if err != nil {