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

Function normalizeAvatarBuffer

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

Source from the content-addressed store, hash-verified

537function emojiStatusPayload(entity: any, customEmojiBuffer?: Buffer): any | undefined {
538 const id = emojiStatusIdFromEntity(entity);
539 if (!id) return undefined;
540 // Always string ID for vendor map lookups
541 return { custom_emoji_id: String(id), ...(customEmojiBuffer ? { customEmojiBuffer } : {}) };
542}
543
544function displayName(entity: any): string {
545 if (!entity) return "User";
546 const first = entity.firstName || entity.first_name || "";
547 const last = entity.lastName || entity.last_name || "";
548 const title = entity.title || "";
549 const username = entity.username ? `@${entity.username}` : "";
550 return [first, last].filter(Boolean).join(" ") || title || username || "User";
551}
552
553function fwdHeaderName(fwd: any): string | undefined {
554 return fwd?.fromName || fwd?.from_name || fwd?.postAuthor || fwd?.post_author || undefined;
555}
556
557function fwdPeer(fwd: any): any | undefined {
558 return fwd?.fromId ?? fwd?.from_id ?? fwd?.savedFromPeer ?? fwd?.saved_from_peer;
559}
560

Callers 1

downloadEntityAvatarFunction · 0.85

Calls 2

getSharpFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected