Merge pull request 'add support for jpg and svg emotes' (#2) from more-emoji-formats into master

Reviewed-on: #2
This commit is contained in:
Your New SJW Waifu 2021-08-18 02:26:58 +02:00
commit c6c6df08be

View File

@ -114,6 +114,18 @@ func findEmotes(dir string, em common.EmotesMap) (common.EmotesMap, error) {
} }
common.LogInfof("Found %d emoteGIFs\n", len(emoteGIFs)) 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 { for _, file := range emotePNGs {
png := strings.ReplaceAll(common.Substr(file, runPathLength, len(file)), "\\", "/") png := strings.ReplaceAll(common.Substr(file, runPathLength, len(file)), "\\", "/")
//common.LogDebugf("Emote PNG: %s", png) //common.LogDebugf("Emote PNG: %s", png)
@ -126,6 +138,18 @@ func findEmotes(dir string, em common.EmotesMap) (common.EmotesMap, error) {
em = em.Add(gif) 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 return em, nil
} }