mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
fix: private reply message serialize
This commit is contained in:
parent
897119cbca
commit
c775d91e1c
@ -76,10 +76,10 @@ type MessageSourceType byte
|
|||||||
|
|
||||||
// MessageSourceType 常量
|
// MessageSourceType 常量
|
||||||
const (
|
const (
|
||||||
MessageSourcePrivate MessageSourceType = 0
|
MessageSourcePrivate MessageSourceType = 1 << iota
|
||||||
MessageSourceGroup MessageSourceType = 1
|
MessageSourceGroup
|
||||||
MessageSourceGuildChannel MessageSourceType = 2
|
MessageSourceGuildChannel
|
||||||
MessageSourceGuildDirect MessageSourceType = 3
|
MessageSourceGuildDirect
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -111,7 +111,7 @@ func ToArrayMessage(e []message.IMessageElement, source MessageSource) (r []glob
|
|||||||
_, ok := e.(*message.ReplyElement)
|
_, ok := e.(*message.ReplyElement)
|
||||||
return ok
|
return ok
|
||||||
})
|
})
|
||||||
if reply != nil && source.SourceType == MessageSourceGroup {
|
if reply != nil && source.SourceType&(MessageSourceGroup|MessageSourcePrivate) != 0 {
|
||||||
replyElem := reply.(*message.ReplyElement)
|
replyElem := reply.(*message.ReplyElement)
|
||||||
rid := int64(source.PrimaryID)
|
rid := int64(source.PrimaryID)
|
||||||
if rid == 0 {
|
if rid == 0 {
|
||||||
@ -277,7 +277,7 @@ func ToStringMessage(e []message.IMessageElement, source MessageSource, isRaw ..
|
|||||||
_, ok := e.(*message.ReplyElement)
|
_, ok := e.(*message.ReplyElement)
|
||||||
return ok
|
return ok
|
||||||
})
|
})
|
||||||
if reply != nil && source.SourceType == MessageSourceGroup {
|
if reply != nil && source.SourceType&(MessageSourceGroup|MessageSourcePrivate) != 0 {
|
||||||
replyElem := reply.(*message.ReplyElement)
|
replyElem := reply.(*message.ReplyElement)
|
||||||
rid := int64(source.PrimaryID)
|
rid := int64(source.PrimaryID)
|
||||||
if rid == 0 {
|
if rid == 0 {
|
||||||
@ -672,7 +672,7 @@ func (bot *CQBot) ConvertObjectMessage(m gjson.Result, sourceType MessageSourceT
|
|||||||
d := make(map[string]string)
|
d := make(map[string]string)
|
||||||
convertElem := func(e gjson.Result) {
|
convertElem := func(e gjson.Result) {
|
||||||
t := e.Get("type").Str
|
t := e.Get("type").Str
|
||||||
if t == "reply" && sourceType == MessageSourceGroup {
|
if t == "reply" && sourceType&(MessageSourceGroup|MessageSourcePrivate) != 0 {
|
||||||
if len(r) > 0 {
|
if len(r) > 0 {
|
||||||
if _, ok := r[0].(*message.ReplyElement); ok {
|
if _, ok := r[0].(*message.ReplyElement); ok {
|
||||||
log.Warnf("警告: 一条信息只能包含一个 Reply 元素.")
|
log.Warnf("警告: 一条信息只能包含一个 Reply 元素.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user