From 92be1e930747330fefc6945c13b597b4ffaed97f Mon Sep 17 00:00:00 2001 From: Your New SJW Waifu Date: Tue, 17 Aug 2021 19:25:04 -0500 Subject: [PATCH] add support for jpg and svg emotes --- emotes.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/emotes.go b/emotes.go index 8f681ba..7f5b559 100644 --- a/emotes.go +++ b/emotes.go @@ -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 }