@@ -35,9 +35,9 @@ import makeWASocket, {
3535 WAMessageUpdate ,
3636 WAPresence ,
3737 WASocket ,
38- } from '@whiskeysockets/ baileys' ;
39- import { Label } from '@whiskeysockets/ baileys/lib/Types/Label' ;
40- import { LabelAssociation } from '@whiskeysockets/ baileys/lib/Types/LabelAssociation' ;
38+ } from 'baileys' ;
39+ import { Label } from 'baileys/lib/Types/Label' ;
40+ import { LabelAssociation } from 'baileys/lib/Types/LabelAssociation' ;
4141import axios from 'axios' ;
4242import { exec } from 'child_process' ;
4343import { isBase64 , isURL } from 'class-validator' ;
@@ -618,6 +618,7 @@ export class BaileysStartupService extends ChannelStartupService {
618618 } ,
619619 userDevicesCache : this . userDevicesCache ,
620620 transactionOpts : { maxCommitRetries : 5 , delayBetweenTriesMs : 2500 } ,
621+ cachedGroupMetadata : this . getGroupMetadataCache ,
621622 patchMessageBeforeSending ( message ) {
622623 if (
623624 message . deviceSentMessage ?. message ?. listMessage ?. listType ===
@@ -1946,11 +1947,9 @@ export class BaileysStartupService extends ChannelStartupService {
19461947 } as unknown as AnyMessageContent ,
19471948 {
19481949 ...option ,
1949- cachedGroupMetadata :
1950- ! this . configService . get < CacheConf > ( 'CACHE' ) . REDIS . ENABLED &&
1951- ! this . configService . get < CacheConf > ( 'CACHE' ) . LOCAL . ENABLED
1952- ? null
1953- : this . getGroupMetadataCache ,
1950+ useCachedGroupMetadata :
1951+ ! ! this . configService . get < CacheConf > ( 'CACHE' ) . REDIS . ENABLED &&
1952+ ! ! this . configService . get < CacheConf > ( 'CACHE' ) . LOCAL . ENABLED ,
19541953 } as unknown as MiscMessageGenerationOptions ,
19551954 ) ;
19561955 }
@@ -1966,11 +1965,9 @@ export class BaileysStartupService extends ChannelStartupService {
19661965 } as unknown as AnyMessageContent ,
19671966 {
19681967 ...option ,
1969- cachedGroupMetadata :
1970- ! this . configService . get < CacheConf > ( 'CACHE' ) . REDIS . ENABLED &&
1971- ! this . configService . get < CacheConf > ( 'CACHE' ) . LOCAL . ENABLED
1972- ? null
1973- : this . getGroupMetadataCache ,
1968+ useCachedGroupMetadata :
1969+ ! ! this . configService . get < CacheConf > ( 'CACHE' ) . REDIS . ENABLED &&
1970+ ! ! this . configService . get < CacheConf > ( 'CACHE' ) . LOCAL . ENABLED ,
19741971 } as unknown as MiscMessageGenerationOptions ,
19751972 ) ;
19761973 }
@@ -1988,11 +1985,9 @@ export class BaileysStartupService extends ChannelStartupService {
19881985 } ,
19891986 {
19901987 ...option ,
1991- cachedGroupMetadata :
1992- ! this . configService . get < CacheConf > ( 'CACHE' ) . REDIS . ENABLED &&
1993- ! this . configService . get < CacheConf > ( 'CACHE' ) . LOCAL . ENABLED
1994- ? null
1995- : this . getGroupMetadataCache ,
1988+ useCachedGroupMetadata :
1989+ ! ! this . configService . get < CacheConf > ( 'CACHE' ) . REDIS . ENABLED &&
1990+ ! ! this . configService . get < CacheConf > ( 'CACHE' ) . LOCAL . ENABLED ,
19961991 } as unknown as MiscMessageGenerationOptions ,
19971992 ) ;
19981993 }
@@ -2016,11 +2011,9 @@ export class BaileysStartupService extends ChannelStartupService {
20162011 message as unknown as AnyMessageContent ,
20172012 {
20182013 ...option ,
2019- cachedGroupMetadata :
2020- ! this . configService . get < CacheConf > ( 'CACHE' ) . REDIS . ENABLED &&
2021- ! this . configService . get < CacheConf > ( 'CACHE' ) . LOCAL . ENABLED
2022- ? null
2023- : this . getGroupMetadataCache ,
2014+ useCachedGroupMetadata :
2015+ ! ! this . configService . get < CacheConf > ( 'CACHE' ) . REDIS . ENABLED &&
2016+ ! ! this . configService . get < CacheConf > ( 'CACHE' ) . LOCAL . ENABLED ,
20242017 } as unknown as MiscMessageGenerationOptions ,
20252018 ) ;
20262019 } ) ( ) ;
@@ -3354,6 +3347,10 @@ export class BaileysStartupService extends ChannelStartupService {
33543347 }
33553348
33563349 public async findGroup ( id : GroupJid , reply : 'inner' | 'out' = 'out' ) {
3350+ if ( this . localSettings . groups_ignore === true ) {
3351+ return ;
3352+ }
3353+
33573354 this . logger . verbose ( 'Fetching group' ) ;
33583355 try {
33593356 const group = await this . client . groupMetadata ( id . groupJid ) ;
@@ -3384,6 +3381,10 @@ export class BaileysStartupService extends ChannelStartupService {
33843381 }
33853382
33863383 public async fetchAllGroups ( getParticipants : GetParticipant ) {
3384+ if ( this . localSettings . groups_ignore === true ) {
3385+ return ;
3386+ }
3387+
33873388 this . logger . verbose ( 'Fetching all groups' ) ;
33883389 try {
33893390 const fetch = Object . values ( await this . client . groupFetchAllParticipating ( ) ) ;
0 commit comments