mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 07:19:37 +00:00
fix: aireply: 修复文字回复模式 (#991)
更新桑帛云api,添加key设置 Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -60,6 +60,7 @@ var (
|
||||
原 = newapikeystore("./data/tts/o.txt")
|
||||
ཆཏ = newapikeystore("./data/tts/c.txt")
|
||||
百 = newapikeystore("./data/tts/b.txt")
|
||||
桑 = newapikeystore("./data/tts/s.txt")
|
||||
)
|
||||
|
||||
type replymode []string
|
||||
@@ -89,6 +90,7 @@ func (r replymode) setReplyMode(ctx *zero.Ctx, name string) error {
|
||||
}
|
||||
|
||||
func (r replymode) getReplyMode(ctx *zero.Ctx) aireply.AIReply {
|
||||
k := 桑.k
|
||||
gid := ctx.Event.GroupID
|
||||
if gid == 0 {
|
||||
gid = -ctx.Event.UserID
|
||||
@@ -97,22 +99,21 @@ func (r replymode) getReplyMode(ctx *zero.Ctx) aireply.AIReply {
|
||||
if ok {
|
||||
switch m.GetData(gid) & 0xff {
|
||||
case 0:
|
||||
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName)
|
||||
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName, k, false, 0)
|
||||
case 1:
|
||||
return aireply.NewLolimiAi(aireply.MomoURL, aireply.MomoBotName)
|
||||
return aireply.NewLolimiAi(aireply.MomoURL, aireply.MomoBotName, k, false, 0)
|
||||
case 2:
|
||||
return aireply.NewQYK(aireply.QYKURL, aireply.QYKBotName)
|
||||
case 3:
|
||||
return aireply.NewXiaoAi(aireply.XiaoAiURL, aireply.XiaoAiBotName)
|
||||
case 4:
|
||||
k := ཆཏ.k
|
||||
if k != "" {
|
||||
return aireply.NewChatGPT(aireply.ChatGPTURL, k)
|
||||
if ཆཏ.k != "" {
|
||||
return aireply.NewChatGPT(aireply.ChatGPTURL, ཆཏ.k)
|
||||
}
|
||||
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName)
|
||||
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName, k, false, 0)
|
||||
}
|
||||
}
|
||||
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName)
|
||||
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName, k, false, 0)
|
||||
}
|
||||
|
||||
var ttsins = func() map[string]tts.TTS {
|
||||
|
||||
@@ -63,6 +63,14 @@ func init() { // 插件主体
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("成功"))
|
||||
}
|
||||
enr.OnPrefix("设置文字回复模式", zero.AdminPermission).SetBlock(true).Handle(setReplyMode)
|
||||
enr.OnRegex(`^设置\s*桑帛云\s*api\s*key\s*(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
err := 桑.set(ctx.State["regex_matched"].([]string)[1])
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR: ", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Text("设置成功"))
|
||||
})
|
||||
enr.OnRegex(`^设置\s*ChatGPT\s*api\s*key\s*(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
err := ཆཏ.set(ctx.State["regex_matched"].([]string)[1])
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user