mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
🔖 1.4.0-beta6
This commit is contained in:
parent
e9fac38c1b
commit
e993f93cf4
4
go.mod
4
go.mod
@ -3,9 +3,9 @@ module github.com/FloatTech/ZeroBot-Plugin
|
|||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require (
|
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/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/antchfx/htmlquery v1.2.4
|
||||||
github.com/corona10/goimagehash v1.0.3
|
github.com/corona10/goimagehash v1.0.3
|
||||||
github.com/fogleman/gg v1.3.0
|
github.com/fogleman/gg v1.3.0
|
||||||
|
|||||||
10
go.sum
10
go.sum
@ -1,11 +1,9 @@
|
|||||||
github.com/FloatTech/AnimeAPI v1.3.4-0.20220509041030-b9aee01996bc h1:FZ+LegVsPIBhtrB4575oOL6nqMomnF987X5LmSifRxg=
|
github.com/FloatTech/AnimeAPI v1.4.1-0.20220510151836-ab2a324e17e3 h1:nmi9trT0Tstad4molrSouin1bboj9iN15xTLKTNVIzg=
|
||||||
github.com/FloatTech/AnimeAPI v1.3.4-0.20220509041030-b9aee01996bc/go.mod h1:KSdH8fZyz/v+8p4WIrk7xyBsf2BOqkyEFBbn65NUNIU=
|
github.com/FloatTech/AnimeAPI v1.4.1-0.20220510151836-ab2a324e17e3/go.mod h1:yPIWJsL2Vsn/mx+H4gVReTSRH0/RPQ90GBK7fJtB5xI=
|
||||||
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/sqlite v0.2.1 h1:9t6Me48XJJCIoPy4nLRvcdhcVKfT0c2lilp7SEKROG8=
|
github.com/FloatTech/sqlite v0.2.1 h1:9t6Me48XJJCIoPy4nLRvcdhcVKfT0c2lilp7SEKROG8=
|
||||||
github.com/FloatTech/sqlite v0.2.1/go.mod h1:6NfHRzqOo9RWeMJEoAQVuo51Omd5LFNxCNQhMF02/9U=
|
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.20220510110942-5476b8b1a779 h1:uqh9CBhwa9Pv6vTvUSelAyY7ZITGNyfQLRvtPverrV4=
|
||||||
github.com/FloatTech/zbputils v1.3.4-0.20220509040909-1ba8aa47f58e/go.mod h1:Cf2wAFtq7OUj4RUHcSQtcAYgAspP06wQseKZwtCJRXQ=
|
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/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 h1:cNPOdTNiVwxLpROLjXCgbIPvdkE+BwvxDvgmdYmWx6Q=
|
||||||
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c/go.mod h1:KqZzu7slNKROh3TSYEH/IUMG6f4M+1qubZ5e52QypsE=
|
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c/go.mod h1:KqZzu7slNKROh3TSYEH/IUMG6f4M+1qubZ5e52QypsE=
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
info = [...]string{
|
info = [...]string{
|
||||||
"* OneBot + ZeroBot + Golang",
|
"* 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.",
|
"* Copyright © 2020 - 2022 FloatTech. All Rights Reserved.",
|
||||||
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
|
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,9 +60,13 @@ func init() {
|
|||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
msg := ctx.ExtractPlainText()
|
msg := ctx.ExtractPlainText()
|
||||||
r := aireply.NewAIReply(getReplyMode(ctx))
|
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 {
|
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 := r.TalkPlain(msg, zero.BotConfig.NickName[0])
|
||||||
reply = re.ReplaceAllStringFunc(reply, func(s string) string {
|
reply = re.ReplaceAllStringFunc(reply, func(s string) string {
|
||||||
f, err := strconv.ParseFloat(s, 64)
|
f, err := strconv.ParseFloat(s, 64)
|
||||||
@ -74,7 +78,10 @@ func init() {
|
|||||||
})
|
})
|
||||||
log.Debugln("[tts]:", reply)
|
log.Debugln("[tts]:", reply)
|
||||||
return reply
|
return reply
|
||||||
})))
|
})
|
||||||
|
if err == nil {
|
||||||
|
ctx.SendChain(message.Record(rec))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
engine.OnRegex(`^设置语音模式(.*)$`, ctxext.FirstValueInList(t)).SetBlock(true).
|
engine.OnRegex(`^设置语音模式(.*)$`, ctxext.FirstValueInList(t)).SetBlock(true).
|
||||||
@ -96,7 +103,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// new 语音简单工厂
|
// new 语音简单工厂
|
||||||
func (t *ttsInstances) new(name string) (ts tts.TTS) {
|
func (t *ttsInstances) new(name string) (ts tts.TTS, err error) {
|
||||||
t.RLock()
|
t.RLock()
|
||||||
ts = t.m[name]
|
ts = t.m[name]
|
||||||
t.RUnlock()
|
t.RUnlock()
|
||||||
@ -104,11 +111,11 @@ func (t *ttsInstances) new(name string) (ts tts.TTS) {
|
|||||||
switch name {
|
switch name {
|
||||||
case "拟声鸟阿梓":
|
case "拟声鸟阿梓":
|
||||||
t.Lock()
|
t.Lock()
|
||||||
ts, _ = mockingbird.NewMockingBirdTTS(0)
|
ts, err = mockingbird.NewMockingBirdTTS(0)
|
||||||
t.Unlock()
|
t.Unlock()
|
||||||
case "拟声鸟药水哥":
|
case "拟声鸟药水哥":
|
||||||
t.Lock()
|
t.Lock()
|
||||||
ts, _ = mockingbird.NewMockingBirdTTS(1)
|
ts, err = mockingbird.NewMockingBirdTTS(1)
|
||||||
t.Unlock()
|
t.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user