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

Function downloadMediaToBuffer

quote/quote.ts:614–630  ·  view source on GitHub ↗
(client: any, target: any)

Source from the content-addressed store, hash-verified

612 const key = peer ? `sender:${stableEntityKey(peer)}` : undefined;
613 if (key && entityCache.has(key)) return entityCache.get(key);
614 try {
615 const sender = await withTimeout((msg as any).getSender?.(), QUOTE_RPC_TIMEOUT_MS, "senderEntity.getSender");
616 if (sender) {
617 if (key) entityCache.set(key, sender);
618 return sender;
619 }
620 } catch (err) {
621 console.debug("[quote] getSender failed:", err?.message || err);
622 }
623 const entity = await getPeerEntity((msg as any).client, peer);
624 if (key) entityCache.set(key, entity);
625 return entity;
626}
627
628async function senderName(msg: Api.Message): Promise<string> {
629 return displayName(await senderEntity(msg));
630}
631
632function emojiStatusIdFromEntity(entity: any): string | undefined {
633 const status = entity?.emojiStatus ?? entity?.emoji_status;

Callers 2

downloadMessageMediaFunction · 0.85

Calls 3

waitForStableFileFunction · 0.85
warnMethod · 0.80
downloadMediaMethod · 0.45

Tested by

no test coverage detected