Skip to content

Commit

Permalink
Update ai_tts.go
Browse files Browse the repository at this point in the history
  • Loading branch information
fangliuyu authored and fumiama committed Sep 12, 2022
1 parent d472bdd commit ba05b04
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions plugin/ai_reply/ai_tts.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ func init() {
defer tts.RUnlock()
m, ok := control.Lookup(ttsServiceName)
if ok {
// m.Enable(-20220905)
tts.defaultSoundMode = soundList[m.GetData(-20220905)]
tts.defaultSoundMode = soundList[m.GetData(-2905)]
}
engine.OnMessage(zero.OnlyToMe).SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
Expand Down Expand Up @@ -303,9 +302,13 @@ func (tts *ttsInstances) setDefaultSoundMode(name string) error {
if !ok {
return errors.New("[error]no fund service")
}
err := m.SetData(-20220905, index)
err := m.SetData(-2905, index)
if err == nil {
tts.defaultSoundMode = tts.soundMode[m.GetData(-20220905)]
soundMode := tts.soundMode[m.GetData(-2905)]
if soundMode != tts.soundMode[index] {
return errors.New("检验数据错误\n当前写入的数据为" + soundMode)
}
tts.defaultSoundMode = soundMode
}
return err
}

0 comments on commit ba05b04

Please sign in to comment.