Compare commits

..
2 Commits
Author SHA1 Message Date
devlikepro ef36e4d3ac [core] 2025.5.3
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-05-16 18:33:10 +07:00
devlikepro ba2ddd62ad [core] NOWEB - fix poll.vote event
fix #960
2025-05-16 18:33:10 +07:00
2 changed files with 64 additions and 1 deletions

No files matched your search

@@ -2,6 +2,7 @@ import makeWASocket, {
Browsers,
Chat,
Contact,
decryptPollVote,
DisconnectReason,
downloadMediaMessage,
extractMessageContent,
@@ -397,6 +398,7 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
this.sock = await this.makeSocket();
this.issueMessageUpdateOnEdits();
this.issueMessageUpdateOnPoll();
this.fixMessageUpsertStatus();
this.issuePresenceUpdateOnMessageUpsert();
if (this.isDebugEnabled()) {
@@ -604,6 +606,67 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
});
}
private issueMessageUpdateOnPoll() {
// Fix for https://github.com/devlikeapro/waha/issues/960
this.sock.ev.on('messages.upsert', async ({ messages }) => {
const meId = this.getSessionMeInfo().id;
if (!meId) {
return;
}
for (const message of messages) {
const content = normalizeMessageContent(message.message);
if (!content.pollUpdateMessage) {
continue;
}
const creationMsgKey = content.pollUpdateMessage.pollCreationMessageKey;
// we need to fetch the poll creation message to get the poll enc key
const pollMsg = await this.getMessage(creationMsgKey);
if (!pollMsg) {
this.logger.warn(
{ creationMsgKey },
'poll creation message not found, cannot decrypt update',
);
continue;
}
const meIdNormalised = jidNormalizedUser(meId);
const pollCreatorJid = getKeyAuthor(creationMsgKey, meIdNormalised);
const voterJid = getKeyAuthor(message.key, meIdNormalised);
const pollEncKey = pollMsg.messageContextInfo?.messageSecret;
try {
const voteMsg = decryptPollVote(content.pollUpdateMessage.vote, {
pollEncKey,
pollCreatorJid,
pollMsgId: creationMsgKey.id,
voterJid,
});
this.sock.ev.emit('messages.update', [
{
key: creationMsgKey,
update: {
pollUpdates: [
{
pollUpdateMessageKey: message.key,
vote: voteMsg,
senderTimestampMs: (
content.pollUpdateMessage.senderTimestampMs as Long
).toNumber(),
},
],
},
},
]);
} catch (err) {
this.logger.warn(
{ err, creationMsgKey },
'failed to decrypt poll vote',
);
}
}
});
}
private issuePresenceUpdateOnMessageUpsert() {
//
// Fix for "typing" after sending a message
+1 -1
View File
@@ -33,7 +33,7 @@ export function getEngineName(): string {
}
export const VERSION: WAHAEnvironment = {
version: '2025.5.2',
version: '2025.5.3',
engine: getEngineName(),
tier: getWAHAVersion(),
browser: