🔥 🎨 tts

This commit is contained in:
fumiama 2022-02-23 11:35:43 +08:00
parent 7f972e3d68
commit 6932643788

View File

@ -25,8 +25,8 @@ const (
) )
var ( var (
reNumber = "(\\-|\\+)?\\d+(\\.\\d+)?" t *ttsInstances
t *ttsInstances re = regexp.MustCompile(`(\-|\+)?\d+(\.\d+)?`)
) )
type ttsInstances struct { type ttsInstances struct {
@ -61,7 +61,6 @@ func init() {
tts := newTTS(getSoundMode(ctx)) tts := newTTS(getSoundMode(ctx))
ctx.SendChain(message.Record(tts.Speak(ctx.Event.UserID, func() string { ctx.SendChain(message.Record(tts.Speak(ctx.Event.UserID, func() string {
reply := r.TalkPlain(msg, zero.BotConfig.NickName[0]) reply := r.TalkPlain(msg, zero.BotConfig.NickName[0])
re := regexp.MustCompile(reNumber)
reply = re.ReplaceAllStringFunc(reply, func(s string) string { reply = re.ReplaceAllStringFunc(reply, func(s string) string {
f, err := strconv.ParseFloat(s, 64) f, err := strconv.ParseFloat(s, 64)
if err != nil { if err != nil {