fix(core): correctly handle result of mtcute.customMethod

This commit is contained in:
alina 🌸 2024-06-28 14:59:26 +03:00
parent c536086310
commit 9daa551e33
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -40,6 +40,18 @@ async function generateReaders(apiSchema: TlFullSchema, mtpSchema: TlFullSchema)
includeMethodResults: true, includeMethodResults: true,
}) })
// for mtcute.customMethod we want to generate a reader that uses r.raw()
const newCode = code.replace(
"'mtcute.customMethod':function(r){return r.bytes()},",
"'mtcute.customMethod':function(r){return r.raw()},",
)
if (newCode === code) {
throw new Error('Failed to replace customMethod writer')
}
code = newCode
const mtpCode = generateReaderCodeForTlEntries(mtpSchema.entries, { const mtpCode = generateReaderCodeForTlEntries(mtpSchema.entries, {
variableName: 'm', variableName: 'm',
}) })