1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-07 04:23:49 +08:00

fix(coolq): tts on ios

fixes #849
This commit is contained in:
wdvxdr 2021-04-22 21:22:30 +08:00
parent 25171e5777
commit 0487f849bc
No known key found for this signature in database
GPG Key ID: 55FF1414A69CEBA6

View File

@ -26,6 +26,7 @@ import (
"github.com/Mrs4s/MiraiGo/utils"
log "github.com/sirupsen/logrus"
"github.com/tidwall/gjson"
"github.com/wdvxdr1123/go-silk"
"github.com/Mrs4s/go-cqhttp/global"
)
@ -785,6 +786,14 @@ func (bot *CQBot) ToElement(t string, d map[string]string, isGroup bool) (m inte
if err != nil {
return nil, err
}
pcm, err := silk.DecodeSilkBuffToPcm(data, 24000)
if err != nil {
return nil, err
}
data, err = silk.EncodePcmBuffToSilk(pcm, 24000, 24000, true)
if err != nil {
return nil, err
}
return &message.VoiceElement{Data: data}, nil
case "record":
f := d["file"]