Compare commits

...
4 Commits
Author SHA1 Message Date
devlikepro 49f63c0f0d [core] 2025.2.6
Release / WEBJS - chrome - amd64 - chrome (push) Waiting to run
Release / WEBJS - chromium - amd64 - latest (push) Waiting to run
Release / WEBJS - chromium - linux/arm64 - arm (push) Waiting to run
Release / GOWS - none - amd64 - gows (push) Waiting to run
Release / GOWS - none - linux/arm64 - gows-arm (push) Waiting to run
Release / NOWEB - none - amd64 - noweb (push) Waiting to run
Release / NOWEB - none - linux/arm64 - noweb-arm (push) Waiting to run
fix #820
2025-02-21 10:06:27 +07:00
devlikepro 33910aedb8 [core] 2025.2.5
Release / WEBJS - chrome - amd64 - chrome (push) Waiting to run
Release / WEBJS - chromium - amd64 - latest (push) Waiting to run
Release / WEBJS - chromium - linux/arm64 - arm (push) Waiting to run
Release / GOWS - none - amd64 - gows (push) Waiting to run
Release / GOWS - none - linux/arm64 - gows-arm (push) Waiting to run
Release / NOWEB - none - amd64 - noweb (push) Waiting to run
Release / NOWEB - none - linux/arm64 - noweb-arm (push) Waiting to run
2025-02-19 09:20:27 +07:00
devlikepro 3359a81a14 [core] NOWEB add message.revoked event
fix #813
2025-02-19 09:20:26 +07:00
devlikepro e27f850e68 [core] NOWEB Fix body extract from messages
fix #813
2025-02-19 09:20:26 +07:00
3 changed files with 39 additions and 6 deletions

No files matched your search

+37 -5
View File
@@ -86,6 +86,7 @@ import {
PollVote,
PollVotePayload,
WAMessageAckBody,
WAMessageRevokedBody,
} from '@waha/structures/webhooks.dto';
import { LoggerBuilder } from '@waha/utils/logging';
import { sleep, waitUntil } from '@waha/utils/promiseTimeout';
@@ -1475,6 +1476,24 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
this.events2.get(WAHAEvents.MESSAGE).switch(messagesFromOthers$);
this.events2.get(WAHAEvents.MESSAGE_ANY).switch(messagesFromAll$);
const messagesRevoked$ = messagesUpsert$.pipe(
// @ts-ignore
filter(
(message) =>
message.message.protocolMessage?.type ===
proto.Message.ProtocolMessage.Type.REVOKE,
),
mergeMap(async (message): Promise<WAMessageRevokedBody> => {
const afterMessage = await this.toWAMessage(message);
return {
after: afterMessage,
before: null,
_data: message,
};
}),
);
this.events2.get(WAHAEvents.MESSAGE_REVOKED).switch(messagesRevoked$);
//
// Message Reactions
//
@@ -1732,6 +1751,12 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
if (message.message.reactionMessage) return;
// Ignore poll votes, we have dedicated handler for that
if (message.message.pollUpdateMessage) return;
// Ignore revoke, we have a dedicated handler for that
if (
message.message.protocolMessage?.type ===
proto.Message.ProtocolMessage.Type.REVOKE
)
return;
if (downloadMedia) {
try {
@@ -1764,7 +1789,7 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
timestamp: ensureNumber(message.messageTimestamp),
from: toCusFormat(fromToParticipant.from),
fromMe: message.key.fromMe,
body: body,
body: body || null,
to: toCusFormat(fromToParticipant.to),
participant: toCusFormat(fromToParticipant.participant),
// Media
@@ -1786,21 +1811,28 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
if (!message) {
return null;
}
let body = message.conversation;
const content = extractMessageContent(message);
if (!content) {
return null;
}
let body = content.conversation || null;
if (!body) {
// Some of the messages have no conversation, but instead have text in extendedTextMessage
// https://github.com/devlikeapro/waha/issues/90
body = message.extendedTextMessage?.text;
body = content.extendedTextMessage?.text;
}
if (!body) {
// Populate from caption
const mediaContent = extractMediaContent(message);
const mediaContent = extractMediaContent(content);
// @ts-ignore - AudioMessage doesn't have caption field
body = mediaContent?.caption;
}
// Response for buttons
if (!body) {
body = message.templateButtonReplyMessage?.selectedDisplayText;
body = content.templateButtonReplyMessage?.selectedDisplayText;
}
if (!body) {
body = content.buttonsResponseMessage?.selectedDisplayText;
}
return body;
}
+1
View File
@@ -91,6 +91,7 @@ export class PollVotePayload {
export class WAMessageRevokedBody {
after?: WAMessage;
before?: WAMessage;
_data?: any;
}
export class WASessionStatusBody {
+1 -1
View File
@@ -33,7 +33,7 @@ export function getEngineName(): string {
}
export const VERSION: WAHAEnvironment = {
version: '2025.2.4',
version: '2025.2.6',
engine: getEngineName(),
tier: getWAHAVersion(),
browser: getBrowserExecutablePath(),