From 6932643788bcbd80fa7ac5aec694c0acc5e711b9 Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 23 Feb 2022 11:35:43 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20=F0=9F=8E=A8=20=20tts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_ai_reply/tts.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugin_ai_reply/tts.go b/plugin_ai_reply/tts.go index a6363a4b..61c03e68 100644 --- a/plugin_ai_reply/tts.go +++ b/plugin_ai_reply/tts.go @@ -25,8 +25,8 @@ const ( ) var ( - reNumber = "(\\-|\\+)?\\d+(\\.\\d+)?" - t *ttsInstances + t *ttsInstances + re = regexp.MustCompile(`(\-|\+)?\d+(\.\d+)?`) ) type ttsInstances struct { @@ -61,7 +61,6 @@ func init() { tts := newTTS(getSoundMode(ctx)) ctx.SendChain(message.Record(tts.Speak(ctx.Event.UserID, func() string { reply := r.TalkPlain(msg, zero.BotConfig.NickName[0]) - re := regexp.MustCompile(reNumber) reply = re.ReplaceAllStringFunc(reply, func(s string) string { f, err := strconv.ParseFloat(s, 64) if err != nil {