add support for jpg and svg emotes #2

Merged
sjw merged 1 commits from more-emoji-formats into master 2021-08-18 02:26:58 +02:00

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
}