From 9542291996c02c8f8f51c57d6986ef5e15e5c298 Mon Sep 17 00:00:00 2001 From: Yang-33 Date: Sat, 1 Jun 2019 16:56:39 +0900 Subject: [PATCH] Fixed error case by '-e 0' : Ojisan could be seriously. --- pattern/tags.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) mode change 100644 => 100755 pattern/tags.go diff --git a/pattern/tags.go b/pattern/tags.go old mode 100644 new mode 100755 index 92392f2..3954f94 --- a/pattern/tags.go +++ b/pattern/tags.go @@ -170,7 +170,13 @@ func ConvertTags(message, targetName string, emojiNumber int) string { for tag, pat := range flexTags { n := strings.Count(message, tag) for i := 0; i < n; i++ { - content := combineMultiplePatterns(pat, rand.Intn(emojiNumber)+1) + content := "" + if emojiNumber > 0 { + content = combineMultiplePatterns(pat, rand.Intn(emojiNumber) + 1) + } else { + // Ojisan could be seriously + content = "。" + } // タグを置換 message = strings.Replace(message, tag, content, 1) }