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

Function bufferToCanvas

quote/quote.ts:823–835  ·  view source on GitHub ↗
(buffer: Buffer)

Source from the content-addressed store, hash-verified

821 console.warn(`quote avatar ${isBig ? "big" : "small"} download failed`, err?.message || err);
822 return undefined;
823 }
824 };
825
826 const [small, big] = await Promise.all([tryDownload(false), tryDownload(true)]);
827 const normalized = small ? await normalizeAvatarBuffer(small) : big ? await normalizeAvatarBuffer(big) : undefined;
828 if (key) avatarCache.set(key, normalized);
829 return normalized;
830}
831
832async function downloadSenderAvatar(msg: Api.Message, entity?: any): Promise<Buffer | undefined> {
833 const client = (msg as any).client ?? await getGlobalClient().catch(() => undefined);
834 return downloadEntityAvatar(client, entity ?? await senderEntity(msg));
835}
836
837/**
838 * Download a file via raw upload.GetFile, bypassing the MediaScheduler.

Callers 1

Calls 1

getCanvasFunction · 0.85

Tested by

no test coverage detected