mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 15:20:22 +00:00
fix: gsvits
This commit is contained in:
@@ -2,17 +2,12 @@
|
||||
package aireply
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/tts/genshin"
|
||||
"github.com/FloatTech/floatbox/binary"
|
||||
"github.com/FloatTech/floatbox/file"
|
||||
ctrl "github.com/FloatTech/zbpctrl"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
@@ -110,17 +105,6 @@ func init() { // 插件主体
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(reply))
|
||||
return
|
||||
}
|
||||
if strings.HasPrefix(rec, "http") {
|
||||
b := md5.Sum(binary.StringToBytes(rec))
|
||||
fn := hex.EncodeToString(b[:])
|
||||
fp := ttscachedir + fn
|
||||
if file.IsNotExist(fp) {
|
||||
if file.DownloadTo(rec, fp) != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
rec = "file:///" + file.BOTPATH + "/" + fp
|
||||
}
|
||||
// 发送语音
|
||||
if id := ctx.SendChain(message.Record(rec)); id.ID() == 0 {
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(reply))
|
||||
|
||||
@@ -57,7 +57,7 @@ func init() {
|
||||
}
|
||||
text := ctx.State["regex_matched"].([]string)[2]
|
||||
name := ctx.State["regex_matched"].([]string)[1]
|
||||
rec := fmt.Sprintf(genshin.CNAPI, name, url.QueryEscape(text), url.QueryEscape(原.k))
|
||||
rec := fmt.Sprintf(genshin.CNAPI, url.QueryEscape(name), url.QueryEscape(text), url.QueryEscape(原.k))
|
||||
b := md5.Sum(binary.StringToBytes(rec))
|
||||
fn := hex.EncodeToString(b[:])
|
||||
fp := "data/tts/" + fn
|
||||
|
||||
Reference in New Issue
Block a user