File tree Expand file tree Collapse file tree
src/components/utils/message Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,15 +4,26 @@ import fs from "fs";
44import log from "../log" ;
55import { addMessage } from "../../services/message" ;
66
7- const PROJECT_AUTO_DOWNLOAD_MEDIA : boolean = process . env . PROJECT_AUTO_DOWNLOAD_MEDIA === "true"
7+ const PROJECT_AUTO_DOWNLOAD_MEDIA : boolean =
8+ process . env . PROJECT_AUTO_DOWNLOAD_MEDIA === "true" ;
89const PROJECT_MAX_DOWNLOAD_MEDIA : number = parseInt (
910 process . env . PROJECT_MAX_DOWNLOAD_MEDIA || "25" ,
1011) ;
1112const MAX_FILE_SIZE : number = PROJECT_MAX_DOWNLOAD_MEDIA * 1024 * 1024 ;
1213
1314export default async function ( msg : Message ) : Promise < void > {
1415 // msg type unknown to ignore group mention statuses
15- if ( ! msg . hasMedia || msg . fromMe || msg . type === "unknown" || ! PROJECT_AUTO_DOWNLOAD_MEDIA ) return ;
16+ if (
17+ ! msg . hasMedia ||
18+ msg . fromMe ||
19+ msg . type === "unknown" ||
20+ ! PROJECT_AUTO_DOWNLOAD_MEDIA
21+ )
22+ return ;
23+
24+ // ignore @Meta AI and others
25+ if ( msg . author && msg . author . split ( "@" ) [ 1 ] === "bot" ) return ;
26+
1627 const media = await msg . downloadMedia ( ) ;
1728 if ( ! media ) return ;
1829
You can’t perform that action at this time.
0 commit comments