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,14 +4,15 @@ 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"
78const PROJECT_MAX_DOWNLOAD_MEDIA : number = parseInt (
89 process . env . PROJECT_MAX_DOWNLOAD_MEDIA || "25" ,
910) ;
1011const MAX_FILE_SIZE : number = PROJECT_MAX_DOWNLOAD_MEDIA * 1024 * 1024 ;
1112
1213export default async function ( msg : Message ) : Promise < void > {
1314 // msg type unknown to ignore group mention statuses
14- if ( ! msg . hasMedia || msg . fromMe || msg . type === "unknown" ) return ;
15+ if ( ! msg . hasMedia || msg . fromMe || msg . type === "unknown" || ! PROJECT_AUTO_DOWNLOAD_MEDIA ) return ;
1516 const media = await msg . downloadMedia ( ) ;
1617 if ( ! media ) return ;
1718
You can’t perform that action at this time.
0 commit comments