perf: unlimited snap view time

This commit is contained in:
rhunk
2023-05-27 11:10:29 +02:00
parent 2207b1a61d
commit 130587e060

View File

@@ -22,11 +22,11 @@ class UnlimitedSnapViewTime :
if (message.messageContent.contentType != ContentType.SNAP) return@hookConstructor
with(message.messageContent) {
val mediaAttributes = ProtoReader(this.content).readPath(11, 5, 2) ?: return@hookConstructor
if (mediaAttributes.exists(6)) return@hookConstructor
this.content = ProtoEditor(this.content).apply {
edit(11, 5, 2) {
ProtoReader(this@with.content).getInt(11, 5, 2, 5)?.let {
writeConstant(5, it)
}
mediaAttributes.getInt(5)?.let { writeConstant(5, it) }
writeBuffer(6, byteArrayOf())
}
}.toByteArray()