Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef36e4d3ac | ||
|
|
ba2ddd62ad |
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
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user