🔖 1.4.0-beta6

This commit is contained in:
源文雨 2022-05-10 23:22:57 +08:00
parent e9fac38c1b
commit e993f93cf4
4 changed files with 20 additions and 15 deletions

4
go.mod
View File

@ -3,9 +3,9 @@ module github.com/FloatTech/ZeroBot-Plugin
go 1.18
require (
github.com/FloatTech/AnimeAPI v1.3.4-0.20220510082952-693d8704f125
github.com/FloatTech/AnimeAPI v1.4.1-0.20220510151836-ab2a324e17e3
github.com/FloatTech/sqlite v0.2.1
github.com/FloatTech/zbputils v1.3.4-0.20220509040909-1ba8aa47f58e
github.com/FloatTech/zbputils v1.3.4-0.20220510110942-5476b8b1a779
github.com/antchfx/htmlquery v1.2.4
github.com/corona10/goimagehash v1.0.3
github.com/fogleman/gg v1.3.0

10
go.sum
View File

@ -1,11 +1,9 @@
github.com/FloatTech/AnimeAPI v1.3.4-0.20220509041030-b9aee01996bc h1:FZ+LegVsPIBhtrB4575oOL6nqMomnF987X5LmSifRxg=
github.com/FloatTech/AnimeAPI v1.3.4-0.20220509041030-b9aee01996bc/go.mod h1:KSdH8fZyz/v+8p4WIrk7xyBsf2BOqkyEFBbn65NUNIU=
github.com/FloatTech/AnimeAPI v1.3.4-0.20220510082952-693d8704f125 h1:zjQYBgv8yQUAbgNHCMESo7BecSSWd9naBjN/HCihRik=
github.com/FloatTech/AnimeAPI v1.3.4-0.20220510082952-693d8704f125/go.mod h1:KSdH8fZyz/v+8p4WIrk7xyBsf2BOqkyEFBbn65NUNIU=
github.com/FloatTech/AnimeAPI v1.4.1-0.20220510151836-ab2a324e17e3 h1:nmi9trT0Tstad4molrSouin1bboj9iN15xTLKTNVIzg=
github.com/FloatTech/AnimeAPI v1.4.1-0.20220510151836-ab2a324e17e3/go.mod h1:yPIWJsL2Vsn/mx+H4gVReTSRH0/RPQ90GBK7fJtB5xI=
github.com/FloatTech/sqlite v0.2.1 h1:9t6Me48XJJCIoPy4nLRvcdhcVKfT0c2lilp7SEKROG8=
github.com/FloatTech/sqlite v0.2.1/go.mod h1:6NfHRzqOo9RWeMJEoAQVuo51Omd5LFNxCNQhMF02/9U=
github.com/FloatTech/zbputils v1.3.4-0.20220509040909-1ba8aa47f58e h1:XjtabNVPvZlMXa/8A9gnyeE0j79mfI2oqVtopUBn8Rk=
github.com/FloatTech/zbputils v1.3.4-0.20220509040909-1ba8aa47f58e/go.mod h1:Cf2wAFtq7OUj4RUHcSQtcAYgAspP06wQseKZwtCJRXQ=
github.com/FloatTech/zbputils v1.3.4-0.20220510110942-5476b8b1a779 h1:uqh9CBhwa9Pv6vTvUSelAyY7ZITGNyfQLRvtPverrV4=
github.com/FloatTech/zbputils v1.3.4-0.20220510110942-5476b8b1a779/go.mod h1:Cf2wAFtq7OUj4RUHcSQtcAYgAspP06wQseKZwtCJRXQ=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c h1:cNPOdTNiVwxLpROLjXCgbIPvdkE+BwvxDvgmdYmWx6Q=
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c/go.mod h1:KqZzu7slNKROh3TSYEH/IUMG6f4M+1qubZ5e52QypsE=

View File

@ -10,7 +10,7 @@ import (
var (
info = [...]string{
"* OneBot + ZeroBot + Golang",
"* Version 1.4.0-beta5 - 2022-05-09 12:11:53 +0800 CST",
"* Version 1.4.0-beta6 - 2022-05-10 23:01:49 +0800 CST",
"* Copyright © 2020 - 2022 FloatTech. All Rights Reserved.",
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
}

View File

@ -60,9 +60,13 @@ func init() {
Handle(func(ctx *zero.Ctx) {
msg := ctx.ExtractPlainText()
r := aireply.NewAIReply(getReplyMode(ctx))
tts := t.new(t.getSoundMode(ctx))
tts, err := t.new(t.getSoundMode(ctx))
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
if tts != nil {
ctx.SendChain(message.Record(tts.Speak(ctx.Event.UserID, func() string {
rec, err := tts.Speak(ctx.Event.UserID, func() string {
reply := r.TalkPlain(msg, zero.BotConfig.NickName[0])
reply = re.ReplaceAllStringFunc(reply, func(s string) string {
f, err := strconv.ParseFloat(s, 64)
@ -74,7 +78,10 @@ func init() {
})
log.Debugln("[tts]:", reply)
return reply
})))
})
if err == nil {
ctx.SendChain(message.Record(rec))
}
}
})
engine.OnRegex(`^设置语音模式(.*)$`, ctxext.FirstValueInList(t)).SetBlock(true).
@ -96,7 +103,7 @@ func init() {
}
// new 语音简单工厂
func (t *ttsInstances) new(name string) (ts tts.TTS) {
func (t *ttsInstances) new(name string) (ts tts.TTS, err error) {
t.RLock()
ts = t.m[name]
t.RUnlock()
@ -104,11 +111,11 @@ func (t *ttsInstances) new(name string) (ts tts.TTS) {
switch name {
case "拟声鸟阿梓":
t.Lock()
ts, _ = mockingbird.NewMockingBirdTTS(0)
ts, err = mockingbird.NewMockingBirdTTS(0)
t.Unlock()
case "拟声鸟药水哥":
t.Lock()
ts, _ = mockingbird.NewMockingBirdTTS(1)
ts, err = mockingbird.NewMockingBirdTTS(1)
t.Unlock()
}
}