MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / extractAnimatedFrames

Function extractAnimatedFrames

quote/quote.ts:797–821  ·  view source on GitHub ↗
(buffer: Buffer, size: number, frameCount: number, fps: number)

Source from the content-addressed store, hash-verified

795 // Bypass the MediaScheduler (which retries 5×15s = 75s on failure) by
796 // using raw upload.GetFile via client.invoke with the photo's DC.
797 // This gives us a single attempt that our withTimeout can actually cap.
798 const inputPeer = utils.getInputPeer(fullEntity);
799 const location = new Api.InputPeerPhotoFileLocation({
800 peer: inputPeer,
801 photoId: photo.photoId,
802 big: isBig,
803 });
804 const dcId = photo.dcId;
805 const result = await withTimeout(
806 client.invoke(
807 new Api.upload.GetFile({
808 location,
809 offset: big_integer.zero,
810 limit: 512 * 1024,
811 precise: true,
812 }),
813 dcId,
814 ),
815 QUOTE_RPC_TIMEOUT_MS,
816 `downloadEntityAvatar.${isBig ? "big" : "small"}`,
817 ) as { bytes?: unknown };
818 const buffer = result?.bytes;
819 return Buffer.isBuffer(buffer) && buffer.length > 0 ? buffer : undefined;
820 } catch (err: any) {
821 console.warn(`quote avatar ${isBig ? "big" : "small"} download failed`, err?.message || err);
822 return undefined;
823 }
824 };

Callers 1

Calls 2

execFileAsyncFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected