1
0
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:
Mrs4s 2021-11-14 04:50:06 +08:00
parent 849be61d5a
commit e8cf25f6f4
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7

View File

@ -74,6 +74,10 @@ func (s *GuildService) SendGuildChannelMessage(guildId, channelId uint64, m *mes
if body.GetResult() != 0 {
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{
Id: body.Head.ContentHead.GetSeq(),
InternalId: body.Head.ContentHead.GetRandom(),
@ -84,7 +88,7 @@ func (s *GuildService) SendGuildChannelMessage(guildId, channelId uint64, m *mes
TinyId: body.Head.RoutingHead.GetFromTinyid(),
Nickname: s.Nickname,
},
Elements: message.ParseMessageElems(body.Body.RichText.Elems),
Elements: elements,
}, nil
}