fix: 转发来自 QQ 的含有多个表情包图片的消息无法转发

fix #94
This commit is contained in:
Clansty 2023-02-22 13:59:13 +08:00
parent efb3d8fcbb
commit 59204eb89a
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import lottie from '../constants/lottie';
import _ from 'lodash';
import emoji from '../constants/emoji';
import convert from '../helpers/convert';
import { CustomFile } from 'telegram/client/uploads';
const NOT_CHAINABLE_ELEMENTS = ['flash', 'record', 'video', 'location', 'share', 'json', 'xml', 'poke'];
@ -98,7 +99,11 @@ export default class ForwardService {
if ('url' in elem)
url = elem.url;
try {
if (elem.type === 'image' && elem.asface && !(elem.file as string).toLowerCase().endsWith('.gif')) {
if (elem.type === 'image' && elem.asface
&& !(elem.file as string).toLowerCase().endsWith('.gif')
// 防止在 TG 中一起发送多个 sticker 失败
&& event.message.filter(it => it.type === 'image').length === 1
) {
useSticker(await convert.webp(elem.file as string, () => fetchFile(elem.url)));
}
else {