mirror of https://github.com/velour/catbase.git
Compare commits
No commits in common. "fed1951e664a8f9fcaba3fe165519e1bd86fa45d" and "789409e159ac68a7eaccabb49692f08fe7345e75" have entirely different histories.
fed1951e66
...
789409e159
|
@ -170,13 +170,13 @@ func (p *MemePlugin) sendMeme(c bot.Connector, channel, channelName, msgID strin
|
|||
allConfigs := p.c.GetMap("meme.memeconfigs", map[string]string{})
|
||||
configtxt, ok := allConfigs[format]
|
||||
if !ok {
|
||||
config = defaultFormatConfig()
|
||||
config = defaultFormatConfig
|
||||
log.Debug().Msgf("Did not find %s in %+v", format, allConfigs)
|
||||
} else {
|
||||
err = json.Unmarshal([]byte(configtxt), &config)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("Could not parse config for %s:\n%s", format, configtxt)
|
||||
config = defaultFormatConfig()
|
||||
config = defaultFormatConfig
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,11 +325,9 @@ func (p *MemePlugin) findFontSize(config []memeText, w, h int, sizes []float64)
|
|||
return fontSize
|
||||
}
|
||||
|
||||
func defaultFormatConfig() []memeText {
|
||||
return []memeText{
|
||||
var defaultFormatConfig = []memeText{
|
||||
{XPerc: 0.5, YPerc: 0.05},
|
||||
{XPerc: 0.5, YPerc: 0.95},
|
||||
}
|
||||
}
|
||||
|
||||
func (p *MemePlugin) genMeme(meme string, bully image.Image, config []memeText) (string, int, int, error) {
|
||||
|
@ -346,9 +344,7 @@ func (p *MemePlugin) genMeme(meme string, bully image.Image, config []memeText)
|
|||
u, err := url.Parse(imgName)
|
||||
if err != nil || u.Scheme == "" {
|
||||
log.Debug().Err(err).Str("imgName", imgName).Msgf("url not detected")
|
||||
if u, err = url.Parse("https://imgflip.com/s/meme/" + imgName); err != nil {
|
||||
return "", 0, 0, err
|
||||
}
|
||||
u, _ = url.Parse("https://imgflip.com/s/meme/" + imgName)
|
||||
}
|
||||
|
||||
log.Debug().Msgf("Attempting to download url: %s", u.String())
|
||||
|
|
Loading…
Reference in New Issue