Fix group image

This commit is contained in:
Him188 2019-11-07 22:02:58 +08:00
parent 1f521e96df
commit 745200f6e1

View File

@ -167,7 +167,8 @@ fun MessageChain.toPacket(forGroup: Boolean): ByteReadPacket = buildPacket {
is At -> throw UnsupportedOperationException("At is not supported now but is expecting to be supported") is At -> throw UnsupportedOperationException("At is not supported now but is expecting to be supported")
is Image -> buildPacket { is Image -> buildPacket {
if (forGroup) { when (id.value.length) {
42 -> {
writeUByte(MessageType.GROUP_IMAGE.value) writeUByte(MessageType.GROUP_IMAGE.value)
//00 00 03 00 CB 02 00 2A 7B 46 36 31 35 39 33 42 35 2D 35 42 39 38 2D 31 37 39 38 2D 33 46 34 37 2D 32 41 39 31 44 33 32 45 44 32 46 43 7D 2E 6A 70 67 //00 00 03 00 CB 02 00 2A 7B 46 36 31 35 39 33 42 35 2D 35 42 39 38 2D 31 37 39 38 2D 33 46 34 37 2D 32 41 39 31 44 33 32 45 44 32 46 43 7D 2E 6A 70 67
@ -185,7 +186,9 @@ fun MessageChain.toPacket(forGroup: Boolean): ByteReadPacket = buildPacket {
writeStringUtf8(id.value) writeStringUtf8(id.value)
writeUByte(0x41u) writeUByte(0x41u)
} }
} else { }
37 -> {
writeUByte(MessageType.FRIEND_IMAGE.value) writeUByte(MessageType.FRIEND_IMAGE.value)
// 00 00 06 00 F3 02 // 00 00 06 00 F3 02
@ -253,6 +256,8 @@ fun MessageChain.toPacket(forGroup: Boolean): ByteReadPacket = buildPacket {
writeUByte(0x41u) writeUByte(0x41u)
} }
} }
else -> error("Illegal ImageId ${id.value}")
}
} }
is PlainText -> buildPacket { is PlainText -> buildPacket {