From e4f6ea04262e204c5f2ee75c4a43f0557d332d1f Mon Sep 17 00:00:00 2001 From: Egor Date: Sun, 10 Oct 2021 03:37:21 +1000 Subject: [PATCH] fix(attachments): sort for gifs --- src/modules/Attachments.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/Attachments.ts b/src/modules/Attachments.ts index dec17ca..c07cabe 100644 --- a/src/modules/Attachments.ts +++ b/src/modules/Attachments.ts @@ -29,6 +29,13 @@ export class Attachments { const attachmentFields: string[] = []; const parsedAttachments = attachments + // Fix для гифок (если первым вложением гифка, то следующие фотографии переносятся в другой embed) + .sort((a, b) => ( + b.type === DOCUMENT && b.doc.ext === 'gif' ? + -1 + : + 1 + )) .reduce((parsedAttachments, { type, photo, video, link, doc, audio, poll, album, textlive, market }) => {