mirror of https://github.com/velour/catbase.git
meme: maybe fix the bully meme
This commit is contained in:
parent
a30be0df8f
commit
af5717e9c1
|
@ -102,7 +102,7 @@ func (p *MemePlugin) help(c bot.Connector, kind bot.Kind, message msg.Message, a
|
||||||
return true
|
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 := ""
|
bullyIcon := ""
|
||||||
|
|
||||||
for _, bully := range p.c.GetArray("meme.bully", []string{}) {
|
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)
|
formats := p.c.GetMap("meme.memes", defaultFormats)
|
||||||
format = randEntry(formats)
|
format = randEntry(formats)
|
||||||
|
log.Debug().Msgf("After bullying:\nFormat: %s", format)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if u, err := c.Profile(id); bullyIcon == "" && err == nil {
|
if u, err := c.Profile(id); bullyIcon == "" && err == nil {
|
||||||
if u.IconImg != nil {
|
if u.IconImg != nil {
|
||||||
return u.IconImg
|
return u.IconImg, format
|
||||||
}
|
}
|
||||||
bullyIcon = u.Icon
|
bullyIcon = u.Icon
|
||||||
}
|
}
|
||||||
|
@ -133,7 +134,7 @@ func (p *MemePlugin) bully(c bot.Connector, format, id string) image.Image {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("error downloading bully icon")
|
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) {
|
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)
|
id, w, h, err := p.genMeme(format, bullyImg, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue