mirror of https://github.com/velour/catbase.git
meme: fix default config
This commit is contained in:
parent
789409e159
commit
ac3d037fa4
|
@ -170,13 +170,13 @@ func (p *MemePlugin) sendMeme(c bot.Connector, channel, channelName, msgID strin
|
||||||
allConfigs := p.c.GetMap("meme.memeconfigs", map[string]string{})
|
allConfigs := p.c.GetMap("meme.memeconfigs", map[string]string{})
|
||||||
configtxt, ok := allConfigs[format]
|
configtxt, ok := allConfigs[format]
|
||||||
if !ok {
|
if !ok {
|
||||||
config = defaultFormatConfig
|
config = defaultFormatConfig()
|
||||||
log.Debug().Msgf("Did not find %s in %+v", format, allConfigs)
|
log.Debug().Msgf("Did not find %s in %+v", format, allConfigs)
|
||||||
} else {
|
} else {
|
||||||
err = json.Unmarshal([]byte(configtxt), &config)
|
err = json.Unmarshal([]byte(configtxt), &config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msgf("Could not parse config for %s:\n%s", format, configtxt)
|
log.Error().Err(err).Msgf("Could not parse config for %s:\n%s", format, configtxt)
|
||||||
config = defaultFormatConfig
|
config = defaultFormatConfig()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,9 +325,11 @@ func (p *MemePlugin) findFontSize(config []memeText, w, h int, sizes []float64)
|
||||||
return fontSize
|
return fontSize
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultFormatConfig = []memeText{
|
func defaultFormatConfig() []memeText {
|
||||||
{XPerc: 0.5, YPerc: 0.05},
|
return []memeText{
|
||||||
{XPerc: 0.5, YPerc: 0.95},
|
{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) {
|
func (p *MemePlugin) genMeme(meme string, bully image.Image, config []memeText) (string, int, int, error) {
|
||||||
|
|
Loading…
Reference in New Issue