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

Method isSupportedMedia

rev/rev.ts:351–369  ·  view source on GitHub ↗
(media: any)

Source from the content-addressed store, hash-verified

349 }
350
351 // ==================== 媒体检测 ====================
352
353 private isSupportedMedia(media: any): boolean {
354 if (!media) return false;
355 if (media instanceof Api.MessageMediaPhoto) return true;
356 if (media instanceof Api.MessageMediaDocument) {
357 const doc = media.document as Api.Document;
358 const mime = doc?.mimeType || '';
359 const fileName = this.getFileNameFromDocument(doc);
360 // 支持 .gif.mp4(Telegram 动图格式),但不支持普通 .mp4
361 if (fileName && fileName.toLowerCase().endsWith('.gif.mp4')) {
362 return true;
363 }
364 return (
365 mime.startsWith('image/') ||
366 mime === 'video/webm' ||
367 mime.endsWith('/webm')
368 );
369 }
370 return false;
371 }
372

Callers 1

Calls 1

Tested by

no test coverage detected