From 9daa551e3309b23939b2ed6a44ef310d9e9329ec Mon Sep 17 00:00:00 2001 From: alina sireneva Date: Fri, 28 Jun 2024 14:59:26 +0300 Subject: [PATCH] fix(core): correctly handle result of mtcute.customMethod --- packages/tl/scripts/gen-code.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/tl/scripts/gen-code.ts b/packages/tl/scripts/gen-code.ts index 7ca4f962..2f8b175b 100644 --- a/packages/tl/scripts/gen-code.ts +++ b/packages/tl/scripts/gen-code.ts @@ -40,6 +40,18 @@ async function generateReaders(apiSchema: TlFullSchema, mtpSchema: TlFullSchema) 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, { variableName: 'm', })