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

Function downloadCustomEmojiAnimatedPreferred

quote/quote.ts:925–935  ·  view source on GitHub ↗
(client: any, doc: any)

Source from the content-addressed store, hash-verified

923 else if (downloaded && typeof downloaded === "string" && fs.existsSync(downloaded)) buffer = await waitForStableFile(downloaded);
924 if (!buffer || buffer.length === 0) buffer = await waitForStableFile(mediaPath);
925 return buffer && buffer.length > 0 ? buffer : undefined;
926 } catch (err: any) {
927 console.warn("quote media download failed", err?.message || err);
928 return undefined;
929 } finally {
930 try { if (fs.existsSync(mediaPath)) fs.unlinkSync(mediaPath); } catch (err) {
931 console.debug("[quote] waitForStableFile loop error:", err?.message || err);
932 }
933 }
934}
935
936async function downloadMessageMedia(msg: Api.Message, enabled: boolean): Promise<Buffer | undefined> {
937 if (!enabled || !(msg as any).media) return undefined;
938 const client = (msg as any).client ?? await getGlobalClient().catch(() => undefined);

Callers 1

Calls 5

customEmojiThumbsFunction · 0.85
downloadMediaToBufferFunction · 0.85
bufferKindFunction · 0.85
quoteMsFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected