mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 19:43:49 +08:00
update voice.
This commit is contained in:
parent
b61fe4e43e
commit
c854339b2d
@ -99,7 +99,7 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
|
||||
newElem = append(newElem, gm)
|
||||
continue
|
||||
}
|
||||
if i, ok := elem.(*message.GroupVoiceElement); ok {
|
||||
if i, ok := elem.(*message.VoiceElement); ok {
|
||||
gv, err := bot.Client.UploadGroupPtt(groupId, i.Data, int32(len(i.Data)))
|
||||
if err != nil {
|
||||
log.Warnf("警告: 群 %v 消息语音上传失败: %v", groupId, err)
|
||||
|
@ -44,6 +44,8 @@ func ToStringMessage(e []message.IMessageElement, code int64, raw ...bool) (r st
|
||||
r += fmt.Sprintf("[CQ:forward,id=%s]", o.ResId)
|
||||
case *message.FaceElement:
|
||||
r += fmt.Sprintf(`[CQ:face,id=%d]`, o.Index)
|
||||
case *message.VoiceElement:
|
||||
r += fmt.Sprintf(`[CQ:record,file=%s]`, o.Name)
|
||||
case *message.ImageElement:
|
||||
if ur {
|
||||
r += fmt.Sprintf(`[CQ:image,file=%s]`, o.Filename)
|
||||
@ -283,7 +285,7 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
|
||||
if !global.IsAMR(data) {
|
||||
return nil, errors.New("unsupported voice file format (please use AMR file for now)")
|
||||
}
|
||||
return &message.GroupVoiceElement{Data: data}, nil
|
||||
return &message.VoiceElement{Data: data}, nil
|
||||
case "face":
|
||||
id, err := strconv.Atoi(d["id"])
|
||||
if err != nil {
|
||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200808003732-2a32e623270d
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200808044635-cd20d7d43dbb
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/guonaihong/gout v0.1.1
|
||||
|
2
go.sum
2
go.sum
@ -4,6 +4,8 @@ github.com/Mrs4s/MiraiGo v0.0.0-20200807030850-ed30f7ad5934 h1:LoNjIsnyEQFGP9Ich
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200807030850-ed30f7ad5934/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200808003732-2a32e623270d h1:K9jHdcO13mLqQB0xm0/ZlY852FoVQJ/WSDwfdmfhDlU=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200808003732-2a32e623270d/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200808044635-cd20d7d43dbb h1:XLe/UreYJRT65GStA3+irRL1Ao0pHZwBtCmTc+4prwA=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200808044635-cd20d7d43dbb/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
|
||||
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
|
||||
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
|
Loading…
x
Reference in New Issue
Block a user