恢复注册方式 (#491)

This commit is contained in:
DreamZero
2022-11-09 13:29:07 +08:00
committed by GitHub
parent 5d94980e7c
commit 6c2fc1b4c2
9 changed files with 29 additions and 49 deletions

View File

@@ -152,7 +152,7 @@ func newttsmode() *ttsmode {
tts := &ttsmode{}
tts.Lock()
defer tts.Unlock()
m, ok := control.Lookup(ttsServiceName)
m, ok := control.Lookup("tts")
tts.mode = make(map[int64]int64, 2*len(soundList))
tts.mode[-2905] = 1
if ok {
@@ -229,7 +229,7 @@ func (tts *ttsmode) setDefaultSoundMode(name string) error {
}
tts.Lock()
defer tts.Unlock()
m, ok := control.Lookup(ttsServiceName)
m, ok := control.Lookup("tts")
if !ok {
return errors.New("[tts] service not found")
}

View File

@@ -17,15 +17,10 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
)
const (
replyServiceName = "aireply"
ttsServiceName = "tts"
)
var replyModes = [...]string{"青云客", "小爱"}
func init() { // 插件主体
enOftts := control.Register(ttsServiceName, &ctrl.Options[*zero.Ctx]{
enOftts := control.Register("tts", &ctrl.Options[*zero.Ctx]{
DisableOnDefault: true,
Brief: "人工智能语音回复",
Help: "- @Bot 任意文本(任意一句话回复)\n" +
@@ -35,7 +30,7 @@ func init() { // 插件主体
"当前适用的原神人物含有以下:\n" + list(soundList[:], 5),
})
tts := newttsmode()
enOfreply := control.Register(replyServiceName, &ctrl.Options[*zero.Ctx]{
enOfreply := control.Register("aireply", &ctrl.Options[*zero.Ctx]{
DisableOnDefault: false,
Brief: "人工智能回复",
Help: "- @Bot 任意文本(任意一句话回复)\n- 设置回复模式[青云客|小爱]",