|
|
|
@ -478,12 +478,17 @@ export class WebhookServer {
|
|
|
|
|
|
|
|
|
|
|
|
// Delegar el manejo del comando
|
|
|
|
// Delegar el manejo del comando
|
|
|
|
const messageId = typeof data?.key?.id === 'string' ? data.key.id : null;
|
|
|
|
const messageId = typeof data?.key?.id === 'string' ? data.key.id : null;
|
|
|
|
|
|
|
|
const participantForKey = typeof data?.key?.participantAlt === 'string'
|
|
|
|
|
|
|
|
? data.key.participantAlt
|
|
|
|
|
|
|
|
: (typeof data?.key?.participant === 'string' ? data.key.participant : null);
|
|
|
|
const outcome = await CommandService.handleWithOutcome({
|
|
|
|
const outcome = await CommandService.handleWithOutcome({
|
|
|
|
sender: normalizedSenderId,
|
|
|
|
sender: normalizedSenderId,
|
|
|
|
groupId: data.key.remoteJid,
|
|
|
|
groupId: data.key.remoteJid,
|
|
|
|
message: messageText,
|
|
|
|
message: messageText,
|
|
|
|
mentions,
|
|
|
|
mentions,
|
|
|
|
messageId: messageId || undefined
|
|
|
|
messageId: messageId || undefined,
|
|
|
|
|
|
|
|
participant: participantForKey || undefined,
|
|
|
|
|
|
|
|
fromMe: !!data?.key?.fromMe
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const responses = outcome.responses;
|
|
|
|
const responses = outcome.responses;
|
|
|
|
|
|
|
|
|
|
|
|
@ -516,7 +521,10 @@ export class WebhookServer {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const emoji = outcome.ok ? '🤖' : '⚠️';
|
|
|
|
const emoji = outcome.ok ? '🤖' : '⚠️';
|
|
|
|
await ResponseQueue.enqueueReaction(data.key.remoteJid, messageId, emoji);
|
|
|
|
const participant = typeof data?.key?.participantAlt === 'string'
|
|
|
|
|
|
|
|
? data.key.participantAlt
|
|
|
|
|
|
|
|
: (typeof data?.key?.participant === 'string' ? data.key.participant : undefined);
|
|
|
|
|
|
|
|
await ResponseQueue.enqueueReaction(data.key.remoteJid, messageId, emoji, { participant, fromMe: !!data?.key?.fromMe });
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
// No romper el flujo por errores de reacción
|
|
|
|
// No romper el flujo por errores de reacción
|
|
|
|
if (process.env.NODE_ENV !== 'test') {
|
|
|
|
if (process.env.NODE_ENV !== 'test') {
|
|
|
|
|