add support for jpg and svg emotes

This commit is contained in:
Your New SJW Waifu 2021-08-17 19:25:04 -05:00
parent 6948550d18
commit 92be1e9307

View File

@ -114,6 +114,18 @@ func findEmotes(dir string, em common.EmotesMap) (common.EmotesMap, error) {
}
common.LogInfof("Found %d emoteGIFs\n", len(emoteGIFs))
emoteJPGs, err := filepath.Glob(filepath.Join(dir, "*.jpg"))
if err != nil {
return em, errors.Wrap(err, "unable to glob emote directory:")
}
common.LogInfof("Found %d emoteJPGs\n", len(emoteJPGs))
emoteSVGs, err := filepath.Glob(filepath.Join(dir, "*.svg"))
if err != nil {
return em, errors.Wrap(err, "unable to glob emote directory:")
}
common.LogInfof("Found %d emoteSVGs\n", len(emoteSVGs))
for _, file := range emotePNGs {
png := strings.ReplaceAll(common.Substr(file, runPathLength, len(file)), "\\", "/")
//common.LogDebugf("Emote PNG: %s", png)
@ -126,6 +138,18 @@ func findEmotes(dir string, em common.EmotesMap) (common.EmotesMap, error) {
em = em.Add(gif)
}
for _, file := range emoteJPGs {
gif := strings.ReplaceAll(common.Substr(file, runPathLength, len(file)), "\\", "/")
//common.LogDebugf("Emote JPG: %s", jpg)
em = em.Add(jpg)
}
for _, file := range emoteJPGs {
gif := strings.ReplaceAll(common.Substr(file, runPathLength, len(file)), "\\", "/")
//common.LogDebugf("Emote SVG: %s", svg)
em = em.Add(svg)
}
return em, nil
}