增加小爱回复 (#100)

* fix:去掉count,修sql

* feat:增加小爱回复

* fix:修一下lint

* fix:修一下lint

* fix:修一下lint

* fix:修一下lint

* fix:修改设置回复模式

* fix:修lint

Co-authored-by: Guohuiyuan <haibaraguo@yeahka.com>
This commit is contained in:
himawari
2022-01-07 19:47:35 +08:00
committed by GitHub
parent ca2f674696
commit ca36038bbd
8 changed files with 288 additions and 170 deletions

View File

@@ -19,7 +19,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/control"
qingyunke "github.com/FloatTech/ZeroBot-Plugin/plugin_qingyunke"
aireply "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_reply"
fileutil "github.com/FloatTech/ZeroBot-Plugin/utils/file"
"github.com/FloatTech/ZeroBot-Plugin/utils/web"
)
@@ -47,14 +47,12 @@ func init() {
engine.OnMessage(zero.OnlyToMe, getAcquire).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) {
msg := ctx.ExtractPlainText()
// 调用青云客接口
reply, err := qingyunke.GetMessage(msg)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
AIReply := aireply.NewAIReply(aireply.GetReplyMode(ctx))
// 把消息里的椛椛替换成对应接口机器人的名字
msg = AIReply.DealQuestion(msg)
reply := AIReply.GetReply(msg)
// 挑出 face 表情
textReply, _ := qingyunke.DealReply(reply)
textReply, _ := AIReply.DealReply(reply)
// 拟声器生成音频
syntPath := getSyntPath()
fileName := getWav(textReply, syntPath, vocoderList[1], ctx.Event.UserID)