(buffer: Buffer)
| 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 | |
| 832 | async 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. |
no test coverage detected