feat: agregar verificación de grupos activos

Co-authored-by: aider (openrouter/x-ai/grok-code-fast-1) <aider@aider.chat>
pull/1/head
borja 2 months ago
parent e03121be89
commit 206949aabe

@ -129,6 +129,14 @@ export class WebhookServer {
return;
}
// Check if the group is active
if (!GroupSyncService.isGroupActive(data.key.remoteJid)) {
if (process.env.NODE_ENV !== 'test') {
console.log('⚠️ Group is not active, ignoring message');
}
return;
}
// Forward to command service only if:
// 1. It's a text message (has conversation field)
// 2. Starts with /tarea command

@ -319,4 +319,14 @@ export class GroupSyncService {
throw error;
}
}
/**
* Checks if a given group ID is active based on the in-memory cache.
*
* @param groupId The group ID to check (e.g., '123456789@g.us').
* @returns True if the group is active, false otherwise.
*/
static isGroupActive(groupId: string): boolean {
return activeGroupsCache.has(groupId);
}
}

Loading…
Cancel
Save