mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
fix: send guild channel message response decoder panic error
This commit is contained in:
parent
849be61d5a
commit
e8cf25f6f4
@ -74,6 +74,10 @@ func (s *GuildService) SendGuildChannelMessage(guildId, channelId uint64, m *mes
|
|||||||
if body.GetResult() != 0 {
|
if body.GetResult() != 0 {
|
||||||
return nil, errors.Errorf("send channel message error: server response %v", body.GetResult())
|
return nil, errors.Errorf("send channel message error: server response %v", body.GetResult())
|
||||||
}
|
}
|
||||||
|
elements := m.Elements
|
||||||
|
if body.Body != nil && body.Body.RichText != nil {
|
||||||
|
elements = message.ParseMessageElems(body.Body.RichText.Elems)
|
||||||
|
}
|
||||||
return &message.GuildChannelMessage{
|
return &message.GuildChannelMessage{
|
||||||
Id: body.Head.ContentHead.GetSeq(),
|
Id: body.Head.ContentHead.GetSeq(),
|
||||||
InternalId: body.Head.ContentHead.GetRandom(),
|
InternalId: body.Head.ContentHead.GetRandom(),
|
||||||
@ -84,7 +88,7 @@ func (s *GuildService) SendGuildChannelMessage(guildId, channelId uint64, m *mes
|
|||||||
TinyId: body.Head.RoutingHead.GetFromTinyid(),
|
TinyId: body.Head.RoutingHead.GetFromTinyid(),
|
||||||
Nickname: s.Nickname,
|
Nickname: s.Nickname,
|
||||||
},
|
},
|
||||||
Elements: message.ParseMessageElems(body.Body.RichText.Elems),
|
Elements: elements,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user